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
p-mazhnik
2022-12-12 01:38:28 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0c85119766b6462d80c1c96b2cf8b87c3f63219b
0c851197
1 parent
869c22ae
docs(web): update changelog, add comments
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
0 deletions
CHANGELOG.md
lib/mobile_scanner_web_plugin.dart
lib/src/web/jsqr.dart
lib/src/web/zxing.dart
CHANGELOG.md
View file @
0c85119
...
...
@@ -12,6 +12,7 @@ Breaking changes:
*
The
`autoResume` attribute has been removed from the `MobileScanner`
widget.
The controller already automatically resumes, so it had no effect.
*
Removed
`MobileScannerCallback` and `MobileScannerArgumentsCallback`
typedef.
*
[
Web
]
Replaced
`jsqr` library with `zxing-js`
for full barcode support.
Improvements:
*
Toggling the device torch now does nothing if the device has no torch, rather than throwing an error.
...
...
@@ -21,6 +22,9 @@ Features:
*
Added a new
`placeholderBuilder` function to the `MobileScanner`
widget to customize the preview placeholder.
*
Added
`autoStart`
parameter to MobileScannerController(). If set to false, controller won't start automatically.
*
Added
`hasTorch`
function on MobileScannerController(). After starting the controller, you can check if the device has a torch.
*
[
Web
]
Added ability to use custom barcode scanning js libraries
by extending
`WebBarcodeReaderBase` class and changing `barCodeReader` property in `MobileScannerWebPlugin`
Fixes:
*
Fixes the missing gradle setup for the Android project, which prevented gradle sync from working.
...
...
lib/mobile_scanner_web_plugin.dart
View file @
0c85119
...
...
@@ -35,6 +35,17 @@ class MobileScannerWebPlugin {
static
final
html
.
DivElement
vidDiv
=
html
.
DivElement
();
/// Represents barcode reader library.
/// Change this property if you want to use a custom implementation.
///
/// Example of using the jsQR library:
/// void main() {
/// if (kIsWeb) {
/// MobileScannerWebPlugin.barCodeReader =
/// JsQrCodeReader(videoContainer: MobileScannerWebPlugin.vidDiv);
/// }
/// runApp(const MaterialApp(home: MyHome()));
/// }
static
WebBarcodeReaderBase
barCodeReader
=
ZXingBarcodeReader
(
videoContainer:
vidDiv
);
StreamSubscription
?
_barCodeStreamSubscription
;
...
...
lib/src/web/jsqr.dart
View file @
0c85119
...
...
@@ -20,6 +20,11 @@ class Code {
external
Uint8ClampedList
get
binaryData
;
}
/// Barcode reader that uses jsQR library.
/// jsQR supports only QR codes format.
///
/// Include jsQR to your index.html file:
/// <script src="https://cdn.jsdelivr.net/npm/jsqr@1.4.0/dist/jsQR.min.js"></script>
class
JsQrCodeReader
extends
WebBarcodeReaderBase
with
InternalStreamCreation
,
InternalTorchDetection
{
JsQrCodeReader
({
required
super
.
videoContainer
});
...
...
lib/src/web/zxing.dart
View file @
0c85119
...
...
@@ -134,6 +134,10 @@ extension JsZXingBrowserMultiFormatReaderExt
external
MediaStream
?
stream
;
}
/// Barcode reader that uses zxing-js library.
///
/// Include zxing-js to your index.html file:
/// <script type="text/javascript" src="https://unpkg.com/@zxing/library@0.19.1"></script>
class
ZXingBarcodeReader
extends
WebBarcodeReaderBase
with
InternalStreamCreation
,
InternalTorchDetection
{
late
final
JsZXingBrowserMultiFormatReader
_reader
=
...
...
Please
register
or
login
to post a comment