showModalDialog static method

Future showModalDialog({
  1. required BuildContext context,
  2. required Widget view,
  3. double radius = 10,
  4. bool useRootNavigator = false,
  5. Color? bg,
  6. ValueChanged<BuildContext>? ctx,
})

Implementation

static Future showModalDialog({
  required BuildContext context,
  required Widget view,
  double radius = 10,
  bool useRootNavigator = false,
  Color? bg,
  ValueChanged<BuildContext>? ctx,
}) {
  return showDialog(
      context: context,
      useRootNavigator: useRootNavigator,
      barrierDismissible: false,
      builder: (BuildContext mContext) {
        if (ctx != null) {
          ctx(mContext);
        }
        return WillPopScope(
          onWillPop: () async => false,
          child: Dialog(
            elevation: 0,
            backgroundColor: bg,
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(radius))),
            child: view,
          ),
        );
      });
}