show<T> static method
Future<T?>
show<T>({
- required BuildContext context,
- required Widget child,
- String? title,
- String? subtitle,
- List<
PrismSheetAction< actions = const [],T> > - bool isScrollControlled = true,
- bool isDismissible = true,
- bool useSafeArea = true,
- double maxDialogWidth = 460,
- Widget? header,
- bool showDragHandle = true,
- Color? backgroundColor,
Shows the adapted surface and resolves with the value passed to Navigator.pop — either from an action, a drag-dismiss (null) or the barrier (null).
Implementation
static Future<T?> show<T>({
required BuildContext context,
required Widget child,
String? title,
String? subtitle,
List<PrismSheetAction<T>> actions = const [],
bool isScrollControlled = true,
bool isDismissible = true,
bool useSafeArea = true,
double maxDialogWidth = 460,
Widget? header,
bool showDragHandle = true,
Color? backgroundColor,
}) {
final tokens = PrismTokens.of(context);
final wide = MediaQuery.sizeOf(context).width >= tokens.breakpointCompact;
if (wide) {
return showDialog<T>(
context: context,
barrierDismissible: isDismissible,
builder: (dialogContext) => Dialog(
backgroundColor: backgroundColor,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(tokens.radiusXl),
),
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxDialogWidth),
child: _SheetContent<T>(
title: title,
subtitle: subtitle,
actions: actions,
header: header,
showDragHandle: false,
child: child,
),
),
),
);
}
return showModalBottomSheet<T>(
context: context,
isScrollControlled: isScrollControlled,
isDismissible: isDismissible,
useSafeArea: useSafeArea,
showDragHandle: showDragHandle,
backgroundColor: backgroundColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(tokens.radiusXl),
),
),
builder: (sheetContext) => _SheetContent<T>(
title: title,
subtitle: subtitle,
actions: actions,
header: header,
showDragHandle: false,
child: child,
),
);
}