From 095e2f62ba00a16ff388e43fb50540ea10ec0a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Mon, 29 Jan 2024 19:40:34 +0100 Subject: [PATCH] fix: change up about dialog also update CHANGELOG.md --- CHANGELOG.md | 5 ++ lib/l10n/app_cs.arb | 6 ++- lib/l10n/app_en.arb | 6 ++- lib/util/utils.dart | 38 ++++++++++++++ lib/views/graph_view.dart | 7 +-- lib/views/home.dart | 21 ++++---- lib/views/recurring_view.dart | 7 +-- lib/views/settings/edit_categories.dart | 16 +++--- lib/views/setup.dart | 15 ++++++ pubspec.lock | 66 ++++++++++++++++++++++++- pubspec.yaml | 5 +- 11 files changed, 158 insertions(+), 34 deletions(-) create mode 100644 lib/util/utils.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index e947fe5..43015f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ +# 1.0.0 +- Change icon +- Placeholder text is now inserted into the field in setup, instead of showing as label +- Show version text in about dialog +- Added tessdata license text into about dialog # 1.0.0-alpha+5 - Add tests - Add searching through entries to homepage diff --git a/lib/l10n/app_cs.arb b/lib/l10n/app_cs.arb index fce2785..8767f04 100644 --- a/lib/l10n/app_cs.arb +++ b/lib/l10n/app_cs.arb @@ -53,7 +53,7 @@ "langDownloadDialog": "Stahuji {lang}, vyčkejte prosím...", "langDownloadProgress": "Postup: {progress} %", "addingFromOcr": "Přidat skrz OCR", - "license":"©️ 2023 Matyáš Caras\nVydáno pod licencí GNU AGPL license verze 3", + "license":"©️ 2023 Matyáš Caras\nVydáno pod licencí GNU AGPL license verze 3\nObsahuje tessdata_fast OCR data pro angličtinu ©️ tessdata_fast / Tesseract přispěvatelé, použito pod licencí Apache 2.0", "description":"Popis", "newWallet":"Přidat novou peněženku", "walletExists":"Peněženka s tímto názvem již existuje!", @@ -104,5 +104,7 @@ "selectExportWallet":"Zvolte peněženku k exportování", "exportError":"Při exportování peněženky nastala chyba", "exportCompleted":"Export dokončen", - "importCompleted":"Import dokončen" + "importCompleted":"Import dokončen", + "setup":"Prvotní nastavení", + "sourceCode":"Zdrojový kód" } \ No newline at end of file diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 09441c3..c9c9d90 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -89,7 +89,7 @@ } }, "addingFromOcr": "Add from OCR", - "license": "©️ 2023 Matyáš Caras\nReleased under the GNU AGPL license version 3", + "license": "©️ 2023 Matyáš Caras\nReleased under the GNU AGPL license version 3\nIncludes the tessdata_fast English trained data, ©️ tessdata_fast / Tesseract contributors, used under the Apache 2.0 license", "description": "Description", "newWallet": "Add new wallet", "walletExists": "A wallet with this name already exists!", @@ -220,5 +220,7 @@ "selectExportWallet":"Select a wallet to export", "exportError":"An error occured trying to export wallet", "exportCompleted":"Export completed", - "importCompleted":"Import completed" + "importCompleted":"Import completed", + "setup":"Setup", + "sourceCode":"Source code" } \ No newline at end of file diff --git a/lib/util/utils.dart b/lib/util/utils.dart new file mode 100644 index 0000000..45dfc37 --- /dev/null +++ b/lib/util/utils.dart @@ -0,0 +1,38 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:prasule/pw/platformbutton.dart'; +import 'package:url_launcher/url_launcher_string.dart'; + +/// Shows an [AboutDialog] with all the data filled, +/// so I don't have to copypaste the same function everywhere +void showAbout(BuildContext context) { + showAboutDialog( + context: context, + applicationLegalese: AppLocalizations.of(context).license, + applicationName: "Prašule", + applicationVersion: "1.0.0", + applicationIcon: const CircleAvatar( + backgroundImage: AssetImage("assets/icon/full_ico.png"), + ), + children: [ + PlatformButton( + text: "Tessdata", + onPressed: () { + unawaited( + launchUrlString( + "https://github.com/tesseract-ocr/tessdata_fast", + ), + ); + }, + ), + PlatformButton( + text: AppLocalizations.of(context).sourceCode, + onPressed: () { + unawaited(launchUrlString("https://git.mnau.xyz/hernik/prasule")); + }, + ), + ], + ); +} diff --git a/lib/views/graph_view.dart b/lib/views/graph_view.dart index b2fc2d8..c5b8108 100644 --- a/lib/views/graph_view.dart +++ b/lib/views/graph_view.dart @@ -11,6 +11,7 @@ import 'package:prasule/pw/platformbutton.dart'; import 'package:prasule/pw/platformroute.dart'; import 'package:prasule/util/drawer.dart'; import 'package:prasule/util/graphs.dart'; +import 'package:prasule/util/utils.dart'; import 'package:prasule/views/settings/settings.dart'; import 'package:prasule/views/setup.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -193,11 +194,7 @@ class _GraphViewState extends State { setState(() {}); }); } else if (value == AppLocalizations.of(context).about) { - showAboutDialog( - context: context, - applicationLegalese: AppLocalizations.of(context).license, - applicationName: "Prašule", - ); + showAbout(context); } }, ), diff --git a/lib/views/home.dart b/lib/views/home.dart index aa028f8..9e0278b 100644 --- a/lib/views/home.dart +++ b/lib/views/home.dart @@ -25,6 +25,7 @@ import 'package:prasule/pw/platformfield.dart'; import 'package:prasule/pw/platformroute.dart'; import 'package:prasule/util/drawer.dart'; import 'package:prasule/util/text_color.dart'; +import 'package:prasule/util/utils.dart'; import 'package:prasule/views/create_entry.dart'; import 'package:prasule/views/settings/settings.dart'; import 'package:prasule/views/settings/tessdata_list.dart'; @@ -219,11 +220,7 @@ class _HomeViewState extends State { await WalletManager.loadWallet(selectedWallet!.name); }); } else if (value == AppLocalizations.of(context).about) { - showAboutDialog( - context: context, - applicationLegalese: AppLocalizations.of(context).license, - applicationName: "Prašule", - ); + showAbout(context); } }, ), @@ -355,8 +352,10 @@ class _HomeViewState extends State { ), ), elements: selectedWallet!.entries - .where((element) => - element.data.name.contains(_filter),) + .where( + (element) => element.data.name + .contains(_filter), + ) .toList(), itemComparator: (a, b) => b.date.compareTo(a.date), @@ -636,9 +635,11 @@ class _HomeViewState extends State { TextButton( onPressed: () async { final filePath = await FlutterFileDialog.pickFile( - params: OpenFileDialogParams( - dialogType: OpenFileDialogType.image, - sourceType: sourceType,),); + params: OpenFileDialogParams( + dialogType: OpenFileDialogType.image, + sourceType: sourceType, + ), + ); if (filePath == null) { if (mounted) Navigator.of(context).pop(); return; diff --git a/lib/views/recurring_view.dart b/lib/views/recurring_view.dart index ca1797d..304cf3a 100644 --- a/lib/views/recurring_view.dart +++ b/lib/views/recurring_view.dart @@ -14,6 +14,7 @@ import 'package:prasule/pw/platformbutton.dart'; import 'package:prasule/pw/platformroute.dart'; import 'package:prasule/util/drawer.dart'; import 'package:prasule/util/text_color.dart'; +import 'package:prasule/util/utils.dart'; import 'package:prasule/views/create_recur_entry.dart'; import 'package:prasule/views/settings/settings.dart'; import 'package:prasule/views/setup.dart'; @@ -117,11 +118,7 @@ class _RecurringEntriesViewState extends State { await WalletManager.loadWallet(selectedWallet!.name); }); } else if (value == AppLocalizations.of(context).about) { - showAboutDialog( - context: context, - applicationLegalese: AppLocalizations.of(context).license, - applicationName: "Prašule", - ); + showAbout(context); } }, ), diff --git a/lib/views/settings/edit_categories.dart b/lib/views/settings/edit_categories.dart index 0f5bb06..40f7c15 100644 --- a/lib/views/settings/edit_categories.dart +++ b/lib/views/settings/edit_categories.dart @@ -15,6 +15,7 @@ import 'package:prasule/pw/platformbutton.dart'; import 'package:prasule/pw/platformfield.dart'; import 'package:prasule/pw/platformroute.dart'; import 'package:prasule/util/text_color.dart'; +import 'package:prasule/util/utils.dart'; import 'package:prasule/views/settings/settings.dart'; import 'package:prasule/views/setup.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -106,11 +107,7 @@ class _EditCategoriesViewState extends State { ), ); } else if (value == AppLocalizations.of(context).about) { - showAboutDialog( - context: context, - applicationLegalese: AppLocalizations.of(context).license, - applicationName: "Prašule", - ); + showAbout(context); } }, ), @@ -158,7 +155,8 @@ class _EditCategoriesViewState extends State { ), ], title: Text( - AppLocalizations.of(context).pickColor,), + AppLocalizations.of(context).pickColor, + ), content: Column( children: [ ColorPicker( @@ -242,8 +240,10 @@ class _EditCategoriesViewState extends State { ), ), ], - title: Text(AppLocalizations.of(context) - .setupCategoriesEditingName,), + title: Text( + AppLocalizations.of(context) + .setupCategoriesEditingName, + ), content: SizedBox( width: 400, child: diff --git a/lib/views/setup.dart b/lib/views/setup.dart index 5642d91..4b6b48c 100644 --- a/lib/views/setup.dart +++ b/lib/views/setup.dart @@ -18,6 +18,7 @@ import 'package:prasule/pw/platformfield.dart'; import 'package:prasule/pw/platformroute.dart'; import 'package:prasule/util/show_message.dart'; import 'package:prasule/util/text_color.dart'; +import 'package:prasule/util/utils.dart'; import 'package:prasule/views/home.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -107,6 +108,20 @@ class _SetupViewState extends State { @override Widget build(BuildContext context) { return Scaffold( + appBar: AppBar( + title: Text(AppLocalizations.of(context).setup), + actions: [ + Tooltip( + message: AppLocalizations.of(context).about, + child: IconButton( + onPressed: () { + showAbout(context); + }, + icon: const Icon(Icons.info_outline), + ), + ), + ], + ), body: Center( child: SizedBox( width: MediaQuery.of(context).size.width, diff --git a/pubspec.lock b/pubspec.lock index e4a3e1d..09ed890 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1017,6 +1017,70 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c + url: "https://pub.dev" + source: hosted + version: "6.2.4" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f" + url: "https://pub.dev" + source: hosted + version: "6.2.2" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" + url: "https://pub.dev" + source: hosted + version: "6.2.4" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + url: "https://pub.dev" + source: hosted + version: "3.1.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + url: "https://pub.dev" + source: hosted + version: "3.1.0" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f + url: "https://pub.dev" + source: hosted + version: "2.3.1" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b + url: "https://pub.dev" + source: hosted + version: "2.2.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 + url: "https://pub.dev" + source: hosted + version: "3.1.1" vector_math: dependency: transitive description: @@ -1106,7 +1170,7 @@ packages: source: hosted version: "6.5.0" yaml: - dependency: transitive + dependency: "direct dev" description: name: yaml sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" diff --git a/pubspec.yaml b/pubspec.yaml index ca3d000..e58da6e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: prasule description: Open-source private expense tracker -version: 1.0.0-alpha+5 +version: 1.0.0+6 environment: sdk: '>=3.1.0-262.2.beta <4.0.0' @@ -39,6 +39,7 @@ dependencies: path_provider: ^2.0.15 settings_ui: ^2.0.2 shared_preferences: ^2.2.2 + url_launcher: ^6.2.4 dev_dependencies: build_runner: ^2.4.6 @@ -56,6 +57,7 @@ dev_dependencies: sdk: flutter test: ^1.24.6 very_good_analysis: ^5.1.0 + yaml: ^3.1.2 flutter_launcher_icons: android: true @@ -87,6 +89,7 @@ flutter: assets: - assets/tessdata_config.json - assets/tessdata/eng.traineddata + - assets/icon/full_ico.png # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg