openDrawer<T> function
Future<T?>
openDrawer<T>({
- required BuildContext context,
- required WidgetBuilder builder,
- required OverlayPosition position,
- bool expands = false,
- bool draggable = true,
- bool barrierDismissible = true,
- WidgetBuilder? backdropBuilder,
- bool useSafeArea = true,
- bool? showDragHandle,
- BorderRadiusGeometry? borderRadius,
- Size? dragHandleSize,
- bool transformBackdrop = true,
- double? surfaceOpacity,
- double? surfaceBlur,
- Color? barrierColor,
- AnimationController? animationController,
- BoxConstraints? constraints,
- AlignmentGeometry? alignment,
Opens a drawer and returns a future that completes when dismissed.
Convenience function that opens a drawer overlay and returns the future directly, suitable for use with async/await patterns.
Returns: A Future that completes with the result when the drawer is dismissed.
Example:
final result = await openDrawer<String>(
context: context,
position: OverlayPosition.left,
builder: (context) => MyDrawerContent(),
);
Implementation
Future<T?> openDrawer<T>({
required BuildContext context,
required WidgetBuilder builder,
required OverlayPosition position,
bool expands = false,
bool draggable = true,
bool barrierDismissible = true,
WidgetBuilder? backdropBuilder,
bool useSafeArea = true,
bool? showDragHandle,
BorderRadiusGeometry? borderRadius,
Size? dragHandleSize,
bool transformBackdrop = true,
double? surfaceOpacity,
double? surfaceBlur,
Color? barrierColor,
AnimationController? animationController,
BoxConstraints? constraints,
AlignmentGeometry? alignment,
}) {
return openDrawerOverlay<T>(
context: context,
builder: builder,
position: position,
expands: expands,
draggable: draggable,
barrierDismissible: barrierDismissible,
backdropBuilder: backdropBuilder,
useSafeArea: useSafeArea,
showDragHandle: showDragHandle,
borderRadius: borderRadius,
dragHandleSize: dragHandleSize,
transformBackdrop: transformBackdrop,
surfaceOpacity: surfaceOpacity,
surfaceBlur: surfaceBlur,
barrierColor: barrierColor,
animationController: animationController,
constraints: constraints,
alignment: alignment,
).future;
}