From c8841ef346f5faffd5145457a87e85980b11dedb Mon Sep 17 00:00:00 2001 From: TheRedKeks <40245965+RedCommander735@users.noreply.github.com> Date: Tue, 21 May 2024 17:47:05 +0200 Subject: [PATCH 1/8] chore: cleanup --- changelogs/CHANGELOG - latest.md | 31 +---------------------------- lib/src/settings/pages/general.dart | 2 -- 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/changelogs/CHANGELOG - latest.md b/changelogs/CHANGELOG - latest.md index d4a9ea0..f3dca35 100644 --- a/changelogs/CHANGELOG - latest.md +++ b/changelogs/CHANGELOG - latest.md @@ -1,34 +1,5 @@ ## Changelog: -- All prices had some rounding errors. Thats fixed now -- Adjusted background color for dark mode -- New settings menu - - General - - Backup - - About + ## Technical changes: -- 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 \ No newline at end of file diff --git a/lib/src/settings/pages/general.dart b/lib/src/settings/pages/general.dart index bc36001..ecb7f64 100644 --- a/lib/src/settings/pages/general.dart +++ b/lib/src/settings/pages/general.dart @@ -1,11 +1,9 @@ import 'package:flutter/material.dart'; import 'package:package_info_plus/package_info_plus.dart'; -import 'package:spritverbrauch/src/components/font_awesome.dart'; import 'package:spritverbrauch/src/components/settings/settings_group.dart'; import 'package:spritverbrauch/src/components/settings/settings_item.dart'; import 'package:spritverbrauch/src/components/settings/settings_topic_page.dart'; import 'package:spritverbrauch/src/utils/csv_handler.dart'; -import 'package:spritverbrauch/src/utils/url_launcher.dart'; class General extends StatefulWidget { General({super.key}); From 8c7ed4d4a48b1c5de83cd9aaeddeb87fa49681d0 Mon Sep 17 00:00:00 2001 From: RedCommander735 <40245965+RedCommander735@users.noreply.github.com> Date: Tue, 21 May 2024 19:32:22 +0200 Subject: [PATCH 2/8] chore: update gitignore --- linux/.gitignore | 2 ++ macos/.gitignore | 1 + windows/.gitignore | 2 ++ 3 files changed, 5 insertions(+) diff --git a/linux/.gitignore b/linux/.gitignore index d3896c9..4607c32 100644 --- a/linux/.gitignore +++ b/linux/.gitignore @@ -1 +1,3 @@ flutter/ephemeral +flutter/generated_plugin_registrant.cc +flutter/generated_plugins.cmake \ No newline at end of file diff --git a/macos/.gitignore b/macos/.gitignore index 746adbb..7b977e7 100644 --- a/macos/.gitignore +++ b/macos/.gitignore @@ -1,5 +1,6 @@ # Flutter-related **/Flutter/ephemeral/ +**/Flutter/GeneratedPluginRegistrant.swift **/Pods/ # Xcode-related diff --git a/windows/.gitignore b/windows/.gitignore index d492d0d..82395d0 100644 --- a/windows/.gitignore +++ b/windows/.gitignore @@ -1,4 +1,6 @@ flutter/ephemeral/ +flutter/generated_plugin_registrant.cc +flutter/generated_plugins.cmake # Visual Studio user-specific files. *.suo From e9218c36492c55a5e0f14cb26540a58ee2b3ba97 Mon Sep 17 00:00:00 2001 From: RedCommander735 <40245965+RedCommander735@users.noreply.github.com> Date: Tue, 21 May 2024 19:35:48 +0200 Subject: [PATCH 3/8] refactor: delete unnecessary files --- linux/flutter/generated_plugin_registrant.cc | 19 -------------- linux/flutter/generated_plugins.cmake | 25 ------------------ macos/Flutter/GeneratedPluginRegistrant.swift | 22 ---------------- .../flutter/generated_plugin_registrant.cc | 20 -------------- windows/flutter/generated_plugins.cmake | 26 ------------------- 5 files changed, 112 deletions(-) delete mode 100644 linux/flutter/generated_plugin_registrant.cc delete mode 100644 linux/flutter/generated_plugins.cmake delete mode 100644 macos/Flutter/GeneratedPluginRegistrant.swift delete mode 100644 windows/flutter/generated_plugin_registrant.cc delete mode 100644 windows/flutter/generated_plugins.cmake diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc deleted file mode 100644 index fe56f8d..0000000 --- a/linux/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,19 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - -#include -#include - -void fl_register_plugins(FlPluginRegistry* registry) { - g_autoptr(FlPluginRegistrar) dynamic_color_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); - dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); - g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); - url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); -} diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 1836621..0000000 --- a/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - dynamic_color - url_launcher_linux -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift deleted file mode 100644 index 1dd30f4..0000000 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// Generated file. Do not edit. -// - -import FlutterMacOS -import Foundation - -import dynamic_color -import package_info_plus -import path_provider_foundation -import shared_preferences_foundation -import sqflite -import url_launcher_macos - -func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) - FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) - PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) - SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) - SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) - UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) -} diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc deleted file mode 100644 index 4266b12..0000000 --- a/windows/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,20 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - -#include -#include -#include - -void RegisterPlugins(flutter::PluginRegistry* registry) { - DynamicColorPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); - PermissionHandlerWindowsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); - UrlLauncherWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("UrlLauncherWindows")); -} diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake deleted file mode 100644 index 2a2380c..0000000 --- a/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,26 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - dynamic_color - permission_handler_windows - url_launcher_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) From 7296745fd10621850ec9c7f067d758b86ddc8dba Mon Sep 17 00:00:00 2001 From: RedCommander735 <40245965+RedCommander735@users.noreply.github.com> Date: Tue, 21 May 2024 19:36:58 +0200 Subject: [PATCH 4/8] refactor: compound icon now works with path so is fully alpha compatible --- lib/src/components/sp_compound_icon.dart | 77 ++++++++++++++++++------ lib/src/listview/list_item.dart | 4 +- lib/src/overview.dart | 8 ++- 3 files changed, 65 insertions(+), 24 deletions(-) diff --git a/lib/src/components/sp_compound_icon.dart b/lib/src/components/sp_compound_icon.dart index 22132df..0d574a0 100644 --- a/lib/src/components/sp_compound_icon.dart +++ b/lib/src/components/sp_compound_icon.dart @@ -1,19 +1,36 @@ import 'package:flutter/material.dart'; -import 'package:icon_decoration/icon_decoration.dart'; -class CompoundIcon extends StatelessWidget { - final IconData firstIcon; - final IconData secondIcon; - final double size; - final double scalar; +enum CompoundIconClipShape { + rect, + circle +} - const CompoundIcon({ +class CompoundIcon extends StatelessWidget { + CompoundIcon({ super.key, required this.firstIcon, required this.secondIcon, this.size = 24, - this.scalar = 1, - }); + this.scalar = 1, this.shape = CompoundIconClipShape.rect, + }) { + switch (shape) { + case CompoundIconClipShape.rect: + clipper = CompoundIconRectClipper(); + break; + case CompoundIconClipShape.circle: + clipper = CompoundIconRoundClipper(); + break; + default: + clipper = CompoundIconRectClipper(); + } + } + + final IconData firstIcon; + final IconData secondIcon; + final double size; + final double scalar; + final CompoundIconClipShape shape; + late final CustomClipper clipper; @override Widget build(BuildContext context) { @@ -30,21 +47,20 @@ class CompoundIcon extends StatelessWidget { color: Colors.transparent, shape: BoxShape.circle, ), - child: Icon( - firstIcon, - size: size, + child: ClipPath( + clipper: clipper, + child: Icon( + firstIcon, + size: size, + ), ), ), ), Align( alignment: Alignment.bottomRight, - child: DecoratedIcon( - icon: Icon( - secondIcon, - size: size * .55, - ), - decoration: - IconDecoration(border: IconBorder(color: Theme.of(context).colorScheme.background, width: size / 8)), + child: Icon( + secondIcon, + size: size * .55, ), ), ], @@ -52,3 +68,26 @@ class CompoundIcon extends StatelessWidget { ); } } + +class CompoundIconRectClipper extends CustomClipper { + @override + Path getClip(Size size) { + Path pathMain = Path()..addRect(Rect.fromLTWH(0, 0, size.width, size.height)); + Path clip = Path()..addRRect(RRect.fromRectAndRadius(Rect.fromLTWH(size.width * 0.48, size.height * 0.48, size.width * 0.6, size.height * 0.6), Radius.circular(size.width * 0.08))); + return Path.combine(PathOperation.difference, pathMain, clip); + } + + @override + bool shouldReclip(covariant CustomClipper oldClipper) => false; +} +class CompoundIconRoundClipper extends CustomClipper { + @override + Path getClip(Size size) { + Path pathMain = Path()..addRect(Rect.fromLTWH(0, 0, size.width, size.height)); + Path clip = Path()..addOval(Rect.fromLTWH(size.width * 0.45, size.height * 0.43, size.width * 0.63, size.height * 0.63)); + return Path.combine(PathOperation.difference, pathMain, clip); + } + + @override + bool shouldReclip(covariant CustomClipper oldClipper) => false; +} diff --git a/lib/src/listview/list_item.dart b/lib/src/listview/list_item.dart index a51dfa2..5177c4f 100644 --- a/lib/src/listview/list_item.dart +++ b/lib/src/listview/list_item.dart @@ -106,7 +106,7 @@ class _ListEntryState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - const CompoundIcon( + CompoundIcon( firstIcon: Icons.local_gas_station_rounded, secondIcon: Icons.route_rounded, ), @@ -159,7 +159,7 @@ class _ListEntryState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - const CompoundIcon( + CompoundIcon( firstIcon: Icons.euro_rounded, secondIcon: Icons.local_gas_station_rounded, ), diff --git a/lib/src/overview.dart b/lib/src/overview.dart index 6862498..b0e704d 100644 --- a/lib/src/overview.dart +++ b/lib/src/overview.dart @@ -90,7 +90,7 @@ class Overview extends StatelessWidget { OverviewElement( value: litersPerKilometerDisplay, unit: 'L/km', - icon: const CompoundIcon( + icon: CompoundIcon( firstIcon: Icons.local_gas_station_rounded, secondIcon: Icons.route_rounded, size: iconSize, @@ -122,10 +122,11 @@ class Overview extends StatelessWidget { OverviewElement( value: pricePerLiterDisplay, unit: '€/L', - icon: const CompoundIcon( + icon: CompoundIcon( firstIcon: Icons.local_gas_station_rounded, secondIcon: Icons.euro_rounded, size: iconSize, + shape: CompoundIconClipShape.circle, ), padding: padding, iconSize: iconSize, @@ -134,10 +135,11 @@ class Overview extends StatelessWidget { OverviewElement( value: pricePerKilometerDisplay, unit: '€/km', - icon: const CompoundIcon( + icon: CompoundIcon( firstIcon: Icons.route_rounded, secondIcon: Icons.euro_rounded, size: iconSize, + shape: CompoundIconClipShape.circle, ), padding: padding, iconSize: iconSize, From e8019e77f1e5971759e6128e72bdc095dc0934f5 Mon Sep 17 00:00:00 2001 From: RedCommander735 <40245965+RedCommander735@users.noreply.github.com> Date: Tue, 21 May 2024 19:37:43 +0200 Subject: [PATCH 5/8] chore: update changelog --- changelogs/CHANGELOG - latest.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/changelogs/CHANGELOG - latest.md b/changelogs/CHANGELOG - latest.md index f3dca35..3377fa6 100644 --- a/changelogs/CHANGELOG - latest.md +++ b/changelogs/CHANGELOG - latest.md @@ -1,5 +1,8 @@ ## Changelog: - +- Icons are now fully alpha compatible ## Technical changes: +- chore: update gitignore +- refactor: delete unnecessary files +- refactor: compound icon now works with path so is fully alpha compatible \ No newline at end of file From 3a6e058904ce07463533e42427bcf0654403bdd6 Mon Sep 17 00:00:00 2001 From: RedCommander735 <40245965+RedCommander735@users.noreply.github.com> Date: Fri, 31 May 2024 21:30:37 +0200 Subject: [PATCH 6/8] fix: formatter was removing leading zeros after decimal seperator --- lib/src/utils/number_formatter.dart | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/src/utils/number_formatter.dart b/lib/src/utils/number_formatter.dart index d9ef2eb..cb8eabb 100644 --- a/lib/src/utils/number_formatter.dart +++ b/lib/src/utils/number_formatter.dart @@ -59,19 +59,10 @@ class FormattedDouble { } String fractionalPartToString() { - return '0$decimalSeperator${fractionalPartAsInt()}'; + return '0$decimalSeperator${fractionalPartAsIntToString()}'; } String fractionalPartAsIntToString({bool roundLastDigit = true, int? fractionDigits}) { - int? frac = fractionalPartAsInt(roundLastDigit: roundLastDigit, fractionDigits: fractionDigits); - if (frac != null) { - return frac.toString(); - } - - return ''; - } - - int? fractionalPartAsInt({bool roundLastDigit = true, int? fractionDigits}) { late String fractionalString; if (fractionDigits != null && fractionDigits.isNegative) { @@ -84,13 +75,12 @@ class FormattedDouble { String fracPart = _value.toString().split('.').last; fractionalString = (fracPart.length > fractionDigits) ? fracPart.substring(0, fractionDigits) : fracPart; } else if (fractionDigits != null && fractionDigits == 0 && !roundLastDigit) { - return null; + return ''; } else { fractionalString = _value.toString().split('.').last; } - final int? fractionAsInt = (fractionalString.isNotEmpty) ? int.parse(fractionalString) : null; - return fractionAsInt; + return fractionalString; } } From 2f8a9ec59d829b5bc57a11349379125f03f658ee Mon Sep 17 00:00:00 2001 From: RedCommander735 <40245965+RedCommander735@users.noreply.github.com> Date: Fri, 31 May 2024 21:32:46 +0200 Subject: [PATCH 7/8] chore: update changelog --- changelogs/CHANGELOG - latest.md | 6 ++---- pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/changelogs/CHANGELOG - latest.md b/changelogs/CHANGELOG - latest.md index 3377fa6..7a67428 100644 --- a/changelogs/CHANGELOG - latest.md +++ b/changelogs/CHANGELOG - latest.md @@ -1,8 +1,6 @@ ## Changelog: -- Icons are now fully alpha compatible +- Hotfix: Leading zeros after decimal seperator were accidetally removed ## Technical changes: -- chore: update gitignore -- refactor: delete unnecessary files -- refactor: compound icon now works with path so is fully alpha compatible \ No newline at end of file +- fix: formatter was removing leading zeros after decimal seperator \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index f8ee539..a2bf5a3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,7 @@ description: "A simple app to keep track of how much fuel you're using on averag # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.2.0+4 +version: 1.2.1+4 environment: flutter: '3.19.0' From 8b81cb2d185a513b95e884443d47db1118aebcc3 Mon Sep 17 00:00:00 2001 From: RedCommander735 <40245965+RedCommander735@users.noreply.github.com> Date: Fri, 31 May 2024 21:35:06 +0200 Subject: [PATCH 8/8] chore: update changelog --- changelogs/CHANGELOG - latest.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelogs/CHANGELOG - latest.md b/changelogs/CHANGELOG - latest.md index 7a67428..d0ee4b3 100644 --- a/changelogs/CHANGELOG - latest.md +++ b/changelogs/CHANGELOG - latest.md @@ -1,6 +1,10 @@ ## Changelog: +- Icons are now fully alpha compatible - Hotfix: Leading zeros after decimal seperator were accidetally removed ## Technical changes: +- chore: update gitignore +- refactor: delete unnecessary files +- refactor: compound icon now works with path so is fully alpha compatible - fix: formatter was removing leading zeros after decimal seperator \ No newline at end of file