Skip to content

Commit b2e8ede

Browse files
committed
feat: pause the activity of webf when app visibility changed.
1 parent 95af892 commit b2e8ede

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

webf/lib/src/launcher/controller.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,14 +709,17 @@ class WebFViewController implements WidgetsBindingObserver {
709709
switch (state) {
710710
case AppLifecycleState.resumed:
711711
document.visibilityChange(VisibilityState.visible);
712+
rootController.resume();
712713
break;
713714
case AppLifecycleState.hidden:
714715
case AppLifecycleState.paused:
715716
document.visibilityChange(VisibilityState.hidden);
717+
rootController.pause();
716718
break;
717719
case AppLifecycleState.inactive:
718720
break;
719721
case AppLifecycleState.detached:
722+
rootController.pause();
720723
break;
721724
}
722725
}
@@ -1344,6 +1347,7 @@ class WebFController {
13441347
module.resumeAnimationFrame();
13451348
view.resumeAnimationTimeline();
13461349
view.document.reactiveWidgetElements();
1350+
SchedulerBinding.instance.scheduleFrame();
13471351
}
13481352

13491353
bool _disposed = false;

0 commit comments

Comments
 (0)