我已经使用TabBarView作为BottomNavigationBar的页面保持器,而不是索引堆栈。但这确实会在每次更改选项卡时刷新页面。状态未维护。该怎么办?
答案 0 :(得分:0)
使用AutomaticKeepAliveClientMixin
flutter.dev
class _SampleScaffoldSate extends State<SampleScaffold> with AutomaticKeepAliveClientMixin {
// ... other code
@override
bool get wantKeepAlive => true;
}