Pārlūkot izejas kodu

1.更新homepage

tags/0.0.16
“yanghuaxuan” pirms 3 gadiem
vecāks
revīzija
d0b9720bfa
1 mainītis faili ar 43 papildinājumiem un 0 dzēšanām
  1. +43
    -0
      lib/pages/home_page/home_page.dart

+ 43
- 0
lib/pages/home_page/home_page.dart Parādīt failu

@@ -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();
}

Notiek ielāde…
Atcelt
Saglabāt