Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2023-10-31 12:32:51 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1676ead64f6e970aaa726e79aac2e0e20f13eae7
1676ead6
1 parent
476ba2ec
only let the torch state callback event update the torch state
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner_controller.dart
View file @
1676ead
...
...
@@ -282,9 +282,6 @@ class MobileScannerController {
final
hasTorch
=
startResult
[
'torchable'
]
as
bool
?
??
false
;
hasTorchState
.
value
=
hasTorch
;
if
(
hasTorch
&&
torchEnabled
)
{
torchState
.
value
=
TorchState
.
on
;
}
final
Size
size
;
...
...
@@ -333,14 +330,15 @@ class MobileScannerController {
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
controllerUninitialized
,
);
}
else
if
(!
hasTorch
)
{
}
if
(!
hasTorch
)
{
return
;
}
torchState
.
value
=
torchState
.
value
==
TorchState
.
off
?
TorchState
.
on
:
TorchState
.
off
;
final
TorchState
newState
=
torchState
.
value
==
TorchState
.
off
?
TorchState
.
on
:
TorchState
.
off
;
await
_methodChannel
.
invokeMethod
(
'torch'
,
torchState
.
valu
e
.
rawValue
);
await
_methodChannel
.
invokeMethod
(
'torch'
,
newStat
e
.
rawValue
);
}
/// Changes the state of the camera (front or back).
...
...
Please
register
or
login
to post a comment