Fix: On Android the X and Y seems to be swapped. (Also the order of corners seem…
…s not correct, but that does not influence this use-case.
Showing
1 changed file
with
5 additions
and
1 deletions
| 1 | +import 'dart:io'; | ||
| 2 | + | ||
| 1 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 2 | import 'package:mobile_scanner/mobile_scanner.dart'; | 4 | import 'package:mobile_scanner/mobile_scanner.dart'; |
| 3 | 5 | ||
| @@ -7,7 +9,9 @@ import 'package:mobile_scanner/mobile_scanner.dart'; | @@ -7,7 +9,9 @@ import 'package:mobile_scanner/mobile_scanner.dart'; | ||
| 7 | /// | 9 | /// |
| 8 | /// https://github.com/juliansteenbakker/mobile_scanner/issues/1183 | 10 | /// https://github.com/juliansteenbakker/mobile_scanner/issues/1183 |
| 9 | Barcode? findBarcodeAtCenter(BarcodeCapture barcodeCapture) { | 11 | Barcode? findBarcodeAtCenter(BarcodeCapture barcodeCapture) { |
| 10 | - final imageSize = barcodeCapture.size; | 12 | + final imageSize = Platform.isAndroid |
| 13 | + ? Size(barcodeCapture.size.height, barcodeCapture.size.width) | ||
| 14 | + : barcodeCapture.size; | ||
| 11 | for (final barcode in barcodeCapture.barcodes) { | 15 | for (final barcode in barcodeCapture.barcodes) { |
| 12 | if (_isPolygonTouchingTheCenter( | 16 | if (_isPolygonTouchingTheCenter( |
| 13 | imageSize: imageSize, | 17 | imageSize: imageSize, |
-
Please register or login to post a comment