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-04-30 11:59:56 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f2152a31d584125338412628901ad87878a246b3
f2152a31
1 parent
8e1fdbd9
add new toggleTorch() method to platform interface
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
lib/src/method_channel/mobile_scanner_method_channel.dart
lib/src/mobile_scanner_platform_interface.dart
lib/src/web/mobile_scanner_web.dart
lib/src/method_channel/mobile_scanner_method_channel.dart
View file @
f2152a3
...
...
@@ -177,8 +177,6 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
await
methodChannel
.
invokeMethod
<
void
>(
'resetScale'
);
}
// TODO: remove the 'torch' function from native
@override
Future
<
void
>
setZoomScale
(
double
zoomScale
)
async
{
await
methodChannel
.
invokeMethod
<
void
>(
'setScale'
,
zoomScale
);
...
...
@@ -275,6 +273,11 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
}
@override
Future
<
void
>
toggleTorch
()
async
{
await
methodChannel
.
invokeMethod
<
void
>(
'toggleTorch'
);
}
@override
Future
<
void
>
updateScanWindow
(
Rect
?
window
)
async
{
if
(
_textureId
==
null
)
{
return
;
...
...
lib/src/mobile_scanner_platform_interface.dart
View file @
f2152a3
...
...
@@ -90,6 +90,11 @@ abstract class MobileScannerPlatform extends PlatformInterface {
throw
UnimplementedError
(
'stop() has not been implemented.'
);
}
/// Toggle the torch on the active camera on or off.
Future
<
void
>
toggleTorch
()
{
throw
UnimplementedError
(
'toggleTorch() has not been implemented.'
);
}
/// Update the scan window to the given [window] rectangle.
///
/// Any barcodes that do not intersect with the given [window] will be ignored.
...
...
lib/src/web/mobile_scanner_web.dart
View file @
f2152a3
...
...
@@ -355,6 +355,14 @@ class MobileScannerWeb extends MobileScannerPlatform {
}
@override
Future
<
void
>
toggleTorch
()
{
throw
UnsupportedError
(
'Setting the torch state is not supported for video tracks on the web.
\n
'
'See https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#instance_properties_of_video_tracks'
,
);
}
@override
Future
<
void
>
updateScanWindow
(
Rect
?
window
)
{
// A scan window is not supported on the web,
// because the scanner does not expose size information for the barcodes.
...
...
Please
register
or
login
to post a comment