AnimatedTextBase class abstract
Base class for creating custom animated text widgets.
Handles the AnimationController lifecycle and common callbacks for starting, completing, and repeating animations.
Subclasses must implement buildAnimation to define the widget's animation.
Example:
class MyAnimatedText extends AnimatedTextBase {
const MyAnimatedText(String text, {super.key}) : super(text);
@override
Widget buildAnimation(BuildContext context, AnimationController controller) {
return FadeTransition(
opacity: controller,
child: Text(text),
);
}
}
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AnimatedTextBase
- Implementers
Constructors
- AnimatedTextBase(String text, {Key? key, Duration duration = const Duration(milliseconds: 2000), TextStyle? style, AnimatedTextMode mode = AnimatedTextMode.forward, bool autoStart = true, AnimationController? controller, VoidCallback? onStarted, VoidCallback? onCompleted, VoidCallback? onRepeated})
-
const
Properties
- autoStart → bool
-
Automatically start animation when the widget is initialized.
final
- controller → AnimationController?
-
Optional external AnimationController. If null, one will be created internally.
final
- duration → Duration
-
Duration of the animation. If a controller is provided, this is ignored.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- mode → AnimatedTextMode
-
Determines how the animation should play.
final
- onCompleted → VoidCallback?
-
Callback triggered when animation completes.
final
- onRepeated → VoidCallback?
-
Callback triggered when the animation repeats (loop or reverse).
final
- onStarted → VoidCallback?
-
Callback triggered when animation starts (forward).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → TextStyle?
-
Optional text style.
final
- text → String
-
The text to animate.
final
Methods
-
buildAnimation(
BuildContext context, AnimationController controller) → Widget - Subclasses must implement this to build the animated widget.
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AnimatedTextBase> -
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