Showing
1 changed file
with
18 additions
and
12 deletions
| @@ -255,11 +255,23 @@ class _MobileScannerState extends State<MobileScanner> | @@ -255,11 +255,23 @@ class _MobileScannerState extends State<MobileScanner> | ||
| 255 | 255 | ||
| 256 | _controller.updateScanWindow(scanWindow); | 256 | _controller.updateScanWindow(scanWindow); |
| 257 | } | 257 | } |
| 258 | - | 258 | + if (widget.overlay != null) { |
| 259 | return Stack( | 259 | return Stack( |
| 260 | alignment: Alignment.center, | 260 | alignment: Alignment.center, |
| 261 | children: [ | 261 | children: [ |
| 262 | - ClipRect( | 262 | + _scanner(value.size, value.webId, value.textureId), |
| 263 | + widget.overlay! | ||
| 264 | + ], | ||
| 265 | + ); | ||
| 266 | + } else { | ||
| 267 | + return _scanner(value.size, value.webId, value.textureId); | ||
| 268 | + } | ||
| 269 | + }, | ||
| 270 | + ); | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + Widget _scanner(Size size, String? webId, int? textureId) { | ||
| 274 | + return ClipRect( | ||
| 263 | child: LayoutBuilder( | 275 | child: LayoutBuilder( |
| 264 | builder: (_, constraints) { | 276 | builder: (_, constraints) { |
| 265 | return SizedBox.fromSize( | 277 | return SizedBox.fromSize( |
| @@ -267,22 +279,16 @@ class _MobileScannerState extends State<MobileScanner> | @@ -267,22 +279,16 @@ class _MobileScannerState extends State<MobileScanner> | ||
| 267 | child: FittedBox( | 279 | child: FittedBox( |
| 268 | fit: widget.fit, | 280 | fit: widget.fit, |
| 269 | child: SizedBox( | 281 | child: SizedBox( |
| 270 | - width: value.size.width, | ||
| 271 | - height: value.size.height, | 282 | + width: size.width, |
| 283 | + height: size.height, | ||
| 272 | child: kIsWeb | 284 | child: kIsWeb |
| 273 | - ? HtmlElementView(viewType: value.webId!) | ||
| 274 | - : Texture(textureId: value.textureId!), | 285 | + ? HtmlElementView(viewType: webId!) |
| 286 | + : Texture(textureId: textureId!), | ||
| 275 | ), | 287 | ), |
| 276 | ), | 288 | ), |
| 277 | ); | 289 | ); |
| 278 | }, | 290 | }, |
| 279 | ), | 291 | ), |
| 280 | - ), | ||
| 281 | - if (widget.overlay != null) | ||
| 282 | - widget.overlay! | ||
| 283 | - ], | ||
| 284 | - ); | ||
| 285 | - }, | ||
| 286 | ); | 292 | ); |
| 287 | } | 293 | } |
| 288 | 294 |
-
Please register or login to post a comment