DesignHaptics class
The haptics ui_core's behaviours play: one callback per moment; a null callback plays nothing.
The default plays the platform's own: HapticFeedback.selectionClick
for a step, the platform's long-press feedback (Android's vibration, as
Feedback.forLongPress plays it; iOS's medium impact) and
HapticFeedback.lightImpact for a threshold. Platforms with no haptics
(desktop, the web) ignore them.
A behaviour reads the table where it plays, with of; a DesignHapticsScope above it swaps the table for its subtree: DesignHaptics.silent for none, or a table of the look's or the app's own. Under flutter_test no haptic plays (the platform message has no receiver); a test that checks one gives a table that records.
DesignHaptics.of(context).selectionChanged?.call();
- Annotations
Constructors
- DesignHaptics({VoidCallback? selectionChanged = HapticFeedback.selectionClick, VoidCallback? longPress = _longPress, VoidCallback? thresholdCrossed = HapticFeedback.lightImpact})
-
A table of the given callbacks; each defaults to the platform's own.
const
- DesignHaptics.silent()
-
A table that plays nothing.
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- longPress → VoidCallback?
-
A long press that opened something (a context menu) or lifted it
(a row to reorder). Null plays nothing.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectionChanged → VoidCallback?
-
A step from one value to the next: a wheel's row crossing its centre,
a slider's thumb crossing a division, a rating's step while dragged.
Null plays nothing.
final
- thresholdCrossed → VoidCallback?
-
A drag passing the point where letting go acts (a swipe row's action,
a sheet's dismiss). Null plays nothing.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
of(
BuildContext context) → DesignHaptics -
The table in force at
context: the nearest DesignHapticsScope's, else the platform's own (const DesignHaptics()).