@@ -422,8 +422,8 @@ class AnimatedTappableState extends _FTappableState<AnimatedTappable> with Singl
422
422
Animation <double >? bounce;
423
423
424
424
FTappableStyle ? _style;
425
- AnimationController ? _bounceController;
426
- CurvedAnimation ? _curvedBounce;
425
+ late final AnimationController _bounceController = AnimationController (vsync : this ) ;
426
+ late final CurvedAnimation _curvedBounce = CurvedAnimation (parent : _bounceController, curve : Curves .linear) ;
427
427
428
428
@override
429
429
void didChangeDependencies () {
@@ -441,27 +441,20 @@ class AnimatedTappableState extends _FTappableState<AnimatedTappable> with Singl
441
441
final style = widget.style? .call (context.theme.tappableStyle) ?? context.theme.tappableStyle;
442
442
if (_style != style) {
443
443
_style = style;
444
- _curvedBounce? .dispose ();
445
- _bounceController? .dispose ();
446
-
447
- _bounceController = AnimationController (
448
- vsync: this ,
449
- duration: style.motion.bounceDownDuration,
450
- reverseDuration: style.motion.bounceUpDuration,
451
- );
452
- _curvedBounce = CurvedAnimation (
453
- parent: _bounceController! ,
454
- curve: style.motion.bounceDownCurve,
455
- reverseCurve: style.motion.bounceUpCurve,
456
- );
457
- bounce = style.motion.bounceTween.animate (_curvedBounce! );
444
+ _bounceController
445
+ ..duration = style.motion.bounceDownDuration
446
+ ..reverseDuration = style.motion.bounceUpDuration;
447
+ _curvedBounce
448
+ ..curve = style.motion.bounceDownCurve
449
+ ..reverseCurve = style.motion.bounceUpCurve;
450
+ bounce = style.motion.bounceTween.animate (_curvedBounce);
458
451
}
459
452
}
460
453
461
454
@override
462
455
void dispose () {
463
- _curvedBounce? .dispose ();
464
- _bounceController? .dispose ();
456
+ _curvedBounce.dispose ();
457
+ _bounceController.dispose ();
465
458
super .dispose ();
466
459
}
467
460
@@ -478,15 +471,15 @@ class AnimatedTappableState extends _FTappableState<AnimatedTappable> with Singl
478
471
void onPressedStart () {
479
472
// Check if it's mounted due to a non-deterministic race condition, https://github.com/forus-labs/forui/issues/482.
480
473
if (mounted) {
481
- _bounceController? .forward ();
474
+ _bounceController.forward ();
482
475
}
483
476
}
484
477
485
478
@override
486
479
void onPressedEnd () {
487
480
// Check if it's mounted due to a non-deterministic race condition, https://github.com/forus-labs/forui/issues/482.
488
481
if (mounted) {
489
- _bounceController? .reverse ();
482
+ _bounceController.reverse ();
490
483
}
491
484
}
492
485
0 commit comments