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
Jennifer
2023-09-18 10:47:57 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b24afed7b7e1300825b8342aec533af71dea3608
b24afed7
1 parent
8d7a0635
fix: Add back LayoutBuilder to calculate the correct widgetSize
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
30 deletions
lib/src/mobile_scanner.dart
lib/src/mobile_scanner.dart
View file @
b24afed
...
...
@@ -248,36 +248,38 @@ class _MobileScannerState extends State<MobileScanner>
@override
Widget
build
(
BuildContext
context
)
{
final
Size
size
=
MediaQuery
.
of
(
context
).
size
;
return
ValueListenableBuilder
<
MobileScannerArguments
?>(
valueListenable:
_controller
.
startArguments
,
builder:
(
context
,
value
,
child
)
{
if
(
value
==
null
)
{
return
_buildPlaceholderOrError
(
context
,
child
);
}
if
(
widget
.
scanWindow
!=
null
&&
scanWindow
==
null
)
{
scanWindow
=
calculateScanWindowRelativeToTextureInPercentage
(
widget
.
fit
,
widget
.
scanWindow
!,
value
.
size
,
size
,
);
_controller
.
updateScanWindow
(
scanWindow
);
}
if
(
widget
.
overlay
!=
null
)
{
return
Stack
(
alignment:
Alignment
.
center
,
children:
[
_scanner
(
value
.
size
,
value
.
webId
,
value
.
textureId
),
widget
.
overlay
!,
],
);
}
else
{
return
_scanner
(
value
.
size
,
value
.
webId
,
value
.
textureId
);
}
return
LayoutBuilder
(
builder:
(
context
,
constraints
)
{
return
ValueListenableBuilder
<
MobileScannerArguments
?>(
valueListenable:
_controller
.
startArguments
,
builder:
(
context
,
value
,
child
)
{
if
(
value
==
null
)
{
return
_buildPlaceholderOrError
(
context
,
child
);
}
if
(
widget
.
scanWindow
!=
null
&&
scanWindow
==
null
)
{
scanWindow
=
calculateScanWindowRelativeToTextureInPercentage
(
widget
.
fit
,
widget
.
scanWindow
!,
value
.
size
,
Size
(
constraints
.
maxWidth
,
constraints
.
maxHeight
),
);
_controller
.
updateScanWindow
(
scanWindow
);
}
if
(
widget
.
overlay
!=
null
)
{
return
Stack
(
alignment:
Alignment
.
center
,
children:
[
_scanner
(
value
.
size
,
value
.
webId
,
value
.
textureId
),
widget
.
overlay
!,
],
);
}
else
{
return
_scanner
(
value
.
size
,
value
.
webId
,
value
.
textureId
);
}
},
);
},
);
}
...
...
Please
register
or
login
to post a comment