haptic_kit library

Comprehensive haptic feedback and vibration toolkit for Flutter — Android & iOS — combined with a set of production-ready animated widgets.

Primitives

  • Haptics — short, semantic taps (impact, notification, selection).
  • Vibration — longer vibrations, custom waveforms, predefined effects.
  • HapticPattern — fluent builder for custom event sequences (Core Haptics on iOS, waveform on Android).
  • VibrationPatterns — ready-made patterns (heartbeat, alarm, …).
  • HapticCapabilities — runtime capability detection.

Animated widgets

Classes

HapticBounce
Tactile press-down with elastic bounce-back, optionally synchronised with haptic feedback.
HapticCapabilities
Snapshot of what the current device can do.
HapticEvent
A single event in a HapticPattern.
HapticPattern
Fluent builder for custom haptic sequences.
HapticPulse
Wraps a child with a looping "breathing" scale pulse, firing a haptic tap on every beat. The attention-getter counterpart to the one-shot HapticShake — use it to draw the eye to a call-to-action, an unread badge or a recording indicator.
HapticPulseState
State exposed so callers can start / stop pulsing via a GlobalKey.
HapticRating
Star rating row that fills with a cascading animation when the user taps a star. Each star fill triggers a haptic tick, so the user feels every star light up in sequence.
Haptics
Short, semantic haptic taps tied to UI events.
HapticSettings
App-wide switch and capability cache for every haptic in this package.
HapticShake
Wraps a child with an externally-triggered horizontal "wiggle" animation
HapticShakeState
State exposed so callers can call shake via a GlobalKey.
HapticSlider
Slider that fires a haptic tick whenever the value crosses a discrete detent — like the iOS picker wheel.
HapticStepper
Numeric stepper with bouncing −/+ buttons and a number that slides up (on increment) or down (on decrement).
HapticToggle
Animated switch with a haptic tick on toggle.
PressAndHoldToConfirm
Long-press confirmation widget — the user must hold their finger on child for holdDuration to trigger onConfirm.
PressAndHoldToConfirmState
State exposed so callers can call reset via a GlobalKey.
SlideToConfirm
Pill-shaped track with a draggable handle. The user must drag the handle from left edge to right edge to confirm.
SlideToConfirmState
State exposed so callers can call reset via a GlobalKey.
Vibration
Longer-form vibration API — one-shot durations, custom waveforms, predefined OS effects and continuous vibrations.
VibrationPatterns
Collection of ready-to-use waveforms and haptic patterns.

Enums

HapticImpactStyle
Style of an impact tap.
HapticNotificationStyle
Style of a notification haptic.
PredefinedEffect
Platform-provided vibration effects.

Constants

kMaxAmplitude → const int
Maximum amplitude value (matches Android's VibrationEffect.MAX_AMPLITUDE).
kMinAmplitude → const int
Minimum amplitude that still produces a perceptible vibration.

Exceptions / Errors

InvalidVibrationArgumentException
Thrown when a parameter passed to the public API is out of range or otherwise invalid.
PlatformVibrationException
Thrown when the underlying platform call fails (native exception, missing plugin, channel error).
UnsupportedHapticException
Thrown when the requested capability is not supported by the device (e.g. Core Haptics on a device without the Taptic Engine, or amplitude control on an older Android phone).
VibrationException
Base class for all errors thrown by haptic_kit.