openSheetOverlay<T> function
DrawerOverlayCompleter<T?>
openSheetOverlay<T>({
- required BuildContext context,
- required WidgetBuilder builder,
- required OverlayPosition position,
- bool barrierDismissible = true,
- bool transformBackdrop = false,
- WidgetBuilder? backdropBuilder,
- Color? barrierColor,
- bool draggable = false,
- AnimationController? animationController,
- bool autoOpen = true,
- BoxConstraints? constraints,
- AlignmentGeometry? alignment,
Opens a sheet overlay with minimal styling and full-screen expansion.
Creates a sheet overlay that slides in from the specified position, typically used for bottom sheets or side panels. Unlike drawers, sheets don't transform the backdrop and have minimal decoration.
Features:
- Full-screen expansion with edge-to-edge content
- Minimal styling and decoration
- Optional drag interaction
- Safe area integration
- Barrier dismissal support
Parameters:
context
(BuildContext, required): build context for overlay creationbuilder
(WidgetBuilder, required): function that builds sheet contentposition
(OverlayPosition, required): side from which sheet slides inbarrierDismissible
(bool, default: true): whether tapping barrier dismisses sheettransformBackdrop
(bool, default: false): whether to transform backdropbackdropBuilder
(WidgetBuilder?, optional): custom backdrop builderbarrierColor
(Color?, optional): color of the modal barrierdraggable
(bool, default: false): whether sheet can be dragged to dismissanimationController
(AnimationController?, optional): custom animation controllerautoOpen
(bool, default: true): whether to automatically open on creationconstraints
(BoxConstraints?, optional): size constraints for sheetalignment
(AlignmentGeometry?, optional): alignment within constraints
Returns: A DrawerOverlayCompleter that provides control over the sheet lifecycle.
Example:
final completer = openSheetOverlay<bool>(
context: context,
position: OverlayPosition.bottom,
builder: (context) => BottomSheetContent(),
draggable: true,
);
Implementation
DrawerOverlayCompleter<T?> openSheetOverlay<T>({
required BuildContext context,
required WidgetBuilder builder,
required OverlayPosition position,
bool barrierDismissible = true,
bool transformBackdrop = false,
WidgetBuilder? backdropBuilder,
Color? barrierColor,
bool draggable = false,
AnimationController? animationController,
bool autoOpen = true,
BoxConstraints? constraints,
AlignmentGeometry? alignment,
}) {
final theme = ComponentTheme.maybeOf<DrawerTheme>(context);
barrierColor ??= theme?.barrierColor;
return openRawDrawer<T>(
context: context,
transformBackdrop: transformBackdrop,
barrierDismissible: barrierDismissible,
useSafeArea: false, // handled by the sheet itself
animationController: animationController,
backdropBuilder: backdropBuilder,
autoOpen: autoOpen,
constraints: constraints,
alignment: alignment,
builder: (context, extraSize, size, padding, stackIndex) {
return SheetWrapper(
position: position,
expands: true,
draggable: draggable,
extraSize: extraSize,
size: size,
padding: padding,
barrierColor: barrierColor,
stackIndex: stackIndex,
child: Builder(builder: (context) {
return builder(context);
}),
);
},
position: position,
);
}