Skip to content

Commit 250a274

Browse files
committed
first commit
1 parent 974569b commit 250a274

8 files changed

+87
-114
lines changed

analysis_options.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ linter:
2222
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
2323
# producing the lint.
2424
rules:
25-
prefer_const_constructors: false
26-
use_key_in_widget_constructors: false
27-
avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_const_constructors: false
26+
# use_key_in_widget_constructors: false
27+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
2828
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
2929

3030
# Additional information about this file can be found at

lib/generated_plugin_registrant.dart

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// ignore_for_file: directives_ordering
66
// ignore_for_file: lines_longer_than_80_chars
7+
// ignore_for_file: depend_on_referenced_packages
78

89
import 'package:url_launcher_web/url_launcher_web.dart';
910

lib/main.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import 'package:flutter/material.dart';
2-
import 'Home.dart';
2+
import 'pages/home_page.dart';
33

44
void main() {
5-
runApp(MyApp());
5+
runApp(const MyApp());
66
}
77

88
class MyApp extends StatelessWidget {
9+
const MyApp({Key? key}) : super(key: key);
10+
911
@override
1012
Widget build(BuildContext context) {
11-
return MaterialApp(
13+
return const MaterialApp(
1214
debugShowCheckedModeBanner: false,
1315
home: MyHomePage(),
1416
);

lib/QR Generator/QRGenerator.dart lib/methods/QR_generator_method.dart

+12-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// ignore_for_file: unnecessary_new, avoid_unnecessary_containers, sized_box_for_whitespace, file_names
1+
// ignore_for_file: unnecessary_new, file_names, avoid_unnecessary_containers, sized_box_for_whitespace, avoid_print
22

33
import 'package:flutter/material.dart';
4-
import 'GeneratedQR.dart';
4+
import '/pages/generated_QR_page.dart';
55

66
class QRGenerator extends StatefulWidget {
77
const QRGenerator({Key? key}) : super(key: key);
@@ -17,19 +17,18 @@ class _QRGeneratorState extends State<QRGenerator> {
1717
Widget build(BuildContext context) {
1818
return Scaffold(
1919
appBar: AppBar(
20-
title: Text(
21-
"QR Generator",
22-
),
20+
title: const Text("QR Generator"),
21+
elevation: 0,
2322
),
2423
body: Container(
2524
child: Column(
2625
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
2726
children: [
2827
Padding(
29-
padding: EdgeInsets.all(15),
28+
padding: const EdgeInsets.all(15),
3029
child: TextFormField(
3130
controller: mycontroller,
32-
decoration: InputDecoration(
31+
decoration: const InputDecoration(
3332
errorStyle: TextStyle(
3433
color: Colors.red,
3534
fontSize: 15,
@@ -49,21 +48,14 @@ class _QRGeneratorState extends State<QRGenerator> {
4948
Container(
5049
width: ((MediaQuery.of(context).size.width) / 2) - 45,
5150
height: 50,
52-
child: OutlineButton(
53-
focusColor: Colors.red,
54-
highlightColor: Colors.blue,
55-
hoverColor: Colors.lightBlue[100],
56-
splashColor: Colors.blue,
57-
borderSide: BorderSide(
58-
width: 3,
59-
color: Colors.blue,
51+
child: OutlinedButton(
52+
style: OutlinedButton.styleFrom(
53+
shape: const StadiumBorder(),
54+
side: const BorderSide(width: 3, color: Colors.blue),
6055
),
61-
shape: StadiumBorder(),
62-
child: Text(
56+
child: const Text(
6357
"Generate QR",
64-
style: TextStyle(
65-
fontSize: 17,
66-
),
58+
style: TextStyle(fontSize: 17),
6759
),
6860
onPressed: navigate,
6961
),

lib/QR Scanner/ScanQR.dart lib/methods/QR_scanner_method.dart

+28-29
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// ignore_for_file: prefer_const_constructors_in_immutables, prefer_const_constructors, prefer_typing_uninitialized_variables, sized_box_for_whitespace, avoid_unnecessary_containers, deprecated_member_use, import_of_legacy_library_into_null_safe, file_names
1+
// ignore_for_file: import_of_legacy_library_into_null_safe, file_names, prefer_typing_uninitialized_variables, sized_box_for_whitespace
22

33
import 'package:barcode_scan/barcode_scan.dart';
44
import 'package:flutter/material.dart';
55
import 'package:url_launcher/url_launcher.dart';
66

77
class ScanQR extends StatefulWidget {
8-
ScanQR({Key? key}) : super(key: key);
8+
const ScanQR({Key? key}) : super(key: key);
99

1010
@override
1111
_ScanQRState createState() => _ScanQRState();
@@ -22,7 +22,8 @@ class _ScanQRState extends State<ScanQR> {
2222
tag: "ScanQR",
2323
child: Scaffold(
2424
appBar: AppBar(
25-
title: Text("QR Scanner"),
25+
title: const Text("QR Scanner"),
26+
elevation: 0,
2627
),
2728
body: Container(
2829
width: double.infinity,
@@ -34,43 +35,41 @@ class _ScanQRState extends State<ScanQR> {
3435
mainAxisAlignment: MainAxisAlignment.center,
3536
children: [
3637
Flexible(
37-
child: Text(
38-
(qrData),
39-
textAlign: TextAlign.center,
40-
style: TextStyle(fontSize: 20),
41-
)),
38+
child: Text(
39+
(qrData),
40+
textAlign: TextAlign.center,
41+
style: const TextStyle(fontSize: 20),
42+
),
43+
),
4244
IconButton(
43-
onPressed: hasdata
44-
? () async {
45-
if (await canLaunch(qrData)) {
46-
await launch(qrData);
47-
} else {
48-
throw "Could not Launch";
49-
}
45+
onPressed: hasdata
46+
? () async {
47+
if (await canLaunch(qrData)) {
48+
await launch(qrData);
49+
} else {
50+
throw "Could not Launch";
5051
}
51-
: null,
52-
icon: Icon(Icons.edit))
52+
}
53+
: null,
54+
icon: const Icon(Icons.edit),
55+
),
5356
],
5457
),
55-
SizedBox(
56-
height: 15,
57-
),
58+
const SizedBox(height: 15),
5859
Container(
5960
width: ((MediaQuery.of(context).size.width) / 2) - 45,
6061
height: 50,
61-
child: OutlineButton(
62-
focusColor: Colors.red,
63-
highlightColor: Colors.blue,
64-
hoverColor: Colors.lightBlue[100],
65-
splashColor: Colors.blue,
66-
borderSide: BorderSide(width: 3, color: Colors.blue),
67-
shape: StadiumBorder(),
68-
child: Text(
62+
child: OutlinedButton(
63+
style: OutlinedButton.styleFrom(
64+
shape: const StadiumBorder(),
65+
side: const BorderSide(width: 3, color: Colors.blue),
66+
),
67+
child: const Text(
6968
"Scan QR",
7069
style: TextStyle(fontSize: 17),
7170
),
7271
onPressed: () async {
73-
var option = ScanOptions(autoEnableFlash: true);
72+
var option = const ScanOptions(autoEnableFlash: true);
7473
data = await BarcodeScanner.scan(options: option);
7574
setState(() {
7675
qrData = data.rawContent.toString();

lib/QR Generator/GeneratedQR.dart lib/pages/generated_QR_page.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ class _GeneratedQRState extends State<GeneratedQR> {
2121
Widget build(BuildContext context) {
2222
return Scaffold(
2323
appBar: AppBar(
24-
title: Text(
25-
"Generated QR ",
26-
),
24+
title: const Text("Generated QR "),
25+
elevation: 0,
2726
),
2827
body: Center(
2928
child: QrImage(

lib/Home.dart lib/pages/home_page.dart

+27-40
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// ignore_for_file: sized_box_for_whitespace, avoid_unnecessary_containers, file_names
22

33
import 'package:flutter/material.dart';
4-
import '/QR Generator/QRGenerator.dart';
5-
import '/QR Scanner/ScanQR.dart';
4+
import '/methods/QR_generator_method.dart';
5+
import '/methods/QR_scanner_method.dart';
66

77
class MyHomePage extends StatefulWidget {
8+
const MyHomePage({Key? key}) : super(key: key);
9+
810
@override
911
_MyHomePageState createState() => _MyHomePageState();
1012
}
@@ -15,11 +17,10 @@ class _MyHomePageState extends State<MyHomePage> {
1517
return Scaffold(
1618
backgroundColor: Colors.white,
1719
appBar: AppBar(
18-
title: Center(
19-
child: Text(
20-
"QR Scanner/Generator",
21-
),
20+
title: const Center(
21+
child: Text("QR Scanner/Generator"),
2222
),
23+
elevation: 0,
2324
),
2425
body: Container(
2526
height: MediaQuery.of(context).size.height,
@@ -34,9 +35,9 @@ class _MyHomePageState extends State<MyHomePage> {
3435
mainAxisAlignment: MainAxisAlignment.spaceAround,
3536
crossAxisAlignment: CrossAxisAlignment.center,
3637
children: [
37-
CircleAvatar(
38+
const CircleAvatar(
3839
backgroundImage: AssetImage(
39-
"images/QR.jpg",
40+
"assets/images/QR.jpg",
4041
),
4142
foregroundColor: Colors.transparent,
4243
backgroundColor: Colors.transparent,
@@ -50,63 +51,49 @@ class _MyHomePageState extends State<MyHomePage> {
5051
child: Container(
5152
width: ((MediaQuery.of(context).size.width) / 2) - 45,
5253
height: 50,
53-
child: OutlineButton(
54-
focusColor: Colors.red,
55-
highlightColor: Colors.blue,
56-
hoverColor: Colors.lightBlue[100],
57-
splashColor: Colors.blue,
58-
borderSide: BorderSide(
59-
width: 3,
60-
color: Colors.blue,
54+
child: OutlinedButton(
55+
style: OutlinedButton.styleFrom(
56+
shape: const StadiumBorder(),
57+
side:
58+
const BorderSide(width: 3, color: Colors.blue),
6159
),
62-
shape: StadiumBorder(),
63-
child: Text(
60+
child: const Text(
6461
"Scan QR",
65-
style: TextStyle(
66-
fontSize: 17,
67-
),
62+
style: TextStyle(fontSize: 17),
6863
),
6964
onPressed: () {
7065
Navigator.push(
7166
context,
7267
MaterialPageRoute(
73-
builder: (context) => ScanQR(),
68+
builder: (context) => const ScanQR(),
7469
),
7570
);
7671
},
7772
),
7873
),
7974
),
80-
SizedBox(
81-
width: 25,
82-
),
75+
const SizedBox(width: 25),
8376
Container(
8477
child: Hero(
8578
tag: "Scan QR",
8679
child: Container(
8780
width: ((MediaQuery.of(context).size.width) / 2) - 45,
8881
height: 50,
89-
child: OutlineButton(
90-
focusColor: Colors.red,
91-
highlightColor: Colors.blue,
92-
hoverColor: Colors.lightBlue[100],
93-
splashColor: Colors.blue,
94-
borderSide: BorderSide(
95-
width: 3,
96-
color: Colors.blue,
82+
child: OutlinedButton(
83+
style: OutlinedButton.styleFrom(
84+
shape: const StadiumBorder(),
85+
side: const BorderSide(
86+
width: 3, color: Colors.blue),
9787
),
98-
shape: StadiumBorder(),
99-
child: Text(
88+
child: const Text(
10089
"Generate QR",
101-
style: TextStyle(
102-
fontSize: 17,
103-
),
90+
style: TextStyle(fontSize: 17),
10491
),
10592
onPressed: () {
10693
Navigator.push(
10794
context,
10895
MaterialPageRoute(
109-
builder: (context) => QRGenerator(),
96+
builder: (context) => const QRGenerator(),
11097
),
11198
);
11299
},
@@ -115,7 +102,7 @@ class _MyHomePageState extends State<MyHomePage> {
115102
),
116103
),
117104
],
118-
)
105+
),
119106
],
120107
),
121108
),

0 commit comments

Comments
 (0)