|
@@ -205,27 +205,20 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
|
|
final _debouncer = Debouncer(const Duration(milliseconds: 300));
|
|
final _debouncer = Debouncer(const Duration(milliseconds: 300));
|
|
ExecutionState executionState = ExecutionState.idle;
|
|
ExecutionState executionState = ExecutionState.idle;
|
|
|
|
|
|
|
|
+ @override
|
|
|
|
+ void initState() {
|
|
|
|
+ _setButtonTheme();
|
|
|
|
+ super.initState();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @override
|
|
|
|
+ void didUpdateWidget(covariant ButtonChildWidget oldWidget) {
|
|
|
|
+ _setButtonTheme();
|
|
|
|
+ super.didUpdateWidget(oldWidget);
|
|
|
|
+ }
|
|
|
|
+
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
- progressStatus = widget.progressStatus;
|
|
|
|
- checkIconColor = widget.buttonStyle.checkIconColor ??
|
|
|
|
- widget.buttonStyle.defaultIconColor;
|
|
|
|
- loadingIconColor = widget.buttonStyle.defaultIconColor;
|
|
|
|
- if (widget.isDisabled) {
|
|
|
|
- buttonColor = widget.buttonStyle.disabledButtonColor ??
|
|
|
|
- widget.buttonStyle.defaultButtonColor;
|
|
|
|
- borderColor = widget.buttonStyle.disabledBorderColor ??
|
|
|
|
- widget.buttonStyle.defaultBorderColor;
|
|
|
|
- iconColor = widget.buttonStyle.disabledIconColor ??
|
|
|
|
- widget.buttonStyle.defaultIconColor;
|
|
|
|
- labelStyle = widget.buttonStyle.disabledLabelStyle ??
|
|
|
|
- widget.buttonStyle.defaultLabelStyle;
|
|
|
|
- } else {
|
|
|
|
- buttonColor = widget.buttonStyle.defaultButtonColor;
|
|
|
|
- borderColor = widget.buttonStyle.defaultBorderColor;
|
|
|
|
- iconColor = widget.buttonStyle.defaultIconColor;
|
|
|
|
- labelStyle = widget.buttonStyle.defaultLabelStyle;
|
|
|
|
- }
|
|
|
|
if (executionState == ExecutionState.successful) {
|
|
if (executionState == ExecutionState.successful) {
|
|
Future.delayed(Duration(seconds: widget.isInAlert ? 1 : 2), () {
|
|
Future.delayed(Duration(seconds: widget.isInAlert ? 1 : 2), () {
|
|
setState(() {
|
|
setState(() {
|
|
@@ -383,6 +376,28 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ void _setButtonTheme() {
|
|
|
|
+ progressStatus = widget.progressStatus;
|
|
|
|
+ checkIconColor = widget.buttonStyle.checkIconColor ??
|
|
|
|
+ widget.buttonStyle.defaultIconColor;
|
|
|
|
+ loadingIconColor = widget.buttonStyle.defaultIconColor;
|
|
|
|
+ if (widget.isDisabled) {
|
|
|
|
+ buttonColor = widget.buttonStyle.disabledButtonColor ??
|
|
|
|
+ widget.buttonStyle.defaultButtonColor;
|
|
|
|
+ borderColor = widget.buttonStyle.disabledBorderColor ??
|
|
|
|
+ widget.buttonStyle.defaultBorderColor;
|
|
|
|
+ iconColor = widget.buttonStyle.disabledIconColor ??
|
|
|
|
+ widget.buttonStyle.defaultIconColor;
|
|
|
|
+ labelStyle = widget.buttonStyle.disabledLabelStyle ??
|
|
|
|
+ widget.buttonStyle.defaultLabelStyle;
|
|
|
|
+ } else {
|
|
|
|
+ buttonColor = widget.buttonStyle.defaultButtonColor;
|
|
|
|
+ borderColor = widget.buttonStyle.defaultBorderColor;
|
|
|
|
+ iconColor = widget.buttonStyle.defaultIconColor;
|
|
|
|
+ labelStyle = widget.buttonStyle.defaultLabelStyle;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
bool get _shouldRegisterGestures =>
|
|
bool get _shouldRegisterGestures =>
|
|
!widget.isDisabled && executionState == ExecutionState.idle;
|
|
!widget.isDisabled && executionState == ExecutionState.idle;
|
|
|
|
|