1.被重绘的tab页要 混入AutomaticKeepAliveClientMixin
// with 混入
class DevicePageLayout extends WidgetState<DevicePage> with AutomaticKeepAliveClientMixin
2.实现wantKeepAlive方法 ,返回值改成true
@override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true;
3.build中加入 super.build(context);
@override
Widget build(BuildContext context) {
super.build(context);
// TODO: implement build
网友评论