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
JakubPatrik
2022-08-16 19:25:56 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f01fcc0db3c51b6e5158692fa4063870e50d3c17
f01fcc0d
1 parent
7e4a5c5f
expose the binaryData from the jsQR library
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
lib/mobile_scanner_web_plugin.dart
lib/src/mobile_scanner_controller.dart
lib/src/web/jsqr.dart
lib/mobile_scanner_web_plugin.dart
View file @
f01fcc0
...
...
@@ -200,7 +200,11 @@ class MobileScannerWebPlugin {
final
code
=
jsQR
(
imgData
.
data
,
canvas
.
width
,
canvas
.
height
);
if
(
code
!=
null
)
{
controller
.
add
({
'name'
:
'barcodeWeb'
,
'data'
:
code
.
data
});
controller
.
add
({
'name'
:
'barcodeWeb'
,
'data'
:
code
.
data
,
'binaryData'
:
code
.
binaryData
,
});
}
}
}
...
...
lib/src/mobile_scanner_controller.dart
View file @
f01fcc0
import
'dart:async'
;
import
'dart:io'
;
import
'dart:typed_data'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -89,6 +90,7 @@ class MobileScannerController {
void
handleEvent
(
Map
event
)
{
final
name
=
event
[
'name'
];
final
data
=
event
[
'data'
];
final
binaryData
=
event
[
'binaryData'
];
switch
(
name
)
{
case
'torchState'
:
final
state
=
TorchState
.
values
[
data
as
int
?
??
0
];
...
...
@@ -106,7 +108,11 @@ class MobileScannerController {
);
break
;
case
'barcodeWeb'
:
barcodesController
.
add
(
Barcode
(
rawValue:
data
as
String
?));
final
bytes
=
(
binaryData
as
List
).
cast
<
int
>();
barcodesController
.
add
(
Barcode
(
rawValue:
data
as
String
?,
rawBytes:
Uint8List
.
fromList
(
bytes
),
));
break
;
default
:
throw
UnimplementedError
();
...
...
lib/src/web/jsqr.dart
View file @
f01fcc0
@JS
()
library
jsqr
;
import
'dart:typed_data'
;
import
'package:js/js.dart'
;
@JS
(
'jsQR'
)
...
...
@@ -9,4 +11,6 @@ external Code? jsQR(dynamic data, int? width, int? height);
@JS
()
class
Code
{
external
String
get
data
;
external
Uint8ClampedList
get
binaryData
;
}
...
...
Please
register
or
login
to post a comment