I have used TabBarView as my page holder for BottomNavigationBar instead of Indexed stack. But this does refresh the page every time tab is changed. The state is not maintained. What to do?
Using AutomaticKeepAliveClientMixin
flutter.dev
class _SampleScaffoldSate extends State<SampleScaffold> with AutomaticKeepAliveClientMixin {
// ... other code
@override
bool get wantKeepAlive => true;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.