rflutter_alert icon indicating copy to clipboard operation
rflutter_alert copied to clipboard

onDismiss/onClose event

Open iulian0512 opened this issue 4 years ago • 1 comments

Hi, how can i run some code when the user clicks on the black background (the alert gets dismissed) and when the user clicks the close button ?

iulian0512 avatar Mar 29 '21 12:03 iulian0512

I know this is a rather old question, but you can

bool? discard = await Alert(
  context: context,
  content: const Text('Unsaved changes exist, '
      'are you sure you want to discard these changes?'),
  buttons: [
    DialogButton(
      child: const Text('Cancel'),
      onPressed: () => Navigator.pop(context, false),
    ),
    DialogButton(
      child: const Text('Discard'),
      onPressed: () => Navigator.pop(context, true),
    ),
  ],
).show();

null is returned in the case of pressing the x or tapping outside the dialog

natebgurutech avatar Oct 10 '22 18:10 natebgurutech

I'm closing this issue because no more recent activity.

ibrahimdevs avatar May 17 '23 08:05 ibrahimdevs