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
Julian Steenbakker
2022-03-04 17:40:08 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f7b9a54886bac23f79bd574f919e547631bbeca9
f7b9a548
1 parent
4b55b0f1
doc: add changelog
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
11 deletions
CHANGELOG.md
example/lib/barcode_scanner_controller.dart
lib/src/mobile_scanner.dart
lib/src/mobile_scanner_controller.dart
lib/src/objects/barcode.dart
CHANGELOG.md
View file @
f7b9a54
...
...
@@ -3,6 +3,9 @@ You can provide a path to controller.analyzeImage(path) in order to scan a local
Check out the example app to see how you can use the image_picker plugin to retrieve a photo from
the gallery. Please keep in mind that this feature is only supported on Android and iOS.
Another feature that has been added is a format selector!
Just keep in mind that iOS for now only supports 1 selected barcode.
## 0.1.3
*
Fixed crash after asking permission.
[
#29
](
https://github.com/juliansteenbakker/mobile_scanner/issues/29
)
*
Upgraded cameraX from 1.1.0-beta01 to 1.1.0-beta02
...
...
example/lib/barcode_scanner_controller.dart
View file @
f7b9a54
...
...
@@ -17,7 +17,7 @@ class _BarcodeScannerWithControllerState
MobileScannerController
controller
=
MobileScannerController
(
torchEnabled:
true
,
// formats: [BarcodeFormat.
ean13, BarcodeFormat.ean8
]
// formats: [BarcodeFormat.
qrCode
]
// facing: CameraFacing.front,
);
...
...
lib/src/mobile_scanner.dart
View file @
f7b9a54
...
...
@@ -24,12 +24,9 @@ class MobileScanner extends StatefulWidget {
final
BoxFit
fit
;
/// Create a [MobileScanner] with a [controller], the [controller] must has been initialized.
const
MobileScanner
({
Key
?
key
,
this
.
onDetect
,
this
.
controller
,
this
.
fit
=
BoxFit
.
cover
})
:
super
(
key:
key
);
const
MobileScanner
(
{
Key
?
key
,
this
.
onDetect
,
this
.
controller
,
this
.
fit
=
BoxFit
.
cover
})
:
super
(
key:
key
);
@override
State
<
MobileScanner
>
createState
()
=>
_MobileScannerState
();
...
...
lib/src/mobile_scanner_controller.dart
View file @
f7b9a54
...
...
@@ -43,6 +43,10 @@ class MobileScannerController {
late
final
ValueNotifier
<
CameraFacing
>
cameraFacingState
;
final
Ratio
?
ratio
;
final
bool
?
torchEnabled
;
/// If provided, the scanner will only detect those specific formats.
///
/// WARNING: On iOS, only 1 format is supported.
final
List
<
BarcodeFormat
>?
formats
;
CameraFacing
facing
;
...
...
@@ -52,7 +56,10 @@ class MobileScannerController {
Stream
<
Barcode
>
get
barcodes
=>
barcodesController
.
stream
;
MobileScannerController
(
{
this
.
facing
=
CameraFacing
.
back
,
this
.
ratio
,
this
.
torchEnabled
,
this
.
formats
})
{
{
this
.
facing
=
CameraFacing
.
back
,
this
.
ratio
,
this
.
torchEnabled
,
this
.
formats
})
{
// In case a new instance is created before calling dispose()
if
(
_controllerHashcode
!=
null
)
{
stop
();
...
...
@@ -146,7 +153,6 @@ class MobileScannerController {
}
else
if
(
Platform
.
isIOS
||
Platform
.
isMacOS
)
{
arguments
[
'formats'
]
=
formats
!.
map
((
e
)
=>
e
.
rawValue
).
toList
();
}
}
// Start the camera with arguments
...
...
lib/src/objects/barcode.dart
View file @
f7b9a54
...
...
@@ -554,7 +554,6 @@ enum BarcodeFormat {
}
extension
BarcodeValue
on
BarcodeFormat
{
int
get
rawValue
{
switch
(
this
)
{
case
BarcodeFormat
.
unknown
:
...
...
@@ -589,7 +588,6 @@ extension BarcodeValue on BarcodeFormat {
return
4096
;
}
}
}
/// Address type constants.
...
...
Please
register
or
login
to post a comment