File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ class DynamicPage extends StatefulWidget {
1717 _DynamicPageState createState () => _DynamicPageState ();
1818}
1919
20- class _DynamicPageState extends State <DynamicPage > {
20+ // ignore: mixin_inherits_from_not_object
21+ class _DynamicPageState extends State <DynamicPage > with AutomaticKeepAliveClientMixin {
2122
2223 bool isLoading = false ;
2324
@@ -63,6 +64,9 @@ class _DynamicPageState extends State<DynamicPage> {
6364 return StoreProvider .of (context);
6465 }
6566
67+ @override
68+ bool get wantKeepAlive => true ;
69+
6670 @override
6771 void initState () {
6872 super .initState ();
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ class TrendPage extends StatefulWidget {
1010 _TrendPageState createState () => _TrendPageState ();
1111}
1212
13- class _TrendPageState extends State <TrendPage > {
13+ // ignore: mixin_inherits_from_not_object
14+ class _TrendPageState extends State <TrendPage > with AutomaticKeepAliveClientMixin {
1415 bool isLoading = false ;
1516
1617 int page = 1 ;
@@ -46,6 +47,9 @@ class _TrendPageState extends State<TrendPage> {
4647 return new ReposItem (e);
4748 }
4849
50+ @override
51+ bool get wantKeepAlive => true ;
52+
4953 @override
5054 void initState () {
5155 super .initState ();
Original file line number Diff line number Diff line change 11import 'package:flutter/material.dart' ;
22
33///支持顶部和顶部的TabBar控件
4+ ///配合AutomaticKeepAliveClientMixin可以keep住
45class GSYTabBarWidget extends StatefulWidget {
56 ///底部模式type
67 static const int BOTTOM_TAB = 1 ;
You can’t perform that action at this time.
0 commit comments