-
Notifications
You must be signed in to change notification settings - Fork 74
/
animated_text_kit.dart
255 lines (243 loc) · 8.98 KB
/
animated_text_kit.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
import 'package:flutter/material.dart';
import 'package:animated_text_kit/animated_text_kit.dart';
class MyAnimatedTextKit extends StatelessWidget {
const MyAnimatedTextKit({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
const colorizeColors = [
Colors.white,
Colors.blue,
Colors.yellow,
Colors.red,
];
const colorizeTextStyle = TextStyle(
fontSize: 50.0,
fontFamily: 'Horizon',
);
return Scaffold(
appBar: AppBar(title: const Text('Animated Text Kit')),
body: Stack(
children: [
SizedBox(
height: double.infinity,
width: double.infinity,
child: Image.asset(
'assets/images/background/background.png',
fit: BoxFit.cover,
),
),
SingleChildScrollView(
controller: null,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
/// `Rotate`
customContainer(
widget: SizedBox(
height: 100,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
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: () => debugPrint("Tap Event"),
),
),
],
),
),
),
/// `Fade`
customContainer(
widget: SizedBox(
height: 100,
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: () => debugPrint("Tap Event"),
),
),
),
),
/// `Typer`
customContainer(
widget: SizedBox(
height: 100,
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: () => debugPrint("Tap Event"),
),
),
),
),
/// `Typewriter`
customContainer(
widget: SizedBox(
height: 100,
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: () => debugPrint("Tap Event"),
),
),
),
),
/// `Scale`
customContainer(
widget: SizedBox(
height: 100,
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 70.0,
fontFamily: 'Canterbury',
),
child: AnimatedTextKit(
animatedTexts: [
ScaleAnimatedText('Think'),
ScaleAnimatedText('Build'),
ScaleAnimatedText('Ship'),
],
onTap: () => debugPrint("Tap Event"),
),
),
),
),
/// `Colorize`
customContainer(
widget: SizedBox(
height: 100,
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: () => debugPrint("Tap Event"),
),
),
),
/// `Wavy`
customContainer(
widget: SizedBox(
height: 100,
width: double.infinity,
child: DefaultTextStyle(
style: const TextStyle(fontSize: 24.0),
child: AnimatedTextKit(
animatedTexts: [
WavyAnimatedText('Hello World'),
WavyAnimatedText('Look at the waves'),
],
isRepeatingAnimation: true,
onTap: () => debugPrint("Tap Event"),
),
),
),
),
/// `Flicker`
customContainer(
widget: SizedBox(
height: 100,
width: 250.0,
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 35,
color: Colors.white,
shadows: [
Shadow(
blurRadius: 7.0,
color: Colors.white,
offset: Offset(0, 0),
),
],
),
child: AnimatedTextKit(
repeatForever: true,
animatedTexts: [
FlickerAnimatedText('Flicker Frenzy'),
FlickerAnimatedText('Night Vibes On'),
FlickerAnimatedText("C'est La Vie !"),
],
onTap: () => debugPrint("Tap Event"),
),
),
),
),
],
),
),
],
),
);
}
}
Widget customContainer({required Widget widget}) {
return Container(
width: double.maxFinite,
margin: const EdgeInsets.symmetric(horizontal: 25.0, vertical: 25.0),
padding: const EdgeInsets.symmetric(horizontal: 5.0, vertical: 5.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
border: Border.all(color: Colors.black, width: 1.0),
),
child: widget,
);
}