Change PageView form SideMenu flutter

433 views Asked by At

How can i change Pageview's pages directly from Sidebar Menu according to each Button. Below the screenshot of the web application.

enter image description here

1

There are 1 answers

4
aedemirsen On

Instead of using PageView you can use this approach;

//class variable
final _screens = [
  const Page1(),
  const Page2(),
  const Page3(),
];

_currentIndex = 0;

//your start page
return Scaffold(
  body: Stack(
    children: [
      _screens[_currentIndex],
      //some code
    ],
  ),
);

And you can change _currentIndex my tapping your left side buttons. (with setState() method)