主要三步:
1、state方法中混入with AutomaticKeepAliveClientMixin
2、继续在state方法中的build方法中添加super.build(context);
3、继续添加
1 @override 2 // TODO: implement wantKeepAlive 3 bool get wantKeepAlive => true; //保持当前页面状态
如果是需要保持状态的页面加入这三个步骤就可以实现~
如果有什么不对的地方,欢迎指正!!!!