mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 16:48:41 +00:00
fix #297
This commit is contained in:
parent
5946420fd0
commit
1cc19f7834
1 changed files with 10 additions and 1 deletions
|
|
@ -206,6 +206,10 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
||||||
|
|
||||||
FlutterVolumeController.addListener(
|
FlutterVolumeController.addListener(
|
||||||
(volume) async {
|
(volume) async {
|
||||||
|
if (!widget.isVisible) {
|
||||||
|
await deInitVolumeControl();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (startedVolume == null) {
|
if (startedVolume == null) {
|
||||||
startedVolume = volume;
|
startedVolume = volume;
|
||||||
return;
|
return;
|
||||||
|
|
@ -221,7 +225,12 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
||||||
}
|
}
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
androidVolumeDownSub = FlutterAndroidVolumeKeydown.stream.listen((event) {
|
androidVolumeDownSub = FlutterAndroidVolumeKeydown.stream.listen((event) {
|
||||||
takePicture();
|
if (widget.isVisible) {
|
||||||
|
takePicture();
|
||||||
|
} else {
|
||||||
|
deInitVolumeControl();
|
||||||
|
return;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue