showDialog method

Future<List<int>?> showDialog(
  1. BuildContext context, {
  2. bool barrierDismissible = true,
  3. Color? backgroundColor,
  4. PickerWidgetBuilder? builder,
  5. Key? key,
})

show dialog picker

Implementation

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