Skip to content

Commit

Permalink
style: flutter lints
Browse files Browse the repository at this point in the history
  • Loading branch information
juliansteenbakker committed Feb 16, 2022
1 parent 2488852 commit dc7f855
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 19 deletions.
2 changes: 0 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:mobile_scanner/mobile_scanner.dart';

Expand Down
8 changes: 4 additions & 4 deletions example/lib/mobile_scanner_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class _AnalyzeViewState extends State<AnalyzeView>

// CameraController cameraController = CameraController(context, width: 320, height: 150);

String? barcode = null;
String? barcode;

@override
Widget build(BuildContext context) {
Expand All @@ -37,13 +37,13 @@ class _AnalyzeViewState extends State<AnalyzeView>
this.barcode = barcode.rawValue;
if (barcode.corners != null) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('${barcode.rawValue}'),
content: Text(barcode.rawValue),
duration: const Duration(milliseconds: 200),
animation: null,
));
setState(() {
final List<Offset> points = [];
double factorWidth = args.size.width / 520;
// double factorWidth = args.size.width / 520;
// double factorHeight = wanted / args.size.height;
final size = MediaQuery.of(context).devicePixelRatio;
debugPrint('Size: ${barcode.corners}');
Expand Down Expand Up @@ -109,7 +109,7 @@ class OpenPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
var paint1 = Paint()
..color = Color(0xff63aa65)
..color = const Color(0xff63aa65)
..strokeWidth = 10;
//draw points on canvas
canvas.drawPoints(PointMode.points, points, paint1);
Expand Down
3 changes: 0 additions & 3 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:mobile_scanner_example/main.dart';

void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
Expand Down
3 changes: 2 additions & 1 deletion lib/src/mobile_scanner_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ class MobileScannerController {
final Map<String, dynamic>? startResult = await methodChannel
.invokeMapMethod<String, dynamic>('start', arguments);

if (startResult == null)
if (startResult == null) {
throw PlatformException(code: 'INITIALIZATION ERROR');
}

hasTorch = startResult['torchable'];
args.value = MobileScannerArguments(
Expand Down
8 changes: 4 additions & 4 deletions lib/src/objects/barcode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ enum BarcodeFormat {
/// Barcode format constant for Data Matrix.
///
/// Constant Value: 16
data_matrix,
dataMatrix,

/// Barcode format constant for EAN-13.
///
Expand All @@ -510,17 +510,17 @@ enum BarcodeFormat {
/// Barcode format constant for QR Code.
///
/// Constant Value: 256
qr_code,
qrCode,

/// Barcode format constant for UPC-A.
///
/// Constant Value: 512
upc_a,
upcA,

/// Barcode format constant for UPC-E.
///
/// Constant Value: 1024
upc_e,
upcE,

/// Barcode format constant for PDF-417.
///
Expand Down
8 changes: 4 additions & 4 deletions lib/src/objects/barcode_utility.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ BarcodeFormat toFormat(int value) {
case 8:
return BarcodeFormat.codebar;
case 16:
return BarcodeFormat.data_matrix;
return BarcodeFormat.dataMatrix;
case 32:
return BarcodeFormat.ean13;
case 64:
return BarcodeFormat.ean8;
case 128:
return BarcodeFormat.itf;
case 256:
return BarcodeFormat.qr_code;
return BarcodeFormat.qrCode;
case 512:
return BarcodeFormat.upc_a;
return BarcodeFormat.upcA;
case 1024:
return BarcodeFormat.upc_e;
return BarcodeFormat.upcE;
case 2048:
return BarcodeFormat.pdf417;
case 4096:
Expand Down
1 change: 0 additions & 1 deletion test/mobile_scanner_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mobile_scanner/src/mobile_scanner.dart';

void main() {
const MethodChannel channel = MethodChannel('mobile_scanner');
Expand Down

0 comments on commit dc7f855

Please sign in to comment.