Skip to content

Commit d83a42e

Browse files
Update ai_barcode_scanner.dart
fix invalid torch icon
1 parent 7dba417 commit d83a42e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/src/ai_barcode_scanner.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,15 @@ class _AiBarcodeScannerState extends State<AiBarcodeScanner> {
288288
icon: const Icon(Icons.cameraswitch_rounded),
289289
onPressed: controller.switchCamera,
290290
),
291+
291292
IconButton(
292-
icon: controller.torchEnabled
293+
icon: controller.value.torchState == TorchState.on
293294
? const Icon(Icons.flashlight_off_rounded)
294295
: const Icon(Icons.flashlight_on_rounded),
295-
onPressed: controller.toggleTorch,
296+
onPressed: (){
297+
controller.toggleTorch();
298+
setState(() {});
299+
}
296300
),
297301
if (!widget.hideGalleryIcon)
298302
GalleryButton.icon(

0 commit comments

Comments
 (0)