Skip to content

Commit de6affa

Browse files
Project Start
0 parents  commit de6affa

15 files changed

+594
-0
lines changed

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
**/doc/api/
26+
**/ios/Flutter/.last_build_id
27+
.dart_tool/
28+
.flutter-plugins
29+
.flutter-plugins-dependencies
30+
.packages
31+
.pub-cache/
32+
.pub/
33+
/build/
34+
35+
# Symbolication related
36+
app.*.symbols
37+
38+
# Obfuscation related
39+
app.*.map.json
40+
41+
# Android Studio will place build artifacts here
42+
/android/app/debug
43+
/android/app/profile
44+
/android/app/release
45+
46+
/android
47+
/windows
48+
/macos
49+
/linux
50+
/ios

.metadata

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled.
5+
6+
version:
7+
revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
8+
channel: stable
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
17+
base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
18+
- platform: android
19+
create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
20+
base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
21+
- platform: ios
22+
create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
23+
base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
24+
- platform: linux
25+
create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
26+
base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
27+
- platform: macos
28+
create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
29+
base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
30+
- platform: web
31+
create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
32+
base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
33+
- platform: windows
34+
create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
35+
base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# qr_code_auth
2+
3+
A new Flutter project.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter application.
8+
9+
A few resources to get you started if this is your first Flutter project:
10+
11+
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13+
14+
For help getting started with Flutter development, view the
15+
[online documentation](https://docs.flutter.dev/), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.

analysis_options.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
24+
rules:
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

lib/main.dart

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import 'dart:async';
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:flutter/services.dart';
5+
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
6+
7+
void main() => runApp(MyApp());
8+
9+
class MyApp extends StatefulWidget {
10+
@override
11+
_MyAppState createState() => _MyAppState();
12+
}
13+
14+
class _MyAppState extends State<MyApp> {
15+
String _scanBarcode = 'Unknown';
16+
17+
@override
18+
void initState() {
19+
super.initState();
20+
}
21+
22+
Future<void> startBarcodeScanStream() async {
23+
FlutterBarcodeScanner.getBarcodeStreamReceiver(
24+
'#ff6666', 'Cancel', true, ScanMode.BARCODE)!
25+
.listen((barcode) => print(barcode));
26+
}
27+
28+
Future<void> scanQR() async {
29+
String barcodeScanRes;
30+
31+
try {
32+
barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
33+
'#ff6666', 'Cancel', true, ScanMode.QR);
34+
print(barcodeScanRes);
35+
} on PlatformException {
36+
barcodeScanRes = 'Failed to get platform version.';
37+
}
38+
39+
if (!mounted) return;
40+
41+
setState(() {
42+
_scanBarcode = barcodeScanRes;
43+
});
44+
}
45+
46+
Future<void> scanBarcodeNormal() async {
47+
String barcodeScanRes;
48+
49+
try {
50+
barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
51+
'#ff6666', 'Cancel', true, ScanMode.BARCODE);
52+
print(barcodeScanRes);
53+
} on PlatformException {
54+
barcodeScanRes = 'Failed to get platform version.';
55+
}
56+
57+
if (!mounted) return;
58+
59+
setState(() {
60+
_scanBarcode = barcodeScanRes;
61+
});
62+
}
63+
64+
@override
65+
Widget build(BuildContext context) {
66+
return MaterialApp(
67+
home: Scaffold(
68+
appBar: AppBar(
69+
title: const Text('Barcode scan'),
70+
),
71+
body: Builder(
72+
builder: (BuildContext context) {
73+
return Container(
74+
alignment: Alignment.center,
75+
child: Flex(
76+
direction: Axis.vertical,
77+
mainAxisAlignment: MainAxisAlignment.center,
78+
children: <Widget>[
79+
ElevatedButton(
80+
onPressed: () => scanBarcodeNormal(),
81+
child: const Text('Barcode scan'),
82+
),
83+
ElevatedButton(
84+
onPressed: () => scanQR(),
85+
child: const Text('QR scan'),
86+
),
87+
ElevatedButton(
88+
onPressed: () => startBarcodeScanStream(),
89+
child: const Text('Start barcode scan stream'),
90+
),
91+
Text(
92+
'Scan result : $_scanBarcode\n',
93+
style: const TextStyle(fontSize: 20),
94+
)
95+
],
96+
),
97+
);
98+
},
99+
),
100+
),
101+
);
102+
}
103+
}

lib/qr_reader_doc_sample.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// /*
2+
// * QR.Flutter
3+
// * Copyright (c) 2019 the QR.Flutter authors.
4+
// * See LICENSE for distribution and usage details.
5+
// */
6+
7+
// import 'package:flutter/material.dart';
8+
// import 'package:flutter/services.dart';
9+
10+
// void main() => runApp(ExampleApp());
11+
12+
// /// The example application class
13+
// class ExampleApp extends StatelessWidget {
14+
// // This widget is the root of your application.
15+
// @override
16+
// Widget build(BuildContext context) {
17+
// SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
18+
// statusBarColor: Colors.white,
19+
// statusBarIconBrightness: Brightness.dark,
20+
// systemNavigationBarColor: Colors.white,
21+
// systemNavigationBarIconBrightness: Brightness.dark,
22+
// ));
23+
// return MaterialApp(
24+
// title: 'QR.Flutter',
25+
// theme: ThemeData.light(),
26+
// debugShowCheckedModeBanner: false,
27+
// home: MainScreen(),
28+
// );
29+
// }
30+
// }

0 commit comments

Comments
 (0)