Page View Animation in Flutter
Page View is a list that works page by page. In this article, we will gonna do How to Animate the Page when sliding. A sample video is given below to get an idea about what we are going to do in this article.
We will use the Transform widget to animate the page.
Creating a Page controller that is used to control pages and listen to swipes.
Creating a Variable currentPageValue used to set the number of the selected pages.
Adding Listener to the controller to change the selected page index when the page is changed.
Create Page list content in a List Variable.
Create a sample Page, pageno, and color as parameters so that we can change every page’s text and color.
Building the Page View
Position values goes between 0 1 2, currentPageValue value goes between 0 and 1 decimals.
Current Position value – position will return decimal numbers Between 0 and 1 negative rotate left, positive rotate right.
Animation using RotateX
Animation using RotateZ
Please Login to comment...