I want to achieve Url Navigation in Flutter Web using Gorouter and PageView-builder built within a single scaffold. I want to change the PageView item only and retain the remaining parts of the scaffold without rendering them again.
Asked
Active
Viewed 263 times
1 Answers
1
You can create a dynamic page. And when navigating pass the id in the slug. Using the slug fetch data. To make this in a single scaffold use the slug inside the scaffold to create some widgets that will dynamically build using the slug.
GoRoute(
name: yourPage,
path: '/yourPage/:slug';,
builder: (context, state) {
final id = state.params['slug'];
return YourPage(
key: state.pageKey,
slug: id,
);
},
),

monzim
- 526
- 2
- 4
- 13
-
Can you please provide me the guidance on how can I implement the other side I mean the Widget side where I am using the PageView.builder? Let's say the page names are: Page1, Page2, Page3, Page4, – Salman Ali Mar 13 '23 at 11:44
-
Are your pages static? – monzim Mar 13 '23 at 12:00
-
Yes they are static Pages, within PageView. I am using PageView.builder for scalability. – Salman Ali Mar 13 '23 at 14:04