Support application lifecycle state change events in the framework
This commit is contained in:
parent
b8562aba60
commit
e880bd92fb
@ -104,6 +104,8 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver {
|
||||
}
|
||||
}
|
||||
|
||||
void didChangeAppLifecycleState(ui.AppLifecycleState state) { }
|
||||
|
||||
final HeroController _heroController = new HeroController();
|
||||
|
||||
Route _generateRoute(RouteSettings settings) {
|
||||
|
@ -16,6 +16,7 @@ class BindingObserver {
|
||||
bool didPopRoute() => false;
|
||||
void didChangeSize(Size size) { }
|
||||
void didChangeLocale(ui.Locale locale) { }
|
||||
void didChangeAppLifecycleState(ui.AppLifecycleState state) { }
|
||||
}
|
||||
|
||||
/// A concrete binding for applications based on the Widgets framework.
|
||||
@ -39,6 +40,7 @@ class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, Rendere
|
||||
BuildableElement.scheduleBuildFor = scheduleBuildFor;
|
||||
ui.window.onLocaleChanged = handleLocaleChanged;
|
||||
ui.window.onPopRoute = handlePopRoute;
|
||||
ui.window.onAppLifecycleStateChanged = handleAppLifecycleStateChanged;
|
||||
}
|
||||
|
||||
/// The one static instance of this class.
|
||||
@ -79,6 +81,11 @@ class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, Rendere
|
||||
}
|
||||
}
|
||||
|
||||
void handleAppLifecycleStateChanged(ui.AppLifecycleState state) {
|
||||
for (BindingObserver observer in _observers)
|
||||
observer.didChangeAppLifecycleState(state);
|
||||
}
|
||||
|
||||
void beginFrame() {
|
||||
buildDirtyElements();
|
||||
super.beginFrame();
|
||||
|
@ -8,8 +8,8 @@ dependencies:
|
||||
collection: '>=1.1.3 <2.0.0'
|
||||
intl: '>=0.12.4+2 <0.13.0'
|
||||
material_design_icons: '>=0.0.3 <0.1.0'
|
||||
sky_engine: 0.0.73
|
||||
sky_services: 0.0.73
|
||||
sky_engine: 0.0.74
|
||||
sky_services: 0.0.74
|
||||
vector_math: '>=1.4.3 <2.0.0'
|
||||
|
||||
# See the comment in flutter_tools' pubspec.yaml. We have to pin it
|
||||
|
Loading…
x
Reference in New Issue
Block a user