pub repository
mirror.p-hatan.iranimated_text_kit
4.1.0A flutter package project which contains a collection of cool and beautiful text animations.
Readme
Table of contents
Installing
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies:
animated_text_kit: ^4.1.0
2. Install it
You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter pub get
3. Import it
Now in your Dart code, you can use:
import 'package:animated_text_kit/animated_text_kit.dart';
Usage
AnimatedTextKit is a Stateful Widget that produces text animations.
Include it in your build method like:
AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText(
'Hello world!',
textStyle: const TextStyle(
fontSize: 32.0,
fontWeight: FontWeight.bold,
),
),
],
speed: const Duration(milliseconds: 2000),
totalRepeatCount: 4,
pause: const Duration(milliseconds: 1000),
displayFullTextOnTap: true,
stopPauseOnTap: true,
)
It has many configurable properties, including:
pause– the time of the pause between animation textsdisplayFullTextOnTap– tapping the animation will rush it to completionisRepeatingAnimation– controls whether the animation repeatsrepeatForever– controls whether the animation repeats forevertotalRepeatCount– number of times the animation should repeat (whenrepeatForeverisfalse)
There are also custom callbacks:
onTap– This is called when a user taps the animated textonNext(int index, bool isLast)– This is called before the next text animation, after the previous one's pauseonNextBeforePause(int index, bool isLast)– This is called before the next text animation, before the previous one's pauseonFinished- This is called at the end, when the parameterisRepeatingAnimationis set tofalse
New with Version 3
Version 3 refactored the code so that common animation controls were moved to
AnimatedTextKit and all animations, except for TextLiquidFill, extend from
AnimatedText. This saved hundreds of lines of duplicate code, increased
consistency across animations, and makes it easier to create new animations.
It also makes the animations more flexible because multiple animations may now be easily combined. For example:
AnimatedTextKit(
animatedTexts: [
FadeAnimatedText(
'Fade First',
textStyle: TextStyle(fontSize: 32.0, fontWeight: FontWeight.bold),
),
ScaleAnimatedText(
'Then Scale',
textStyle: TextStyle(fontSize: 70.0, fontFamily: 'Canterbury'),
),
],
),
Using the legacy FadeAnimatedTextKit is equivalent to using AnimatedTextKit with FadeAnimatedText.
An advantage of AnimatedTextKit is that the animatedTexts may be any subclass of AnimatedText, while using FadeAnimatedTextKit essentially restricts you to using just FadeAnimatedText.
Legacy AnimatedTextKit classes
Have you noticed that animation classes come in pairs?
For example, there is FadeAnimatedText and FadeAnimatedTextKit.
The significant refactoring with Version 3 split the original FadeAnimatedTextKit into FadeAnimatedText and a re-usable AnimatedTextKit, then FadeAnimatedTextKit was adjusted for backwards compatibility.
When introducing a new AnimationText subclass, you may wonder if you also need to also introduce an additional Kit class. The answer is NO. :tada:
Going forward, we are championing the adoption of the Version 3 approach, and have deprecated the legacy Kit classes.
This will make creating new animations easier.
We know it makes some legacy code more verbose, but the flexibility and simplicity is a conscious trade-off.
Animations
Many animations are provided, but you can also create your own animations.
Rotate
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const SizedBox(width: 20.0, height: 100.0),
const Text(
'Be',
style: TextStyle(fontSize: 43.0),
),
const SizedBox(width: 20.0, height: 100.0),
DefaultTextStyle(
style: const TextStyle(
fontSize: 40.0,
fontFamily: 'Horizon',
),
child: AnimatedTextKit(
animatedTexts: [
RotateAnimatedText('AWESOME'),
RotateAnimatedText('OPTIMISTIC'),
RotateAnimatedText('DIFFERENT'),
]
onTap: () {
print("Tap Event");
},
),
),
],
);
Note: You can override transition height by setting the value of parameter transitionHeight for RotateAnimatedTextKit class.
Fade
return SizedBox(
width: 250.0,
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 32.0,
fontWeight: FontWeight.bold,
),
child: AnimatedTextKit(
animatedTexts: [
FadeAnimatedText('do IT!'),
FadeAnimatedText('do it RIGHT!!'),
FadeAnimatedText('do it RIGHT NOW!!!'),
],
onTap: () {
print("Tap Event");
},
),
),
);
Typer
return SizedBox(
width: 250.0,
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 30.0,
fontFamily: 'Bobbers',
),
child: AnimatedTextKit(
animatedTexts: [
TyperAnimatedText('It is not enough to do your best,'),
TyperAnimatedText('you must know what to do,'),
TyperAnimatedText('and then do your best'),
TyperAnimatedText('- W.Edwards Deming'),
]
onTap: () {
print("Tap Event");
},
),
),
);
Typewriter
return SizedBox(
width: 250.0,
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 30.0,
fontFamily: 'Agne',
),
child: AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText('Discipline is the best tool'),
TypewriterAnimatedText('Design first, then code'),
TypewriterAnimatedText('Do not patch bugs out, rewrite them'),
TypewriterAnimatedText('Do not test bugs out, design them out'),
],
onTap: () {
print("Tap Event");
},
),
),
);
Scale
return SizedBox(
width: 250.0,
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 70.0,
fontFamily: 'Canterbury',
),
child: AnimatedTextKit(
animatedTexts: [
ScaleAnimatedText('Think'),
ScaleAnimatedText('Build'),
ScaleAnimatedText('Ship'),
],
onTap: () {
print("Tap Event");
},
),
),
);
Colorize
const colorizeColors = [
Colors.purple,
Colors.blue,
Colors.yellow,
Colors.red,
];
const colorizeTextStyle = TextStyle(
fontSize: 50.0,
fontFamily: 'Horizon',
);
return SizedBox(
width: 250.0,
child: AnimatedTextKit(
animatedTexts: [
ColorizeAnimatedText(
'Larry Page',
textStyle: colorizeTextStyle,
colors: colorizeColors,
),
ColorizeAnimatedText(
'Bill Gates',
textStyle: colorizeTextStyle,
colors: colorizeColors,
),
ColorizeAnimatedText(
'Steve Jobs',
textStyle: colorizeTextStyle,
colors: colorizeColors,
),
],
isRepeatingAnimation: true,
onTap: () {
print("Tap Event");
},
),
);
Note: colors list should contains at least two values.
TextLiquidFill
return SizedBox(
width: 250.0,
child: TextLiquidFill(
text: 'LIQUIDY',
waveColor: Colors.blueAccent,
boxBackgroundColor: Colors.redAccent,
textStyle: TextStyle(
fontSize: 80.0,
fontWeight: FontWeight.bold,
),
boxHeight: 300.0,
),
);
To get more information about how the animated text made from scratch by @HemilPanchiwala, visit the Medium blog.
Wavy
return DefaultTextStyle(
style: const TextStyle(
fontSize: 20.0,
),
child: AnimatedTextKit(
animatedTexts: [
WavyAnimatedText('Hello World'),
WavyAnimatedText('Look at the waves'),
],
isRepeatingAnimation: true,
onTap: () {
print("Tap Event");
},
),
);
Create your own Animations
You can easily create your own animations by creating new classes that extend
AnimatedText, just like most animations in this package. You will need to
implement:
- Class constructor – Initializes animation parameters.
initAnimation– InitializesAnimationinstances and binds them to the givenAnimationController.animatedBuilder– Builder method to return aWidgetbased onAnimationvalues.completeText– Returns theWidgetto display once the animation is complete. (The default implementation returns a styledTextwidget.)
Then use AnimatedTextKit to display the custom animated text class like:
AnimatedTextKit(
animatedTexts: [
CustomAnimatedText(
'Insert Text Here',
textStyle: const TextStyle(
fontSize: 32.0,
fontWeight: FontWeight.bold,
),
),
],
),
Bugs or Requests
If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull request are also welcome.
See Contributing.md.
Contributors
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind are welcome! See Contributing.md.
Changelog
4.1.0
- Legacy
Kitclasses are now marked as deprecated DefaultTextStylemay be used to set a common text style acrossAnimatedTextinstancestextStyleis no longer required forAnimatedTextsubclasses (except forColorizeAnimatedText)FadeAnimatedTextmay now be customized to adjust the fade-in and fade-out interval- BREAKING CHANGE:
AnimatedText.completeTextnow has aBuildContextparameter
4.0.0
- Migrated to nnbd(null-safety)
3.1.2
- Fixed insecure links in readme.
3.1.1
- Added Flutter Favorite badge to readme.
3.1.0
- Added
rotateOutflag toRotateAnimatedTextso that one may optionally disable the rotation-out animation. - Updated the
exampleapp to demonstrateRotateAnimatedTextwithrotateOutdisabled.
3.0.2
- Fixed major bug #168, introduced with version 3
- Updated the
exampleapp to show a Tap Count - Optimized the
disposeforAnimatedTextKit - Added missing return type to
onNextfunction signatures
3.0.1
- Optimized the
initStateforAnimatedTextKit.
3.0.0
- Refactored code to reduce duplication, improve consistency, and simplify making new animations. Created
AnimatedTextandAnimatedTextKit. PR #157 - Removed the unused
alignmentproperty from all exceptRotateAnimatedTextKit. Resolves #153 - Added a
textDirectionproperty toColorizeAnimatedTextKitto support RTL text. Resolves #109 - Added a
loadUntilproperty toTextLiquidFillto optionally show a partial fill. Resolves #75 - Optimized
TextLiquidFill. PR #165 - Optimized
ColorizeAnimatedTextKit. PR #155 - Updated the Dart SDK constraint to be 2.10+.
- Regenerated the
exampleplatform code. PR #162 - Migrated from Travis CI to GitHub Actions.
2.5.4
- Added missing dart documentation to the public classes and methods.
2.5.3
- Updated the
READMEto revert links to bepub.devfriendly.
2.5.2
Issue Fixed
- Bug fix for
ScaleAnimatedTextKitto checkmountedbeforesetStateto avoid potential conflict withdispose. Resolves #105 -- PR #143
2.5.1
Bug Fixes and Enhancements
- Minor bug fix to
RotateAnimatedTextKitto properly handlealignmentproperty, and introducedtextDirectionproperty #138 - Increased test coverage #128
2.5.0
Bug Fixes and Enhancements
- Increase test coverage #137 and #135.
- Removed redundant
_textsvariables #133. - Added pedantic lint rules. #132.
- Refactored code to move default logic from the State class to the StatefulWidget #131.
- Revised
_textKeyto not be a global variable. Resolves #129 issue -- PR #130. - Other basic improvements #136 and #134.
2.4.1
Issue Fixed
- Issue #125
2.4.0
Issues Fixed
2.3.0
New Animated Text
- Wavy Text by @SirusCodes.
Issues Fixed
2.2.0
Issues Fixed
- Issue #51
Code Review #81
- Removed obsolete
newkeywords. - Added types to collection and function variables.
- Added
finalandconstkeywords. - Replaced
nullguards with concise?.and??operators. - Added missing null check on
disposeforFadeAnimatedTextKit. - In
fade.dart, renamed the_RotatingTextStateclass to_FadeTextStateto be consistent with the overall pattern and avoid confusion with_RotatingTextStateinrotate.dart.
Warning:
- Removed
onNextBeforePausefromColorizeAnimatedTextKitbecause it was not referenced.
2.1.0
Issues Fixed
Feature Enhancement
-
Add
repeatForeveroption.repeatForever: true, //this will ignore [totalRepeatCount]
2.0.1
- Minor updates.
2.0.0
-
TextLiquidFill animated text added to the package🎉🎉
-
Breaking Changes: Different arguments are included in the classes and
durationhas been broken intospeedandpausein some classes as per their needs.duration- Change the duration from the animation time of the complete list to single element animation time.speed- Time between the display of characters.pause- Delay between the animation of texts.totalRepeatCount- Sets the number of times animation should repeatdisplayFullTextOnTap- If true, tapping the screen will stop current animated text, and display it fully.stopPauseOnTap- If true, tapping during a pause will stop it and start the next text animation.
-
Better control over Animated Texts: Callbacks added:
onNext(int index, bool isLast)- This callback will be called before the next text animation, after the previous ones pause.onNextBeforePause(int index, bool isLast)- This callback will be called before the next text animation, before the previous one's pause.onFinished- This callback is called at the end when the parameterisRepeatingAnimationis set to false.
1.3.1
- Updated example app readme.
- Added documentation for the various parameters of all the animated widgets.
1.3.0
Feature Enhancement
- Added attribute to align text.
- Updated Readme.
1.2.0
Feature Enhancement
- Added attribute to check whether the animation should repeat or not.
- Updated Readme.
1.1.1
- Fixed flutter formatting issues.
1.1.0
Feature Enhancement
- Added onTap callback for all AnimatedText widget.
- Updated Readme.
1.0.3
- General update.
1.0.2
- Updated Readme.
1.0.1
- Initial Release.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add animated_text_kitpubspec.yaml
name: animated_text_kit
description: A flutter package project which contains a collection of cool and beautiful text animations.
version: 4.1.0
homepage: https://github.com/aagarwal1012/Animated-Text-Kit/
maintainer: Ayush Agarwal (@aagarwal1012)
dependencies:
flutter:
sdk: flutter
characters: ^1.1.0
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.11.0
flutter:
environment:
sdk: ">=2.12.0-0 <3.0.0"
flutter: ">=1.22.0"
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 1.0.1 | 2018-08-10T09:39:43.665398Z | Download | 3b7cbc0a963c4b37fa5d15c5ba38c38bd2b5826c235553f2848701a947e8aea3 |
| 1.0.2 | 2018-08-10T13:33:26.977256Z | Download | 340776dc161c07984de0ba5d0bd93ec1ccdc1d724c9ab702e5c674474ba12870 |
| 1.0.3 | 2018-08-14T17:47:31.234835Z | Download | 076e8fc4527b615f6e8fb749c79d134c0c129ce886a085b887273140cd4e09a5 |
| 1.1.0 | 2018-09-19T14:12:28.995611Z | Download | 5dbe6a03ced907a81eb5c2bd43ad939a7fa15869ce13c05a3f0816108db91288 |
| 1.1.1 | 2018-10-25T22:10:13.689461Z | Download | 39301f90cc13f9a301bb743e3d1c32266cb4a31ae286d2e0dfe4f0f87a1e57c7 |
| 1.2.0 | 2018-11-21T17:50:28.082575Z | Download | edd23c6f8355dc7857af367b6128824f79b4dedd15225bdbdc71a975c859d48b |
| 1.3.0 | 2019-01-30T22:37:50.240049Z | Download | 064b7f1a51a68f0a6824ed4291aa48060d4ed345d29707090db4b1b682e35a8a |
| 1.3.1 | 2019-05-28T17:03:18.112518Z | Download | d566edbde35550271fb28511b9093b6bae53b8773b8df6fb5a4fe36534bde1c2 |
| 2.0.0 | 2019-12-25T20:41:58.677948Z | Download | 7d401646664f0566b531a026960af9f0bf6602d10039a3674637203db24b7889 |
| 2.0.1 | 2020-04-29T14:37:41.433462Z | Download | 27a9f2b77aab931bbc4939a47cf2626ade19b0621a93592aae2e3daf2fcde772 |
| 2.1.0 | 2020-05-22T20:56:13.585044Z | Download | a3ec787b7c9500a08c40d269ca1479f568cd505b57a5ff0c3b43a29cb06e8008 |
| 2.2.0 | 2020-05-30T19:07:34.848275Z | Download | b8772b1a91326d6307f73649a23c589bf802e87153f4f9515b72e07e7c75ee6a |
| 2.3.0 | 2020-10-03T22:21:31.644523Z | Download | 4688bcd5d3f59d7d7ec24f194f9bbbc639380de9128ad49b7d1f7f315cbe8efa |
| 2.4.0 | 2020-10-14T05:30:43.633749Z | Download | a8051390c26e48e39eecef3ce0b04448f6cdf3a05c37f75af1adba405f875d4e |
| 2.4.1 | 2020-10-18T09:41:38.503362Z | Download | 1774e554677971d8d0765c25ccba9d614d357a8ff15b5549908a39e4c2d34def |
| 2.5.0 | 2020-10-24T19:13:57.752100Z | Download | f94371011447009e7242ed77447eda07d08b15d323b29d831222d9ff7d2cc5cf |
| 2.5.1 | 2020-10-26T05:43:54.402953Z | Download | 10c0bb77c1054421c618704acbb22fb75ed53bb190b738c805a57a06970195e8 |
| 2.5.2 | 2020-11-01T19:46:21.406148Z | Download | 49d9508fbb1292805fc81c863aa11553eacbd3345ee8ce082ae2c78037535234 |
| 2.5.3 | 2020-11-01T20:53:22.832046Z | Download | 0e9ab1f7e7f892aca7ffe8b53311f23d1f0f2094cb03aa42de7fed21c6c796bb |
| 2.5.4 | 2020-11-06T21:01:11.038690Z | Download | 41c615f94edfdde93324d8f80ff915bcfc933f368574b6737c8b9f2856741d2d |
| 3.0.0 | 2020-12-07T12:55:10.618024Z | Download | c34a7454639f3e68164fe78adc6e185c08ff12bf21aa4e8ab3c744e39f272ece |
| 3.0.1 | 2020-12-11T10:51:14.455033Z | Download | 91232e2c6f64319701664a4e72b98a6bed556609917d27a40c5e7ad93d86e0a1 |
| 3.0.2 | 2020-12-15T17:49:37.989413Z | Download | 84343cc195224dfca7135cff4293e8e8efa4f448cfd187d25aefc551abc98629 |
| 3.1.0 | 2020-12-17T17:08:40.198307Z | Download | 8e2d38cfa3687cb2ffeee8f4a9bdc7aaa5e838970de74b5d24201b20bfafdfcc |
| 3.1.1 | 2021-02-17T12:39:16.638599Z | Download | 4bbb0b0e356985f01551070d1924c03a5def2a97cf261dbd06d1621e945ef242 |
| 3.1.2 | 2021-02-17T19:32:58.363292Z | Download | 617b93ac2e54be590c49b863afcef1a21f983376e55538d12e8028b83f3fe8aa |
| 4.0.0 | 2021-02-22T18:49:24.688248Z | Download | ecc5f3120d5ffd0c9b6e6cbdb3435292555cb5db339269841fb9834394071bb7 |
| 4.1.0 | 2021-03-24T17:25:06.739018Z | Download | 17c098e65eb1f710e17af3e72fda88e87f036072292485fa5d2c5fc721b2d353 |
| 4.1.1 | 2021-03-26T08:55:54.354106Z | Download | 3eacf7861eacbb65ca715e0dc61dac90c4e843c19c7c0347241e30a397dad2bd |
| 4.2.0 | 2021-04-14T17:33:44.369504Z | Download | ea637054b3f9858a11976c27c7a91c0a412994b02d304e1350ff41ad3d7809b8 |
| 4.2.1 | 2021-04-24T08:50:56.332060Z | Download | 5e6bf696c1db94fae17ef0527a17cef82f3100daebb53a3bdeb1c34f6b2ccdcc |
| 4.2.2 | 2022-06-05T14:54:43.629507Z | Download | 37392a5376c9a1a503b02463c38bc0342ef814ddbb8f9977bc90f2a84b22fa92 |
| 4.2.3 | 2025-01-25T16:07:24.487704Z | Download | adba517adb7e6adeb1eb5e1c8a147dd7bc664dfdf2f5e92226b572a91393a93d |
| 4.3.0 | 2025-10-04T13:50:52.907320Z | Download | 1d41486860885321972dd332179357a535d50d4780fc2ba5e1805bde085c81f2 |
Dependencies
characters "^1.1.0"
flutter {
"sdk": "flutter"
}