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
casvanluijtelaar
2022-06-14 11:00:47 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
08aa3a55a00c8fa22f39c857d8c67754d67f3d28
08aa3a55
1 parent
3d8a140f
example cleanup
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
26 deletions
example/lib/barcode_scanner_window.dart
example/lib/barcode_scanner_window.dart
View file @
08aa3a5
...
...
@@ -12,37 +12,24 @@ class BarcodeScannerWithScanWindow extends StatefulWidget {
}
class
_BarcodeScannerWithScanWindowState
extends
State
<
BarcodeScannerWithScanWindow
>
with
SingleTickerProviderStateMixin
{
String
?
barcode
;
late
Rect
scanWindow
;
extends
State
<
BarcodeScannerWithScanWindow
>
{
late
MobileScannerController
controller
;
String
?
barcode
;
@override
void
initState
()
{
super
.
initState
();
controller
=
MobileScannerController
();
}
final
screenWidth
=
window
.
physicalSize
.
shortestSide
/
window
.
devicePixelRatio
;
final
screenHeight
=
window
.
physicalSize
.
longestSide
/
window
.
devicePixelRatio
;
scanWindow
=
Rect
.
fromCenter
(
center:
Offset
(
screenWidth
/
2
,
screenHeight
/
2
),
@override
Widget
build
(
BuildContext
context
)
{
final
scanWindow
=
Rect
.
fromCenter
(
center:
MediaQuery
.
of
(
context
).
size
.
center
(
Offset
.
zero
),
width:
200
,
height:
200
,
);
controller
=
MobileScannerController
(
torchEnabled:
false
,
);
}
bool
isStarted
=
true
;
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
backgroundColor:
Colors
.
black
,
body:
Builder
(
...
...
@@ -52,11 +39,9 @@ class _BarcodeScannerWithScanWindowState
MobileScanner
(
scanWindow:
scanWindow
,
controller:
controller
,
onDetect:
(
barcode
,
args
)
{
setState
(()
{
this
.
barcode
=
barcode
.
rawValue
;
});
},
onDetect:
(
barcode
,
_
)
=>
setState
(()
{
this
.
barcode
=
barcode
.
rawValue
;
}),
),
CustomPaint
(
painter:
ScannerOverlay
(
scanWindow
),
...
...
Please
register
or
login
to post a comment