TapFillIcon class

A TapFillIcon is an icon button widget. When this button tapped, it change the icon from borderIcon to fillIcon with animations. If you push when this button's state is fillIcon, change from fillIcon to borderIcon without animations.

{@tool snippet} This example shows how to create a favorite button that is often used in SNS apps.

TapFillIcon(
  fillIcon: Icon(Icons.favorite, color: Colors.red),
  borderIcon: Icon(Icons.favorite_border, color: Colors.grey),
  initialPushed: false,
),

{@end-tool}

Inheritance

Constructors

TapFillIcon({required Widget fillIcon, required Widget borderIcon, Duration animateDuration = const Duration(milliseconds: 300), bool initialPushed = false, AnimationController? animationController, Curve animationCurve = Curves.easeOutBack, void onTap()?, void onPush()?, void onPull()?, Key? key})
const

Properties

animateDuration Duration
The duration of the animation from tap to filled icon.
final
animationController AnimationController?
An animation controller of this button.
final
animationCurve Curve
The animation curve when fill an icon.
final
borderIcon Widget
An icon before pushed this button.
final
fillIcon Widget
An icon after pushed this button.
final
hashCode int
The hash code for this object.
no setterinherited
initialPushed bool
The initial state of this button.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPull → void Function()?
A callback when tap this button from the state of fillIcon.
final
onPush → void Function()?
A callback when tap this button from the state of borderIcon.
final
onTap → void Function()?
A callback when tap this button.
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() TapFillIconState
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