materialDialog static method

Future<void> materialDialog({
  1. required BuildContext context,
  2. dynamic onClose(
    1. dynamic value
    )?,
  3. String? title,
  4. String? msg,
  5. List<Widget>? actions,
  6. Widget customView = holder,
  7. CustomViewPosition customViewPosition = CustomViewPosition.BEFORE_TITLE,
  8. LottieBuilder? lottieBuilder,
  9. bool barrierDismissible = true,
  10. Color? barrierColor = Colors.black54,
  11. String? barrierLabel,
  12. bool useSafeArea = true,
  13. bool useRootNavigator = true,
  14. RouteSettings? routeSettings,
  15. ShapeBorder dialogShape = dialogShape,
  16. TextStyle titleStyle = titleStyle,
  17. TextStyle? msgStyle,
  18. TextAlign? titleAlign,
  19. TextAlign? msgAlign,
  20. Color color = bcgColor,
  21. 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,
  List<Widget>? actions,
  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: actions,
          animationBuilder: lottieBuilder,
          customView: customView,
          customViewPosition: customViewPosition,
          titleStyle: titleStyle,
          msgStyle: msgStyle,
          titleAlign: titleAlign,
          msgAlign: msgAlign,
          color: color,
        ),
      );
    },
  ).then((value) => onClose?.call(value));
}