This commit is contained in:
ashilkn 2022-12-16 16:34:51 +05:30
parent 2ee6e26e48
commit 6c2b6f8eed

View file

@ -38,9 +38,7 @@ class ButtonWidget extends StatelessWidget {
final bool isDisabled;
final ButtonSize buttonSize;
///Passing a non null value to this will pop the Navigator stack and return
///buttonIndex along with it when pressed. Button action will only work if
///isInAlert is true
///Button action will only work if isInAlert is true
final ButtonAction? buttonAction;
///setting this flag to true will make the button appear like how it would
@ -347,7 +345,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
setState(() {
executionState = ExecutionState.successful;
Future.delayed(Duration(seconds: widget.isInAlert ? 1 : 2), () {
widget.buttonAction != null && widget.isInAlert
widget.isInAlert
? Navigator.of(context, rootNavigator: true)
.pop(widget.buttonAction)
: null;
@ -362,7 +360,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
if (executionState == ExecutionState.error) {
setState(() {
executionState = ExecutionState.idle;
widget.buttonAction != null && widget.isInAlert
widget.isInAlert
? Future.delayed(
const Duration(seconds: 0),
() => Navigator.of(context, rootNavigator: true).pop(