DragSheet class

A widget that can be dragged and dismissed, typically used for modal sheets.

It supports gestures for dragging and flinging to dismiss, along with configurable animations and physics.

Inheritance

Constructors

DragSheet({Key? key, required WidgetBuilder builder, required bool shrinkWrap, VoidCallback? onDismissed, VoidCallback? onShow, double minScale = 0.75, double maxScale = 1.0, double minRadius = 0.0, double maxRadius = 50.0, double minOpacity = 0.0, double maxOpacity = 0.5, Duration entranceDuration = const Duration(milliseconds: 200), Duration exitDuration = const Duration(milliseconds: 200), Duration gestureFadeDuration = const Duration(milliseconds: 300), Duration programmaticFadeDuration = const Duration(milliseconds: 1000), double effectDistance = 120.0, BgOpacity? bgOpacity, double swipeVelocityMultiplier = 3.5, double swipeAccelerationThreshold = 3000, double swipeAccelerationMultiplier = 6.0, double swipeMinVelocity = 1800.0, double swipeMaxVelocity = 5000.0, double swipeFriction = 0.09, Duration opacityDuration = const Duration(milliseconds: 200), ApplyBorderRadius applyBorderRadius = ApplyBorderRadius.toTop, bool closeOnShrinkWrapTap = true})
Creates a DragSheet.
const

Properties

applyBorderRadius ApplyBorderRadius
Specifies which corners of the sheet should have a border radius.
final
bgOpacity BgOpacity?
Configuration for the background scrim's color and opacity.
final
builder WidgetBuilder
Builds the content of the sheet.
final
closeOnShrinkWrapTap bool
If true and shrinkWrap is also true, tapping the area outside the sheet content (but within its bottom-aligned container) dismisses the sheet. Defaults to true.
final
effectDistance double
The distance over which drag effects (scale, radius) are interpolated.
final
entranceDuration Duration
Duration of the entrance animation when the sheet is shown.
final
exitDuration Duration
Duration of the exit animation when the sheet is dismissed programmatically.
final
gestureFadeDuration Duration
Duration of the background fade when dismissing via a gesture.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxOpacity double
The maximum opacity of the background scrim.
final
maxRadius double
The maximum corner radius applied when the sheet is scaled down.
final
maxScale double
The maximum scale factor (typically 1.0 for full size).
final
minOpacity double
The minimum opacity of the background scrim.
final
minRadius double
The minimum corner radius applied during drag (typically 0.0 for squared corners).
final
minScale double
The minimum scale factor applied to the sheet during drag.
final
onDismissed VoidCallback?
Called when the sheet has been fully dismissed.
final
onShow VoidCallback?
Called when the sheet has been fully shown.
final
opacityDuration Duration
Duration for opacity-related animations, such as background fade and scale-down effects.
final
programmaticFadeDuration Duration
Duration of the background fade when dismissing programmatically.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shrinkWrap bool
If true, the sheet will take up only the necessary vertical space for its content. If false, it will expand to fill available vertical space.
final
swipeAccelerationMultiplier double
Multiplier for swipe acceleration to enhance fling speed.
final
swipeAccelerationThreshold double
Threshold for detecting acceleration in swipe gestures.
final
swipeFriction double
Friction applied to fling animations.
final
swipeMaxVelocity double
Maximum velocity for a swipe fling.
final
swipeMinVelocity double
Minimum velocity for a swipe to be considered a fling.
final
swipeVelocityMultiplier double
Multiplier for swipe velocity to determine fling strength.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<DragSheet>
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