AnimButton class
A highly customizable animated button that provides visual feedback on tap.
Use AnimButton to easily add a scaling animation to any button. It supports custom labels, child widgets, colors, gradients, and more.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AnimButton
Constructors
-
AnimButton({Key? key, String? label, Widget? child, double? height = 45.0, double? width = 100.0, double borderRadius = 8.0, required VoidCallback onPressed, Color buttonColor = Colors.lightBlueAccent, Gradient? gradient, Curve animationCurve = Curves.easeInOut, TextAlign? alignment = TextAlign.center, TextStyle textStyle = const TextStyle(color: Colors.white, fontSize: 15.0, letterSpacing: 1.0), double animationBegin = 1.0, double animationEnd = 0.75, Duration duration = const Duration(milliseconds: 150), EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, List<
BoxShadow> ? boxShadow}) -
Creates an AnimButton.
const
Properties
- alignment → TextAlign?
-
Alignment for the text inside the butotn
final
- animationBegin → double
-
The starting scale value for the animation. Defaults to 1.0.
final
- animationCurve → Curve
-
The curve to use for the scaling animation.
final
- animationEnd → double
-
The ending scale value for the animation when pressed. Defaults to 0.75.
final
- borderRadius → double
-
The border radius of the button. Defaults to 8.0.
final
-
boxShadow
→ List<
BoxShadow> ? -
A list of shadows to apply to the button.
final
-
The background color of the button.
This is ignored if gradient is provided.
final
- child → Widget?
-
A custom widget to display inside the button.
If provided, label will be ignored.
final
- duration → Duration
-
The duration of the scale down animation.
final
- gradient → Gradient?
-
An optional gradient for the button background.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
The height of the button. Defaults to 45.0.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
The text to display inside the button.
If child is provided, this will be ignored.
final
- margin → EdgeInsetsGeometry?
-
The external margin of the button.
final
- onPressed → VoidCallback
-
Callback function called when the button is pressed.
final
- padding → EdgeInsetsGeometry?
-
The internal padding of the button.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textStyle → TextStyle
-
The text style for the button label.
final
- width → double?
-
The width of the button. Defaults to 100.0.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AnimButton> -
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