Implement new AnimationStatus getters (#148570)

PR #147801 introduced some convenient `AnimationStatus` getters, but I just realized that `AnimationController` now has 2 getters for the same thing: `isAnimating` and `isRunning`.

The intent of this pull request is to correct that mistake, and implement the getters in the appropriate places.
This commit is contained in:
Nate
2024-05-20 11:43:03 -06:00
committed by GitHub
parent 73ecc8a9b2
commit 76a07a1646
53 changed files with 221 additions and 384 deletions

View File

@@ -77,7 +77,7 @@ class _AnimatedDigitState extends State<AnimatedDigit> with SingleTickerProvider
}
void handleAnimationCompleted(AnimationStatus status) {
if (status == AnimationStatus.completed) {
if (status.isCompleted) {
if (pendingValues.isNotEmpty) {
// Display the next pending value. The duration was scaled down
// in didUpdateWidget by the total number of pending values so

View File

@@ -32,18 +32,14 @@ class _HomeState extends State<Home> with TickerProviderStateMixin<Home> {
int selectedIndex = 0;
AnimationController buildFaderController() {
final AnimationController controller = AnimationController(
return AnimationController(
vsync: this,
duration: const Duration(milliseconds: 300),
);
controller.addStatusListener(
(AnimationStatus status) {
if (status == AnimationStatus.dismissed) {
setState(() {}); // Rebuild unselected destinations offstage.
}
},
);
return controller;
)..addStatusListener((AnimationStatus status) {
if (status.isDismissed) {
setState(() {}); // Rebuild unselected destinations offstage.
}
});
}
@override