SlideController class
if you want to expand/collapse the actions at the pre- or post- position you could set usePreActionController or usePostActionController to true to enable controlling the actions at the pre- or post- position
if usePreActionController or usePostActionController is set to true, the corresponding ActionController would be created and bound to RenderSlideAction automatically
invoking expand/collapse/toggleAction only takes effects for two cases:
- usePreActionController is true and the current openedPosition is ActionPosition.pre
- usePostActionController is true and the current openedPosition is ActionPosition.post
See also:
- SlideActionPanel, the widget is used to configure RenderSlideAction
- RenderSlideAction, the render object is used to render the actions at the specific position
- Inheritance
-
- Object
- TickerProvider
- SlideAnimator
- SlideController
- Mixed-in types
Constructors
- SlideController({bool usePreActionController = false, bool usePostActionController = false, ActionPosition? initOpenedPosition, double slideTolerance = _kSlideRatioTolerance})
Properties
- absoluteRatio → double
-
no setterinherited
- direction → SlideDirection
-
the direction of the sliding
if ratio is 0, it will be SlideDirection.idle, indicating not sliding (this panel is closed)
no setterinherited
- dismissed → bool
-
indicates if the panel is closed/dismissed
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- initOpenedPosition → ActionPosition?
-
the initial opened position of the SlidablePanel
if null, the SlidablePanel would be closed/dismissed initially;
otherwise, the SlidablePanel would be opened at the initOpenedPosition without animation.
final
- layoutSize ↔ LayoutSize?
-
the layout result of RenderSlidable for all actions
getter/setter pairinherited
- openedPosition → ActionPosition?
-
the current position of the SlideActionPanel
it would be null if the SlideActionPanel is not opened
it would be ActionPosition.pre if the current animation value is greater than 0
it would be ActionPosition.post if the current animation value is less than 0
no setteroverride
- postActionController → ActionController?
-
no setteroverride
- preActionController → ActionController?
-
no setteroverride
- ratio → double
-
represents the current sliding ratio relative to the size of the
SlidePanel
if ratio > 0 indicates we are sliding to see the pre actions if ratio < 0 indicates we are sliding to see the post actions if ratio == 0 indicates we are not sliding, all actions are hidden, only the main child is visibleno setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
slidePercent
→ Animation<
double> -
no setterinherited
- slideTolerance → double
-
the ratio of triggering the SlideActionPanel to the next position
when users try to drag the SlidablePanel
default to
_kSlideRatioTolerance
final - usePostActionController → bool
-
whether to use ActionController for the post-action panel
default to false
if set to true, postActionController would be created
using toggleAction, expand or collapse to control the actions at ActionPosition.post
final
- usePreActionController → bool
-
whether to use ActionController for the pre-action panel
default to false
if set to true, preActionController would be created
using toggleAction, expand or collapse to control the actions at ActionPosition.pre
final
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
collapse(
int index, {required ActionPosition position, Curve curve = Curves.easeInOut, Duration duration = const Duration(milliseconds: 150)}) → Future< void> -
collapse the
index
to the original position according to the openedPosition if the openedPosition is null, it would do nothinginherited -
createTicker(
TickerCallback onTick) → Ticker -
Creates a ticker with the given callback.
inherited
-
dismiss(
{Curve curve = Curves.easeInOut, Duration duration = const Duration(milliseconds: 300), VoidCallback? onDismissed}) → Future< void> -
close the SlidablePanel
it will make all SlideActionPanel invisible
it will have no effect if the SlidablePanel is already dismissed/closed
onDismissed
would be called when the SlidablePanel is actually dismissed by this operations -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
expand(
int index, {Curve curve = Curves.easeInOut, Duration duration = const Duration(milliseconds: 150)}) → Future< void> -
expand the
index
to occupy the opened action panel according to the openedPosition if the openedPosition is null, it would do nothinginherited -
hasExpandedAt(
int index) → bool -
whether the
index
item is expanded according to the openedPosition if the openedPosition is null, it would return false if there is no ActionController at the openedPosition, it would return falseinherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onDragEnd(
DragEndDetails details) → void -
if
_shouldToggle
returns true, it will try to open or dismiss the SlidablePanel continually otherwise, it will reset the SlidablePanel to the previous positioninherited -
onDragUpdate(
DragUpdateDetails details) → void -
when dragging the SlidablePanel, this method will be called
each update of the ratio would trigger the RenderSlidable to re-layout
inherited
-
open(
{ActionPosition position = ActionPosition.pre, Curve curve = Curves.easeInOut, Duration duration = const Duration(milliseconds: 300), VoidCallback? onOpened}) → Future< void> -
open the SlidablePanel to the
position
it will make the actions of SlideActionPanel visible at theposition
onOpened
would be called when the SlideActionPanel atposition
is opened if provided -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toggleAction(
int index, {Curve curve = Curves.easeInOut, Duration duration = const Duration(milliseconds: 150)}) → Future< void> -
toggle the action item at
index
according to the openedPosition ifindex
has been expanded, it would collapse ifindex
has not been expanded, it would expandinherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited