I’m trying to use Flutter FAB in PageView, but since the FAB takes a variable that is initialized in the page 2, it creates an error.
So how can i show the FAB only after the second page?
I’m trying to use Flutter FAB in PageView, but since the FAB takes a variable that is initialized in the page 2, it creates an error.
So how can i show the FAB only after the second page?
2
Answers
The solution I used was to set a callback with the bool floating.
on the home page:
`
floatingActionButton:(floating) ? FloatingMenu(pageController: pageController) : null,
then on the
initState
function of second page used the callback to change the bool valueYou can use PageView on top level, and use scaffold on every item.It can also be done by adding listener to the pageController.