Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings menu via settings icon in top left corner #16

Merged
merged 45 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b5a3801
fix: minor display issue
RedCommander735 May 19, 2024
a939080
feat: added settings icon
RedCommander735 May 19, 2024
ecdba7b
chore: update changelog
RedCommander735 May 19, 2024
e90b5fd
style: adjusted 'filter active' text
RedCommander735 May 19, 2024
98fabca
refactor: grouped filter with settings internally
RedCommander735 May 19, 2024
8a1f403
style: darkmode background now fully black
RedCommander735 May 20, 2024
a9bb9b3
style: centered page titles
RedCommander735 May 20, 2024
a3bc767
ci: new dependency to read app version
RedCommander735 May 20, 2024
0e75420
feat: first enty on about page in settings
RedCommander735 May 20, 2024
4e2cc12
chore: bump version number
RedCommander735 May 20, 2024
75c5abd
chore: update changelog
RedCommander735 May 20, 2024
73463b0
fix: minor display issue
RedCommander735 May 19, 2024
4140443
feat: added settings icon
RedCommander735 May 19, 2024
59ab311
chore: update changelog
RedCommander735 May 19, 2024
f0950f9
style: adjusted 'filter active' text
RedCommander735 May 19, 2024
b13ba61
refactor: grouped filter with settings internally
RedCommander735 May 19, 2024
b65c0ec
style: darkmode background now fully black
RedCommander735 May 20, 2024
2af2149
style: centered page titles
RedCommander735 May 20, 2024
860d8b6
ci: new dependency to read app version
RedCommander735 May 20, 2024
4938892
feat: first enty on about page in settings
RedCommander735 May 20, 2024
74c7190
chore: bump version number
RedCommander735 May 20, 2024
37234c5
chore: update changelog
RedCommander735 May 20, 2024
eb4ecad
Merge branch '15-settings-page' of https://github.com/RedCommander735…
RedCommander735 May 20, 2024
d8dba6f
wip: started with settings group
RedCommander735 May 20, 2024
fdefbe2
Merge remote-tracking branch 'origin/develop' into 15-settings-page
RedCommander735 May 20, 2024
ebee75f
feat: add settings group and license info
RedCommander735 May 20, 2024
76dfbd3
fix: typo in license
RedCommander735 May 20, 2024
b45cdb6
chore: removed cuppertino_icons and added url_launcher and fontawesom…
RedCommander735 May 20, 2024
9c3c6e3
feat: add fontawesome 5 brands
RedCommander735 May 20, 2024
e26e481
fix: add all applicable licenses
RedCommander735 May 20, 2024
3a103b2
feat: finished about page in settings
RedCommander735 May 20, 2024
308ffc2
chore: update changelog
RedCommander735 May 20, 2024
1df6ae1
refactor: move all settings components to their own file
RedCommander735 May 20, 2024
4a2900c
chore: format all documents
RedCommander735 May 20, 2024
91f6aa0
chore: update changelog
RedCommander735 May 20, 2024
e7648b9
feat: added general settings page
RedCommander735 May 20, 2024
c6d8199
style: changed all icons to their rounded variants
RedCommander735 May 20, 2024
5762a63
style: added spacing below group headline
RedCommander735 May 20, 2024
b54a6e4
chore: add csv and storage perm handler
RedCommander735 May 20, 2024
b961667
feat: new deleteAll and createItems methods
RedCommander735 May 20, 2024
01f260f
feat: csv ex and import
RedCommander735 May 20, 2024
3f170f9
chore: update readme
RedCommander735 May 20, 2024
fe43f60
chore: update readme
RedCommander735 May 20, 2024
c295f60
feat: confirmation dialog to prevent accidental loads
RedCommander735 May 20, 2024
e966c73
chore: update changelog
RedCommander735 May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,11 @@ Also add information on how to contact you by electronic and paper mail.
notice like this when it starts in an interactive mode:

Spritverbrauch Copyright (C) 2024 RedCommander735
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w`.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
under certain conditions; type `show c` for details.

The hypothetical commands `show w' and `show c' should show the appropriate
The hypothetical commands `show w` and `show c` should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ A simple app to keep track of how much fuel you're using on average.
- [x] Database and backend stuff (actual function)
- [x] Prices with 3rd digit ^
- [x] Time date selector for overview
- [ ] Settings page via breadcrumbs
- [ ] App info
- [ ] Backup to csv/xslx/...?
- [x] Settings page via breadcrumbs

#### Extra stuff:
- [ ] Edit Items on longpress instead of deleting
Expand All @@ -26,4 +24,6 @@ A simple app to keep track of how much fuel you're using on average.
- [ ] Time date selector for overview
- [ ] Add option set starting date from listview item
- [ ] Settings page via breadcrumbs
- [ ] File explorer for csv import
- [ ] Option to only load elements and do not delete old
- [ ] Color Theme changer
1 change: 0 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "de.redcommander735.spritverbrauch"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<application
android:label="Spritverbrauch${applicationLabelSuffix}"
android:name="${applicationName}"
Expand Down
32 changes: 30 additions & 2 deletions changelogs/CHANGELOG - latest.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
## Changelog:
- Hotfix: Text color was always set to black
- All prices had some rounding errors. Thats fixed now
- Adjusted background color for dark mode
- New settings menu
- General
- Backup
- About


