diff --git a/example/lib/scanner_button_widgets.dart b/example/lib/scanner_button_widgets.dart index 8e05b238a..b9297885d 100644 --- a/example/lib/scanner_button_widgets.dart +++ b/example/lib/scanner_button_widgets.dart @@ -144,8 +144,6 @@ class ToggleFlashlightButton extends StatelessWidget { iconSize: 32.0, icon: const Icon(Icons.flash_auto), onPressed: () async { - // This button only turns off the auto mode. - // Perhaps we can switch between on / off / auto? await controller.toggleTorch(); }, ); diff --git a/lib/src/enums/torch_state.dart b/lib/src/enums/torch_state.dart index 31d91d8be..5e45078f4 100644 --- a/lib/src/enums/torch_state.dart +++ b/lib/src/enums/torch_state.dart @@ -2,7 +2,7 @@ enum TorchState { /// The flashlight turns on automatically in low light conditions. /// - /// This is currently only supported on iOS. + /// This is currently only supported on iOS and MacOS. auto(2), /// The flashlight is off. diff --git a/lib/src/mobile_scanner_controller.dart b/lib/src/mobile_scanner_controller.dart index 4696cffa7..91ec82416 100644 --- a/lib/src/mobile_scanner_controller.dart +++ b/lib/src/mobile_scanner_controller.dart @@ -361,6 +361,9 @@ class MobileScannerController extends ValueNotifier { /// /// Does nothing if the device has no torch, /// or if the camera is not running. + /// + /// If the current torch state is [TorchState.auto], + /// the torch is turned on or off depending on its actual current state. Future toggleTorch() async { _throwIfNotInitialized();