ButtonAnimationStyle class
ButtonAnimationStyle defines composable animation styles for buttons. Use factory constructors to create different animation effects.
Constructors
- ButtonAnimationStyle.bounce({Duration duration = const Duration(milliseconds: 150), Curve curve = Curves.easeOutBack, bool enableHapticFeedback = true, double scaleMin = 0.92})
-
Scale down on press, spring back on release
Best for add to cart, like buttons
factory
- ButtonAnimationStyle.clickable({Duration duration = const Duration(milliseconds: 100), Curve curve = Curves.easeInOut, bool enableHapticFeedback = true, double translateY = 4.0, double shadowOffset = 4.0})
-
Duolingo-style 3D press effect with translateY and shadow
Best for primary actions and game-like UX
factory
- ButtonAnimationStyle.jelly({Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.elasticOut, bool enableHapticFeedback = true, double jellyStrength = 0.15})
-
Wobbly elastic deformation
Best for fun/casual apps
factory
- ButtonAnimationStyle.morph({Duration duration = const Duration(milliseconds: 150), Curve curve = Curves.easeInOut, bool enableHapticFeedback = false, double morphRadius = 24.0})
-
Border radius increases on press
Best for subtle feedback
factory
- ButtonAnimationStyle.none()
-
No animation (default behavior, backwards compatible)
const
- ButtonAnimationStyle.pulse({Duration duration = const Duration(milliseconds: 800), Curve curve = Curves.easeInOut, bool enableHapticFeedback = false, double pulseScale = 1.05})
-
Subtle continuous scale pulse while pressed
Best for long-press actions
factory
- ButtonAnimationStyle.ripple({Duration duration = const Duration(milliseconds: 400), Curve curve = Curves.easeOut, bool enableHapticFeedback = true, double rippleScale = 2.0})
-
Enhanced ripple from press point
Best for material design emphasis
factory
- ButtonAnimationStyle.shake({Duration duration = const Duration(milliseconds: 400), Curve curve = Curves.easeInOut, bool enableHapticFeedback = true, double shakeOffset = 8.0, int shakeCount = 3})
-
Horizontal shake (programmatic trigger)
Best for error states
factory
- ButtonAnimationStyle.shine({Duration duration = const Duration(milliseconds: 600), Curve curve = Curves.easeInOut, bool enableHapticFeedback = false, Color shineColor = Colors.white, double shineWidth = 0.3})
-
Glossy highlight sweep across button
Best for premium features
factory
- ButtonAnimationStyle.squeeze({Duration duration = const Duration(milliseconds: 120), Curve curve = Curves.easeInOut, bool enableHapticFeedback = true, double squeezeX = 0.95, double squeezeY = 1.05})
-
Horizontal compress, vertical expand
Best for playful interactions
factory
Properties
- curve → Curve
-
final
- duration → Duration
-
final
- enableHapticFeedback → bool
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- jellyStrength → double?
-
final
- morphRadius → double?
-
final
- pulseScale → double?
-
final
- rippleScale → double?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleMax → double?
-
final
- scaleMin → double?
-
final
- shadowOffset → double?
-
final
- shakeCount → int?
-
final
- shakeOffset → double?
-
final
- shineColor → Color?
-
final
- shineWidth → double?
-
final
- squeezeX → double?
-
final
- squeezeY → double?
-
final
- translateY → double?
-
final
- type → ButtonAnimationType
-
final
Methods
-
copyWith(
{ButtonAnimationType? type, Duration? duration, Curve? curve, bool? enableHapticFeedback, double? translateY, double? shadowOffset, double? scaleMin, double? scaleMax, double? pulseScale, double? squeezeX, double? squeezeY, double? jellyStrength, Color? shineColor, double? shineWidth, double? rippleScale, double? morphRadius, double? shakeOffset, int? shakeCount}) → ButtonAnimationStyle - Create a copy of this style with overridden properties
-
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.
inherited