主要三步:
1、state方法中混入with AutomaticKeepAliveClientMixin

2、繼續在state方法中的build方法中添加super.build(context);

3、繼續添加
1 @override 2 // TODO: implement wantKeepAlive 3 bool get wantKeepAlive => true; //保持當前頁面狀態

如果是需要保持狀態的頁面加入這三個步驟就可以實現~
如果有什么不對的地方,歡迎指正!!!!


1 @override 2 // TODO: implement wantKeepAlive 3 bool get wantKeepAlive => true; //保持當前頁面狀態

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。