showBottomSheetOrDialog function

Future showBottomSheetOrDialog({
  1. required BuildContext context,
  2. required Widget child,
  3. BottomSheetDialog bottomSheetDialog = BottomSheetDialog.Dialog,
})

Shows a bottom sheet or a dialog based on the specified type.

Implementation

Future<dynamic> showBottomSheetOrDialog({
  required BuildContext context,
  required Widget child,
  BottomSheetDialog bottomSheetDialog = BottomSheetDialog.Dialog,
}) {
  if (bottomSheetDialog == BottomSheetDialog.BottomSheet) {
    // Show a bottom sheet.
    return showModalBottomSheet(context: context, builder: (_) => child);
  } else {
    // Show a dialog.
    return showInDialog(context, builder: (_) => child);
  }
}