## Technical changes:
- fix: text color was set to black
- feat: new custom number formatter
- fix: all numbers should now display correctly
- feat: new settings icon in main menu
- style: adjusted 'filter active' text
- style: dark mode background now fully black
- style: centered page titles
- ci: new dependency to read app version
- feat: first enty on about page in settings
- chore: bump version number
- feat: add settings group and license info
- fix: typo in license
- chore: removed cuppertino_icons and added url_launcher and fontawesome 5 brands
- feat: add fontawesome 5 brands
- fix: add all applicable licenses
- feat: finished about page in settings
- refactor: move all settings components to their own file
- chore: format all documents
- feat: added general settings page
- style: changed all icons to their rounded variants
- style: added spacing below group headline
- chore: add csv and storage perm handler
- feat: new deleteAll and createItems methods
- feat: csv ex and import
- feat: confirmation dialog to prevent accidental loads
34 changes: 34 additions & 0 deletions fonts/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Font Awesome Free License
-------------------------

Font Awesome Free is free, open source, and GPL friendly. You can use it for
commercial projects, open source projects, or really almost whatever you want.
Full Font Awesome Free license: https://fontawesome.com/license/free.

# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
In the Font Awesome Free download, the CC BY 4.0 license applies to all icons
packaged as SVG and JS file types.

# Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL)
In the Font Awesome Free download, the SIL OFL license applies to all icons
packaged as web and desktop font files.

# Code: MIT License (https://opensource.org/licenses/MIT)
In the Font Awesome Free download, the MIT license applies to all non-font and
non-icon files.

# Attribution
Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
Awesome Free files already contain embedded comments with sufficient
attribution, so you shouldn't need to do anything additional when using these
files normally.

We've kept attribution comments terse, so we ask that you do not actively work
to remove them from files, especially code. They're a great way for folks to
learn about Font Awesome.

# Brand Icons
All brand icons are trademarks of their respective owners. The use of these
trademarks does not indicate endorsement of the trademark holder by Font
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
to represent the company, product, or service to which they refer.**
Binary file added fonts/otfs/Font-Awesome-5-Brands-Regular-400.otf
Binary file not shown.
Binary file added fonts/otfs/Font-Awesome-5-Free-Regular-400.otf
Binary file not shown.
Binary file added fonts/otfs/Font-Awesome-5-Free-Solid-900.otf
Binary file not shown.
19 changes: 19 additions & 0 deletions fonts/otfs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
A HEADS UP ABOUT DUOTONE ICONS ON THE DESKTOP
---------------------------------------------

Duotone icons are a bit different to use than other Font Awesome icons at the moment.

* We currently recommend using the Duotone-specific optimized .svg vector
files. These can be found in the /svgs/duotone folder of this download.

* Using Ligatures with Duotone Icons is NOT currently recommended - while we've
included a Duotone ligature-based font file in our Pro desktop download, we
can't recommend it as a way to use our icons on the desktop. Read the special
instructions for using duotones with ligatures here -
https://fontawesome.com/how-to-use/on-the-desktop/referencing-icons/duotone-icons#using-ligatures.

You can read the nitty gritty on the current limitations desktop apps have that
made our Duotone ligature implementation diferent there as well. And our full
Duotone Desktop docs are available at:

https://fontawesome.com/how-to-use/on-the-desktop/referencing-icons/duotone-icons.
91 changes: 56 additions & 35 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,40 @@ import 'package:dynamic_color/dynamic_color.dart';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:spritverbrauch/src/filter/filter_model.dart';
import 'package:spritverbrauch/src/settings/filter_model.dart';

import 'package:spritverbrauch/src/listview/item_list_model.dart';
import 'package:spritverbrauch/src/listview/item_list_view.dart';
import 'package:spritverbrauch/src/overview.dart';
import 'package:spritverbrauch/src/add_item.dart';
import 'package:spritverbrauch/src/filter/filter.dart';
import 'package:spritverbrauch/src/settings/filter.dart';

import 'package:provider/provider.dart';
import 'package:spritverbrauch/src/settings/settings.dart';
import 'package:spritverbrauch/src/settings/settings_model.dart';
import 'package:spritverbrauch/src/utils/licenses.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
addLicenses();

runApp(
MultiProvider(providers: [
ChangeNotifierProvider(create: (BuildContext context) => ItemListModel()),
ChangeNotifierProvider(create: (BuildContext context) => FilterModel())
ChangeNotifierProvider(create: (BuildContext context) => FilterModel()),
ChangeNotifierProvider(create: (BuildContext context) => SettingsModel()),
], child: const Spritpreise()),
);
}

