|
|
@ -86,6 +86,11 @@ class _ReaderWidgetState extends State<ReaderWidget> |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void didChangeAppLifecycleState(AppLifecycleState state) { |
|
|
|
void didChangeAppLifecycleState(AppLifecycleState state) { |
|
|
|
|
|
|
|
final CameraController? cameraController = controller; |
|
|
|
|
|
|
|
if (cameraController == null || !cameraController.value.isInitialized) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch (state) { |
|
|
|
switch (state) { |
|
|
|
case AppLifecycleState.resumed: |
|
|
|
case AppLifecycleState.resumed: |
|
|
|
if (cameras.isNotEmpty && !_cameraOn) { |
|
|
|
if (cameras.isNotEmpty && !_cameraOn) { |
|
|
@ -93,9 +98,8 @@ class _ReaderWidgetState extends State<ReaderWidget> |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case AppLifecycleState.inactive: |
|
|
|
case AppLifecycleState.inactive: |
|
|
|
break; |
|
|
|
|
|
|
|
case AppLifecycleState.paused: |
|
|
|
case AppLifecycleState.paused: |
|
|
|
controller?.stopImageStream().then((_) => controller?.dispose()); |
|
|
|
controller?.dispose(); |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
|
_cameraOn = false; |
|
|
|
_cameraOn = false; |
|
|
|
}); |
|
|
|
}); |
|
|
|