Showing
1 changed file
with
5 additions
and
3 deletions
| @@ -179,6 +179,8 @@ class _MobileScannerState extends State<MobileScanner> | @@ -179,6 +179,8 @@ class _MobileScannerState extends State<MobileScanner> | ||
| 179 | ); | 179 | ); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | + Rect? scanWindow; | ||
| 183 | + | ||
| 182 | @override | 184 | @override |
| 183 | Widget build(BuildContext context) { | 185 | Widget build(BuildContext context) { |
| 184 | return LayoutBuilder( | 186 | return LayoutBuilder( |
| @@ -191,14 +193,14 @@ class _MobileScannerState extends State<MobileScanner> | @@ -191,14 +193,14 @@ class _MobileScannerState extends State<MobileScanner> | ||
| 191 | const ColoredBox(color: Colors.black); | 193 | const ColoredBox(color: Colors.black); |
| 192 | } | 194 | } |
| 193 | 195 | ||
| 194 | - if (widget.scanWindow != null) { | ||
| 195 | - final window = calculateScanWindowRelativeToTextureInPercentage( | 196 | + if (widget.scanWindow != null && scanWindow == null) { |
| 197 | + scanWindow = calculateScanWindowRelativeToTextureInPercentage( | ||
| 196 | widget.fit, | 198 | widget.fit, |
| 197 | widget.scanWindow!, | 199 | widget.scanWindow!, |
| 198 | value.size, | 200 | value.size, |
| 199 | Size(constraints.maxWidth, constraints.maxHeight), | 201 | Size(constraints.maxWidth, constraints.maxHeight), |
| 200 | ); | 202 | ); |
| 201 | - _controller.updateScanWindow(window); | 203 | + _controller.updateScanWindow(scanWindow!); |
| 202 | } | 204 | } |
| 203 | 205 | ||
| 204 | return ClipRect( | 206 | return ClipRect( |
-
Please register or login to post a comment