API Reference
FlexibleSheet Widget
| Parameter |
Type |
Default |
Description |
maxHeight |
double |
required |
Maximum height the sheet can expand to |
minHeight |
double |
required |
Minimum height the sheet collapses to |
childBuilder |
Widget Function(double) |
required |
Builder for the sheet content; receives the current height |
handleBuilder |
Widget Function(double)? |
null |
Builder for the drag handle; receives the current height |
controller |
FlexibleSheetController? |
null |
Controller for programmatic open, close, toggle, and animation |
direction |
SheetDirection |
topToBottom |
Slide direction: topToBottom or bottomToTop |
snapBehavior |
SheetSnapBehavior |
snapToEdge |
Snap behavior on release: snapToEdge or freePosition |
physics |
SheetPhysics? |
default |
Spring animation configuration (mass, stiffness, damping, velocity) |
initialHeight |
double? |
minHeight |
Starting height; must be between minHeight and maxHeight |
width |
double? |
null |
Optional fixed width; if null, the sheet fills its parent width |
alignment |
AlignmentGeometry? |
null |
Horizontal alignment when width is set; defaults to center |
isDraggable |
bool |
true |
Whether the user can drag the handle to resize |
onStateChanged |
ValueChanged<bool>? |
null |
Called when the sheet opens (true) or closes (false) |
onHeightChanged |
ValueChanged<double>? |
null |
Called on every height change (drag or animation) |
clipBehavior |
Clip |
Clip.hardEdge |
Clipping behavior for the sheet content |
FlexibleSheetController
Constructor
FlexibleSheetController({bool initialIsOpen = false})
| Parameter |
Type |
Default |
Description |
initialIsOpen |
bool |
false |
Whether the sheet starts in the open state |
Methods
| Method |
Description |
open() |
Animate the sheet to maxHeight |
close() |
Animate the sheet to minHeight |
toggle() |
Toggle between open and closed states |
animateTo(double height) |
Animate to a specific height (clamped to min/max) |
showHandle() |
Make the drag handle visible |
hideHandle() |
Hide the drag handle |
Properties
| Property |
Type |
Description |
isOpen |
bool |
Whether the sheet is currently at maxHeight |
currentHeight |
double |
The current height of the sheet |
isHandleVisible |
bool |
Whether the drag handle is currently visible |
SheetPhysics
const SheetPhysics({
SpringDescription spring = const SpringDescription(mass: 1, stiffness: 500, damping: 30),
double defaultVelocity = 1500,
})
| Parameter |
Type |
Default |
Description |
spring |
SpringDescription |
mass: 1, stiffness: 500, damping: 30 |
Spring configuration for animations |
defaultVelocity |
double |
1500 |
Default animation velocity in px/s for programmatic actions |
Enums
SheetDirection
| Value |
Description |
topToBottom |
Content on top, handle below — dragging down expands the sheet |
bottomToTop |
Handle on top, content below — dragging up expands the sheet |
SheetSnapBehavior
| Value |
Description |
snapToEdge |
Snaps to fully open or fully closed based on velocity and position |
freePosition |
Stays at the exact height where the user released the drag |