Jonny Borges

add more animation tests

1 import 'dart:math'; 1 import 'dart:math';
  2 +import 'dart:ui';
2 3
3 import 'package:flutter/widgets.dart'; 4 import 'package:flutter/widgets.dart';
4 5
5 import 'get_animated_builder.dart'; 6 import 'get_animated_builder.dart';
6 7
  8 +typedef OffsetBuilder = Offset Function(BuildContext, double);
  9 +
7 class FadeInAnimation extends OpacityAnimation { 10 class FadeInAnimation extends OpacityAnimation {
8 FadeInAnimation({ 11 FadeInAnimation({
9 super.key, 12 super.key,
@@ -89,47 +92,83 @@ class ScaleAnimation extends GetAnimatedBuilder<double> { @@ -89,47 +92,83 @@ class ScaleAnimation extends GetAnimatedBuilder<double> {
89 ); 92 );
90 } 93 }
91 94
92 -class SlideAnimation extends GetAnimatedBuilder<Offset> {  
93 - SlideAnimation({ 95 +// class SlideAnimation extends GetAnimatedBuilder<Offset> {
  96 +// SlideAnimation({
  97 +// super.key,
  98 +// required super.duration,
  99 +// required super.delay,
  100 +// required super.child,
  101 +// super.onComplete,
  102 +// required Offset begin,
  103 +// required Offset end,
  104 +// super.idleValue = const Offset(0, 0),
  105 +// }) : super(
  106 +// builder: (context, value, child) => Transform.translate(
  107 +// offset: value,
  108 +// child: child,
  109 +// ),
  110 +// tween: Tween(begin: begin, end: end),
  111 +// );
  112 +// }
  113 +
  114 +class BounceAnimation extends GetAnimatedBuilder<double> {
  115 + BounceAnimation({
94 super.key, 116 super.key,
95 required super.duration, 117 required super.duration,
96 required super.delay, 118 required super.delay,
97 required super.child, 119 required super.child,
98 super.onComplete, 120 super.onComplete,
99 - required Offset begin,  
100 - required Offset end,  
101 - super.idleValue = const Offset(0, 0), 121 + super.curve = Curves.bounceOut,
  122 + required double begin,
  123 + required double end,
  124 + super.idleValue = 0,
102 }) : super( 125 }) : super(
103 - builder: (context, value, child) => Transform.translate(  
104 - offset: value, 126 + builder: (context, value, child) => Transform.scale(
  127 + scale: 1 + value.abs(),
105 child: child, 128 child: child,
106 ), 129 ),
107 - tween: Tween(begin: begin, end: end), 130 + tween: Tween<double>(begin: begin, end: end),
108 ); 131 );
109 } 132 }
110 133
111 -class BounceAnimation extends GetAnimatedBuilder<double> {  
112 - BounceAnimation({ 134 +class SpinAnimation extends GetAnimatedBuilder<double> {
  135 + SpinAnimation({
113 super.key, 136 super.key,
114 required super.duration, 137 required super.duration,
115 required super.delay, 138 required super.delay,
116 required super.child, 139 required super.child,
117 super.onComplete, 140 super.onComplete,
118 - super.curve = Curves.bounceOut, 141 + super.idleValue = 0,
  142 + }) : super(
  143 + builder: (context, value, child) => Transform.rotate(
  144 + angle: value * pi / 180.0,
  145 + child: child,
  146 + ),
  147 + tween: Tween<double>(begin: 0, end: 360),
  148 + );
  149 +}
  150 +
  151 +class SizeAnimation extends GetAnimatedBuilder<double> {
  152 + SizeAnimation({
  153 + super.key,
  154 + required super.duration,
  155 + required super.delay,
  156 + required super.child,
  157 + super.onComplete,
  158 + super.idleValue = 0,
119 required double begin, 159 required double begin,
120 required double end, 160 required double end,
121 - super.idleValue = 0,  
122 }) : super( 161 }) : super(
123 builder: (context, value, child) => Transform.scale( 162 builder: (context, value, child) => Transform.scale(
124 - scale: 1 + value.abs(), 163 + scale: value,
125 child: child, 164 child: child,
126 ), 165 ),
127 tween: Tween<double>(begin: begin, end: end), 166 tween: Tween<double>(begin: begin, end: end),
128 ); 167 );
129 } 168 }
130 169
131 -class ShakeAnimation extends GetAnimatedBuilder<double> {  
132 - ShakeAnimation({ 170 +class BlurAnimation extends GetAnimatedBuilder<double> {
  171 + BlurAnimation({
133 super.key, 172 super.key,
134 required super.duration, 173 required super.duration,
135 required super.delay, 174 required super.delay,
@@ -139,69 +178,207 @@ class ShakeAnimation extends GetAnimatedBuilder<double> { @@ -139,69 +178,207 @@ class ShakeAnimation extends GetAnimatedBuilder<double> {
139 required double end, 178 required double end,
140 super.idleValue = 0, 179 super.idleValue = 0,
141 }) : super( 180 }) : super(
142 - builder: (context, value, child) => Transform.rotate(  
143 - angle: value * pi / 180.0, 181 + builder: (context, value, child) => BackdropFilter(
  182 + filter: ImageFilter.blur(
  183 + sigmaX: value,
  184 + sigmaY: value,
  185 + ),
144 child: child, 186 child: child,
145 ), 187 ),
146 tween: Tween<double>(begin: begin, end: end), 188 tween: Tween<double>(begin: begin, end: end),
147 ); 189 );
148 } 190 }
149 191
150 -class SpinAnimation extends GetAnimatedBuilder<double> {  
151 - SpinAnimation({ 192 +class FlipAnimation extends GetAnimatedBuilder<double> {
  193 + FlipAnimation({
152 super.key, 194 super.key,
153 required super.duration, 195 required super.duration,
154 required super.delay, 196 required super.delay,
155 required super.child, 197 required super.child,
156 super.onComplete, 198 super.onComplete,
  199 + required double begin,
  200 + required double end,
157 super.idleValue = 0, 201 super.idleValue = 0,
158 }) : super( 202 }) : super(
159 - builder: (context, value, child) => Transform.rotate(  
160 - angle: value * pi / 180.0, 203 + builder: (context, value, child) {
  204 + final radians = value * pi;
  205 + return Transform(
  206 + transform: Matrix4.rotationY(radians),
  207 + alignment: Alignment.center,
  208 + child: child,
  209 + );
  210 + },
  211 + tween: Tween<double>(begin: begin, end: end),
  212 + );
  213 +}
  214 +
  215 +class WaveAnimation extends GetAnimatedBuilder<double> {
  216 + WaveAnimation({
  217 + super.key,
  218 + required super.duration,
  219 + required super.delay,
  220 + required super.child,
  221 + super.onComplete,
  222 + required double begin,
  223 + required double end,
  224 + super.idleValue = 0,
  225 + }) : super(
  226 + builder: (context, value, child) => Transform(
  227 + transform: Matrix4.translationValues(
  228 + 0.0,
  229 + 20.0 * sin(value * pi * 2),
  230 + 0.0,
  231 + ),
161 child: child, 232 child: child,
162 ), 233 ),
163 - tween: Tween<double>(begin: 0, end: 360), 234 + tween: Tween<double>(begin: begin, end: end),
164 ); 235 );
165 } 236 }
166 237
167 -class ColorAnimation extends GetAnimatedBuilder<Color?> {  
168 - ColorAnimation({ 238 +class WobbleAnimation extends GetAnimatedBuilder<double> {
  239 + WobbleAnimation({
169 super.key, 240 super.key,
170 required super.duration, 241 required super.duration,
171 required super.delay, 242 required super.delay,
172 required super.child, 243 required super.child,
173 super.onComplete, 244 super.onComplete,
174 - required Color begin,  
175 - required Color end,  
176 - Color? idleColor, 245 + required double begin,
  246 + required double end,
  247 + super.idleValue = 0,
177 }) : super( 248 }) : super(
178 - builder: (context, value, child) => ColorFiltered(  
179 - colorFilter: ColorFilter.mode(  
180 - Color.lerp(begin, end, value!.value.toDouble())!,  
181 - BlendMode.srcIn,  
182 - ), 249 + builder: (context, value, child) => Transform(
  250 + transform: Matrix4.identity()
  251 + ..setEntry(3, 2, 0.001)
  252 + ..rotateZ(sin(value * pi * 2) * 0.1),
  253 + alignment: Alignment.center,
183 child: child, 254 child: child,
184 ), 255 ),
185 - idleValue: idleColor ?? begin,  
186 - tween: ColorTween(begin: begin, end: end), 256 + tween: Tween<double>(begin: begin, end: end),
187 ); 257 );
188 } 258 }
189 259
190 -class SizeAnimation extends GetAnimatedBuilder<double> {  
191 - SizeAnimation({ 260 +class SlideInLeftAnimation extends SlideAnimation {
  261 + SlideInLeftAnimation({
  262 + super.key,
  263 + required super.duration,
  264 + required super.delay,
  265 + required super.child,
  266 + super.onComplete,
  267 + required super.begin,
  268 + required super.end,
  269 + super.idleValue = 0,
  270 + }) : super(
  271 + offsetBuild: (context, value) =>
  272 + Offset(value * MediaQuery.of(context).size.width, 0),
  273 + );
  274 +}
  275 +
  276 +class SlideInRightAnimation extends SlideAnimation {
  277 + SlideInRightAnimation({
  278 + super.key,
  279 + required super.duration,
  280 + required super.delay,
  281 + required super.child,
  282 + super.onComplete,
  283 + required super.begin,
  284 + required super.end,
  285 + super.idleValue = 0,
  286 + }) : super(
  287 + offsetBuild: (context, value) =>
  288 + Offset((1 - value) * MediaQuery.of(context).size.width, 0),
  289 + );
  290 +}
  291 +
  292 +class SlideInUpAnimation extends SlideAnimation {
  293 + SlideInUpAnimation({
  294 + super.key,
  295 + required super.duration,
  296 + required super.delay,
  297 + required super.child,
  298 + super.onComplete,
  299 + required super.begin,
  300 + required super.end,
  301 + super.idleValue = 0,
  302 + }) : super(
  303 + offsetBuild: (context, value) =>
  304 + Offset(0, value * MediaQuery.of(context).size.height),
  305 + );
  306 +}
  307 +
  308 +class SlideInDownAnimation extends SlideAnimation {
  309 + SlideInDownAnimation({
192 super.key, 310 super.key,
193 required super.duration, 311 required super.duration,
194 required super.delay, 312 required super.delay,
195 required super.child, 313 required super.child,
196 super.onComplete, 314 super.onComplete,
  315 + required super.begin,
  316 + required super.end,
197 super.idleValue = 0, 317 super.idleValue = 0,
  318 + }) : super(
  319 + offsetBuild: (context, value) =>
  320 + Offset(0, (1 - value) * MediaQuery.of(context).size.height),
  321 + );
  322 +}
  323 +
  324 +class SlideAnimation extends GetAnimatedBuilder<double> {
  325 + SlideAnimation({
  326 + super.key,
  327 + required super.duration,
  328 + required super.delay,
  329 + required super.child,
198 required double begin, 330 required double begin,
199 required double end, 331 required double end,
  332 + required OffsetBuilder offsetBuild,
  333 + super.onComplete,
  334 + super.idleValue = 0,
200 }) : super( 335 }) : super(
201 - builder: (context, value, child) => Transform.scale(  
202 - scale: value, 336 + builder: (context, value, child) => Transform.translate(
  337 + offset: offsetBuild(context, value),
203 child: child, 338 child: child,
204 ), 339 ),
205 tween: Tween<double>(begin: begin, end: end), 340 tween: Tween<double>(begin: begin, end: end),
206 ); 341 );
207 } 342 }
  343 +
  344 +// class ZoomAnimation extends GetAnimatedBuilder<double> {
  345 +// ZoomAnimation({
  346 +// super.key,
  347 +// required super.duration,
  348 +// required super.delay,
  349 +// required super.child,
  350 +// super.onComplete,
  351 +// required double begin,
  352 +// required double end,
  353 +// super.idleValue = 0,
  354 +// }) : super(
  355 +// builder: (context, value, child) => Transform.scale(
  356 +// scale: lerpDouble(1, end, value)!,
  357 +// child: child,
  358 +// ),
  359 +// tween: Tween<double>(begin: begin, end: end),
  360 +// );
  361 +// }
  362 +
  363 +class ColorAnimation extends GetAnimatedBuilder<Color?> {
  364 + ColorAnimation({
  365 + super.key,
  366 + required super.duration,
  367 + required super.delay,
  368 + required super.child,
  369 + super.onComplete,
  370 + required Color begin,
  371 + required Color end,
  372 + Color? idleColor,
  373 + }) : super(
  374 + builder: (context, value, child) => ColorFiltered(
  375 + colorFilter: ColorFilter.mode(
  376 + Color.lerp(begin, end, value!.value.toDouble())!,
  377 + BlendMode.srcIn,
  378 + ),
  379 + child: child,
  380 + ),
  381 + idleValue: idleColor ?? begin,
  382 + tween: ColorTween(begin: begin, end: end),
  383 + );
  384 +}
@@ -81,8 +81,9 @@ extension AnimationExtension on Widget { @@ -81,8 +81,9 @@ extension AnimationExtension on Widget {
81 } 81 }
82 82
83 GetAnimatedBuilder slide({ 83 GetAnimatedBuilder slide({
84 - required Offset begin,  
85 - required Offset end, 84 + required OffsetBuilder offset,
  85 + double begin = 0,
  86 + double end = 1,
86 Duration duration = _defaultDuration, 87 Duration duration = _defaultDuration,
87 Duration delay = _defaultDelay, 88 Duration delay = _defaultDelay,
88 ValueSetter<AnimationController>? onComplete, 89 ValueSetter<AnimationController>? onComplete,
@@ -94,6 +95,7 @@ extension AnimationExtension on Widget { @@ -94,6 +95,7 @@ extension AnimationExtension on Widget {
94 begin: begin, 95 begin: begin,
95 end: end, 96 end: end,
96 onComplete: onComplete, 97 onComplete: onComplete,
  98 + offsetBuild: offset,
97 child: this, 99 child: this,
98 ); 100 );
99 } 101 }
@@ -116,7 +118,21 @@ extension AnimationExtension on Widget { @@ -116,7 +118,21 @@ extension AnimationExtension on Widget {
116 ); 118 );
117 } 119 }
118 120
119 - GetAnimatedBuilder shake({ 121 + GetAnimatedBuilder spin({
  122 + Duration duration = _defaultDuration,
  123 + Duration delay = _defaultDelay,
  124 + ValueSetter<AnimationController>? onComplete,
  125 + bool isSequential = false,
  126 + }) {
  127 + return SpinAnimation(
  128 + duration: duration,
  129 + delay: _getDelay(isSequential, delay),
  130 + onComplete: onComplete,
  131 + child: this,
  132 + );
  133 + }
  134 +
  135 + GetAnimatedBuilder size({
120 required double begin, 136 required double begin,
121 required double end, 137 required double end,
122 Duration duration = _defaultDuration, 138 Duration duration = _defaultDuration,
@@ -124,7 +140,7 @@ extension AnimationExtension on Widget { @@ -124,7 +140,7 @@ extension AnimationExtension on Widget {
124 ValueSetter<AnimationController>? onComplete, 140 ValueSetter<AnimationController>? onComplete,
125 bool isSequential = false, 141 bool isSequential = false,
126 }) { 142 }) {
127 - return ShakeAnimation( 143 + return SizeAnimation(
128 duration: duration, 144 duration: duration,
129 delay: _getDelay(isSequential, delay), 145 delay: _getDelay(isSequential, delay),
130 begin: begin, 146 begin: begin,
@@ -134,29 +150,51 @@ extension AnimationExtension on Widget { @@ -134,29 +150,51 @@ extension AnimationExtension on Widget {
134 ); 150 );
135 } 151 }
136 152
137 - GetAnimatedBuilder spin({ 153 + GetAnimatedBuilder blur({
  154 + double begin = 0,
  155 + double end = 15,
138 Duration duration = _defaultDuration, 156 Duration duration = _defaultDuration,
139 Duration delay = _defaultDelay, 157 Duration delay = _defaultDelay,
140 ValueSetter<AnimationController>? onComplete, 158 ValueSetter<AnimationController>? onComplete,
141 bool isSequential = false, 159 bool isSequential = false,
142 }) { 160 }) {
143 - return SpinAnimation( 161 + return BlurAnimation(
  162 + duration: duration,
  163 + delay: _getDelay(isSequential, delay),
  164 + begin: begin,
  165 + end: end,
  166 + onComplete: onComplete,
  167 + child: this,
  168 + );
  169 + }
  170 +
  171 + GetAnimatedBuilder flip({
  172 + double begin = 0,
  173 + double end = 1,
  174 + Duration duration = _defaultDuration,
  175 + Duration delay = _defaultDelay,
  176 + ValueSetter<AnimationController>? onComplete,
  177 + bool isSequential = false,
  178 + }) {
  179 + return FlipAnimation(
144 duration: duration, 180 duration: duration,
145 delay: _getDelay(isSequential, delay), 181 delay: _getDelay(isSequential, delay),
  182 + begin: begin,
  183 + end: end,
146 onComplete: onComplete, 184 onComplete: onComplete,
147 child: this, 185 child: this,
148 ); 186 );
149 } 187 }
150 188
151 - GetAnimatedBuilder size({  
152 - required double begin,  
153 - required double end, 189 + GetAnimatedBuilder wave({
  190 + double begin = 0,
  191 + double end = 1,
154 Duration duration = _defaultDuration, 192 Duration duration = _defaultDuration,
155 Duration delay = _defaultDelay, 193 Duration delay = _defaultDelay,
156 ValueSetter<AnimationController>? onComplete, 194 ValueSetter<AnimationController>? onComplete,
157 bool isSequential = false, 195 bool isSequential = false,
158 }) { 196 }) {
159 - return SizeAnimation( 197 + return WaveAnimation(
160 duration: duration, 198 duration: duration,
161 delay: _getDelay(isSequential, delay), 199 delay: _getDelay(isSequential, delay),
162 begin: begin, 200 begin: begin,
@@ -101,14 +101,14 @@ void main() { @@ -101,14 +101,14 @@ void main() {
101 101
102 testWidgets('slide() returns a SlideAnimation', 102 testWidgets('slide() returns a SlideAnimation',
103 (WidgetTester tester) async { 103 (WidgetTester tester) async {
104 - const begin = Offset.zero;  
105 - const end = Offset.zero; 104 + const begin = 0;
  105 + const end = 1;
106 final widget = buildWidget(); 106 final widget = buildWidget();
107 - final animation = widget.slide(begin: begin, end: end); 107 + final animation = widget.slide(offset: (_, __) => const Offset(0, 0));
108 108
109 expect(animation, isA<SlideAnimation>()); 109 expect(animation, isA<SlideAnimation>());
110 110
111 - _testDefaultValues<Offset>( 111 + _testDefaultValues(
112 animation: animation, widget: widget, begin: begin, end: end); 112 animation: animation, widget: widget, begin: begin, end: end);
113 }); 113 });
114 114
@@ -130,39 +130,65 @@ void main() { @@ -130,39 +130,65 @@ void main() {
130 ); 130 );
131 }); 131 });
132 132
133 - testWidgets('shake() returns a ShakeAnimation',  
134 - (WidgetTester tester) async { 133 + testWidgets('spin() returns a SpinAnimation', (WidgetTester tester) async {
  134 + final widget = buildWidget();
  135 + const begin = 0.0;
  136 + const end = 360;
  137 + final animation = widget.spin();
  138 +
  139 + expect(animation, isA<SpinAnimation>());
  140 +
  141 + _testDefaultValues(
  142 + animation: animation, widget: widget, begin: begin, end: end);
  143 + });
  144 +
  145 + testWidgets('size() returns a SizeAnimation', (WidgetTester tester) async {
  146 + final widget = buildWidget();
  147 +
135 const begin = 0.9; 148 const begin = 0.9;
136 const end = 1.1; 149 const end = 1.1;
  150 + final animation = widget.size(begin: begin, end: end);
  151 +
  152 + expect(animation, isA<SizeAnimation>());
  153 +
  154 + _testDefaultValues(
  155 + animation: animation, widget: widget, begin: begin, end: end);
  156 + });
  157 +
  158 + testWidgets('blur() returns a BlurAnimation', (WidgetTester tester) async {
137 final widget = buildWidget(); 159 final widget = buildWidget();
138 - final animation = widget.shake(begin: begin, end: end);  
139 160
140 - expect(animation, isA<ShakeAnimation>()); 161 + const begin = 0.9;
  162 + const end = 1.1;
  163 + final animation = widget.blur(begin: begin, end: end);
  164 +
  165 + expect(animation, isA<BlurAnimation>());
141 166
142 _testDefaultValues( 167 _testDefaultValues(
143 animation: animation, widget: widget, begin: begin, end: end); 168 animation: animation, widget: widget, begin: begin, end: end);
144 }); 169 });
145 170
146 - testWidgets('spin() returns a SpinAnimation', (WidgetTester tester) async { 171 + testWidgets('flip() returns a FlipAnimation', (WidgetTester tester) async {
147 final widget = buildWidget(); 172 final widget = buildWidget();
148 - const begin = 0.0;  
149 - const end = 360;  
150 - final animation = widget.spin();  
151 173
152 - expect(animation, isA<SpinAnimation>()); 174 + const begin = 0.9;
  175 + const end = 1.1;
  176 + final animation = widget.flip(begin: begin, end: end);
  177 +
  178 + expect(animation, isA<FlipAnimation>());
153 179
154 _testDefaultValues( 180 _testDefaultValues(
155 animation: animation, widget: widget, begin: begin, end: end); 181 animation: animation, widget: widget, begin: begin, end: end);
156 }); 182 });
157 183
158 - testWidgets('size() returns a SizeAnimation', (WidgetTester tester) async { 184 + testWidgets('wave() returns a FlipAnimation', (WidgetTester tester) async {
159 final widget = buildWidget(); 185 final widget = buildWidget();
160 186
161 const begin = 0.9; 187 const begin = 0.9;
162 const end = 1.1; 188 const end = 1.1;
163 - final animation = widget.size(begin: begin, end: end); 189 + final animation = widget.wave(begin: begin, end: end);
164 190
165 - expect(animation, isA<SizeAnimation>()); 191 + expect(animation, isA<WaveAnimation>());
166 192
167 _testDefaultValues( 193 _testDefaultValues(
168 animation: animation, widget: widget, begin: begin, end: end); 194 animation: animation, widget: widget, begin: begin, end: end);
@@ -325,45 +325,124 @@ void main() { @@ -325,45 +325,124 @@ void main() {
325 await tester.pumpAndSettle(); 325 await tester.pumpAndSettle();
326 }); 326 });
327 327
328 - testWidgets('SlideAnimation', (WidgetTester tester) async { 328 + testWidgets('WaveAnimation', (WidgetTester tester) async {
329 await tester.pumpWidget( 329 await tester.pumpWidget(
330 - SlideAnimation( 330 + WaveAnimation(
331 duration: const Duration(seconds: 1), 331 duration: const Duration(seconds: 1),
332 delay: Duration.zero, 332 delay: Duration.zero,
333 - begin: Offset.zero,  
334 - end: const Offset(1.0, 1.0), 333 + begin: 1.0,
  334 + end: 2.0,
335 child: Container(), 335 child: Container(),
336 ), 336 ),
337 ); 337 );
338 - expect(find.byType(SlideAnimation), findsOneWidget); 338 + expect(find.byType(WaveAnimation), findsOneWidget);
339 await tester.pumpAndSettle(); 339 await tester.pumpAndSettle();
340 }); 340 });
341 341
342 - testWidgets('BounceAnimation', (WidgetTester tester) async { 342 + testWidgets('WobbleAnimation', (WidgetTester tester) async {
343 await tester.pumpWidget( 343 await tester.pumpWidget(
344 - BounceAnimation( 344 + WobbleAnimation(
345 duration: const Duration(seconds: 1), 345 duration: const Duration(seconds: 1),
346 delay: Duration.zero, 346 delay: Duration.zero,
347 - begin: 0.0,  
348 - end: 1.0, 347 + begin: 1.0,
  348 + end: 2.0,
349 child: Container(), 349 child: Container(),
350 ), 350 ),
351 ); 351 );
352 - expect(find.byType(BounceAnimation), findsOneWidget); 352 + expect(find.byType(WobbleAnimation), findsOneWidget);
  353 + await tester.pumpAndSettle();
  354 + });
  355 +
  356 + testWidgets('SlideAnimation', (WidgetTester tester) async {
  357 + await tester.pumpWidget(
  358 + SlideAnimation(
  359 + offsetBuild: (p0, p1) => const Offset(1.0, 1.0),
  360 + duration: const Duration(seconds: 1),
  361 + delay: Duration.zero,
  362 + begin: 0,
  363 + end: 1,
  364 + child: Container(),
  365 + ),
  366 + );
  367 + expect(find.byType(SlideAnimation), findsOneWidget);
  368 + await tester.pumpAndSettle();
  369 + });
  370 +
  371 + testWidgets('SlideInLeftAnimation', (WidgetTester tester) async {
  372 + await tester.pumpWidget(
  373 + _Wrapper(
  374 + child: SlideInLeftAnimation(
  375 + duration: const Duration(seconds: 1),
  376 + delay: Duration.zero,
  377 + begin: 1.0,
  378 + end: 2.0,
  379 + child: Container(),
  380 + ),
  381 + ),
  382 + );
  383 + expect(find.byType(SlideInLeftAnimation), findsOneWidget);
  384 + await tester.pumpAndSettle();
  385 + });
  386 +
  387 + testWidgets('SlideInRightAnimation', (WidgetTester tester) async {
  388 + await tester.pumpWidget(
  389 + _Wrapper(
  390 + child: SlideInRightAnimation(
  391 + duration: const Duration(seconds: 1),
  392 + delay: Duration.zero,
  393 + begin: 1.0,
  394 + end: 2.0,
  395 + child: Container(),
  396 + ),
  397 + ),
  398 + );
  399 + expect(find.byType(SlideInRightAnimation), findsOneWidget);
  400 + await tester.pumpAndSettle();
  401 + });
  402 +
  403 + testWidgets('SlideInUpAnimation', (WidgetTester tester) async {
  404 + await tester.pumpWidget(
  405 + _Wrapper(
  406 + child: SlideInUpAnimation(
  407 + duration: const Duration(seconds: 1),
  408 + delay: Duration.zero,
  409 + begin: 1.0,
  410 + end: 2.0,
  411 + child: Container(),
  412 + ),
  413 + ),
  414 + );
  415 + expect(find.byType(SlideInUpAnimation), findsOneWidget);
  416 + await tester.pumpAndSettle();
  417 + });
  418 +
  419 + testWidgets('SlideInDownAnimation', (WidgetTester tester) async {
  420 + await tester.pumpWidget(
  421 + _Wrapper(
  422 + child: SlideInDownAnimation(
  423 + duration: const Duration(seconds: 1),
  424 + delay: Duration.zero,
  425 + begin: 1.0,
  426 + end: 2.0,
  427 + child: Container(),
  428 + ),
  429 + ),
  430 + );
  431 + expect(find.byType(SlideInDownAnimation), findsOneWidget);
353 await tester.pumpAndSettle(); 432 await tester.pumpAndSettle();
354 }); 433 });
355 434
356 - testWidgets('ShakeAnimation', (WidgetTester tester) async { 435 + testWidgets('BounceAnimation', (WidgetTester tester) async {
357 await tester.pumpWidget( 436 await tester.pumpWidget(
358 - ShakeAnimation( 437 + BounceAnimation(
359 duration: const Duration(seconds: 1), 438 duration: const Duration(seconds: 1),
360 delay: Duration.zero, 439 delay: Duration.zero,
361 begin: 0.0, 440 begin: 0.0,
362 - end: 10.0, 441 + end: 1.0,
363 child: Container(), 442 child: Container(),
364 ), 443 ),
365 ); 444 );
366 - expect(find.byType(ShakeAnimation), findsOneWidget); 445 + expect(find.byType(BounceAnimation), findsOneWidget);
367 await tester.pumpAndSettle(); 446 await tester.pumpAndSettle();
368 }); 447 });
369 448
@@ -406,4 +485,32 @@ void main() { @@ -406,4 +485,32 @@ void main() {
406 expect(find.byType(SizeAnimation), findsOneWidget); 485 expect(find.byType(SizeAnimation), findsOneWidget);
407 await tester.pumpAndSettle(); 486 await tester.pumpAndSettle();
408 }); 487 });
  488 +
  489 + testWidgets('BlurAnimation', (WidgetTester tester) async {
  490 + await tester.pumpWidget(
  491 + BlurAnimation(
  492 + duration: const Duration(seconds: 1),
  493 + delay: Duration.zero,
  494 + begin: 1.0,
  495 + end: 2.0,
  496 + child: Container(),
  497 + ),
  498 + );
  499 + expect(find.byType(BlurAnimation), findsOneWidget);
  500 + await tester.pumpAndSettle();
  501 + });
  502 +
  503 + testWidgets('FlipAnimation', (WidgetTester tester) async {
  504 + await tester.pumpWidget(
  505 + FlipAnimation(
  506 + duration: const Duration(seconds: 1),
  507 + delay: Duration.zero,
  508 + begin: 1.0,
  509 + end: 2.0,
  510 + child: Container(),
  511 + ),
  512 + );
  513 + expect(find.byType(FlipAnimation), findsOneWidget);
  514 + await tester.pumpAndSettle();
  515 + });
409 } 516 }