PageView/TabBarView 等控件保存状态的问题解决方案

时间:2020-04-03 20:10:49   收藏:0   阅读:93

官方推荐方法:

AutomaticKeepAliveClientMixin,同时实现wantKeepAlive方法。

class _MsgLisViewState extends State<MsgListView> with AutomaticKeepAliveClientMixin {
...
@override bool get wantKeepAlive
=> true; // 需要实现这个方法,返回true则会保持状态 ... }

 


作者:yuanzhiying

原文:https://www.cnblogs.com/jiuyi/p/12628539.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!