materialDialog static method

Future<void> materialDialog({
  1. required BuildContext context,
  2. dynamic onClose(
    1. dynamic value
    )?,
  3. String? title,
  4. String? msg,
  5. @Deprecated('The actions is Deprecated, please use actionsBuilder') List<Widget>? actions,
  6. dynamic actionsBuilder(
    1. BuildContext context
    )?,
  7. Widget customView = holder,
  8. CustomViewPosition customViewPosition = CustomViewPosition.BEFORE_TITLE,
  9. LottieBuilder? lottieBuilder,
  10. bool barrierDismissible = true,
  11. Color? barrierColor = Colors.black54,
  12. String? barrierLabel,
  13. bool useSafeArea = true,
  14. bool useRootNavigator = true,
  15. RouteSettings? routeSettings,
  16. ShapeBorder dialogShape = dialogShape,
  17. TextStyle titleStyle = titleStyle,
  18. TextStyle? msgStyle,
  19. TextAlign? titleAlign,
  20. TextAlign? msgAlign,
  21. Color color = bcgColor,
  22. double? dialogWidth,
})

Displays normal Material dialog above the current contents of the app context your parent widget context color dialog background color title your dialog title titleStyle your dialog title style titleAlign your dialog title alignment msg your dialog description message msgStyle your dialog description style msgAlign your dialog description alignment customView a custom view shown in the dialog at customViewPosition and by default before the title actions Widgets to display a row of buttons after the msg widget. onClose used to listen to dialog close events.

Implementation

/// [title] your dialog title
/// [titleStyle] your dialog title style
/// [titleAlign] your dialog title alignment
/// [msg] your dialog description message
/// [msgStyle] your dialog description style
/// [msgAlign] your dialog description alignment
/// [customView] a custom view shown in the dialog at [customViewPosition] and by default before the title

/// [actions] Widgets to display a row of buttons after the [msg] widget.
/// [onClose] used to listen to dialog close events.

static Future<void> materialDialog({
  required BuildContext context,
  Function(dynamic value)? onClose,
  String? title,
  String? msg,
  @Deprecated('The actions is Deprecated, please use actionsBuilder') List<Widget>? actions,
  Function(BuildContext context)? actionsBuilder,
  Widget customView = holder,
  CustomViewPosition customViewPosition = CustomViewPosition.BEFORE_TITLE,
  LottieBuilder? lottieBuilder,
  bool barrierDismissible = true,
  Color? barrierColor = Colors.black54,
  String? barrierLabel,
  bool useSafeArea = true,
  bool useRootNavigator = true,
  RouteSettings? routeSettings,
  ShapeBorder dialogShape = dialogShape,
  TextStyle titleStyle = titleStyle,
  TextStyle? msgStyle,
  TextAlign? titleAlign,
  TextAlign? msgAlign,
  Color color = bcgColor,
  double? dialogWidth,
}) async {
  await showDialog(
    context: context,
    barrierDismissible: barrierDismissible,
    barrierColor: barrierColor,
    barrierLabel: barrierLabel,
    useSafeArea: useSafeArea,
    useRootNavigator: useRootNavigator,
    routeSettings: routeSettings,
    builder: (context) {
      return Dialog(
        backgroundColor: color,
        shape: dialogShape,
        child: DialogWidget(
          title: title,
          dialogWidth: dialogWidth,
          msg: msg,
          actions: actionsBuilder != null ? actionsBuilder(context) : actions,
          animationBuilder: lottieBuilder,
          customView: customView,
          customViewPosition: customViewPosition,
          titleStyle: titleStyle,
          msgStyle: msgStyle,
          titleAlign: titleAlign,
          msgAlign: msgAlign,
          color: color,
        ),
      );
    },
  ).then((value) => onClose?.call(value));
}