Julian Steenbakker

style: flutter format

@@ -18,8 +18,10 @@ class _AnalyzeViewState extends State<AnalyzeView> @@ -18,8 +18,10 @@ class _AnalyzeViewState extends State<AnalyzeView>
18 with SingleTickerProviderStateMixin { 18 with SingleTickerProviderStateMixin {
19 String? barcode; 19 String? barcode;
20 20
21 - MobileScannerController controller = MobileScannerController(torchEnabled: true,  
22 - facing: CameraFacing.front,); 21 + MobileScannerController controller = MobileScannerController(
  22 + torchEnabled: true,
  23 + facing: CameraFacing.front,
  24 + );
23 25
24 @override 26 @override
25 Widget build(BuildContext context) { 27 Widget build(BuildContext context) {
@@ -60,9 +62,11 @@ class _AnalyzeViewState extends State<AnalyzeView> @@ -60,9 +62,11 @@ class _AnalyzeViewState extends State<AnalyzeView>
60 builder: (context, state, child) { 62 builder: (context, state, child) {
61 switch (state as TorchState) { 63 switch (state as TorchState) {
62 case TorchState.off: 64 case TorchState.off:
63 - return const Icon(Icons.flash_off, color: Colors.grey); 65 + return const Icon(Icons.flash_off,
  66 + color: Colors.grey);
64 case TorchState.on: 67 case TorchState.on:
65 - return const Icon(Icons.flash_on, color: Colors.yellow); 68 + return const Icon(Icons.flash_on,
  69 + color: Colors.yellow);
66 } 70 }
67 }, 71 },
68 ), 72 ),
@@ -48,9 +48,10 @@ class _AnalyzeViewState extends State<AnalyzeView> @@ -48,9 +48,10 @@ class _AnalyzeViewState extends State<AnalyzeView>
48 final size = MediaQuery.of(context).devicePixelRatio; 48 final size = MediaQuery.of(context).devicePixelRatio;
49 debugPrint('Size: ${barcode.corners}'); 49 debugPrint('Size: ${barcode.corners}');
50 for (var point in barcode.corners!) { 50 for (var point in barcode.corners!) {
51 - final adjustedWith = point.dx ;  
52 - final adjustedHeight= point.dy ;  
53 - points.add(Offset(adjustedWith / size, adjustedHeight / size)); 51 + final adjustedWith = point.dx;
  52 + final adjustedHeight = point.dy;
  53 + points.add(
  54 + Offset(adjustedWith / size, adjustedHeight / size));
54 // points.add(Offset((point.dx ) / size, 55 // points.add(Offset((point.dx ) / size,
55 // (point.dy) / size)); 56 // (point.dy) / size));
56 // final differenceWidth = (args.wantedSize!.width - args.size.width) / 2; 57 // final differenceWidth = (args.wantedSize!.width - args.size.width) / 2;
@@ -3,10 +3,7 @@ import 'package:mobile_scanner/mobile_scanner.dart'; @@ -3,10 +3,7 @@ import 'package:mobile_scanner/mobile_scanner.dart';
3 3
4 import 'mobile_scanner_arguments.dart'; 4 import 'mobile_scanner_arguments.dart';
5 5
6 -enum Ratio {  
7 - ratio_4_3,  
8 - ratio_16_9  
9 -} 6 +enum Ratio { ratio_4_3, ratio_16_9 }
10 7
11 /// A widget showing a live camera preview. 8 /// A widget showing a live camera preview.
12 class MobileScanner extends StatefulWidget { 9 class MobileScanner extends StatefulWidget {
@@ -18,7 +15,8 @@ class MobileScanner extends StatefulWidget { @@ -18,7 +15,8 @@ class MobileScanner extends StatefulWidget {
18 /// Create a [MobileScanner] with a [controller], the [controller] must has been initialized. 15 /// Create a [MobileScanner] with a [controller], the [controller] must has been initialized.
19 const MobileScanner( 16 const MobileScanner(
20 {Key? key, this.onDetect, this.controller, this.fit = BoxFit.cover}) 17 {Key? key, this.onDetect, this.controller, this.fit = BoxFit.cover})
21 - : assert((controller != null )), super(key: key); 18 + : assert((controller != null)),
  19 + super(key: key);
22 20
23 @override 21 @override
24 State<MobileScanner> createState() => _MobileScannerState(); 22 State<MobileScanner> createState() => _MobileScannerState();
@@ -11,5 +11,6 @@ class MobileScannerArguments { @@ -11,5 +11,6 @@ class MobileScannerArguments {
11 final bool hasTorch; 11 final bool hasTorch;
12 12
13 /// Create a [MobileScannerArguments]. 13 /// Create a [MobileScannerArguments].
14 - MobileScannerArguments({required this.textureId,required this.size, required this.hasTorch}); 14 + MobileScannerArguments(
  15 + {required this.textureId, required this.size, required this.hasTorch});
15 } 16 }
@@ -38,7 +38,6 @@ class MobileScannerController { @@ -38,7 +38,6 @@ class MobileScannerController {
38 int? _controllerHashcode; 38 int? _controllerHashcode;
39 StreamSubscription? events; 39 StreamSubscription? events;
40 40
41 -  
42 final ValueNotifier<MobileScannerArguments?> args = ValueNotifier(null); 41 final ValueNotifier<MobileScannerArguments?> args = ValueNotifier(null);
43 final ValueNotifier<TorchState> torchState = ValueNotifier(TorchState.off); 42 final ValueNotifier<TorchState> torchState = ValueNotifier(TorchState.off);
44 late final ValueNotifier<CameraFacing> cameraFacingState; 43 late final ValueNotifier<CameraFacing> cameraFacingState;
@@ -107,7 +106,8 @@ class MobileScannerController { @@ -107,7 +106,8 @@ class MobileScannerController {
107 106
108 setAnalyzeMode(AnalyzeMode.barcode.index); 107 setAnalyzeMode(AnalyzeMode.barcode.index);
109 // Check authorization status 108 // Check authorization status
110 - MobileScannerState state = MobileScannerState.values[await methodChannel.invokeMethod('state')]; 109 + MobileScannerState state =
  110 + MobileScannerState.values[await methodChannel.invokeMethod('state')];
111 switch (state) { 111 switch (state) {
112 case MobileScannerState.undetermined: 112 case MobileScannerState.undetermined:
113 final bool result = await methodChannel.invokeMethod('request'); 113 final bool result = await methodChannel.invokeMethod('request');
@@ -129,13 +129,17 @@ class MobileScannerController { @@ -129,13 +129,17 @@ class MobileScannerController {
129 if (torchEnabled != null) arguments['torch'] = torchEnabled; 129 if (torchEnabled != null) arguments['torch'] = torchEnabled;
130 130
131 // Start the camera with arguments 131 // Start the camera with arguments
132 - final Map<String, dynamic>? startResult = await methodChannel.invokeMapMethod<String, dynamic>(  
133 - 'start', arguments); 132 + final Map<String, dynamic>? startResult = await methodChannel
  133 + .invokeMapMethod<String, dynamic>('start', arguments);
134 134
135 - if (startResult == null) throw PlatformException(code: 'INITIALIZATION ERROR'); 135 + if (startResult == null)
  136 + throw PlatformException(code: 'INITIALIZATION ERROR');
136 137
137 hasTorch = startResult['torchable']; 138 hasTorch = startResult['torchable'];
138 - args.value = MobileScannerArguments(textureId: startResult['textureId'], size: toSize(startResult['size']), hasTorch: hasTorch); 139 + args.value = MobileScannerArguments(
  140 + textureId: startResult['textureId'],
  141 + size: toSize(startResult['size']),
  142 + hasTorch: hasTorch);
139 } 143 }
140 144
141 Future<void> stop() async => await methodChannel.invokeMethod('stop'); 145 Future<void> stop() async => await methodChannel.invokeMethod('stop');
@@ -157,7 +161,8 @@ class MobileScannerController { @@ -157,7 +161,8 @@ class MobileScannerController {
157 Future<void> switchCamera() async { 161 Future<void> switchCamera() async {
158 ensure('switchCamera'); 162 ensure('switchCamera');
159 await stop(); 163 await stop();
160 - facing = facing == CameraFacing.back ? CameraFacing.front : CameraFacing.back; 164 + facing =
  165 + facing == CameraFacing.back ? CameraFacing.front : CameraFacing.back;
161 start(); 166 start();
162 } 167 }
163 168
@@ -16,5 +16,4 @@ void main() { @@ -16,5 +16,4 @@ void main() {
16 tearDown(() { 16 tearDown(() {
17 channel.setMockMethodCallHandler(null); 17 channel.setMockMethodCallHandler(null);
18 }); 18 });
19 -  
20 } 19 }