mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-20 14:26:23 +08:00
@ -20,7 +20,12 @@ class FirstPage extends StatefulWidget {
|
||||
FirstPageState createState() => new FirstPageState();
|
||||
}
|
||||
|
||||
class FirstPageState extends State<FirstPage> {
|
||||
class FirstPageState extends State<FirstPage> with AutomaticKeepAliveClientMixin{
|
||||
|
||||
|
||||
@override
|
||||
// TODO: implement wantKeepAlive
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -68,6 +73,7 @@ class FirstPageState extends State<FirstPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return new Column(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
|
@ -15,7 +15,7 @@ class CollectionPage extends StatefulWidget {
|
||||
_CollectionPageState createState() => _CollectionPageState();
|
||||
}
|
||||
|
||||
class _CollectionPageState extends State<CollectionPage> {
|
||||
class _CollectionPageState extends State<CollectionPage> with AutomaticKeepAliveClientMixin{
|
||||
_CollectionPageState() {
|
||||
final eventBus = new EventBus();
|
||||
ApplicationEvent.event = eventBus;
|
||||
@ -23,6 +23,11 @@ class _CollectionPageState extends State<CollectionPage> {
|
||||
CollectionControlModel _collectionControl = new CollectionControlModel();
|
||||
List<Collection> _collectionList;
|
||||
ScrollController _scrollController = new ScrollController();
|
||||
|
||||
@override
|
||||
// TODO: implement wantKeepAlive
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -102,7 +107,7 @@ class _CollectionPageState extends State<CollectionPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(_collectionList);
|
||||
super.build(context);
|
||||
if (_collectionList.length == 0) {
|
||||
return ListView(
|
||||
children: <Widget>[
|
||||
|
@ -13,7 +13,7 @@ class WidgetPage extends StatefulWidget {
|
||||
SecondPageState createState() => new SecondPageState(catModel);
|
||||
}
|
||||
|
||||
class SecondPageState extends State<WidgetPage> {
|
||||
class SecondPageState extends State<WidgetPage> with AutomaticKeepAliveClientMixin{
|
||||
CatControlModel catModel;
|
||||
SecondPageState(this.catModel) : super();
|
||||
|
||||
@ -23,6 +23,11 @@ class SecondPageState extends State<WidgetPage> {
|
||||
|
||||
List<Cat> categories = [];
|
||||
|
||||
@override
|
||||
// TODO: implement wantKeepAlive
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
renderCats();
|
||||
@ -52,6 +57,7 @@ class SecondPageState extends State<WidgetPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
if (categories.length == 0) {
|
||||
return ListView(
|
||||
children: <Widget>[new Container()],
|
||||
|
Reference in New Issue
Block a user