HoldDownButton class

The HoldDownButton is a StatefulWidget that can be held down to repeatedly trigger an action.

Uses a GestureDetector to detect a long press and a long press release to trigger or stop the repeated action.

If the child does not have an onTap method defined, the onHoldDown method will be called, else priority is given to the child's onTap method.

Inheritance

Constructors

HoldDownButton({Key? key, required Widget child, required VoidCallback onHoldDown, Duration longWait = const Duration(milliseconds: 600), Duration middleWait = const Duration(milliseconds: 400), Duration minWait = const Duration(milliseconds: 250), Duration holdWait = const Duration(milliseconds: 100)})
Creates a HoldDownButton widget. Great to use when want to execute a function continuously when the button is hold.

Properties

child Widget
The widget to display.
final
hashCode int
The hash code for this object.
no setterinherited
holdWait Duration
Duration between each onHoldDown function call when the button is hold.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
longWait Duration
Delay between the 1st & 2nd onHoldDown function call.
final
middleWait Duration
Delay between the 2nd & 3rd onHoldDown function call.
final
minWait Duration
Delay between the 3rd & 4th onHoldDown function call.
final
onHoldDown VoidCallback
The Function to call repeatedly when the button is hold.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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