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
Navaron Bracke
2023-11-09 11:54:45 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b551840c5e1cf2dd035e59925b9ba8a46d370c2e
b551840c
1 parent
18bcb68b
let the barcode overlay take the corners & capture size as arguments
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
example/lib/barcode_scanner_window.dart
example/lib/barcode_scanner_window.dart
View file @
b551840
...
...
@@ -138,20 +138,20 @@ class ScannerOverlay extends CustomPainter {
class
BarcodeOverlay
extends
CustomPainter
{
BarcodeOverlay
({
required
this
.
barcode
,
required
this
.
barcodeCorners
,
required
this
.
barcodeSize
,
required
this
.
boxFit
,
required
this
.
cameraPreviewSize
,
required
this
.
capture
,
});
final
Barcode
barcode
;
final
List
<
Offset
>
barcodeCorners
;
final
Size
barcodeSize
;
final
BoxFit
boxFit
;
final
Size
cameraPreviewSize
;
final
BarcodeCapture
capture
;
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
if
(
barcode
.
c
orners
.
isEmpty
)
{
if
(
barcode
C
orners
.
isEmpty
)
{
return
;
}
...
...
@@ -175,15 +175,15 @@ class BarcodeOverlay extends CustomPainter {
final
double
ratioHeight
;
if
(!
kIsWeb
&&
Platform
.
isIOS
)
{
ratioWidth
=
capture
.
size
.
width
/
adjustedSize
.
destination
.
width
;
ratioHeight
=
capture
.
size
.
height
/
adjustedSize
.
destination
.
height
;
ratioWidth
=
barcodeSize
.
width
/
adjustedSize
.
destination
.
width
;
ratioHeight
=
barcodeSize
.
height
/
adjustedSize
.
destination
.
height
;
}
else
{
ratioWidth
=
cameraPreviewSize
.
width
/
adjustedSize
.
destination
.
width
;
ratioHeight
=
cameraPreviewSize
.
height
/
adjustedSize
.
destination
.
height
;
}
final
List
<
Offset
>
adjustedOffset
=
[];
for
(
final
offset
in
barcode
.
c
orners
)
{
for
(
final
offset
in
barcode
C
orners
)
{
adjustedOffset
.
add
(
Offset
(
offset
.
dx
/
ratioWidth
+
horizontalPadding
,
...
...
Please
register
or
login
to post a comment