I have a single page. I want to show the same page again and again without rebuilding it again on the next page or without losing it's state when scrolling ( infinitely)
Here's the below code, (Every time I move to the next page, the widgets[0] get to rebuild. I don't want that. I want to use the widgets[0] from the previous page without rebuilding the new page.]
Widget widgets = [Page1()];
PageView.builder(
controller: PageController(),
itemBuilder: (BuildContext context, int itemIndex) {
return widgets[0];
},
),
I have tried using AutomaticKeepAliveClientMixin
but it preserves the state of the previous page when I scroll back, but it rebuilds a new widget everytime I go to a new page. I want to reuse the previous widget in the new page.