Animated Text Kit는 시각적으로 매력적이고 사용자 정의 가능한 텍스트 애니메이션을 제공하는 플러터 패키지입니다. 개발자가 앱에 타이핑, 페이드인/아웃, 스크롤링과 같은 동적 텍스트 효과를 쉽게 추가할 수 있도록 도와줍니다. 스플래시 화면, 환영 메시지 또는 몰입감 있는 UI 요소에 이상적이며, 안드로이드, iOS, 웹, macOS, 윈도우, 리눅스 등 여러 플랫폼을 지원합니다. 이 패키지는 가볍고 플러터 위젯 시스템과 원활하게 통합되어 최소한의 설정으로 부드러운 애니메이션을 제공합니다.
사용 사례
스플래시 화면
환영 메시지
인터랙티브 UI 요소
로딩 표시기
동적 제목
온보딩 시퀀스
주요 기능
사전 구축된 텍스트 애니메이션
사용자 정의 가능한 속도 및 지연
다중 플랫폼 지원
Flutter와의 간편한 통합
부드러운 전환
텍스트 스타일 옵션
적합한 대상
앱 온보딩 흐름
사용자 참여를 유도하는 인터페이스
앱 내 간단한 애니메이션
교육용 또는 발표용 앱
창의적인 디지털 디스플레이
경량 애니메이션 요구 사항
고려 사항
텍스트 애니메이션만 가능
많은 인스턴스가 있는 경우 성능에 영향을 미칠 수 있습니다
복잡한 애니메이션에 적합하지 않습니다
최적의 사용자 경험을 위해 신중한 조정이 필요합니다
짧은 지속 시간 효과에 최적
Flutter의 렌더링 성능에 의존합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Animated Text Kit
A flutter package which contains a collection of some cool and awesome text animations. Recommended package for text animations in Codemagic's Ebook, "Flutter libraries we love". Try out our live example app.
pause – the time of the pause between animation texts
displayFullTextOnTap – tapping the animation will rush it to completion
isRepeatingAnimation – controls whether the animation repeats
repeatForever – controls whether the animation repeats forever
totalRepeatCount – number of times the animation should repeat (when repeatForever is false)
controller - It allows for control over the animation by providing methods to play, pause and reset the text animations programmatically
There are also custom callbacks:
onTap – This is called when a user taps the animated text
onNext(int index, bool isLast) – This is called before the next text animation, after the previous one's pause
onNextBeforePause(int index, bool isLast) – This is called before the next text animation, before the previous one's pause
onFinished - This is called at the end, when the parameter isRepeatingAnimation is set to false
Note: You might come up with an issue that the text does not get updated with setState as shown here. The solution to this, is a key that changes based on the text. For reference, watch this video.
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:
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.
returnSizedBox(
width: 250.0,
child: DefaultTextStyle(
style: constTextStyle(
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
returnSizedBox(
width: 250.0,
child: DefaultTextStyle(
style: constTextStyle(
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");
},
),
),
);
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 – Initializes Animation instances and binds them to the given AnimationController.
animatedBuilder – Builder method to return a Widget based on Animation values.
completeText – Returns the Widget to display once the animation is complete. (The default implementation returns a styled Text widget.)
Then use AnimatedTextKit to display the custom animated text class like:
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.