SHARE
TWEET

Untitled

John_Joe Nov 19th, 2019 (edited) 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class PopUpDialog {
  2.  Bloc _bloc;
  3.   String showDeleteDialog() {
  4.     _bloc = Provider.of<Bloc>(context);
  5.     showDialog(
  6.         context: context,
  7.         builder: (BuildContext buildContext) {
  8.           return AlertDialog(
  9.               actions: <Widget>[
  10.                 FlatButton(
  11.                   color: Colors.orange,
  12.                   child: Text('YES', style: TextStyle(color: Colors.white)),
  13.                   onPressed: () async {
  14.                    Navigator.pop(buildContext);
  15.                     var result = await _bloc.delete();
  16.                     if (result == "Success") {
  17.                       return result;
  18.                     } else {
  19.                       return "Failed";
  20.                     }
  21.                   },
  22.                 ),
  23.                 FlatButton(
  24.                   color: Colors.white,
  25.                   child: Text('CANCEL'),
  26.                   onPressed: () {
  27.                     Navigator.of(buildContext, rootNavigator: true)
  28.                         .pop('dialog');
  29.                   },
  30.                 )
  31.               ],
  32.               title: Text(Localization.of(buildContext).deleteDialogTitle),
  33.               content: Text(Localization.of(buildContext).deleteDialogContent));
  34.         });
  35.  
  36.     return "Failed";
  37.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top