main.dart
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import 'package:flutter/material.dart';
import 'package:mobile_scanner_example/barcode_scanner_analyze_image.dart';
import 'package:mobile_scanner_example/barcode_scanner_controller.dart';
import 'package:mobile_scanner_example/barcode_scanner_listview.dart';
import 'package:mobile_scanner_example/barcode_scanner_pageview.dart';
import 'package:mobile_scanner_example/barcode_scanner_returning_image.dart';
import 'package:mobile_scanner_example/barcode_scanner_simple.dart';
import 'package:mobile_scanner_example/barcode_scanner_window.dart';
import 'package:mobile_scanner_example/barcode_scanner_zoom.dart';
import 'package:mobile_scanner_example/mobile_scanner_overlay.dart';
import 'package:mobile_scanner_example/picklist/picklist_result.dart';
void main() {
runApp(
const MaterialApp(
title: 'Mobile Scanner Example',
home: MyHome(),
),
);
}
class MyHome extends StatelessWidget {
const MyHome({super.key});
Widget _buildItem(BuildContext context, String label, Widget page) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: ElevatedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => page,
),
);
},
child: Text(label),
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Mobile Scanner Example')),
body: Center(
child: ListView(
children: [
_buildItem(
context,
'MobileScanner Simple',
const BarcodeScannerSimple(),
),
_buildItem(
context,
'MobileScanner with ListView',
const BarcodeScannerListView(),
),
_buildItem(
context,
'MobileScanner with Controller',
const BarcodeScannerWithController(),
),
_buildItem(
context,
'MobileScanner with ScanWindow',
const BarcodeScannerWithScanWindow(),
),
_buildItem(
context,
'MobileScanner with Controller (return image)',
const BarcodeScannerReturningImage(),
),
_buildItem(
context,
'MobileScanner with zoom slider',
const BarcodeScannerWithZoom(),
),
_buildItem(
context,
'MobileScanner with PageView',
const BarcodeScannerPageView(),
),
_buildItem(
context,
'MobileScanner with Overlay',
const BarcodeScannerWithOverlay(),
),
_buildItem(
context,
'Analyze image from file',
const BarcodeScannerAnalyzeImage(),
),
_buildItem(
context,
'Picklist mode',
const PicklistResult(),
),
],
),
),
);
}
}