I have a PageView widget like below:
Widget buildPageView() {
return PageView(
controller: pageController,
onPageChanged: (index) {
pageChanged(index);
},
children: <Widget>[
AddPropertyDescription(pageController: pageController,),
AddPropertyMedia(pageController: pageController),
AddPropertyLocation(pageController: pageController),
AddPropertyDetails(pageController: pageController),
AddPropertyAmenities(pageController: pageController)
],
);
}
I have five pages as a Widget in my PageView, now I want to pass data from one page to another till the last page when page changed.....
I have taken the Next
button in each Page, In the Next button onTap() I simply increase the page number to slide to next page like below
onTap: () async{
pageController.animateToPage(
1,
duration: Duration(milliseconds: 300),
curve: Curves.linear,
);
},
When pressing the next button and go to the next screen I want to carry data and pass it to the next page.
Is there anyone here who could have faced the same problem in flutter.....
Please guide me on how can I achieve this.......