Showing
7 changed files
with
14 additions
and
19 deletions
| @@ -20,7 +20,7 @@ class _AnalyzeViewState extends State<AnalyzeView> | @@ -20,7 +20,7 @@ class _AnalyzeViewState extends State<AnalyzeView> | ||
| 20 | 20 | ||
| 21 | // CameraController cameraController = CameraController(context, width: 320, height: 150); | 21 | // CameraController cameraController = CameraController(context, width: 320, height: 150); |
| 22 | 22 | ||
| 23 | - String? barcode = null; | 23 | + String? barcode; |
| 24 | 24 | ||
| 25 | @override | 25 | @override |
| 26 | Widget build(BuildContext context) { | 26 | Widget build(BuildContext context) { |
| @@ -37,13 +37,13 @@ class _AnalyzeViewState extends State<AnalyzeView> | @@ -37,13 +37,13 @@ class _AnalyzeViewState extends State<AnalyzeView> | ||
| 37 | this.barcode = barcode.rawValue; | 37 | this.barcode = barcode.rawValue; |
| 38 | if (barcode.corners != null) { | 38 | if (barcode.corners != null) { |
| 39 | ScaffoldMessenger.of(context).showSnackBar(SnackBar( | 39 | ScaffoldMessenger.of(context).showSnackBar(SnackBar( |
| 40 | - content: Text('${barcode.rawValue}'), | 40 | + content: Text(barcode.rawValue), |
| 41 | duration: const Duration(milliseconds: 200), | 41 | duration: const Duration(milliseconds: 200), |
| 42 | animation: null, | 42 | animation: null, |
| 43 | )); | 43 | )); |
| 44 | setState(() { | 44 | setState(() { |
| 45 | final List<Offset> points = []; | 45 | final List<Offset> points = []; |
| 46 | - double factorWidth = args.size.width / 520; | 46 | + // double factorWidth = args.size.width / 520; |
| 47 | // double factorHeight = wanted / args.size.height; | 47 | // double factorHeight = wanted / args.size.height; |
| 48 | final size = MediaQuery.of(context).devicePixelRatio; | 48 | final size = MediaQuery.of(context).devicePixelRatio; |
| 49 | debugPrint('Size: ${barcode.corners}'); | 49 | debugPrint('Size: ${barcode.corners}'); |
| @@ -109,7 +109,7 @@ class OpenPainter extends CustomPainter { | @@ -109,7 +109,7 @@ class OpenPainter extends CustomPainter { | ||
| 109 | @override | 109 | @override |
| 110 | void paint(Canvas canvas, Size size) { | 110 | void paint(Canvas canvas, Size size) { |
| 111 | var paint1 = Paint() | 111 | var paint1 = Paint() |
| 112 | - ..color = Color(0xff63aa65) | 112 | + ..color = const Color(0xff63aa65) |
| 113 | ..strokeWidth = 10; | 113 | ..strokeWidth = 10; |
| 114 | //draw points on canvas | 114 | //draw points on canvas |
| 115 | canvas.drawPoints(PointMode.points, points, paint1); | 115 | canvas.drawPoints(PointMode.points, points, paint1); |
| @@ -5,11 +5,8 @@ | @@ -5,11 +5,8 @@ | ||
| 5 | // gestures. You can also use WidgetTester to find child widgets in the widget | 5 | // gestures. You can also use WidgetTester to find child widgets in the widget |
| 6 | // tree, read text, and verify that the values of widget properties are correct. | 6 | // tree, read text, and verify that the values of widget properties are correct. |
| 7 | 7 | ||
| 8 | -import 'package:flutter/material.dart'; | ||
| 9 | import 'package:flutter_test/flutter_test.dart'; | 8 | import 'package:flutter_test/flutter_test.dart'; |
| 10 | 9 | ||
| 11 | -import 'package:mobile_scanner_example/main.dart'; | ||
| 12 | - | ||
| 13 | void main() { | 10 | void main() { |
| 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { | 11 | testWidgets('Verify Platform version', (WidgetTester tester) async { |
| 15 | // Build our app and trigger a frame. | 12 | // Build our app and trigger a frame. |
| @@ -132,8 +132,9 @@ class MobileScannerController { | @@ -132,8 +132,9 @@ class MobileScannerController { | ||
| 132 | final Map<String, dynamic>? startResult = await methodChannel | 132 | final Map<String, dynamic>? startResult = await methodChannel |
| 133 | .invokeMapMethod<String, dynamic>('start', arguments); | 133 | .invokeMapMethod<String, dynamic>('start', arguments); |
| 134 | 134 | ||
| 135 | - if (startResult == null) | 135 | + if (startResult == null) { |
| 136 | throw PlatformException(code: 'INITIALIZATION ERROR'); | 136 | throw PlatformException(code: 'INITIALIZATION ERROR'); |
| 137 | + } | ||
| 137 | 138 | ||
| 138 | hasTorch = startResult['torchable']; | 139 | hasTorch = startResult['torchable']; |
| 139 | args.value = MobileScannerArguments( | 140 | args.value = MobileScannerArguments( |
| @@ -490,7 +490,7 @@ enum BarcodeFormat { | @@ -490,7 +490,7 @@ enum BarcodeFormat { | ||
| 490 | /// Barcode format constant for Data Matrix. | 490 | /// Barcode format constant for Data Matrix. |
| 491 | /// | 491 | /// |
| 492 | /// Constant Value: 16 | 492 | /// Constant Value: 16 |
| 493 | - data_matrix, | 493 | + dataMatrix, |
| 494 | 494 | ||
| 495 | /// Barcode format constant for EAN-13. | 495 | /// Barcode format constant for EAN-13. |
| 496 | /// | 496 | /// |
| @@ -510,17 +510,17 @@ enum BarcodeFormat { | @@ -510,17 +510,17 @@ enum BarcodeFormat { | ||
| 510 | /// Barcode format constant for QR Code. | 510 | /// Barcode format constant for QR Code. |
| 511 | /// | 511 | /// |
| 512 | /// Constant Value: 256 | 512 | /// Constant Value: 256 |
| 513 | - qr_code, | 513 | + qrCode, |
| 514 | 514 | ||
| 515 | /// Barcode format constant for UPC-A. | 515 | /// Barcode format constant for UPC-A. |
| 516 | /// | 516 | /// |
| 517 | /// Constant Value: 512 | 517 | /// Constant Value: 512 |
| 518 | - upc_a, | 518 | + upcA, |
| 519 | 519 | ||
| 520 | /// Barcode format constant for UPC-E. | 520 | /// Barcode format constant for UPC-E. |
| 521 | /// | 521 | /// |
| 522 | /// Constant Value: 1024 | 522 | /// Constant Value: 1024 |
| 523 | - upc_e, | 523 | + upcE, |
| 524 | 524 | ||
| 525 | /// Barcode format constant for PDF-417. | 525 | /// Barcode format constant for PDF-417. |
| 526 | /// | 526 | /// |
| @@ -29,7 +29,7 @@ BarcodeFormat toFormat(int value) { | @@ -29,7 +29,7 @@ BarcodeFormat toFormat(int value) { | ||
| 29 | case 8: | 29 | case 8: |
| 30 | return BarcodeFormat.codebar; | 30 | return BarcodeFormat.codebar; |
| 31 | case 16: | 31 | case 16: |
| 32 | - return BarcodeFormat.data_matrix; | 32 | + return BarcodeFormat.dataMatrix; |
| 33 | case 32: | 33 | case 32: |
| 34 | return BarcodeFormat.ean13; | 34 | return BarcodeFormat.ean13; |
| 35 | case 64: | 35 | case 64: |
| @@ -37,11 +37,11 @@ BarcodeFormat toFormat(int value) { | @@ -37,11 +37,11 @@ BarcodeFormat toFormat(int value) { | ||
| 37 | case 128: | 37 | case 128: |
| 38 | return BarcodeFormat.itf; | 38 | return BarcodeFormat.itf; |
| 39 | case 256: | 39 | case 256: |
| 40 | - return BarcodeFormat.qr_code; | 40 | + return BarcodeFormat.qrCode; |
| 41 | case 512: | 41 | case 512: |
| 42 | - return BarcodeFormat.upc_a; | 42 | + return BarcodeFormat.upcA; |
| 43 | case 1024: | 43 | case 1024: |
| 44 | - return BarcodeFormat.upc_e; | 44 | + return BarcodeFormat.upcE; |
| 45 | case 2048: | 45 | case 2048: |
| 46 | return BarcodeFormat.pdf417; | 46 | return BarcodeFormat.pdf417; |
| 47 | case 4096: | 47 | case 4096: |
| 1 | import 'package:flutter/services.dart'; | 1 | import 'package:flutter/services.dart'; |
| 2 | import 'package:flutter_test/flutter_test.dart'; | 2 | import 'package:flutter_test/flutter_test.dart'; |
| 3 | -import 'package:mobile_scanner/src/mobile_scanner.dart'; | ||
| 4 | 3 | ||
| 5 | void main() { | 4 | void main() { |
| 6 | const MethodChannel channel = MethodChannel('mobile_scanner'); | 5 | const MethodChannel channel = MethodChannel('mobile_scanner'); |
-
Please register or login to post a comment