Usage
Top-to-Bottom Sheet (default)
final controller = FlexibleSheetController();
FlexibleSheet(
maxHeight: 500,
minHeight: 50,
controller: controller,
childBuilder: (height) => MyContent(height: height),
handleBuilder: (height) => const MyHandle(),
onStateChanged: (isOpen) => debugPrint('isOpen: $isOpen'),
onHeightChanged: (h) => debugPrint('height: ${h.round()}'),
);
controller.open();
controller.close();
controller.toggle();
controller.animateTo(250);
Bottom-to-Top Sheet
FlexibleSheet(
maxHeight: 500,
minHeight: 50,
direction: SheetDirection.bottomToTop,
controller: controller,
childBuilder: (height) => MyContent(height: height),
handleBuilder: (height) => const MyHandle(),
);
Free Position (no snapping)
FlexibleSheet(
maxHeight: 500,
minHeight: 50,
snapBehavior: SheetSnapBehavior.freePosition,
childBuilder: (height) => MyContent(height: height),
handleBuilder: (height) => const MyHandle(),
);
Custom Width & Alignment
FlexibleSheet(
maxHeight: 400,
minHeight: 60,
width: 320,
alignment: Alignment.centerRight,
childBuilder: (height) => MyContent(height: height),
handleBuilder: (height) => const MyHandle(),
);
Custom Spring Physics
FlexibleSheet(
maxHeight: 500,
minHeight: 50,
physics: SheetPhysics(
spring: SpringDescription(mass: 1, stiffness: 600, damping: 35),
defaultVelocity: 2000,
),
childBuilder: (height) => MyContent(height: height),
handleBuilder: (height) => const MyHandle(),
);
Handle Visibility Control
final controller = FlexibleSheetController();
controller.hideHandle();
controller.showHandle();
print(controller.isHandleVisible);
Start in Open State
final controller = FlexibleSheetController(initialIsOpen: true);
FlexibleSheet(
maxHeight: 500,
minHeight: 50,
initialHeight: 500,
controller: controller,
childBuilder: (height) => MyContent(height: height),
handleBuilder: (height) => const MyHandle(),
);