A widget that can be dismissed by dragging in the indicated direction.
Dragging or flinging this widget in the DismissDirection causes the child to slide out of view. Following the slide animation, if resizeDuration is non-null, the Dismissable widget animates its height (or width, whichever is perpendicular to the dismiss direction) to zero over the resizeDuration.
Backgrounds can be used to implement the "leave-behind" idiom. If a background is specified it is stacked behind the Dismissable's child and is exposed when the child moves.
The widget calls the onDimissed
callback either after its size has
collapsed to zero (if resizeDuration is non-null) or immediately after
the slide animation (if resizeDuration is null). If the Dismissable is a
list item, it must have a key that distinguishes it from the other items and
its onDismissed callback must remove the item from the list.
- Inheritance
- Object
- Widget
- StatefulWidget
- Dismissable
Constructors
- Dismissable({@required Key key, Widget child, Widget background, Widget secondaryBackground, VoidCallback onResize, DismissDirectionCallback onDismissed, DismissDirection direction: DismissDirection.horizontal, Duration resizeDuration: const Duration(milliseconds: 300) })
-
Creates a widget that can be dismissed.
Properties
- background → Widget
-
A widget that is stacked behind the child. If secondaryBackground is also specified then this widget only appears when the child has been dragged down or to the right.
read-only - child → Widget
-
The widget below this widget in the tree.
read-only - direction → DismissDirection
-
The direction in which the widget can be dismissed.
read-only - onDismissed → DismissDirectionCallback
-
Called when the widget has been dismissed, after finishing resizing.
read-only - onResize → VoidCallback
-
Called when the widget changes size (i.e., when contracting before being dismissed).
read-only - resizeDuration → Duration
-
The amount of time the widget will spend contracting before onDismissed is called.
read-only - secondaryBackground → Widget
-
A widget that is stacked behind the child and is exposed when the child has been dragged up or to the left. It may only be specified when background has also been specified.
read-only - hashCode → int
-
Get a hash code for this object.
read-only, inherited - key → Key
-
Controls how one widget replaces another widget in the tree.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
createState(
) → _DismissableState -
Creates the mutable state for this widget at a given location in the tree.
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited -
debugFillDescription(
List<String> description) → void -
Add additional information to the given description for use by toString.
inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited -
toStringShort(
) → String -
A short, textual description of this widget.
inherited