Showing
3 changed files
with
4 additions
and
3 deletions
| @@ -144,8 +144,6 @@ class ToggleFlashlightButton extends StatelessWidget { | @@ -144,8 +144,6 @@ class ToggleFlashlightButton extends StatelessWidget { | ||
| 144 | iconSize: 32.0, | 144 | iconSize: 32.0, |
| 145 | icon: const Icon(Icons.flash_auto), | 145 | icon: const Icon(Icons.flash_auto), |
| 146 | onPressed: () async { | 146 | onPressed: () async { |
| 147 | - // This button only turns off the auto mode. | ||
| 148 | - // Perhaps we can switch between on / off / auto? | ||
| 149 | await controller.toggleTorch(); | 147 | await controller.toggleTorch(); |
| 150 | }, | 148 | }, |
| 151 | ); | 149 | ); |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | enum TorchState { | 2 | enum TorchState { |
| 3 | /// The flashlight turns on automatically in low light conditions. | 3 | /// The flashlight turns on automatically in low light conditions. |
| 4 | /// | 4 | /// |
| 5 | - /// This is currently only supported on iOS. | 5 | + /// This is currently only supported on iOS and MacOS. |
| 6 | auto(2), | 6 | auto(2), |
| 7 | 7 | ||
| 8 | /// The flashlight is off. | 8 | /// The flashlight is off. |
| @@ -361,6 +361,9 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { | @@ -361,6 +361,9 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { | ||
| 361 | /// | 361 | /// |
| 362 | /// Does nothing if the device has no torch, | 362 | /// Does nothing if the device has no torch, |
| 363 | /// or if the camera is not running. | 363 | /// or if the camera is not running. |
| 364 | + /// | ||
| 365 | + /// If the current torch state is [TorchState.auto], | ||
| 366 | + /// the torch is turned on or off depending on its actual current state. | ||
| 364 | Future<void> toggleTorch() async { | 367 | Future<void> toggleTorch() async { |
| 365 | _throwIfNotInitialized(); | 368 | _throwIfNotInitialized(); |
| 366 | 369 |
-
Please register or login to post a comment