widget_lifecycle 1.4.0 copy "widget_lifecycle: ^1.4.0" to clipboard
widget_lifecycle: ^1.4.0 copied to clipboard

lifecycle for widget

1.4.0 #

  • support callShowOnAppResume
  • support callHideOnAppPause

1.3.0+1 #

  • support custom appLifecycleListener

1.2.0 #

BREAKING CHANGE:

  • rename api
  • add LifecycleController

          final controller = LifecycleController();
          LifecycleAware(
            key: ValueKey("id"),
            controller: controller,
            onShow: () {
              debugPrint("onShow");
            },
            onHide: (){
              
            },
            showVisibilityThreshold: 0.5,
            hideVisibilityThreshold: 0.1,
            child: xxxx,
        );
          
          

1.1.0 #

  • support visibleThreshold
          LifecycleAware(
            visibleThreshold: 0.3,
            observer: LifecycleObserver(onCreate: (l) {
              print("onCreate $_keyWrapper");
            }, onVisible: (l) {
              print("onVisible");
            }
            builder: (BuildContext context, Lifecycle lifecycle) {
              return Padding(
                padding: EdgeInsets.all(10),
                child: Container(
                  width: 300,
                  height: 600,
                  color: Colors.amberAccent,
                ),
              );
            },
          )

1.0.0 #

  • support lifecycle callback
  final Function(Lifecycle lifecycle)? onCreate;
  final Function(Lifecycle lifecycle)? onVisible;
  final Function(Lifecycle lifecycle)? onInvisible;
  final Function(Lifecycle lifecycle)? onDispose;
  final Function(Lifecycle lifecycle)? onBackground;
  final Function(Lifecycle lifecycle)? onForeground;