TabBarView中的children要实现AutomaticKeepAliveClientMixin(用with),且重写wantKeepAlive方法
@protected
bool get wantKeepAlive => true;
在build方法中还需要调用super.build(context);
TabBarView中的children要实现AutomaticKeepAliveClientMixin(用with),且重写wantKeepAlive方法
@protected
bool get wantKeepAlive => true;
在build方法中还需要调用super.build(context);
本文标题:flutter TabBarView不保持child的state
本文链接:https://www.haomeiwen.com/subject/ukvqmctx.html
网友评论