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