Browse Source

Made success state of button as short as possible if it doesn't have to be surfaced on UI

ashilkn 2 years ago
parent
commit
50970a6875
1 changed files with 4 additions and 4 deletions
  1. 4 4
      lib/ui/components/button_widget.dart

+ 4 - 4
lib/ui/components/button_widget.dart

@@ -340,9 +340,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
   }
 
   bool get _shouldRegisterGestures =>
-      !widget.isDisabled &&
-      (executionState == ExecutionState.idle ||
-          !widget.shouldSurfaceExecutionStates);
+      !widget.isDisabled && executionState == ExecutionState.idle;
 
   void _onTap() async {
     if (widget.onTap != null) {
@@ -370,7 +368,9 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
       if (executionState == ExecutionState.inProgress) {
         setState(() {
           executionState = ExecutionState.successful;
-          Future.delayed(const Duration(seconds: 2), () {
+          Future.delayed(
+              Duration(seconds: widget.shouldSurfaceExecutionStates ? 2 : 0),
+              () {
             widget.isInAlert
                 ? Navigator.of(context, rootNavigator: true)
                     .pop(widget.buttonAction)