class Spritpreise extends StatefulWidget {
const Spritpreise({super.key});

static final _defaultLightColorScheme = ColorScheme.fromSeed(
seedColor: Colors.blue[900]!, brightness: Brightness.light);
static final _defaultLightColorScheme =
ColorScheme.fromSeed(seedColor: Colors.blue[900]!, brightness: Brightness.light);

static final _defaultDarkColorScheme = ColorScheme.fromSeed(
seedColor: Colors.blue[900]!, brightness: Brightness.dark);
static final _defaultDarkColorScheme =
ColorScheme.fromSeed(seedColor: Colors.blue[900]!, brightness: Brightness.dark, background: Colors.black);

@override
State<Spritpreise> createState() => _SpritpreiseState();
Expand Down Expand Up @@ -61,10 +66,13 @@ class _SpritpreiseState extends State<Spritpreise> {
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: lightColorScheme ?? Spritpreise._defaultLightColorScheme,
scaffoldBackgroundColor: Spritpreise._defaultLightColorScheme.background,
useMaterial3: true,
),
darkTheme: ThemeData(
colorScheme: darkColorScheme ?? Spritpreise._defaultDarkColorScheme,
appBarTheme: AppBarTheme(backgroundColor: Spritpreise._defaultDarkColorScheme.background),
scaffoldBackgroundColor: Spritpreise._defaultDarkColorScheme.background,
useMaterial3: true,
),
themeMode: ThemeMode.system,
Expand Down Expand Up @@ -118,38 +126,51 @@ class Main extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(8.0),
child: Consumer2<FilterModel, ItemListModel>(
builder: (BuildContext context, FilterModel filterModel,
ItemListModel itemListModel, Widget? child) {
return Row(
builder: (BuildContext context, FilterModel filterModel, ItemListModel itemListModel,
Widget? child) {
return Column(
children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Filter(),
),
);
},
icon: const Icon(Icons.tune),
),
if (filterModel.filterEnabled)
const Text(
'Filter aktiv',
style: TextStyle(fontSize: 14),
),
if (filterModel.filterEnabled && itemListModel.hiddenEntries > 0)
Text(
', ausgeblendete Enträge: ${itemListModel.hiddenEntries}',
style: const TextStyle(fontSize: 14),
Row(children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Settings(),
),
);
},
icon: const Icon(Icons.settings),
),
if (filterModel.filterEnabled)
IconButton(
onPressed: () {
filterModel.setFilterEnabled(false);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Filter(),
),
);
},
icon: const Icon(Icons.close),
)
icon: const Icon(Icons.tune),
),
if (filterModel.filterEnabled)
const Text(
'Filter aktiv',
style: TextStyle(fontSize: 14),
),
if (filterModel.filterEnabled && itemListModel.hiddenEntries > 0)
Text(
', ausgeblendet: ${itemListModel.hiddenEntries}',
style: const TextStyle(fontSize: 14),
),
if (filterModel.filterEnabled)
IconButton(
onPressed: () {
filterModel.setFilterEnabled(false);
},
icon: const Icon(Icons.close),
),
]),
],
);
},
Expand All @@ -164,7 +185,7 @@ class Main extends StatelessWidget {
),
Center(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 80),
padding: EdgeInsets.only(top: 80),
child: FractionallySizedBox(
widthFactor: 0.55,
child: Overview(),
Expand Down
14 changes: 7 additions & 7 deletions lib/src/add_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ class _AddItemState extends State<AddItem> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Eintrag hinzufügen')),
appBar: AppBar(
title: const Text('Eintrag hinzufügen'),
centerTitle: true,
),
body: Form(
key: _formKey,
child: Scrollbar(
Expand All @@ -52,11 +55,9 @@ class _AddItemState extends State<AddItem> {
filled: true,
labelText: 'Datum',
prefixIcon: const Icon(Icons.calendar_today),
enabledBorder:
const OutlineInputBorder(borderSide: BorderSide.none),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide.none),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary),
borderSide: BorderSide(color: Theme.of(context).colorScheme.primary),
),
),
readOnly: true,
Expand Down Expand Up @@ -153,8 +154,7 @@ class _AddItemState extends State<AddItem> {
litersPerKilometer: litersPerKilometer,
);

Provider.of<ItemListModel>(context, listen: false)
.add(item);
Provider.of<ItemListModel>(context, listen: false).add(item);

ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text("Eintrag hinzugefügt"),
Expand Down
9 changes: 9 additions & 0 deletions lib/src/components/font_awesome.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:flutter/widgets.dart';

class FontAwesomeBrands {
FontAwesomeBrands._();

static const _kFontFam = 'FontAwesomeBrands';

static const IconData github = IconData(0xf09b, fontFamily: _kFontFam);
}
33 changes: 33 additions & 0 deletions lib/src/components/settings/settings_group.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';

class SettingsGroup extends StatelessWidget {
const SettingsGroup({super.key, required this.title, required this.children});

final String title;
final List<Widget> children;

@override
Widget build(BuildContext context) {
return Column(
children: List.from([
Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 16, top: 16, bottom: 4),
child: Text(
title,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold,
fontSize: DefaultTextStyle.of(context).style.fontSize! * 17 / 20),
),
),
],
)
])
..addAll(children)..add(const Divider(
height: 0,
)),
);
}
}
Loading
Loading