skaran921 / flutter_awesome_alert_box

Other
7 stars 2 forks source link

fixed all routines that ingored their icon parameter to use it if it … #6

Open timmaffett opened 3 years ago

timmaffett commented 3 years ago

…is provided.

added Future [result] member variable to all dialogs that present button choices so callers have the option of to 'await DialogObject.result' to get the result sent to pop(). added default result to all pop() calls for dialogs that have more than one button (the button text is sent by default as the result). added pop() calls to all dialogs default [onPressedYes] functions so that the 'Yes' buttons dismiss the dialog by default

Several of the dialogs ignored their [icon] parameters if they were provided, this has been fixed. I have also added a 'result' Future member to the dialogs that have a yes and no button. This allows the creator/caller of the dialog object to subsequently do something like: var confirmAB = ConfirmAlertBox(onPressedYes: () { Navigator.pop(context, "DELETE"); }, onPressedNo: () { Navigator.pop(context, "CANCEL"); },); String result = await confirmAB.result; if( result=="DELETE" ) { ... }

(basically use the alert boxes like regular showDialog() calls.) This change has no effect for any use that is not using it. All previous behavior is identical (although the icon parameters are no longer ingored, but that would not be expected behavior)

Thanks!