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:51:53 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8e1fdbd9ed2b81f8fdad9c0176bea3de23fa64ae
8e1fdbd9
1 parent
51c786d1
remove `setTorchState()` from the platform interface
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
26 deletions
lib/src/method_channel/mobile_scanner_method_channel.dart
lib/src/mobile_scanner_controller.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 @
8e1fdbd
...
...
@@ -177,14 +177,7 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
await
methodChannel
.
invokeMethod
<
void
>(
'resetScale'
);
}
@override
Future
<
void
>
setTorchState
(
TorchState
torchState
)
async
{
if
(
torchState
==
TorchState
.
unavailable
)
{
return
;
}
await
methodChannel
.
invokeMethod
<
void
>(
'torch'
,
torchState
.
rawValue
);
}
// TODO: remove the 'torch' function from native
@override
Future
<
void
>
setZoomScale
(
double
zoomScale
)
async
{
...
...
lib/src/mobile_scanner_controller.dart
View file @
8e1fdbd
...
...
@@ -374,13 +374,10 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
return
;
}
final
TorchState
newState
=
torchState
==
TorchState
.
off
?
TorchState
.
on
:
TorchState
.
off
;
// Update the torch state to the new state.
// Request the torch state to be switched to the opposite state.
// When the platform has updated the torch state,
// it will send an update through the torch state event stream.
await
MobileScannerPlatform
.
instance
.
setTorchState
(
newState
);
await
MobileScannerPlatform
.
instance
.
toggleTorch
(
);
}
/// Update the scan window with the given [window] rectangle.
...
...
lib/src/mobile_scanner_platform_interface.dart
View file @
8e1fdbd
...
...
@@ -67,11 +67,6 @@ abstract class MobileScannerPlatform extends PlatformInterface {
/// This is only supported on the web.
void
setBarcodeLibraryScriptUrl
(
String
scriptUrl
)
{}
/// Set the torch state of the active camera.
Future
<
void
>
setTorchState
(
TorchState
torchState
)
{
throw
UnimplementedError
(
'setTorchState() has not been implemented.'
);
}
/// Set the zoom scale of the camera.
///
/// The [zoomScale] must be between `0.0` and `1.0` (both inclusive).
...
...
lib/src/web/mobile_scanner_web.dart
View file @
8e1fdbd
...
...
@@ -236,14 +236,6 @@ class MobileScannerWeb extends MobileScannerPlatform {
}
@override
Future
<
void
>
setTorchState
(
TorchState
torchState
)
{
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
>
setZoomScale
(
double
zoomScale
)
{
throw
UnsupportedError
(
'Setting the zoom scale is not supported for video tracks on the web.
\n
'
...
...
Please
register
or
login
to post a comment