fixed camera not being initialized on Android

This commit is contained in:
Vadim 2024-04-06 19:04:19 +02:00
parent 46e2c8342f
commit 639ec6e9d4

View file

@ -251,18 +251,6 @@ class _WidgetsBindingObserver with WidgetsBindingObserver {
/// Revoking camera permissions results in app being killed both on Android and iOS /// Revoking camera permissions results in app being killed both on Android and iOS
@override @override
void didChangeAppLifecycleState(AppLifecycleState state) { void didChangeAppLifecycleState(AppLifecycleState state) {
switch (defaultTargetPlatform) {
/// On Android opening a dialog results in [AppLifecycleState.inactive]
case TargetPlatform.android:
if (_prevState == AppLifecycleState.inactive && state == AppLifecycleState.resumed) {
return;
}
_prevState = state;
onLifecycleStateChanged(state);
/// When coming from the app's settings iOS fires paused -> inactive -> resumed state which falls into this condition.
/// So the inactive state is skipped.
case TargetPlatform.iOS:
if (state == AppLifecycleState.inactive) { if (state == AppLifecycleState.inactive) {
return; return;
} }
@ -270,7 +258,5 @@ class _WidgetsBindingObserver with WidgetsBindingObserver {
_prevState = state; _prevState = state;
onLifecycleStateChanged(state); onLifecycleStateChanged(state);
} }
default:
}
} }
} }