show method
Call to display this Message box.
Implementation
Future<void> show({
BuildContext? context,
String? title,
String? msg,
List<Widget>? body,
List<Widget>? actions,
}) {
context = context ?? this.context;
title = title ?? this.title;
msg = msg ?? this.msg;
body = body ?? this.body;
if (body == null) {
if (msg == null || msg.isEmpty) {
body = [const Text('Shall we continue?')];
} else {
body = [Text(msg)];
}
}
actions = actions ?? this.actions;
actions ??= <Widget>[
TextButton(
key: const Key('button01'),
onPressed: () {
Navigator.pop(context!);
},
child: const Text('OK'),
),
];
return showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) => AlertDialog(
title: Text(title ?? ''),
content: SingleChildScrollView(
child: ListBody(
children: body!,
),
),
actions: actions,
),
);
}