confirm method

void confirm (BuildContext context, String title, String message, dynamic callback(bool))

Implementation

static void confirm(BuildContext context, String title, String message, Function(bool) callback) {
  showDialog(
    context: context,
    barrierDismissible: false,
    builder: (BuildContext context) {
      return AlertDialog(
        title: Text(title),
        content: Text(message),
        actions: <Widget>[
          FlatButton(
            child: new Text("Cancel"),
            onPressed: () {
              callback(false);
              Navigator.of(context).pop();
            },
          ),
          FlatButton(
            child: new Text("Confirm"),
            onPressed: () {
              callback(true);
              Navigator.of(context).pop();
            },
          ),
        ],
      );
    },
  );
}