|
| 1 | +# PageView |
| 2 | +--- |
| 3 | + |
| 4 | +> Introduction |
| 5 | +
|
| 6 | +A PageView widget is a common widget that handles a scrollable list of pages. A PageView is very similar to a carousel. |
| 7 | + |
| 8 | +This is a step-by-step guide to show you how to make use of the PageView Component in Flutterflow. |
| 9 | + |
| 10 | +The Pageview widget can be used to create onboarding pages, Instagram carousels, and custom features. There are no boundaries to what you can create with the PageView component. |
| 11 | + |
| 12 | +>What you’ll need |
| 13 | +
|
| 14 | +To follow along, you’d need to [Sign-In](https://app.flutterflow.io/) to a flutterflow.io account or [create a new account](https://app.flutterflow.io/create-account). |
| 15 | + |
| 16 | +>Things you can do with the Pageview component |
| 17 | +
|
| 18 | +* Add, delete, and style the Pageview. |
| 19 | +* You can change the scroll direction of a Pageview. |
| 20 | +* You can cusomize the indicator dots of a PageView. |
| 21 | +* Using a stack component, you can add more components on a pageview. |
| 22 | + |
| 23 | + |
| 24 | +## PageView Component in Flutterflow |
| 25 | +The image below shows an onboarding screen that can be created with the PageView component. |
| 26 | + |
| 27 | +<!-- Add an image showing a sample onboarding screen using the flutterflow onboarding --> |
| 28 | + |
| 29 | +**Note**: If you don’t have a previous project, you’ll be seeing a screen that prompts you to create a new project or open a previous one. If you open a previous project, you can just add a new screen. |
| 30 | + |
| 31 | +Otherwise, you create a new project and give it a name. |
| 32 | + |
| 33 | +<!-- Add an image showing a create new screen page--> |
| 34 | + |
| 35 | +After creating a project successfully, you will be introduced to the flutterflow workspace. Like this |
| 36 | + |
| 37 | +<!-- Image of the flutterflow workspace --> |
| 38 | + |
| 39 | +> Creating a new PageView |
| 40 | +You have a workspace to build your application. The next thing you need to do is search for the PageView from the component section on your left. |
| 41 | + |
| 42 | +If by any chance you can’t find it at a first glance, on the search bar above the Widgets/Components tab, type in 'PageView'. The PageView component/widget can be found under the Layout components. |
| 43 | + |
| 44 | +Drag and drop the PageView component onto the empty screen. You should have something similar to this: |
| 45 | + |
| 46 | +<!-- Images of a default pageview --> |
| 47 | + |
| 48 | +The pageview currently has three pages. To add a new page, look to the right-hand side of the screen to see the properties page for a PageView component. |
| 49 | + |
| 50 | +<!-- screenshot of a Pageview property tab--> |
| 51 | + |
| 52 | + |
| 53 | +> Adding a new Page to the PageView |
| 54 | +Click on ‘Page 1’ and you get a dropdown option to add a new page or click through the number of pages on the screen. |
| 55 | + |
| 56 | +> Deleting a Page from the PageView |
| 57 | +You can delete a page by clicking on the page of a PageView and pressing your delete button. This deletes the image. Press the delete button again to delete the placeholder. |
| 58 | + |
| 59 | +>Changing the Size Of A PageView |
| 60 | +Still on the properties page by your right, under the PageView properties, there is a width and height property that can be set either in pixel(PX) or percentage(%). |
| 61 | + |
| 62 | +To Make the PageView take up the full screen, take the following steps: |
| 63 | + 1. Click on the scaffold(*the blank part of the mobile screen*). On the properties bar, uncheck the SafeArea. |
| 64 | +2. Right-click on the mobile view to switch back to Page View Properties. |
| 65 | + |
| 66 | +Under the Page View Property, set the height and width to infinity by clicking on the infinity symbol on the text field. |
| 67 | +To remove the margin at the bottom, change the number from 50 to 0 on the bottom(**B**) text field under the margin properties. |
| 68 | + |
| 69 | +We have a full-screen PageView. |
| 70 | + |
| 71 | +> Changing the scroll direction of the PageView |
| 72 | +
|
| 73 | +You can change the scroll direction of the PageView by switching the Axis dropdown values from horizontal(left to right) to vertical(top to bottom). |
| 74 | + |
| 75 | +### Customizing the PageView Indicator |
| 76 | +You can move the indicator around by moving the slider either left to right to position horizontally or top to bottom to position vertically. |
| 77 | + |
| 78 | +> Changing the color of an indicator |
| 79 | +Under the Indicator properties, click on the active color box and use the color picker to select the color you want. |
| 80 | + |
| 81 | +To edit an inactive color, click on the inactive color box and use the color picker to select the color you want. |
| 82 | + |
| 83 | +Customizing the indicator can be done by changing the values in the ‘Dot height and Dot width’ textboxes. |
| 84 | + |
| 85 | +To control the spacing, you can edit the value in the spacing textfield. |
| 86 | + |
| 87 | +To give the indicator dots custom borderRadius, you can edit the value on the Border Radius textfield. |
| 88 | + |
| 89 | + |
| 90 | +### Adding components on the Pageview |
| 91 | + |
| 92 | +To add a button component on a Pageview you can take the following steps: |
| 93 | + |
| 94 | +* Wrap the Pageview in a stack. To do this, you have to click on the mobile view/Scaffold or right click to select the current page. |
| 95 | + |
| 96 | +Ensure that the page is selected. Right click and select ‘wrap widget’ or Ctrl + B to show a dialog box like this: |
| 97 | + |
| 98 | +<!-- Image of the options and the dialog box to choose the stack component from --> |
| 99 | + |
| 100 | +You have successfully wrapped our Pageview in a stack widget. This allows you to stack components onto the pageview. |
| 101 | + |
| 102 | +To add a button, you can drag an ‘icon button’ onto the Pageview. Click on the Icon properties on the left to choose a specific icon button and style. |
| 103 | + |
| 104 | +**Note**: Ensure that you select the widget/component you want to work on before you try to stack any components on it. |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +Finally, you have a beautiful and custom PageView. |
| 109 | + |
| 110 | +You can always learn by watching or reading through the documentation, but to make this work, it is important that you practice, play arround with components and if there is a feature you would want to be added, send a mail to [email protected]. |
| 111 | + |
| 112 | +> Next steps |
| 113 | +
|
| 114 | +Check out other guides to learn more about how to make use of components. |
| 115 | + |
| 116 | +* <!-- * [Scaffold](link to scaffold guide) --> |
| 117 | +* [Frequently Asked Questions](faq/faq.md) |
| 118 | + |
| 119 | +Happy building! |
0 commit comments