Skip to content

Commit

Permalink
Finalize interface, make dozen's of performace improvements,
Browse files Browse the repository at this point in the history
Here, we have,
1. Done several performance improvements,
2. Enhaced and finailze interface,
3. Fixes some bugs related to duplicate qr-note scan,
... and some minor changes.
  • Loading branch information
s-m-quadri committed Jul 30, 2023
1 parent 4672261 commit ca43a30
Show file tree
Hide file tree
Showing 27 changed files with 432 additions and 468 deletions.
24 changes: 0 additions & 24 deletions lib/about/about.dart

This file was deleted.

20 changes: 10 additions & 10 deletions lib/history/history_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class _QRNHistoryState extends State<QRNHistory> {
Widget buildShortView(BuildContext context, Trace trace) {
return ListTile(
horizontalTitleGap: 5,
leading: Icon(Icons.history),
leading: const Icon(Icons.history),
iconColor: Theme.of(context).primaryColor,
title: Text(trace.datetime.toString()),
subtitle: Text(trace.activity),
Expand All @@ -28,14 +28,14 @@ class _QRNHistoryState extends State<QRNHistory> {

Future<Widget> getList() async {
DatabaseManager db = DatabaseManager();
List<Trace>? buckets_temp = await db.getAllHistory();
List<Trace>? bucketsTemp = await db.getAllHistory();

setState(() {
buckets = buckets_temp;
buckets = bucketsTemp;
});

if (buckets!.isEmpty) {
return Text("Do some activity to trace history!");
return const Text("Do some activity to trace history!");
}

return RefreshIndicator(
Expand All @@ -46,10 +46,10 @@ class _QRNHistoryState extends State<QRNHistory> {
},
),
onRefresh: () async {
List<Trace>? buckets_temp = await db.getAllHistory();
await Future.delayed(Duration(milliseconds: 1500));
List<Trace>? bucketsTemp = await db.getAllHistory();
await Future.delayed(const Duration(milliseconds: 1500));
setState(() {
buckets = buckets_temp;
buckets = bucketsTemp;
});
});
}
Expand All @@ -58,7 +58,7 @@ class _QRNHistoryState extends State<QRNHistory> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("History"),
title: const Text("History"),
),
body: Center(
child: FutureBuilder<Widget>(
Expand All @@ -76,9 +76,9 @@ class _QRNHistoryState extends State<QRNHistory> {
if (snapshot.hasData) {
return snapshot.data!;
} else if (snapshot.hasError) {
return Text("Error Occurred");
return const Text("Error Occurred");
} else {
return Center(
return const Center(
child: CircularProgressIndicator(),
);
}
Expand Down
43 changes: 18 additions & 25 deletions lib/home/home.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import '../scan/scan.dart';
import '../settings/settings.dart';
import '../about/about.dart';
import '../storage/storage.dart';
import '../history/history_page.dart';
import 'overview.dart';
import 'package:url_launcher/url_launcher.dart';

class HomePage extends StatefulWidget {
const HomePage({super.key, required this.title});
Expand All @@ -30,42 +30,34 @@ class _HomePageState extends State<HomePage> {

static const List<BottomNavigationBarItem> _optionButtons = [
BottomNavigationBarItem(
icon: Icon(Icons.home_outlined),
label: "Home",
tooltip: "Home Page",
backgroundColor: Colors.red
),
icon: Icon(Icons.home_outlined),
label: "Home",
tooltip: "Home Page",
backgroundColor: Colors.red),
BottomNavigationBarItem(
icon: Icon(Icons.dataset_outlined),
label: "Storage",
tooltip: "Storage Page",
),
];

Future<void> _getScannedNotes(BuildContext context) async {
String result = await Navigator.push(
context, MaterialPageRoute(builder: (context) => Settings()));

if (!mounted) return;

ScaffoldMessenger.of(context)
..removeCurrentSnackBar()
..showSnackBar(SnackBar(content: Text("Result: $result")));
}

void _menuOnSelect(int index) {
switch (index) {
case 1:
Navigator.push(
context, MaterialPageRoute(builder: (context) => QRNHistory()));
context, MaterialPageRoute(builder: (context) => const QRNHistory()));
break;
case 2:
Navigator.push(
context, MaterialPageRoute(builder: (context) => Settings()));
context, MaterialPageRoute(builder: (context) => const Settings()));
break;
case 3:
Navigator.push(
context, MaterialPageRoute(builder: (context) => About()));
launchUrl(Uri.parse(
"https://github.com/s-m-quadri/qr-notes/blob/stable/README.md"));
break;
case 4:
launchUrl(Uri.parse("https://github.com/s-m-quadri/qr-notes"));
break;
}
}
Expand All @@ -80,15 +72,15 @@ class _HomePageState extends State<HomePage> {
// onPressed: _getScannedNotes,
onPressed: () {
Navigator.push(
context, MaterialPageRoute(builder: (context) => QRScan()));
context, MaterialPageRoute(builder: (context) => const QRScan()));
},
backgroundColor: Colors.blue.shade50,
splashColor: Colors.blue.shade900,
tooltip: "Capture QR Notes",
child: Icon(
Icons.camera_alt,
color: Theme.of(context).primaryColorDark,
color: Colors.blue.shade900,
),
backgroundColor: Theme.of(context).cardColor,
splashColor: Theme.of(context).primaryColor,
tooltip: "Capture QR Notes",
),
appBar: AppBar(
title: Text(widget.title),
Expand All @@ -100,6 +92,7 @@ class _HomePageState extends State<HomePage> {
PopupMenuItem(value: 1, child: Text("History")),
PopupMenuItem(value: 2, child: Text("Settings")),
PopupMenuItem(value: 3, child: Text("About")),
PopupMenuItem(value: 4, child: Text("Repository")),
];
})
],
Expand Down
105 changes: 40 additions & 65 deletions lib/home/overview.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

class QRNOverview extends StatefulWidget {
const QRNOverview({Key? key}) : super(key: key);
Expand All @@ -10,78 +11,52 @@ class QRNOverview extends StatefulWidget {
class _QRNOverviewState extends State<QRNOverview> {
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image(
image: AssetImage("assets/icon.png"),
width: 128,
),
SizedBox(height: 10),
Text("Welcome to",
style: TextStyle(
fontSize: 24,
color: Theme.of(context).primaryColorDark,
)),
Text("QR Notes",
style: TextStyle(
fontSize: 48,
color: Theme.of(context).primaryColorDark,
)),
SizedBox(
child: Text(
"Scan, Convert, Generate and Share Markdown-Notes via QR Codes",
style: TextStyle(
fontSize: 14,
color: Theme.of(context).primaryColorDark,
),
textAlign: TextAlign.center,
return ListView(
children: [
const Image(
image: AssetImage("assets/icon.png"),
width: 300,
height: 300,
),
ListTile(
title: Text(
"Welcome to",
style: TextStyle(
fontSize: 24,
color: Theme.of(context).primaryColorDark,
),
width: 256,
textAlign: TextAlign.center,
),
SizedBox(
child: Text(
"v0.3/dev",
style: TextStyle(
fontSize: 22,
color: Theme.of(context).primaryColorDark,
),
textAlign: TextAlign.center,
subtitle: Text(
"QR Notes",
style: TextStyle(
fontSize: 48,
color: Theme.of(context).primaryColorDark,
),
width: 256,
textAlign: TextAlign.center,
),
SizedBox(height: 10),
Divider(thickness: 1, color: Theme.of(context).primaryColorDark),
SizedBox(
child: Text(
style: TextStyle(
fontSize: 24,
color: Theme.of(context).primaryColorDark,
),
"""Modules ready to use""",
textAlign: TextAlign.center,
),
ListTile(
tileColor: Colors.blue.shade50,
contentPadding: const EdgeInsets.symmetric(horizontal: 30),
title: Text(
"Scan, Convert, Generate and Share Markdown-Notes via QR Codes",
style: TextStyle(
fontSize: 18,
color: Theme.of(context).primaryColorDark,
),
width: 256,
textAlign: TextAlign.center,
),
SizedBox(height: 10),
SizedBox(
child: Text(
style: TextStyle(
fontSize: 14,
color: Theme.of(context).primaryColorDark,
),
"""
1. Storage Module: Managing the saved QR-Notes.
2. QR Notes Parser Module: Recognizing the QR-Code as QR-Note.
3. History Module: Storing the traces of all activities.
4. Scan Module: Detecting and processing the first QR-Note.""",
textAlign: TextAlign.left,
),
width: 256,
subtitle: TextButton(
onPressed: () => launchUrl(
Uri.parse("https://github.com/s-m-quadri/qr-notes/releases")),
style: TextButton.styleFrom(
backgroundColor: Colors.white,
foregroundColor: Colors.blue.shade900),
child: const Text("What's New!"),
),
],
),
),
],
);
}
}
6 changes: 3 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class MyApp extends StatelessWidget {
title: 'QR Notes',
theme: ThemeData(
primarySwatch: Colors.blue,
primaryColorDark: Color(0xFF1c4587),
primaryColor: Color(0xFFA4C2F4),
primaryColorDark: const Color(0xFF1c4587),
primaryColor: const Color(0xFFA4C2F4),
primaryColorLight: Colors.white,
cardColor: Color(0xFFC9DAF8),
cardColor: const Color(0xFFC9DAF8),
shadowColor: Colors.black,
brightness: Brightness.light,
useMaterial3: true,
Expand Down
65 changes: 0 additions & 65 deletions lib/pagePlaceholder.dart

This file was deleted.

Loading

0 comments on commit ca43a30

Please sign in to comment.