Skip to content

Commit

Permalink
fix documentation for auto torch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
navaronbracke committed Apr 30, 2024
1 parent c544951 commit f57d19d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions example/lib/scanner_button_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/enums/torch_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions lib/src/mobile_scanner_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
///
/// 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<void> toggleTorch() async {
_throwIfNotInitialized();

Expand Down

0 comments on commit f57d19d

Please sign in to comment.