show<T> static method
Future<T?>
show<T>(
- BuildContext context,
- TModalWidgetBuilder<
T> builder, { - bool persistent = false,
- double? width,
- double? minWidth,
- double? minHeight,
- bool fullscreen = false,
- double gap = 50,
- String? title,
- bool? showCloseButton,
- Widget layoutBuilder(
- BuildContext context,
- Widget child
Shows a modal dialog.
builder: Function to build the content of the modal.header: Optional custom header builder.footer: Optional custom footer builder.persistent: Whether the modal can be dismissed by tapping outside.width: The width of the modal (default 500).title: The title text for the default header.showCloseButton: Whether to show a close button.
Implementation
static Future<T?> show<T>(
BuildContext context,
TModalWidgetBuilder<T> builder, {
bool persistent = false,
double? width,
double? minWidth,
double? minHeight,
bool fullscreen = false,
double gap = 50,
String? title,
bool? showCloseButton,
Widget Function(BuildContext context, Widget child)? layoutBuilder,
}) {
return showDialog<T>(
context: context,
barrierDismissible: persistent,
builder: (BuildContext dialogContext) {
final mContext = TModalContext<T>(dialogContext);
return TModal(
builder.call(mContext),
persistent: persistent,
width: width,
fullscreen: fullscreen,
gap: gap,
title: title,
showCloseButton: showCloseButton,
layoutBuilder: layoutBuilder,
onClose: () {
Navigator.of(dialogContext).pop();
},
);
},
);
}