diff --git a/lib/qr_code_screen.dart b/lib/qr_code_screen.dart index 8dc8f49..05f9295 100644 --- a/lib/qr_code_screen.dart +++ b/lib/qr_code_screen.dart @@ -48,14 +48,13 @@ class _QrCodeScreenState extends State { ValueListenableBuilder( valueListenable: _controller, builder: (context, state, _) { - final torchState = state.torchState; return IconButton( icon: Icon( - torchState == TorchState.on + state.torchState == TorchState.on ? Icons.flash_on : Icons.flash_off, ), - onPressed: torchState == TorchState.unavailable + onPressed: state.torchState == TorchState.unavailable ? null : () => _controller.toggleTorch(), );