page_life_cycle 1.0.1 page_life_cycle: ^1.0.1 copied to clipboard
由于flutter本身widget没有路由onShow,onHide事件,根据路由变化增加widget的onShow,onHide事件,同时继承了WidgetsBindingObserver的didChangeAppLifecycleState app周期,同时优化了两点,1.只触发当前路由是顶层路由的widget,2.优化在ios上AppLifecycleState.paused延迟触发的表现
Use this package as a library
Depend on it
Run this command:
With Flutter:
$ flutter pub add page_life_cycle
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
page_life_cycle: ^1.0.1
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Import it
Now in your Dart code, you can use:
import 'package:page_life_cycle/page_life_cycle.dart';