showAlertDialog static method

dynamic showAlertDialog(
  1. BuildContext context,
  2. String title,
  3. String content
)

Implementation

static showAlertDialog(BuildContext context,String title ,String content)
{
 // Create button
 Widget YesButton = TextButton(
   child: const Text("Ok"),
   onPressed: () {
     Navigator.of(context,rootNavigator: true).pop();
     },
   );

 AlertDialog alert = AlertDialog(
   title:  Text(title),
   content:  Text(content),
   actions: [
     YesButton,
   ],
 );

 // show the dialog
     showDialog(
   context: context,
   builder: (BuildContext context) {
     return alert;
   },
 );
  }