materialDialog static method
Future<void>
materialDialog({
- required BuildContext context,
- dynamic onClose(
- dynamic value
- String? title,
- String? msg,
- @Deprecated('The actions is Deprecated, please use actionsBuilder') List<
Widget> ? actions, - dynamic actionsBuilder(
- BuildContext context
- Widget customView = holder,
- CustomViewPosition customViewPosition = CustomViewPosition.BEFORE_TITLE,
- LottieBuilder? lottieBuilder,
- bool barrierDismissible = true,
- Color? barrierColor = Colors.black54,
- String? barrierLabel,
- bool useSafeArea = true,
- RouteSettings? routeSettings,
- ShapeBorder dialogShape = dialogShape,
- TextStyle titleStyle = titleStyle,
- TextStyle? msgStyle,
- TextAlign? titleAlign,
- TextAlign? msgAlign,
- Color color = bcgColor,
- 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));
}