Home > Software engineering >  how to create a alert dialog in flutter as per image?
how to create a alert dialog in flutter as per image?

Time:11-25

enter image description here

CodePudding user response:

You can simply use flutter_dialogs

install in pubspec.yaml:

flutter_dialogs: ^2.1.1

Usage:

showPlatformDialog(
  context: context,
  builder: (context) => BasicDialogAlert(
    title: Text("Are you sure?"),
    content: Text("This Action will permanently remove the announcement"),
    actions: <Widget>[
      BasicDialogAction(
        title: Text("Cancel"),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
      BasicDialogAction(
        title: Text("ok"),
        onPressed: () {
         //what to do after clicking ok
        },
      ),
    ],
  ),
);  

 
  • Related