OudsBottomSheetScaffold class

A scaffold that displays a standard (persistent) bottom sheet anchored to the bottom of the screen, co-existing with the main content.

Unlike a modal bottom sheet, a standard bottom sheet remains visible while the user interacts with the rest of the screen.

States

The sheet has two states:

State Height
Partially expanded sheetPeekHeight (default 56 dp)
Expanded 85 % of the available body height

Gestures

When sheetSwipeEnabled is true:

  • Swipe up → expands the sheet from partially expanded.
  • Swipe down → collapses the sheet from expanded to peek height.

Programmatic control

Use a GlobalKey to call OudsBottomSheetScaffoldState.expand or OudsBottomSheetScaffoldState.partialExpand:

final scaffoldKey = GlobalKey<OudsBottomSheetScaffoldState>();

OudsBottomSheetScaffold(
  key: scaffoldKey,
  topBar: AppBar(title: Text('My screen')),
  sheetContent: (context) => Text('Sheet content'),
  content: (context) => Text('Main content'),
);

// Expand programmatically:
scaffoldKey.currentState?.expand();

// Collapse back to peek height:
scaffoldKey.currentState?.partialExpand();

Parameters

See also

Inheritance

Constructors

OudsBottomSheetScaffold({Key? key, required WidgetBuilder sheetContent, required WidgetBuilder content, double sheetPeekHeight = kOudsBottomSheetPeekHeight, bool sheetDragHandle = true, bool sheetSwipeEnabled = true, PreferredSizeWidget? topBar, ValueChanged<bool>? onExpansionChanged})
const

Properties

content → WidgetBuilder
Builder for the main content of the screen.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onExpansionChanged → ValueChanged<bool>?
Called when the sheet changes between expanded and partially expanded. true = expanded, false = collapsed.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sheetContent → WidgetBuilder
Builder for the content of the bottom sheet.
final
sheetDragHandle → bool
Toggles the visibility of the drag handle at the top of the bottom sheet. When true, shows OudsBottomSheetDefaults.dragHandle.
final
sheetPeekHeight → double
The height of the bottom sheet when it is collapsed.
final
sheetSwipeEnabled → bool
Whether the sheet swiping is enabled and should react to the user's input.
final
topBar → PreferredSizeWidget?
The top app bar of the screen.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → OudsBottomSheetScaffoldState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited