Skip to main content

PageView

The PageView widget is a scrolling area that turns through several pages, one page at a time.
Use it for onboarding, image slides, screens you swipe left and right, and more.

Definition and role

The PageView widget lays out repeated child items as pages, and lets you move one page at a time by swiping or from a script. Set the scroll direction (horizontal or vertical), page snapping, scroll physics, end padding, and more.

  • Category: Layouts
  • Size when dropped: inside a parent layout (Row, Column, Stack, and so on) it starts at 300 x 200. Placed at the top level with no parent, it appears larger to fill the canvas.

Features

FeatureDescription
Page-by-page scrollingShows one page at a time, and a swipe turns to the next page.
Scroll directionSet pages to turn horizontally or vertically.
Page snappingSnaps to the nearest page once scrolling stops.
Repeated itemsRenders the child repeatedly, and controls how many pages appear.
Script controlControl the visible page with goToPage, nextPage, previousPage, and more, and receive the onPageChanged event whenever the page changes.

How to use

  1. Open the Layouts category in the left widget palette.
  2. Drag and drop the PageView item onto the canvas.
  3. Place the child widgets you want to show as pages inside it.
  4. In the Properties panel on the right, set scrollDirection, pageSnapping, and other values as needed.
  5. If needed, connect the action to run on a page change to onPageChanged.

Properties

PropertyDescriptionDefaultValue / Type
scrollDirectionDirection pages turn inHorizontal (horizontal)horizontal, vertical
itemCountNumber of pages (items) to show0Number (integer)
reverseFlip the scroll directionfalsetrue / false
physicsScroll physicsNot setbouncing, clamping, alwaysScrollable, rangeMaintaining, neverScrollable, page
pageSnappingSnap to the nearest page after scrollingtruetrue / false
dragStartBehaviorWhat counts as the start of a dragstartdown, start
allowImplicitScrollingPreload adjacent pages (allows accessibility scrolling)falsetrue / false
restorationIdIdentifier for restoring the scroll positionNot setString
clipBehaviorHow content outside the area is clippedhardEdgenone, hardEdge, antiAlias, antiAliasWithSaveLayer
padEndsAdd padding at the outer ends of the first and last pagestruetrue / false

Notes and tips

warning

Setting physics to neverScrollable stops swiping from turning pages. In that case, move between pages only from a script — goToPage, nextPage, or previousPage.

tip

Connect the action to run on a page change to onPageChanged. To check the current page number from a script, call getCurrentPage().

Learn more

tip

For the full Widget Control (Property, Method, Event) you can use to drive this widget from a script, visit PageView Widget Control.