Flutter AlertDialog And SnackBar

Flutter Alert Dialog :

  myAlertDialog(context) {  
    return showDialog(  
      context: context,  
      builder: (BuildContext context) {  
       return Expanded(  
         child: AlertDialog(  
        title: Text("Alert Dialog"),  
        content: Text("Do You want to delete ?"),  
        actions: [  
         TextButton(  
           onPressed: () {  
            mySnackBar("Delete Success", context);  
            Navigator.of(context).pop();  
           },  
           child: Text("YES")),  
         TextButton(  
           onPressed: () {  
            Navigator.of(context).pop();  
           },  
           child: Text("No")),  
        ],  
       ));  
      });  
   } // myAlertDialog End Here ==========  

Flutter SnackBar :

  mySnackBar(message, context) {  
   return ScaffoldMessenger.of(context)  
     .showSnackBar(SnackBar(content: Text(message)));  
  }  












Next Post Previous Post
No Comment
Add Comment
comment url