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>(
|
ValueListenableBuilder<MobileScannerState>(
|
||||||
valueListenable: _controller,
|
valueListenable: _controller,
|
||||||
builder: (context, state, _) {
|
builder: (context, state, _) {
|
||||||
final torchState = state.torchState;
|
|
||||||
return IconButton(
|
return IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
torchState == TorchState.on
|
state.torchState == TorchState.on
|
||||||
? Icons.flash_on
|
? Icons.flash_on
|
||||||
: Icons.flash_off,
|
: Icons.flash_off,
|
||||||
),
|
),
|
||||||
onPressed: torchState == TorchState.unavailable
|
onPressed: state.torchState == TorchState.unavailable
|
||||||
? null
|
? null
|
||||||
: () => _controller.toggleTorch(),
|
: () => _controller.toggleTorch(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue