showDialog method
Future<List<int> ?>
showDialog(
- BuildContext context, {
- bool barrierDismissible = true,
- Color? backgroundColor,
- PickerWidgetBuilder? builder,
- Key? key,
show dialog picker
Implementation
Future<List<int>?> showDialog(BuildContext context,
{bool barrierDismissible = true,
Color? backgroundColor,
PickerWidgetBuilder? builder,
Key? key}) {
return Dialog.showDialog<List<int>>(
context: context,
barrierDismissible: barrierDismissible,
builder: (BuildContext context) {
final actions = <Widget>[];
final theme = Theme.of(context);
final myCancel = PickerWidgetState._buildButton(
context, cancelText, cancel, cancelTextStyle, true, theme, () {
Navigator.pop<List<int>>(context, null);
if (onCancel != null) {
onCancel!();
}
});
if (cancel != null) {
actions.add(myCancel!);
}
final myConfirm = PickerWidgetState._buildButton(
context, confirmText, confirm, confirmTextStyle, false, theme,
() async {
if (onConfirmBefore != null &&
!(await onConfirmBefore!(this, selecteds))) {
return; // Cancel;
}
Navigator.pop<List<int>>(context, selecteds);
if (onConfirm != null) {
onConfirm!(this, selecteds);
}
});
if (confirm != null) {
actions.add(myConfirm!);
}
return AlertDialog(
key: key ?? const Key('picker-dialog'),
title: title,
backgroundColor: backgroundColor,
actions: actions,
content: builder == null
? makePicker(theme)
: builder(context, makePicker(theme)),
);
});
}