Remove torchState variable in ValueListenableBuilder
This commit is contained in:
parent
79cc43da0d
commit
fc640eade0
1 changed files with 2 additions and 3 deletions
|
|
@ -48,14 +48,13 @@ class _QrCodeScreenState extends State<QrCodeScreen> {
|
|||
ValueListenableBuilder<MobileScannerState>(
|
||||
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(),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue