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-11-08 17:15:23 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
86e8e952e3d6d0c7b7b6562300d58748f91d0a9b
86e8e952
1 parent
3c5a6091
clamp the zoom scale
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner_controller.dart
View file @
86e8e95
...
...
@@ -113,17 +113,13 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
/// Set the zoom scale of the camera.
///
/// The [zoomScale] must be between 0.0 and 1.0 (both inclusive).
///
/// If the [zoomScale] is out of range,
/// it is adjusted to fit within the allowed range.
Future
<
void
>
setZoomScale
(
double
zoomScale
)
async
{
if
(
zoomScale
<
0
||
zoomScale
>
1
)
{
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
genericError
,
errorDetails:
MobileScannerErrorDetails
(
message:
'The zoomScale must be between 0.0 and 1.0'
,
),
);
}
final
double
clampedZoomScale
=
zoomScale
.
clamp
(
0.0
,
1.0
);
await
MobileScannerPlatform
.
instance
.
setZoomScale
(
z
oomScale
);
await
MobileScannerPlatform
.
instance
.
setZoomScale
(
clampedZ
oomScale
);
}
/// Stop the camera.
...
...
Please
register
or
login
to post a comment