Skip to content

Commit 414bd87

Browse files
authoredJan 26, 2025
Merge pull request #167 from BuildMirai/dv/PageView-docs
docs: Add PageView widget documentation
2 parents 4780d64 + e2117ea commit 414bd87

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
 

‎website/docs/widgets/page_view.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# PageView
2+
3+
The Mirai PageView allows you to build a Flutter PageView widget using JSON.
4+
To know more about the PageView widget in Flutter, refer to the [official documentation](https://api.flutter.dev/flutter/widgets/PageView-class.html).
5+
6+
## Properties
7+
8+
| Property | Type | Description |
9+
|------------------------|------------------------------|-------------------------------------------------------------------------------|
10+
| scrollDirection | `Axis` | The axis along which the page view scrolls. Defaults to `Axis.horizontal`. |
11+
| reverse | `bool` | Whether the page view scrolls in the reverse direction. Defaults to `false`. |
12+
| physics | `MiraiScrollPhysics?` | The physics for the scroll view. |
13+
| pageSnapping | `bool` | Whether the page view should snap to page boundaries. Defaults to `true`. |
14+
| onPageChanged | `Map<String, dynamic>?` | The callback that is called when the page changes. |
15+
| dragStartBehavior | `DragStartBehavior` | The drag start behavior. Defaults to `DragStartBehavior.start`. |
16+
| allowImplicitScrolling | `bool` | Whether to allow implicit scrolling. Defaults to `false`. |
17+
| restorationId | `String?` | The restoration ID to save and restore the scroll offset. |
18+
| clipBehavior | `Clip` | The clip behavior of the page view. Defaults to `Clip.hardEdge`. |
19+
| padEnds | `bool` | Whether to pad the ends of the page view. Defaults to `true`. |
20+
| initialPage | `int` | The initial page to show. Defaults to `0`. |
21+
| keepPage | `bool` | Whether to save the current page. Defaults to `true`. |
22+
| viewportFraction | `double` | The fraction of the viewport that each page should occupy. Defaults to `1.0`. |
23+
| children | `List<Map<String, dynamic>>` | The widgets below this widget in the tree. Defaults to an empty list. |
24+
25+
## Example JSON
26+
27+
```json
28+
{
29+
"type": "pageView",
30+
"children": [
31+
{
32+
"type": "container",
33+
"color": "#D9D9D9",
34+
"child": {
35+
"type": "center",
36+
"child": {
37+
"type": "text",
38+
"data": "Page 1",
39+
"style": {
40+
"fontSize": 23,
41+
"fontWeight": "w400"
42+
}
43+
}
44+
}
45+
},
46+
{
47+
"type": "container",
48+
"color": "#FC3F1B",
49+
"child": {
50+
"type": "center",
51+
"child": {
52+
"type": "text",
53+
"data": "Page 2",
54+
"style": {
55+
"fontSize": 23,
56+
"fontWeight": "w400"
57+
}
58+
}
59+
}
60+
},
61+
{
62+
"type": "container",
63+
"color": "#D9D9D9",
64+
"child": {
65+
"type": "center",
66+
"child": {
67+
"type": "text",
68+
"data": "Page 3",
69+
"style": {
70+
"fontSize": 23,
71+
"fontWeight": "w400"
72+
}
73+
}
74+
}
75+
}
76+
]
77+
}
78+
```

0 commit comments

Comments
 (0)