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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user