BurstIconButton class

A button widget that creates a burst animation effect when tapped or long-pressed.

When the user taps the button, a single burst icon floats upward with a fade-out effect. When the user long-presses, burst icons are continuously spawned at a configurable rate.

{@tool snippet}

BurstIconButton(
  icon: const Icon(Icons.favorite_border, size: 32),
  pressedIcon: const Icon(Icons.favorite, size: 32, color: Colors.red),
  burstIcon: const Icon(Icons.favorite, size: 32, color: Colors.pink),
  onPressed: () => print('Pressed!'),
)

{@end-tool}

Inheritance

Constructors

BurstIconButton({Key? key, required Icon icon, Icon? pressedIcon, Icon? burstIcon, Duration duration = const Duration(milliseconds: 1200), Duration throttleDuration = const Duration(milliseconds: 100), required VoidCallback? onPressed, double? crossAmplitude, double? burstDistance, int? burstCount, Curve? burstCurve})
Creates a BurstIconButton.
const

Properties

burstCount int?
The number of burst icons spawned per tap.
final
burstCurve Curve?
The animation curve used for the burst animation.
final
burstDistance double?
The vertical distance (in logical pixels) the burst icons travel upward.
final
burstIcon Icon?
The icon used for the burst animation effect.
final
crossAmplitude double?
The maximum horizontal displacement (in logical pixels) of burst icons as they float upward.
final
duration Duration
The duration of the burst animation.
final
hashCode int
The hash code for this object.
no setterinherited
icon Icon
The default icon displayed in the button.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPressed VoidCallback?
Called when the button is tapped or when a long press ends.
final
pressedIcon Icon?
The icon displayed while the button is pressed down.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
throttleDuration Duration
The interval between burst icon spawns during a long press.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<BurstIconButton>
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, int wrapWidth = 65}) 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