Browse Source

Minor changes

ashilkn 2 years ago
parent
commit
a370781c94
2 changed files with 11 additions and 9 deletions
  1. 1 0
      lib/ui/components/action_sheet_widget.dart
  2. 10 9
      lib/ui/components/button_widget.dart

+ 1 - 0
lib/ui/components/action_sheet_widget.dart

@@ -35,6 +35,7 @@ Future<dynamic> showActionSheet({
         isCheckIconGreen: isCheckIconGreen,
         isCheckIconGreen: isCheckIconGreen,
       );
       );
     },
     },
+    isDismissible: false,
   );
   );
 }
 }
 
 

+ 10 - 9
lib/ui/components/button_widget.dart

@@ -19,10 +19,11 @@ enum ButtonSize {
   large;
   large;
 }
 }
 
 
-enum ButtonIndex {
+enum ButtonAction {
   first,
   first,
   second,
   second,
-  third;
+  third,
+  cancelled;
 }
 }
 
 
 typedef FutureVoidCallback = Future<void> Function();
 typedef FutureVoidCallback = Future<void> Function();
@@ -37,7 +38,7 @@ class ButtonWidget extends StatelessWidget {
 
 
   ///Passing a non null value to this will pop the Navigator stack and return
   ///Passing a non null value to this will pop the Navigator stack and return
   ///buttonIndex along with it when pressed
   ///buttonIndex along with it when pressed
-  final ButtonIndex? buttonIndex;
+  final ButtonAction? buttonAction;
 
 
   ///setting this flag to true will make the button appear like how it would
   ///setting this flag to true will make the button appear like how it would
   ///on dark theme irrespective of the app's theme.
   ///on dark theme irrespective of the app's theme.
@@ -50,7 +51,7 @@ class ButtonWidget extends StatelessWidget {
     this.onTap,
     this.onTap,
     this.isInActionSheet = false,
     this.isInActionSheet = false,
     this.isDisabled = false,
     this.isDisabled = false,
-    this.buttonIndex,
+    this.buttonAction,
     super.key,
     super.key,
   });
   });
 
 
@@ -112,7 +113,7 @@ class ButtonWidget extends StatelessWidget {
       onTap: onTap,
       onTap: onTap,
       labelText: labelText,
       labelText: labelText,
       icon: icon,
       icon: icon,
-      buttonIndex: buttonIndex,
+      buttonAction: buttonAction,
     );
     );
   }
   }
 }
 }
@@ -125,7 +126,7 @@ class ButtonChildWidget extends StatefulWidget {
   final IconData? icon;
   final IconData? icon;
   final bool isDisabled;
   final bool isDisabled;
   final ButtonSize buttonSize;
   final ButtonSize buttonSize;
-  final ButtonIndex? buttonIndex;
+  final ButtonAction? buttonAction;
   const ButtonChildWidget({
   const ButtonChildWidget({
     required this.buttonStyle,
     required this.buttonStyle,
     required this.buttonType,
     required this.buttonType,
@@ -134,7 +135,7 @@ class ButtonChildWidget extends StatefulWidget {
     this.onTap,
     this.onTap,
     this.labelText,
     this.labelText,
     this.icon,
     this.icon,
-    this.buttonIndex,
+    this.buttonAction,
     super.key,
     super.key,
   });
   });
 
 
@@ -327,8 +328,8 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
     // idle state. This Future is for delaying the execution of the if
     // idle state. This Future is for delaying the execution of the if
     // condition so that the calback in the debouncer finishes execution before.
     // condition so that the calback in the debouncer finishes execution before.
     await Future.delayed(const Duration(milliseconds: 5));
     await Future.delayed(const Duration(milliseconds: 5));
-    if (widget.buttonIndex != null) {
-      Navigator.of(context, rootNavigator: true).pop(widget.buttonIndex);
+    if (widget.buttonAction != null) {
+      Navigator.of(context, rootNavigator: true).pop(widget.buttonAction);
     }
     }
     if (executionState == ExecutionState.inProgress) {
     if (executionState == ExecutionState.inProgress) {
       setState(() {
       setState(() {