PageView — A Flutter Widget — WalkingTree Technologies

A PageView is a Flutter widget that creates scrollable pages on the screen. It can either create a list of a fixed number of pages or can use a builder function to create pages on demand. The PageView widget is quite similar to the ListView widget when it comes to constructing elements.

What are the different PageView constructors?

  1. PageView() — Creates a scrollable list of pages from an explicit list of widgets
  2. PageView.builder() — Creates a scrollable list of pages using widgets that are created on-demand
  3. PageView.custom() — Creates a scrollable list of pages with a custom child model

Not just this, you can add custom transitions, change page scrolling to horizontal or vertical, set page snapping to true or false, and customize many other things.

How does the PageView work?

The first thing you will be needing is a PageController which manages the swipe detection and provides the animation. You can use the initialPage property to set which page to start on.

Then create your page using the PageView widget and give the controller and pages to display.

That’s it! With the help of PageView and PageController, users can swipe between different screens of the app.

Check out the Flutter widget of the week video for more information

Originally published at on June 8, 2020.

WalkingTree is an IT software and service provider recognized for its passion for technology.