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 20:15:34 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7cb95d50288630de049a8452e6f8016ec0bc9ea8
7cb95d50
1 parent
ff99c61d
fix bug with null scan window; abort if texture is null
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
android/src/main/kotlin/dev/steenbakker/mobile_scanner/MobileScannerHandler.kt
lib/src/method_channel/mobile_scanner_method_channel.dart
lib/src/mobile_scanner_controller.dart
android/src/main/kotlin/dev/steenbakker/mobile_scanner/MobileScannerHandler.kt
View file @
7cb95d5
...
...
@@ -269,7 +269,7 @@ class MobileScannerHandler(
}
private fun updateScanWindow(call: MethodCall, result: MethodChannel.Result) {
mobileScanner
!!
.scanWindow = call.argument<List<Float>?>("rect")
mobileScanner
?
.scanWindow = call.argument<List<Float>?>("rect")
result.success(null)
}
...
...
lib/src/method_channel/mobile_scanner_method_channel.dart
View file @
7cb95d5
...
...
@@ -287,9 +287,19 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
@override
Future
<
void
>
updateScanWindow
(
Rect
?
window
)
async
{
if
(
_textureId
==
null
)
{
return
;
}
List
<
double
>?
points
;
if
(
window
!=
null
)
{
points
=
[
window
.
left
,
window
.
top
,
window
.
right
,
window
.
bottom
];
}
await
methodChannel
.
invokeMethod
<
void
>(
'updateScanWindow'
,
{
'rect'
:
window
},
{
'rect'
:
points
},
);
}
...
...
lib/src/mobile_scanner_controller.dart
View file @
7cb95d5
...
...
@@ -288,6 +288,13 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
await
MobileScannerPlatform
.
instance
.
setTorchState
(
newState
);
}
/// Update the scan window with the given [window] rectangle.
///
/// If [window] is null, the scan window will be reset to the full camera preview.
Future
<
void
>
updateScanWindow
(
Rect
?
window
)
async
{
await
MobileScannerPlatform
.
instance
.
updateScanWindow
(
window
);
}
@override
Future
<
void
>
dispose
()
async
{
if
(
_isDisposed
)
{
...
...
Please
register
or
login
to post a comment