Animated Text helps you to animate between words by re-using the similar alphabets in them.
Add this to your package's pubspec.yaml
file:
dependencies:
animated_text: ^1.0.3
You can install packages from the command line:
with pub
:
$ pub get
with Flutter
:
$ flutter packages get
Now in your Dart
code, you can use:
import 'package:animated_text/animated_text.dart';
/** Your parent widget here */
child : AnimatedText(
alignment: Alignment.center,
speed: Duration(milliseconds: 1000),
controller: AnimatedTextController.loop,
displayTime: Duration(milliseconds: 1000),
wordList: ['animations.', 'are.', 'easier.', 'now.'],
textStyle: TextStyle(
color: Colors.black,
fontSize: 55,
fontWeight: FontWeight.w700),
onAnimate: (index) {
print("Animating index:" + index.toString());
},
onFinished: () {
print("Animtion finished");
},
),
key | description |
---|---|
controller | controls the animation state enum AnimatedTextController { play, pause, stop, restart, loop } by-default it is set to AnimatedTextController.play |
onAnimate | called whenever the next animation is going to start |
onFinished | called when the animation is finished and is not a looping animation |
repeatCount | it tells how many times the animation should be repeated by default it is set to repeatCount = 5 |
textStyle | Uses the DefaultTextStyle of the context if not used. |
displayTime | tells for how much time the animation should wait and display the text before starting the next animation. |
On-going implementation for future:
- Custom Fade Animation