extendedAnimation method Null safety
- BuildContext context
Returns the animation that controls the NavigationRail.extended state.
This can be used to synchronize animations in the leading or trailing widget, such as an animated menu or a FloatingActionButton animation.
This example shows how to use this animation to create a FloatingActionButton
that animates itself between the normal and extended states of the
NavigationRail.
An instance of MyNavigationRailFab
is created for NavigationRail.leading.
Pressing the FAB button toggles the "extended" state of the NavigationRail.
To create a local project with this code sample, run:
flutter create --sample=material.NavigationRail.extendedAnimation.1 mysample
flutter create --sample=material.NavigationRail.extendedAnimation.1 mysample
Implementation
static Animation<double> extendedAnimation(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<_ExtendedNavigationRailAnimation>()!.animation;
}