flexible_sheet banner
> flexible_sheet_

flexible_sheet

A flexible, persistent sheet widget for Flutter — supports top-to-bottom and bottom-to-top directions with configurable snap behavior, spring physics, and programmatic control.

v1.0.0 MIT #Bottom sheet#Flexible#Animations#Physics#UI
3
LIKES
188
DOWNLOADS
100%
HEALTH
160/160
POINTS
> Overview_

Overview

A flexible, persistent sheet widget for Flutter — supports top-to-bottom and bottom-to-top directions with configurable snap behavior, spring physics, and programmatic control.

ورقة مرنة قابلة للسحب مع تحكم برمجي كامل وanimation أملس.. صُممت لتكون سهلة الاستخدام مع واجهة API بسيطة وواضحة، ومُحسّنة للأداء العالي.

> Platforms_

Platforms

iOSAndroidWebmacOSWindows
> Features_

Features

Bidirectional — slides from top or bottom via `SheetDirection.topToBottom` / `SheetDirection.bottomToTop`
Snap behavior — snap to edges or remain at the released position via `SheetSnapBehavior.snapToEdge` / `SheetSnapBehavior.freePosition`
Spring physics — fine-tune mass, stiffness, damping, and velocity through `SheetPhysics`
Programmatic control — `open()`, `close()`, `toggle()`, `animateTo(height)` via `FlexibleSheetController`
Handle visibility — show or hide the drag handle at runtime with `showHandle()` / `hideHandle()`
Width & alignment — optionally constrain the sheet width and align it horizontally within its parent
Callbacks — listen to open/close state changes (`onStateChanged`) and continuous height updates (`onHeightChanged`)
Zero dependencies — built entirely on the Flutter SDK with no external packages
--
> Installation_

Installation

$ flutter pub add flexible_sheet

dependencies:
  flexible_sheet: ^1.0.0
> Quick Start_

Quick Start

import 'package:flexible_sheet/flexible_sheet.dart';
flexible_sheet demo
> Usage_

Usage

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()}'),
);

// Programmatic control
controller.open();
controller.close();
controller.toggle();
controller.animateTo(250);
> Bottom-to-Top Sheet_

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)_

Free Position (no snapping)

FlexibleSheet(
  maxHeight: 500,
  minHeight: 50,
  snapBehavior: SheetSnapBehavior.freePosition,
  childBuilder: (height) => MyContent(height: height),
  handleBuilder: (height) => const MyHandle(),
);
> Custom Width & Alignment_

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_

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_

Handle Visibility Control

final controller = FlexibleSheetController();

// Hide the drag handle programmatically
controller.hideHandle();

// Show it again
controller.showHandle();

// Check current state
print(controller.isHandleVisible); // true or false
> Start in Open State_

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(),
);
> API Reference_

API Reference

FlexibleSheetController({bool initialIsOpen = false})
> Methods_

Methods

const SheetPhysics({
  SpringDescription spring = const SpringDescription(mass: 1, stiffness: 500, damping: 30),
  double defaultVelocity = 1500,
})
> Enums_

Enums

// Before (1.x)
import 'package:persistent_top_sheet/persistent_top_sheet.dart';
final controller = PersistentTopSheetController();
PersistentTopSheet(
  maxHeight: 500, minHeight: 50,
  animationSpeed: 2000,
  controller: controller,
  childBuilder: (h) => ...,
  handleBuilder: (h) => ...,
);

// After (2.0)
import 'package:flexible_sheet/flexible_sheet.dart';
final controller = FlexibleSheetController();
FlexibleSheet(
  maxHeight: 500, minHeight: 50,
  physics: SheetPhysics(defaultVelocity: 2000),
  controller: controller,
  childBuilder: (h) => ...,
  handleBuilder: (h) => ...,
);