Skip to content

Commit ae45ee3

Browse files
committed
code formatting
1 parent c7af6e2 commit ae45ee3

File tree

4 files changed

+43
-42
lines changed

4 files changed

+43
-42
lines changed

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

lib/ai_barcode_scanner.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
library ai_barcode_scanner;
22

3-
export 'src/ai_barcode_scanner.dart';
43
export 'package:mobile_scanner/mobile_scanner.dart';
4+
5+
export 'src/ai_barcode_scanner.dart';
56
export 'src/overlay.dart';

lib/src/ai_barcode_scanner.dart

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -184,23 +184,6 @@ class _AiBarcodeScannerState extends State<AiBarcodeScanner> {
184184
/// Scanner controller
185185
late MobileScannerController controller;
186186

187-
@override
188-
void initState() {
189-
controller = widget.controller ?? MobileScannerController();
190-
super.initState();
191-
}
192-
193-
@override
194-
void dispose() {
195-
controller.dispose();
196-
super.dispose();
197-
198-
/// calls onDispose function if it is not null
199-
if (widget.onDispose != null) {
200-
widget.onDispose!.call();
201-
}
202-
}
203-
204187
@override
205188
Widget build(BuildContext context) {
206189
/// keeps the app in portrait mode
@@ -363,4 +346,21 @@ class _AiBarcodeScannerState extends State<AiBarcodeScanner> {
363346
),
364347
);
365348
}
349+
350+
@override
351+
void dispose() {
352+
controller.dispose();
353+
super.dispose();
354+
355+
/// calls onDispose function if it is not null
356+
if (widget.onDispose != null) {
357+
widget.onDispose!.call();
358+
}
359+
}
360+
361+
@override
362+
void initState() {
363+
controller = widget.controller ?? MobileScannerController();
364+
super.initState();
365+
}
366366
}

lib/src/overlay.dart

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,6 @@ import 'dart:math';
33
import 'package:flutter/material.dart';
44

55
class OverlayShape extends ShapeBorder {
6-
OverlayShape({
7-
this.borderColor = Colors.red,
8-
this.borderWidth = 4.0,
9-
this.overlayColor = const Color.fromRGBO(0, 0, 0, 80),
10-
this.borderRadius = 0,
11-
this.borderLength = 42,
12-
double? cutOutSize,
13-
double? cutOutWidth,
14-
double? cutOutHeight,
15-
this.cutOutBottomOffset = 0,
16-
}) : cutOutWidth = cutOutWidth ?? cutOutSize ?? 250,
17-
cutOutHeight = cutOutHeight ?? cutOutSize ?? 250 {
18-
assert(
19-
borderLength <=
20-
min(this.cutOutWidth, this.cutOutHeight) / 2 + borderWidth * 2,
21-
"Border can't be larger than ${min(this.cutOutWidth, this.cutOutHeight) / 2 + borderWidth * 2}",
22-
);
23-
assert(
24-
(cutOutWidth == null && cutOutHeight == null) ||
25-
(cutOutSize == 0.0 && cutOutWidth != null && cutOutHeight != null),
26-
'Use only cutOutWidth and cutOutHeight or only cutOutSize');
27-
}
28-
296
/// Color of the border.
307
final Color borderColor;
318

@@ -50,6 +27,29 @@ class OverlayShape extends ShapeBorder {
5027
/// Bottom offset of the cut out.
5128
final double cutOutBottomOffset;
5229

30+
OverlayShape({
31+
this.borderColor = Colors.red,
32+
this.borderWidth = 4.0,
33+
this.overlayColor = const Color.fromRGBO(0, 0, 0, 80),
34+
this.borderRadius = 0,
35+
this.borderLength = 42,
36+
double? cutOutSize,
37+
double? cutOutWidth,
38+
double? cutOutHeight,
39+
this.cutOutBottomOffset = 0,
40+
}) : cutOutWidth = cutOutWidth ?? cutOutSize ?? 250,
41+
cutOutHeight = cutOutHeight ?? cutOutSize ?? 250 {
42+
assert(
43+
borderLength <=
44+
min(this.cutOutWidth, this.cutOutHeight) / 2 + borderWidth * 2,
45+
"Border can't be larger than ${min(this.cutOutWidth, this.cutOutHeight) / 2 + borderWidth * 2}",
46+
);
47+
assert(
48+
(cutOutWidth == null && cutOutHeight == null) ||
49+
(cutOutSize == 0.0 && cutOutWidth != null && cutOutHeight != null),
50+
'Use only cutOutWidth and cutOutHeight or only cutOutSize');
51+
}
52+
5353
@override
5454
EdgeInsetsGeometry get dimensions => const EdgeInsets.all(10);
5555

0 commit comments

Comments
 (0)