buttonElev method
填充主题色, 按钮文字为白色
backgroundColor
背景填充色,没有则用主题色
Implementation
Widget buttonElev(void Function() onPressed,
{double? width,
double? height,
int? textSize,
Color? textColor,
Color? backgroundColor,
double? radius,
VoidCallback? onLongPress,
bool removeShadow = false}) {
return SizedBox(
width: width ?? double.infinity,
height: height ?? 46.h,
child: ElevatedButton(
onPressed: onPressed,
onLongPress: onLongPress,
style: ButtonStyle(
shadowColor: MaterialStateProperty.all(removeShadow ? Colors.transparent : Colors.black),
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(EdgeInsets.zero),
backgroundColor: backgroundColor == null ? null : MaterialStateProperty.all(backgroundColor),
shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius ?? 6.h))),
),
child: Text(
this,
style: (textSize ?? 14).textStyle(textColor ?? Colors.white),
),
),
);
}