Skip to content

Instantly share code, notes, and snippets.

@jtmuller5
Created January 5, 2022 20:07
Show Gist options
  • Save jtmuller5/033195b7e41d47bbaa574c99833c059e to your computer and use it in GitHub Desktop.
Save jtmuller5/033195b7e41d47bbaa574c99833c059e to your computer and use it in GitHub Desktop.
bool confirm = await showDialog<bool>(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Are you sure?'),
content: const Text('This action cannot be undone.'),
actions: [
TextButton(
child: const Text('Cancel'),
onPressed: (){
Navigator.pop(context,false);
},
),
TextButton(
child:const Text('End'),
onPressed: (){
Navigator.pop(context,true);
},
)
],
);
},) ?? false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment