SnapController class
The widget that is responsible of ALL Snap related logic and UI. It is important to define two essential concepts used for this package: I) The view is what is being moved. It is the widget that snaps to the bound. II) The bound is what the view is being snapped to.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SnapController
Constructors
-
SnapController(Widget uiChild, bool useCache, GlobalKey<
State< viewKey, GlobalKey<StatefulWidget> >State< boundKey, Offset constraintsMin, Offset constraintsMax, Offset flexibilityMin, Offset flexibilityMax, {Key? key, double customBoundWidth = 0, double customBoundHeight = 0, List<StatefulWidget> >SnapTarget> ? snapTargets, double minSnapDistance = 0, bool animateSnap = true, bool useFlick = true, double flickSensitivity = 0.075, MoveCallback? onMove, DragCallback? onDragStart, DragCallback? onDragUpdate, DragCallback? onDragEnd, SnapCallback? onSnap}) -
const
Properties
- animateSnap → bool
-
Use this value to set whether the snapping should occur directly or via an animation.
final
-
boundKey
→ GlobalKey<
State< StatefulWidget> > -
The GlobalKey of the bound.
final
- constraintsMax → Offset
-
Use this value to set the upper right boundary of the movement.
final
- constraintsMin → Offset
-
Use this value to set the lower left boundary of the movement.
final
- customBoundHeight → double
-
Use this value to set a custom bound height. If not set, SnapController will automatically calculate it via boundKey.
final
- customBoundWidth → double
-
Use this value to set a custom bound width. If not set, SnapController will automatically calculate it via boundKey.
final
- flexibilityMax → Offset
-
Use this value to set the upper right elasticity of the movement.
final
- flexibilityMin → Offset
-
Use this value to set the lower left elasticity of the movement.
final
- flickSensitivity → double
-
Use this value to set the sensitivity of flick.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- minSnapDistance → double
-
Use this value to set the minimum distance in pixels required for the snapping to occur. If no SnapTarget is found that is closer to the uiChild than this value, the snapping will not occur.
final
- onDragEnd → DragCallback?
-
The callback for when the drag ends.
final
- onDragStart → DragCallback?
-
The callback for when the drag starts.
final
- onDragUpdate → DragCallback?
-
The callback for when the drag updates.
final
- onMove → MoveCallback?
-
The callback for when the view moves.
final
- onSnap → SnapCallback?
-
The callback for when the view snaps.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
snapTargets
→ List<
SnapTarget> ? -
The list of SnapTargets your view can snap to.
final
- uiChild → Widget
-
The widget that is to be displayed on your UI.
final
- useCache → bool
-
Set this to true if your uiChild doesn't change at runtime.
final
- useFlick → bool
-
Use this value to set whether flick should be used or not.
final
-
viewKey
→ GlobalKey<
State< StatefulWidget> > -
The GlobalKey of the view.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → SnapControllerState -
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}) → 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