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-02-16 09:37:08 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dc7f855dd57a716a2e071641d2c0ecae404ea833
dc7f855d
1 parent
24888522
style: flutter lints
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
19 deletions
example/lib/main.dart
example/lib/mobile_scanner_overlay.dart
example/test/widget_test.dart
lib/src/mobile_scanner_controller.dart
lib/src/objects/barcode.dart
lib/src/objects/barcode_utility.dart
test/mobile_scanner_test.dart
example/lib/main.dart
View file @
dc7f855
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'package:mobile_scanner/mobile_scanner.dart'
;
...
...
example/lib/mobile_scanner_overlay.dart
View file @
dc7f855
...
...
@@ -20,7 +20,7 @@ class _AnalyzeViewState extends State<AnalyzeView>
// CameraController cameraController = CameraController(context, width: 320, height: 150);
String
?
barcode
=
null
;
String
?
barcode
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -37,13 +37,13 @@ class _AnalyzeViewState extends State<AnalyzeView>
this
.
barcode
=
barcode
.
rawValue
;
if
(
barcode
.
corners
!=
null
)
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
'
${barcode.rawValue}
'
),
content:
Text
(
barcode
.
rawValue
),
duration:
const
Duration
(
milliseconds:
200
),
animation:
null
,
));
setState
(()
{
final
List
<
Offset
>
points
=
[];
double
factorWidth
=
args
.
size
.
width
/
520
;
//
double factorWidth = args.size.width / 520;
// double factorHeight = wanted / args.size.height;
final
size
=
MediaQuery
.
of
(
context
).
devicePixelRatio
;
debugPrint
(
'Size:
${barcode.corners}
'
);
...
...
@@ -109,7 +109,7 @@ class OpenPainter extends CustomPainter {
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
var
paint1
=
Paint
()
..
color
=
Color
(
0xff63aa65
)
..
color
=
const
Color
(
0xff63aa65
)
..
strokeWidth
=
10
;
//draw points on canvas
canvas
.
drawPoints
(
PointMode
.
points
,
points
,
paint1
);
...
...
example/test/widget_test.dart
View file @
dc7f855
...
...
@@ -5,11 +5,8 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:mobile_scanner_example/main.dart'
;
void
main
(
)
{
testWidgets
(
'Verify Platform version'
,
(
WidgetTester
tester
)
async
{
// Build our app and trigger a frame.
...
...
lib/src/mobile_scanner_controller.dart
View file @
dc7f855
...
...
@@ -132,8 +132,9 @@ class MobileScannerController {
final
Map
<
String
,
dynamic
>?
startResult
=
await
methodChannel
.
invokeMapMethod
<
String
,
dynamic
>(
'start'
,
arguments
);
if
(
startResult
==
null
)
if
(
startResult
==
null
)
{
throw
PlatformException
(
code:
'INITIALIZATION ERROR'
);
}
hasTorch
=
startResult
[
'torchable'
];
args
.
value
=
MobileScannerArguments
(
...
...
lib/src/objects/barcode.dart
View file @
dc7f855
...
...
@@ -490,7 +490,7 @@ enum BarcodeFormat {
/// Barcode format constant for Data Matrix.
///
/// Constant Value: 16
data
_m
atrix
,
data
M
atrix
,
/// Barcode format constant for EAN-13.
///
...
...
@@ -510,17 +510,17 @@ enum BarcodeFormat {
/// Barcode format constant for QR Code.
///
/// Constant Value: 256
qr
_c
ode
,
qr
C
ode
,
/// Barcode format constant for UPC-A.
///
/// Constant Value: 512
upc
_a
,
upc
A
,
/// Barcode format constant for UPC-E.
///
/// Constant Value: 1024
upc
_e
,
upc
E
,
/// Barcode format constant for PDF-417.
///
...
...
lib/src/objects/barcode_utility.dart
View file @
dc7f855
...
...
@@ -29,7 +29,7 @@ BarcodeFormat toFormat(int value) {
case
8
:
return
BarcodeFormat
.
codebar
;
case
16
:
return
BarcodeFormat
.
data
_m
atrix
;
return
BarcodeFormat
.
data
M
atrix
;
case
32
:
return
BarcodeFormat
.
ean13
;
case
64
:
...
...
@@ -37,11 +37,11 @@ BarcodeFormat toFormat(int value) {
case
128
:
return
BarcodeFormat
.
itf
;
case
256
:
return
BarcodeFormat
.
qr
_c
ode
;
return
BarcodeFormat
.
qr
C
ode
;
case
512
:
return
BarcodeFormat
.
upc
_a
;
return
BarcodeFormat
.
upc
A
;
case
1024
:
return
BarcodeFormat
.
upc
_e
;
return
BarcodeFormat
.
upc
E
;
case
2048
:
return
BarcodeFormat
.
pdf417
;
case
4096
:
...
...
test/mobile_scanner_test.dart
View file @
dc7f855
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:mobile_scanner/src/mobile_scanner.dart'
;
void
main
(
)
{
const
MethodChannel
channel
=
MethodChannel
(
'mobile_scanner'
);
...
...
Please
register
or
login
to post a comment