Bladeren bron

1.更新homepage

tags/0.0.16
“yanghuaxuan” 3 jaren geleden
bovenliggende
commit
d0b9720bfa
1 gewijzigde bestanden met toevoegingen van 43 en 0 verwijderingen
  1. +43
    -0
      lib/pages/home_page/home_page.dart

+ 43
- 0
lib/pages/home_page/home_page.dart Bestand weergeven

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

Laden…
Annuleren
Opslaan