浏览代码

1.更新homepage

tags/0.0.16
“yanghuaxuan” 3 年前
父节点
当前提交
d0b9720bfa
共有 1 个文件被更改,包括 43 次插入0 次删除
  1. +43
    -0
      lib/pages/home_page/home_page.dart

+ 43
- 0
lib/pages/home_page/home_page.dart 查看文件

@@ -492,3 +492,46 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver, Ticker
}
}
}

final RouteObserver<Route> lifeObserver = RouteObserver();

abstract class LifeState<T extends StatefulWidget> extends State<T> with RouteAware {
@override
void initState() {
super.initState();
}

@override
void didChangeDependencies() {
lifeObserver.subscribe(this, ModalRoute.of(context));
super.didChangeDependencies();
}

@override
void dispose() {
lifeObserver.unsubscribe(this);
super.dispose();
}

void didPop() {
onPaused();
}

void didPopNext() {
onResume();
print("回到首页");
setState(() {});
}

void didPush() {
onResume();
}

void didPushNext() {
onPaused();
}

void onResume();

void onPaused();
}

正在加载...
取消
保存