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
Sven Op de Hipt
2023-06-19 21:24:57 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ea06f32841914a3ff1417b870fa2022064a67392
ea06f328
1 parent
5aa2c119
add overlay to scanner
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
19 deletions
lib/src/mobile_scanner.dart
lib/src/mobile_scanner.dart
View file @
ea06f32
...
...
@@ -62,6 +62,10 @@ class MobileScanner extends StatefulWidget {
/// Default: false
final
bool
startDelay
;
/// The overlay which will be painted above the scanner when has started successful.
/// Will no be pointed when an error occurs or the scanner hasn't be started yet.
final
Widget
?
overlay
;
/// Create a new [MobileScanner] using the provided [controller]
/// and [onBarcodeDetected] callback.
const
MobileScanner
({
...
...
@@ -74,6 +78,7 @@ class MobileScanner extends StatefulWidget {
this
.
placeholderBuilder
,
this
.
scanWindow
,
this
.
startDelay
=
false
,
this
.
overlay
,
super
.
key
,
});
...
...
@@ -252,24 +257,31 @@ class _MobileScannerState extends State<MobileScanner>
_controller
.
updateScanWindow
(
scanWindow
);
}
return
ClipRect
(
child:
LayoutBuilder
(
builder:
(
_
,
constraints
)
{
return
SizedBox
.
fromSize
(
size:
constraints
.
biggest
,
child:
FittedBox
(
fit:
widget
.
fit
,
child:
SizedBox
(
width:
value
.
size
.
width
,
height:
value
.
size
.
height
,
child:
kIsWeb
?
HtmlElementView
(
viewType:
value
.
webId
!)
:
Texture
(
textureId:
value
.
textureId
!),
),
),
);
},
),
return
Stack
(
alignment:
Alignment
.
center
,
children:
[
ClipRect
(
child:
LayoutBuilder
(
builder:
(
_
,
constraints
)
{
return
SizedBox
.
fromSize
(
size:
constraints
.
biggest
,
child:
FittedBox
(
fit:
widget
.
fit
,
child:
SizedBox
(
width:
value
.
size
.
width
,
height:
value
.
size
.
height
,
child:
kIsWeb
?
HtmlElementView
(
viewType:
value
.
webId
!)
:
Texture
(
textureId:
value
.
textureId
!),
),
),
);
},
),
),
if
(
widget
.
overlay
!=
null
)
widget
.
overlay
!
],
);
},
);
...
...
@@ -286,4 +298,4 @@ class _MobileScannerState extends State<MobileScanner>
_controller
.
dispose
();
super
.
dispose
();
}
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment