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
2024-01-02 14:24:55 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f47d16e67e62f792474f11e1bf3a2e3c3a300042
f47d16e6
1 parent
f2f16e9a
don't update the zoom scale or torch state if the camer is not running
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletions
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner_controller.dart
View file @
f47d16e
...
...
@@ -175,9 +175,15 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
}
/// Reset the zoom scale of the camera.
///
/// Does nothing if the camera is not running.
Future
<
void
>
resetZoomScale
()
async
{
_throwIfNotInitialized
();
if
(!
value
.
isRunning
)
{
return
;
}
// When the platform has updated the zoom scale,
// it will send an update through the zoom scale state event stream.
await
MobileScannerPlatform
.
instance
.
resetZoomScale
();
...
...
@@ -189,9 +195,15 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
///
/// If the [zoomScale] is out of range,
/// it is adjusted to fit within the allowed range.
///
/// Does nothing if the camera is not running.
Future
<
void
>
setZoomScale
(
double
zoomScale
)
async
{
_throwIfNotInitialized
();
if
(!
value
.
isRunning
)
{
return
;
}
final
double
clampedZoomScale
=
zoomScale
.
clamp
(
0.0
,
1.0
);
// Update the zoom scale state to the new state.
...
...
@@ -313,10 +325,15 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
/// Switches the flashlight on or off.
///
/// Does nothing if the device has no torch.
/// Does nothing if the device has no torch,
/// or if the camera is not running.
Future
<
void
>
toggleTorch
()
async
{
_throwIfNotInitialized
();
if
(!
value
.
isRunning
)
{
return
;
}
final
TorchState
torchState
=
value
.
torchState
;
if
(
torchState
==
TorchState
.
unavailable
)
{
...
...
Please
register
or
login
to post a comment