![]() |
VOOZH | about |
Routes are simply Pages in Flutter applications. An application often needs to move from one page to another. However, animations can be used to make these transitions smoother. These animations can be used to curve or tween the Animation object of the PageRouteBuilder class to alter the transition animation.
We will discuss them in detail here.
Using the PageRouteBuilder, create two routes with the first route as the Homepage with a button "Goto page 2" and the second route with just an empty page named "Page 2", using the code below.
main.dart:
You can build a tween of an animation object by using the below code :
main.dart:
The AnimatedWidget has the property of its state once the animation value changes. You can create one like below:
Use the below code to create a CurveTween:
Use the chain() method to combine two tweens, as shown below:
No, we use the animation.drive() method to create an Animation object of the combined tweens, as shown below:
main.dart:
Output: