openSheet<T> function
Future<T?>
openSheet<T>({
- required BuildContext context,
- required WidgetBuilder builder,
- required OverlayPosition position,
- bool barrierDismissible = true,
- bool transformBackdrop = false,
- Color? barrierColor,
- bool draggable = false,
- AnimationController? animationController,
- WidgetBuilder? backdropBuilder,
- BoxConstraints? constraints,
- AlignmentGeometry? alignment,
Opens a sheet and returns a future that completes when dismissed.
Convenience function that opens a sheet overlay and returns the future directly, suitable for use with async/await patterns.
Returns: A Future that completes with the result when the sheet is dismissed.
Example:
final accepted = await openSheet<bool>(
context: context,
position: OverlayPosition.bottom,
builder: (context) => ConfirmationSheet(),
);
Implementation
Future<T?> openSheet<T>({
required BuildContext context,
required WidgetBuilder builder,
required OverlayPosition position,
bool barrierDismissible = true,
bool transformBackdrop = false,
Color? barrierColor,
bool draggable = false,
AnimationController? animationController,
WidgetBuilder? backdropBuilder,
BoxConstraints? constraints,
AlignmentGeometry? alignment,
}) {
return openSheetOverlay<T>(
context: context,
builder: builder,
position: position,
barrierDismissible: barrierDismissible,
transformBackdrop: transformBackdrop,
barrierColor: barrierColor,
draggable: draggable,
animationController: animationController,
backdropBuilder: backdropBuilder,
constraints: constraints,
alignment: alignment,
).future;
}