create static method

Future<void> create(
  1. String title,
  2. String message,
  3. String okLabel,
  4. BuildContext context, {
  5. Function? callback,
})

Implementation

static Future<void> create(String title, String message, String okLabel, m.BuildContext context, {Function? callback}) async {
  return m.showDialog<void>(
    context: context,
    barrierDismissible: false, // user must tap button!
    builder: (m.BuildContext context) {
      return m.AlertDialog(
        title: m.Text(title),
        content: m.SingleChildScrollView(
          child: m.ListBody(
            children: <m.Widget>[
              m.Text(message),
            ],
          ),
        ),
        actions: <m.Widget>[
         m.TextButton(
            child: m.Text(okLabel),
            onPressed: () {
              m.Navigator.of(context).pop();
              if(callback != null) {
                callback();
              }
            },
          ),
        ],
      );
    },
  );
}