Protected against bots by Yandex SmartCaptcha. Data processing policy
PageView
Swipeable pages: each child is a page the full size of the element, swiped with a gesture that snaps to a page. Carousels, onboarding, galleries. The element needs a bounded size along the swipe axis (for example,
SizedBox height:
).
Type:
multi-child
SizedBox height:200
PageView
Center
Text "Page 1"
Center
Text "Page 2"
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
scrollDirection
|
string |
horizontal
|
Swipe axis:
horizontal
or
vertical
|
reverse
|
bool | false | Swipe in the opposite direction |
pageSnapping
|
bool | true | Snap to a whole page after the gesture |
onPageChanged
|
callback
(page)
|
— |
Page change; the
page
argument is the number of the new page, from zero
|
clipBehavior
|
string |
hardEdge
|
Clipping the content at the bounds |
physics
|
string | — |
Response to the gesture:
never
hands the wheel to the outer scroller,
bouncing
,
clamping
,
always
|
padEnds
|
bool | true | Padding at the outer pages when a page is narrower than the viewport |
The argument name in
onPageChanged
must be exactly
page
: the value is passed by name.
Examples
Onboarding with a page number
@current:0
Column spacing:12
SizedBox height:240
PageView onPageChanged:(page){current = page}
ColoredBox color:#4f46e5
Center
Text "Welcome"
#style color:#ffffff fontSize:24
ColoredBox color:#7c3aed
Center
Text "Everything in one place"
#style color:#ffffff fontSize:24
Text $"Page ${current + 1} of 2"
Vertical swiping
SizedBox height:240
PageView scrollDirection:vertical
ColoredBox color:#0ea5e9
Center
Text "Swipe up"
#style color:#ffffff fontSize:22
ColoredBox color:#14b8a6
Center
Text "Second"
#style color:#ffffff fontSize:22
ColoredBox color:#f59e0b
Center
Text "Third"
#style color:#ffffff fontSize:22
Differences between the app and the site
On the site
PageView
is a block that scrolls along its axis with CSS snapping to pages (
scroll-snap
): it swipes with the wheel, the touchpad and a finger, each page full width (height). Only
scrollDirection
is read.
onPageChanged
is not called on the site;
reverse
,
pageSnapping:false
,
padEnds
,
physics
,
clipBehavior
are not read.