|
|
@ -30,10 +30,16 @@ class ASButton extends StatefulWidget {
|
|
|
|
final EdgeInsets padding;
|
|
|
|
final EdgeInsets padding;
|
|
|
|
|
|
|
|
|
|
|
|
///点击事件
|
|
|
|
///点击事件
|
|
|
|
final VoidCallback onpressed;
|
|
|
|
final VoidCallback onPressed;
|
|
|
|
|
|
|
|
|
|
|
|
///宽度
|
|
|
|
///宽度
|
|
|
|
final double width;
|
|
|
|
final double width;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///不可点击颜色
|
|
|
|
|
|
|
|
final Color disableColor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///不可点击时文字颜色
|
|
|
|
|
|
|
|
final Color disableTextColor;
|
|
|
|
ASButton({
|
|
|
|
ASButton({
|
|
|
|
Key key,
|
|
|
|
Key key,
|
|
|
|
this.bgcolor,
|
|
|
|
this.bgcolor,
|
|
|
@ -44,8 +50,10 @@ class ASButton extends StatefulWidget {
|
|
|
|
this.textStyle,
|
|
|
|
this.textStyle,
|
|
|
|
this.padding,
|
|
|
|
this.padding,
|
|
|
|
@required this.title,
|
|
|
|
@required this.title,
|
|
|
|
this.onpressed,
|
|
|
|
this.onPressed,
|
|
|
|
this.width,
|
|
|
|
this.width,
|
|
|
|
|
|
|
|
this.disableColor,
|
|
|
|
|
|
|
|
this.disableTextColor,
|
|
|
|
}) : super(key: key);
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
ASButton.warn(
|
|
|
|
ASButton.warn(
|
|
|
@ -54,9 +62,11 @@ class ASButton extends StatefulWidget {
|
|
|
|
this.padding,
|
|
|
|
this.padding,
|
|
|
|
this.radius,
|
|
|
|
this.radius,
|
|
|
|
this.bgcolor,
|
|
|
|
this.bgcolor,
|
|
|
|
this.onpressed,
|
|
|
|
this.onPressed,
|
|
|
|
@required this.title,
|
|
|
|
@required this.title,
|
|
|
|
this.width})
|
|
|
|
this.width,
|
|
|
|
|
|
|
|
this.disableColor,
|
|
|
|
|
|
|
|
this.disableTextColor})
|
|
|
|
: outline = true,
|
|
|
|
: outline = true,
|
|
|
|
outlineColor = Color(0xFFE50112),
|
|
|
|
outlineColor = Color(0xFFE50112),
|
|
|
|
textColor = Color(0xFFE50112),
|
|
|
|
textColor = Color(0xFFE50112),
|
|
|
@ -69,8 +79,10 @@ class ASButton extends StatefulWidget {
|
|
|
|
this.textStyle,
|
|
|
|
this.textStyle,
|
|
|
|
this.padding,
|
|
|
|
this.padding,
|
|
|
|
@required this.title,
|
|
|
|
@required this.title,
|
|
|
|
this.onpressed,
|
|
|
|
this.onPressed,
|
|
|
|
this.width})
|
|
|
|
this.width,
|
|
|
|
|
|
|
|
this.disableColor,
|
|
|
|
|
|
|
|
this.disableTextColor})
|
|
|
|
: outline = true,
|
|
|
|
: outline = true,
|
|
|
|
outlineColor = Color(0x73000000),
|
|
|
|
outlineColor = Color(0x73000000),
|
|
|
|
textColor = Color(0xD9000000),
|
|
|
|
textColor = Color(0xD9000000),
|
|
|
@ -83,8 +95,10 @@ class ASButton extends StatefulWidget {
|
|
|
|
this.textStyle,
|
|
|
|
this.textStyle,
|
|
|
|
this.padding,
|
|
|
|
this.padding,
|
|
|
|
@required this.title,
|
|
|
|
@required this.title,
|
|
|
|
this.onpressed,
|
|
|
|
this.onPressed,
|
|
|
|
this.width})
|
|
|
|
this.width,
|
|
|
|
|
|
|
|
this.disableColor,
|
|
|
|
|
|
|
|
this.disableTextColor})
|
|
|
|
: bgcolor = Color(0xFFFFB600),
|
|
|
|
: bgcolor = Color(0xFFFFB600),
|
|
|
|
textColor = Color(0xD9FFFFFF),
|
|
|
|
textColor = Color(0xD9FFFFFF),
|
|
|
|
outline = false,
|
|
|
|
outline = false,
|
|
|
@ -96,12 +110,31 @@ class ASButton extends StatefulWidget {
|
|
|
|
this.textStyle,
|
|
|
|
this.textStyle,
|
|
|
|
this.padding,
|
|
|
|
this.padding,
|
|
|
|
@required this.title,
|
|
|
|
@required this.title,
|
|
|
|
this.onpressed,
|
|
|
|
this.onPressed,
|
|
|
|
this.width})
|
|
|
|
this.width,
|
|
|
|
|
|
|
|
this.disableColor,
|
|
|
|
|
|
|
|
this.disableTextColor})
|
|
|
|
: bgcolor = Color(0xFFF2F2F2),
|
|
|
|
: bgcolor = Color(0xFFF2F2F2),
|
|
|
|
textColor = Color(0xD9000000),
|
|
|
|
textColor = Color(0xD9000000),
|
|
|
|
outline = false,
|
|
|
|
outline = false,
|
|
|
|
super(key: key);
|
|
|
|
super(key: key);
|
|
|
|
|
|
|
|
ASButton.order({
|
|
|
|
|
|
|
|
Key key,
|
|
|
|
|
|
|
|
@required this.title,
|
|
|
|
|
|
|
|
this.onPressed,
|
|
|
|
|
|
|
|
this.outlineColor,
|
|
|
|
|
|
|
|
this.width,
|
|
|
|
|
|
|
|
}) : bgcolor = Color(0xFFFFBD32),
|
|
|
|
|
|
|
|
textColor=Color(0xFF0000000),
|
|
|
|
|
|
|
|
textStyle = TextStyle(
|
|
|
|
|
|
|
|
fontSize: 14.sp,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
|
|
|
radius = 5.w,
|
|
|
|
|
|
|
|
outline = false,
|
|
|
|
|
|
|
|
disableColor = Color(0xFFFFDF9B),
|
|
|
|
|
|
|
|
disableTextColor = Color(0x73000000),
|
|
|
|
|
|
|
|
padding=EdgeInsets.symmetric(vertical: 8.w),
|
|
|
|
|
|
|
|
super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_ASButtonState createState() => _ASButtonState();
|
|
|
|
_ASButtonState createState() => _ASButtonState();
|
|
|
@ -111,14 +144,16 @@ class _ASButtonState extends State<ASButton> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialButton(
|
|
|
|
return MaterialButton(
|
|
|
|
|
|
|
|
disabledColor: widget.disableColor ?? widget.bgcolor,
|
|
|
|
|
|
|
|
disabledTextColor: widget.disableTextColor ?? Color(0x73000000),
|
|
|
|
|
|
|
|
textColor: widget.textColor ?? Color(0xFFFFB600),
|
|
|
|
minWidth: widget.width ?? 75.w,
|
|
|
|
minWidth: widget.width ?? 75.w,
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
onPressed: widget.onpressed,
|
|
|
|
onPressed: widget.onPressed,
|
|
|
|
child: widget.title is String
|
|
|
|
child: widget.title is String
|
|
|
|
? Text(widget.title,
|
|
|
|
? Text(widget.title,
|
|
|
|
style: widget.textStyle ??
|
|
|
|
style: widget.textStyle ??
|
|
|
|
TextStyle(
|
|
|
|
TextStyle(
|
|
|
|
color: widget.textColor ?? Color(0xFFFFB600),
|
|
|
|
|
|
|
|
fontSize: 13.sp))
|
|
|
|
fontSize: 13.sp))
|
|
|
|
: widget.title,
|
|
|
|
: widget.title,
|
|
|
|
padding: widget.padding ?? EdgeInsets.symmetric(vertical: 6.w),
|
|
|
|
padding: widget.padding ?? EdgeInsets.symmetric(vertical: 6.w),
|
|
|
@ -129,6 +164,9 @@ class _ASButtonState extends State<ASButton> {
|
|
|
|
borderRadius: BorderRadius.circular(widget.radius ?? 15.5.w)),
|
|
|
|
borderRadius: BorderRadius.circular(widget.radius ?? 15.5.w)),
|
|
|
|
color: widget.bgcolor ?? Color(0xFFFFFFFF),
|
|
|
|
color: widget.bgcolor ?? Color(0xFFFFFFFF),
|
|
|
|
elevation: 0,
|
|
|
|
elevation: 0,
|
|
|
|
|
|
|
|
focusElevation: 0,
|
|
|
|
|
|
|
|
highlightElevation: 0,
|
|
|
|
|
|
|
|
hoverElevation: 0,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|