From 76ce3af6437690ae004fae3c909f77539859a380 Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Sun, 11 Jan 2026 15:26:10 +0100 Subject: [PATCH 01/12] implement custom alert dialog --- .../views/main_menu/settings_view.dart | 11 +++---- .../widgets/custom_alert_dialog.dart | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 lib/presentation/widgets/custom_alert_dialog.dart diff --git a/lib/presentation/views/main_menu/settings_view.dart b/lib/presentation/views/main_menu/settings_view.dart index 0fa7085..d416deb 100644 --- a/lib/presentation/views/main_menu/settings_view.dart +++ b/lib/presentation/views/main_menu/settings_view.dart @@ -5,6 +5,7 @@ import 'package:game_tracker/l10n/generated/app_localizations.dart'; import 'package:game_tracker/presentation/widgets/tiles/settings_list_tile.dart'; import 'package:game_tracker/services/data_transfer_service.dart'; import 'package:package_info_plus/package_info_plus.dart'; +import 'package:game_tracker/presentation/widgets/custom_alert_dialog.dart'; class SettingsView extends StatefulWidget { const SettingsView({super.key}); @@ -92,17 +93,17 @@ class _SettingsViewState extends State { onPressed: () { showDialog( context: context, - builder: (context) => AlertDialog( - title: Text('${loc.delete_all_data}?'), - content: Text(loc.this_cannot_be_undone), + builder: (context) => CustomAlertDialog( + title: '${loc.delete_all_data}?', + content: loc.this_cannot_be_undone, actions: [ TextButton( onPressed: () => Navigator.of(context).pop(false), - child: Text(loc.cancel), + child: Text(loc.cancel, style: TextStyle(color: CustomTheme.textColor),), ), TextButton( onPressed: () => Navigator.of(context).pop(true), - child: Text(loc.delete), + child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor),), ), ], ), diff --git a/lib/presentation/widgets/custom_alert_dialog.dart b/lib/presentation/widgets/custom_alert_dialog.dart new file mode 100644 index 0000000..6a6019a --- /dev/null +++ b/lib/presentation/widgets/custom_alert_dialog.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:game_tracker/core/custom_theme.dart'; + +class CustomAlertDialog extends StatelessWidget { + final String title; + final String content; + final List actions; + + const CustomAlertDialog({ + super.key, + required this.title, + required this.content, + required this.actions, + }); + + @override + Widget build(BuildContext context) { + return AlertDialog( + title: Text(title, style: const TextStyle(color: CustomTheme.textColor,),), + content: Text(content, style: const TextStyle(color: CustomTheme.textColor),), + actions: actions, + backgroundColor: CustomTheme.boxColor, + shape: RoundedRectangleBorder( + borderRadius: CustomTheme.standardBorderRadiusAll, + side: BorderSide(color: CustomTheme.boxBorder), + ), + ); + } +} From 3ceae8341b56461d6d376d54f7fa57afa481cb79 Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Sun, 11 Jan 2026 15:26:50 +0100 Subject: [PATCH 02/12] add const --- lib/presentation/views/main_menu/settings_view.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/presentation/views/main_menu/settings_view.dart b/lib/presentation/views/main_menu/settings_view.dart index d416deb..500a550 100644 --- a/lib/presentation/views/main_menu/settings_view.dart +++ b/lib/presentation/views/main_menu/settings_view.dart @@ -99,7 +99,7 @@ class _SettingsViewState extends State { actions: [ TextButton( onPressed: () => Navigator.of(context).pop(false), - child: Text(loc.cancel, style: TextStyle(color: CustomTheme.textColor),), + child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor),), ), TextButton( onPressed: () => Navigator.of(context).pop(true), From 22ce742d4333a80d9b759de160591245b98ddbfa Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Sun, 11 Jan 2026 17:14:28 +0100 Subject: [PATCH 03/12] change button alignment & remove InkWell Animation --- lib/presentation/views/main_menu/settings_view.dart | 9 +++++++++ lib/presentation/widgets/custom_alert_dialog.dart | 1 + 2 files changed, 10 insertions(+) diff --git a/lib/presentation/views/main_menu/settings_view.dart b/lib/presentation/views/main_menu/settings_view.dart index 500a550..5814537 100644 --- a/lib/presentation/views/main_menu/settings_view.dart +++ b/lib/presentation/views/main_menu/settings_view.dart @@ -98,13 +98,22 @@ class _SettingsViewState extends State { content: loc.this_cannot_be_undone, actions: [ TextButton( + style: TextButton.styleFrom( + splashFactory: NoSplash.splashFactory, + overlayColor: Colors.transparent, + ), onPressed: () => Navigator.of(context).pop(false), child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor),), ), TextButton( + style: TextButton.styleFrom( + splashFactory: NoSplash.splashFactory, + overlayColor: Colors.transparent, + ), onPressed: () => Navigator.of(context).pop(true), child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor),), ), + ], ), ).then((confirmed) { diff --git a/lib/presentation/widgets/custom_alert_dialog.dart b/lib/presentation/widgets/custom_alert_dialog.dart index 6a6019a..2456b56 100644 --- a/lib/presentation/widgets/custom_alert_dialog.dart +++ b/lib/presentation/widgets/custom_alert_dialog.dart @@ -20,6 +20,7 @@ class CustomAlertDialog extends StatelessWidget { content: Text(content, style: const TextStyle(color: CustomTheme.textColor),), actions: actions, backgroundColor: CustomTheme.boxColor, + actionsAlignment: MainAxisAlignment.spaceAround, shape: RoundedRectangleBorder( borderRadius: CustomTheme.standardBorderRadiusAll, side: BorderSide(color: CustomTheme.boxBorder), From 1ebcfc9e57e1685fe75a0c2438ab297c8de2f0c9 Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Sun, 11 Jan 2026 17:21:05 +0100 Subject: [PATCH 04/12] implement animation --- .../views/main_menu/settings_view.dart | 73 +++++++++++++++---- 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/lib/presentation/views/main_menu/settings_view.dart b/lib/presentation/views/main_menu/settings_view.dart index 5814537..cab26ef 100644 --- a/lib/presentation/views/main_menu/settings_view.dart +++ b/lib/presentation/views/main_menu/settings_view.dart @@ -97,23 +97,14 @@ class _SettingsViewState extends State { title: '${loc.delete_all_data}?', content: loc.this_cannot_be_undone, actions: [ - TextButton( - style: TextButton.styleFrom( - splashFactory: NoSplash.splashFactory, - overlayColor: Colors.transparent, - ), + _PressableButton( onPressed: () => Navigator.of(context).pop(false), - child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor),), + child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor)), ), - TextButton( - style: TextButton.styleFrom( - splashFactory: NoSplash.splashFactory, - overlayColor: Colors.transparent, - ), + _PressableButton( onPressed: () => Navigator.of(context).pop(true), - child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor),), + child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor)), ), - ], ), ).then((confirmed) { @@ -227,3 +218,59 @@ class _SettingsViewState extends State { }); } } + +class _PressableButton extends StatefulWidget { + final VoidCallback onPressed; + final Widget child; + + const _PressableButton({required this.onPressed, required this.child}); + + @override + State<_PressableButton> createState() => _PressableButtonState(); +} + +class _PressableButtonState extends State<_PressableButton> { + bool _isPressed = false; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTapDown: (_) => setState(() => _isPressed = true), + onTapUp: (_) => setState(() => _isPressed = false), + onTapCancel: () => setState(() => _isPressed = false), + onTap: widget.onPressed, + child: AnimatedScale( + scale: _isPressed ? 0.95 : 1.0, + duration: const Duration(milliseconds: 100), + child: AnimatedOpacity( + opacity: _isPressed ? 0.6 : 1.0, + duration: const Duration(milliseconds: 100), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: widget.child, + ), + ), + ), + ); + } +} + + +/* + TextButton( + style: TextButton.styleFrom( + splashFactory: NoSplash.splashFactory, + overlayColor: Colors.transparent, + ), + onPressed: () => Navigator.of(context).pop(false), + child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor),), + ), + TextButton( + style: TextButton.styleFrom( + splashFactory: NoSplash.splashFactory, + overlayColor: Colors.transparent, + ), + onPressed: () => Navigator.of(context).pop(true), + child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor),), + ), + */ From d7f4b1c227f10c83b956e9db6724b3fdd180ec6c Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Tue, 13 Jan 2026 20:41:03 +0100 Subject: [PATCH 05/12] seperate button into widget & change to agreed design --- .../views/main_menu/settings_view.dart | 61 +------------------ .../buttons/animated_dialog_button.dart | 48 +++++++++++++++ 2 files changed, 51 insertions(+), 58 deletions(-) create mode 100644 lib/presentation/widgets/buttons/animated_dialog_button.dart diff --git a/lib/presentation/views/main_menu/settings_view.dart b/lib/presentation/views/main_menu/settings_view.dart index cab26ef..21b9d64 100644 --- a/lib/presentation/views/main_menu/settings_view.dart +++ b/lib/presentation/views/main_menu/settings_view.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:game_tracker/core/custom_theme.dart'; import 'package:game_tracker/core/enums.dart'; import 'package:game_tracker/l10n/generated/app_localizations.dart'; +import 'package:game_tracker/presentation/widgets/buttons/animated_dialog_button.dart'; import 'package:game_tracker/presentation/widgets/tiles/settings_list_tile.dart'; import 'package:game_tracker/services/data_transfer_service.dart'; import 'package:package_info_plus/package_info_plus.dart'; @@ -97,11 +98,11 @@ class _SettingsViewState extends State { title: '${loc.delete_all_data}?', content: loc.this_cannot_be_undone, actions: [ - _PressableButton( + AnimatedDialogButton( onPressed: () => Navigator.of(context).pop(false), child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor)), ), - _PressableButton( + AnimatedDialogButton( onPressed: () => Navigator.of(context).pop(true), child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor)), ), @@ -218,59 +219,3 @@ class _SettingsViewState extends State { }); } } - -class _PressableButton extends StatefulWidget { - final VoidCallback onPressed; - final Widget child; - - const _PressableButton({required this.onPressed, required this.child}); - - @override - State<_PressableButton> createState() => _PressableButtonState(); -} - -class _PressableButtonState extends State<_PressableButton> { - bool _isPressed = false; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTapDown: (_) => setState(() => _isPressed = true), - onTapUp: (_) => setState(() => _isPressed = false), - onTapCancel: () => setState(() => _isPressed = false), - onTap: widget.onPressed, - child: AnimatedScale( - scale: _isPressed ? 0.95 : 1.0, - duration: const Duration(milliseconds: 100), - child: AnimatedOpacity( - opacity: _isPressed ? 0.6 : 1.0, - duration: const Duration(milliseconds: 100), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: widget.child, - ), - ), - ), - ); - } -} - - -/* - TextButton( - style: TextButton.styleFrom( - splashFactory: NoSplash.splashFactory, - overlayColor: Colors.transparent, - ), - onPressed: () => Navigator.of(context).pop(false), - child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor),), - ), - TextButton( - style: TextButton.styleFrom( - splashFactory: NoSplash.splashFactory, - overlayColor: Colors.transparent, - ), - onPressed: () => Navigator.of(context).pop(true), - child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor),), - ), - */ diff --git a/lib/presentation/widgets/buttons/animated_dialog_button.dart b/lib/presentation/widgets/buttons/animated_dialog_button.dart new file mode 100644 index 0000000..cf49c19 --- /dev/null +++ b/lib/presentation/widgets/buttons/animated_dialog_button.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; +import 'package:game_tracker/core/custom_theme.dart'; + +/// A custom animated button widget that provides a scaling and opacity effect +/// when pressed. This widget is designed to be used in dialogs or other UI +/// components where a visually appealing button is required. +class AnimatedDialogButton extends StatefulWidget { + /// Callback function that is triggered when the button is pressed. + final VoidCallback onPressed; + + /// The child widget to be displayed inside the button, typically a text or icon. + final Widget child; + + /// Creates an instance of `AnimatedDialogButton`. + /// + /// The [onPressed] and [child] parameters are required. + const AnimatedDialogButton({required this.onPressed, required this.child}); + + @override + State createState() => _AnimatedDialogButtonState(); +} + +class _AnimatedDialogButtonState extends State { + bool _isPressed = false; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTapDown: (_) => setState(() => _isPressed = true), + onTapUp: (_) => setState(() => _isPressed = false), + onTapCancel: () => setState(() => _isPressed = false), + onTap: widget.onPressed, + child: AnimatedScale( + scale: _isPressed ? 0.95 : 1.0, + duration: const Duration(milliseconds: 100), + child: AnimatedOpacity( + opacity: _isPressed ? 0.6 : 1.0, + duration: const Duration(milliseconds: 100), + child: Container( + decoration: CustomTheme.standardBoxDecoration, + padding: EdgeInsets.symmetric(horizontal: 26, vertical: 6), + child: widget.child, + ), + ), + ), + ); + } +} From d662680a340371d9d901315394af533f1c23648d Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Tue, 13 Jan 2026 20:46:42 +0100 Subject: [PATCH 06/12] fix dart analysis errors --- lib/presentation/widgets/buttons/animated_dialog_button.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/presentation/widgets/buttons/animated_dialog_button.dart b/lib/presentation/widgets/buttons/animated_dialog_button.dart index cf49c19..42104b2 100644 --- a/lib/presentation/widgets/buttons/animated_dialog_button.dart +++ b/lib/presentation/widgets/buttons/animated_dialog_button.dart @@ -14,7 +14,7 @@ class AnimatedDialogButton extends StatefulWidget { /// Creates an instance of `AnimatedDialogButton`. /// /// The [onPressed] and [child] parameters are required. - const AnimatedDialogButton({required this.onPressed, required this.child}); + const AnimatedDialogButton({super.key, required this.onPressed, required this.child}); @override State createState() => _AnimatedDialogButtonState(); @@ -38,7 +38,7 @@ class _AnimatedDialogButtonState extends State { duration: const Duration(milliseconds: 100), child: Container( decoration: CustomTheme.standardBoxDecoration, - padding: EdgeInsets.symmetric(horizontal: 26, vertical: 6), + padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 6), child: widget.child, ), ), From 4161e1e88bcede3643de9ed7ae8ef5a8c5f92dbb Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Tue, 13 Jan 2026 20:50:54 +0100 Subject: [PATCH 07/12] add docs to custom_alert_dialog.dart --- lib/presentation/widgets/custom_alert_dialog.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/presentation/widgets/custom_alert_dialog.dart b/lib/presentation/widgets/custom_alert_dialog.dart index 2456b56..5dc8b9a 100644 --- a/lib/presentation/widgets/custom_alert_dialog.dart +++ b/lib/presentation/widgets/custom_alert_dialog.dart @@ -1,9 +1,19 @@ import 'package:flutter/material.dart'; import 'package:game_tracker/core/custom_theme.dart'; +/// A custom alert dialog widget that follows the application's design theme. +/// +/// This widget provides a styled alternative to the default Flutter AlertDialog, +/// with consistent colors, borders, and layout that match the app's custom theme. class CustomAlertDialog extends StatelessWidget { + /// The title text displayed at the top of the dialog. final String title; + + /// The main content text displayed in the body of the dialog. final String content; + + /// A list of action widgets (typically buttons) displayed at the bottom of the dialog. + /// These actions are horizontally spaced around the dialog's width. final List actions; const CustomAlertDialog({ From 82ad2b74f829e857a949cb607d77349d1b1bea6c Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Tue, 13 Jan 2026 21:16:59 +0100 Subject: [PATCH 08/12] refactor: enhance documentation and fix punctuation in localization strings --- lib/l10n/arb/app_de.arb | 2 +- lib/l10n/arb/app_en.arb | 2 +- lib/l10n/generated/app_localizations.dart | 2 +- lib/l10n/generated/app_localizations_de.dart | 2 +- lib/l10n/generated/app_localizations_en.dart | 2 +- .../buttons/animated_dialog_button.dart | 12 +++++------ .../widgets/custom_alert_dialog.dart | 20 +++++++++---------- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/l10n/arb/app_de.arb b/lib/l10n/arb/app_de.arb index 6aee6ee..7091586 100644 --- a/lib/l10n/arb/app_de.arb +++ b/lib/l10n/arb/app_de.arb @@ -79,7 +79,7 @@ "stats": "Statistiken", "successfully_added_player": "Spieler:in {playerName} erfolgreich hinzugefügt", "there_is_no_group_matching_your_search": "Es gibt keine Gruppe, die deiner Suche entspricht", - "this_cannot_be_undone": "Dies kann nicht rückgängig gemacht werden", + "this_cannot_be_undone": "Dies kann nicht rückgängig gemacht werden.", "today_at": "Heute um", "undo": "Rückgängig", "unknown_exception": "Unbekannter Fehler (siehe Konsole)", diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index c311050..6eb7613 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -356,7 +356,7 @@ "stats": "Stats", "successfully_added_player": "Successfully added player {playerName}", "there_is_no_group_matching_your_search": "There is no group matching your search", - "this_cannot_be_undone": "This can't be undone", + "this_cannot_be_undone": "This can't be undone.", "today_at": "Today at", "undo": "Undo", "unknown_exception": "Unknown Exception (see console)", diff --git a/lib/l10n/generated/app_localizations.dart b/lib/l10n/generated/app_localizations.dart index 399dc85..e78d69b 100644 --- a/lib/l10n/generated/app_localizations.dart +++ b/lib/l10n/generated/app_localizations.dart @@ -575,7 +575,7 @@ abstract class AppLocalizations { /// Warning message for irreversible actions /// /// In en, this message translates to: - /// **'This can\'t be undone'** + /// **'This can\'t be undone.'** String get this_cannot_be_undone; /// Date format for today diff --git a/lib/l10n/generated/app_localizations_de.dart b/lib/l10n/generated/app_localizations_de.dart index f4d0f8c..8ecc0a7 100644 --- a/lib/l10n/generated/app_localizations_de.dart +++ b/lib/l10n/generated/app_localizations_de.dart @@ -262,7 +262,7 @@ class AppLocalizationsDe extends AppLocalizations { @override String get this_cannot_be_undone => - 'Dies kann nicht rückgängig gemacht werden'; + 'Dies kann nicht rückgängig gemacht werden.'; @override String get today_at => 'Heute um'; diff --git a/lib/l10n/generated/app_localizations_en.dart b/lib/l10n/generated/app_localizations_en.dart index 6c4ac74..b911676 100644 --- a/lib/l10n/generated/app_localizations_en.dart +++ b/lib/l10n/generated/app_localizations_en.dart @@ -261,7 +261,7 @@ class AppLocalizationsEn extends AppLocalizations { 'There is no group matching your search'; @override - String get this_cannot_be_undone => 'This can\'t be undone'; + String get this_cannot_be_undone => 'This can\'t be undone.'; @override String get today_at => 'Today at'; diff --git a/lib/presentation/widgets/buttons/animated_dialog_button.dart b/lib/presentation/widgets/buttons/animated_dialog_button.dart index 42104b2..c0ce560 100644 --- a/lib/presentation/widgets/buttons/animated_dialog_button.dart +++ b/lib/presentation/widgets/buttons/animated_dialog_button.dart @@ -4,18 +4,18 @@ import 'package:game_tracker/core/custom_theme.dart'; /// A custom animated button widget that provides a scaling and opacity effect /// when pressed. This widget is designed to be used in dialogs or other UI /// components where a visually appealing button is required. +/// +/// Parameters: +/// - [onPressed]: Callback function that is triggered when the button is pressed. +/// - [child]: The child widget to be displayed inside the button, typically a text or icon. class AnimatedDialogButton extends StatefulWidget { + const AnimatedDialogButton({super.key, required this.onPressed, required this.child}); + /// Callback function that is triggered when the button is pressed. final VoidCallback onPressed; - /// The child widget to be displayed inside the button, typically a text or icon. final Widget child; - /// Creates an instance of `AnimatedDialogButton`. - /// - /// The [onPressed] and [child] parameters are required. - const AnimatedDialogButton({super.key, required this.onPressed, required this.child}); - @override State createState() => _AnimatedDialogButtonState(); } diff --git a/lib/presentation/widgets/custom_alert_dialog.dart b/lib/presentation/widgets/custom_alert_dialog.dart index 5dc8b9a..832369a 100644 --- a/lib/presentation/widgets/custom_alert_dialog.dart +++ b/lib/presentation/widgets/custom_alert_dialog.dart @@ -5,17 +5,13 @@ import 'package:game_tracker/core/custom_theme.dart'; /// /// This widget provides a styled alternative to the default Flutter AlertDialog, /// with consistent colors, borders, and layout that match the app's custom theme. +/// +/// Parameters: +/// - [title]: The title text displayed at the top of the dialog. +/// - [content]: The main content text displayed in the body of the dialog. +/// - [actions]: A list of action widgets (typically buttons) displayed at the bottom +/// of the dialog. These actions are horizontally spaced around the dialog's width. class CustomAlertDialog extends StatelessWidget { - /// The title text displayed at the top of the dialog. - final String title; - - /// The main content text displayed in the body of the dialog. - final String content; - - /// A list of action widgets (typically buttons) displayed at the bottom of the dialog. - /// These actions are horizontally spaced around the dialog's width. - final List actions; - const CustomAlertDialog({ super.key, required this.title, @@ -23,6 +19,10 @@ class CustomAlertDialog extends StatelessWidget { required this.actions, }); + final String title; + final String content; + final List actions; + @override Widget build(BuildContext context) { return AlertDialog( From 4019ed083ff75e6abecffcf6e9a2247f64a69401 Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Tue, 13 Jan 2026 21:53:45 +0100 Subject: [PATCH 09/12] add background color option to AnimatedDialogButton --- .../main_menu/settings_view/settings_view.dart | 3 ++- .../widgets/buttons/animated_dialog_button.dart | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/presentation/views/main_menu/settings_view/settings_view.dart b/lib/presentation/views/main_menu/settings_view/settings_view.dart index 1304f4a..34381c4 100644 --- a/lib/presentation/views/main_menu/settings_view/settings_view.dart +++ b/lib/presentation/views/main_menu/settings_view/settings_view.dart @@ -111,7 +111,8 @@ class _SettingsViewState extends State { ), AnimatedDialogButton( onPressed: () => Navigator.of(context).pop(true), - child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor)), + child: Text(loc.delete, style: TextStyle(color: CustomTheme.textColor)), + backgroundColor: CustomTheme.secondaryColor, ), ], ), diff --git a/lib/presentation/widgets/buttons/animated_dialog_button.dart b/lib/presentation/widgets/buttons/animated_dialog_button.dart index c0ce560..a93f7cf 100644 --- a/lib/presentation/widgets/buttons/animated_dialog_button.dart +++ b/lib/presentation/widgets/buttons/animated_dialog_button.dart @@ -8,13 +8,18 @@ import 'package:game_tracker/core/custom_theme.dart'; /// Parameters: /// - [onPressed]: Callback function that is triggered when the button is pressed. /// - [child]: The child widget to be displayed inside the button, typically a text or icon. +/// - [backgroundColor]: Optional background color for the button container. If null, uses the standard box color from CustomTheme. class AnimatedDialogButton extends StatefulWidget { - const AnimatedDialogButton({super.key, required this.onPressed, required this.child}); + const AnimatedDialogButton({ + super.key, + required this.onPressed, + required this.child, + this.backgroundColor, + }); - /// Callback function that is triggered when the button is pressed. final VoidCallback onPressed; - /// The child widget to be displayed inside the button, typically a text or icon. final Widget child; + final Color? backgroundColor; @override State createState() => _AnimatedDialogButtonState(); @@ -37,7 +42,11 @@ class _AnimatedDialogButtonState extends State { opacity: _isPressed ? 0.6 : 1.0, duration: const Duration(milliseconds: 100), child: Container( - decoration: CustomTheme.standardBoxDecoration, + decoration: widget.backgroundColor != null + ? CustomTheme.standardBoxDecoration.copyWith( + color: widget.backgroundColor, + ) + : CustomTheme.standardBoxDecoration, padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 6), child: widget.child, ), From db51990695d60144175ea136cb62dfafd17002f6 Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Tue, 13 Jan 2026 22:17:38 +0100 Subject: [PATCH 10/12] Revert "add background color option to AnimatedDialogButton" This reverts commit 4019ed083ff75e6abecffcf6e9a2247f64a69401. --- .../main_menu/settings_view/settings_view.dart | 3 +-- .../widgets/buttons/animated_dialog_button.dart | 17 ++++------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/lib/presentation/views/main_menu/settings_view/settings_view.dart b/lib/presentation/views/main_menu/settings_view/settings_view.dart index 34381c4..1304f4a 100644 --- a/lib/presentation/views/main_menu/settings_view/settings_view.dart +++ b/lib/presentation/views/main_menu/settings_view/settings_view.dart @@ -111,8 +111,7 @@ class _SettingsViewState extends State { ), AnimatedDialogButton( onPressed: () => Navigator.of(context).pop(true), - child: Text(loc.delete, style: TextStyle(color: CustomTheme.textColor)), - backgroundColor: CustomTheme.secondaryColor, + child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor)), ), ], ), diff --git a/lib/presentation/widgets/buttons/animated_dialog_button.dart b/lib/presentation/widgets/buttons/animated_dialog_button.dart index a93f7cf..c0ce560 100644 --- a/lib/presentation/widgets/buttons/animated_dialog_button.dart +++ b/lib/presentation/widgets/buttons/animated_dialog_button.dart @@ -8,18 +8,13 @@ import 'package:game_tracker/core/custom_theme.dart'; /// Parameters: /// - [onPressed]: Callback function that is triggered when the button is pressed. /// - [child]: The child widget to be displayed inside the button, typically a text or icon. -/// - [backgroundColor]: Optional background color for the button container. If null, uses the standard box color from CustomTheme. class AnimatedDialogButton extends StatefulWidget { - const AnimatedDialogButton({ - super.key, - required this.onPressed, - required this.child, - this.backgroundColor, - }); + const AnimatedDialogButton({super.key, required this.onPressed, required this.child}); + /// Callback function that is triggered when the button is pressed. final VoidCallback onPressed; + /// The child widget to be displayed inside the button, typically a text or icon. final Widget child; - final Color? backgroundColor; @override State createState() => _AnimatedDialogButtonState(); @@ -42,11 +37,7 @@ class _AnimatedDialogButtonState extends State { opacity: _isPressed ? 0.6 : 1.0, duration: const Duration(milliseconds: 100), child: Container( - decoration: widget.backgroundColor != null - ? CustomTheme.standardBoxDecoration.copyWith( - color: widget.backgroundColor, - ) - : CustomTheme.standardBoxDecoration, + decoration: CustomTheme.standardBoxDecoration, padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 6), child: widget.child, ), From 5350113ee14e71a66ad304fbe16a6ec631a51e36 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Tue, 13 Jan 2026 22:54:19 +0100 Subject: [PATCH 11/12] Updated doc strings --- .../buttons/animated_dialog_button.dart | 18 ++++++++------- .../widgets/custom_alert_dialog.dart | 23 +++++++++---------- pubspec.yaml | 2 +- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/presentation/widgets/buttons/animated_dialog_button.dart b/lib/presentation/widgets/buttons/animated_dialog_button.dart index c0ce560..65c0510 100644 --- a/lib/presentation/widgets/buttons/animated_dialog_button.dart +++ b/lib/presentation/widgets/buttons/animated_dialog_button.dart @@ -1,18 +1,20 @@ import 'package:flutter/material.dart'; import 'package:game_tracker/core/custom_theme.dart'; -/// A custom animated button widget that provides a scaling and opacity effect -/// when pressed. This widget is designed to be used in dialogs or other UI -/// components where a visually appealing button is required. -/// -/// Parameters: -/// - [onPressed]: Callback function that is triggered when the button is pressed. -/// - [child]: The child widget to be displayed inside the button, typically a text or icon. class AnimatedDialogButton extends StatefulWidget { - const AnimatedDialogButton({super.key, required this.onPressed, required this.child}); + /// A custom animated button widget that provides a scaling and opacity effect + /// when pressed. + /// - [onPressed]: Callback function that is triggered when the button is pressed. + /// - [child]: The child widget to be displayed inside the button, typically a text or icon. + const AnimatedDialogButton({ + super.key, + required this.onPressed, + required this.child, + }); /// Callback function that is triggered when the button is pressed. final VoidCallback onPressed; + /// The child widget to be displayed inside the button, typically a text or icon. final Widget child; diff --git a/lib/presentation/widgets/custom_alert_dialog.dart b/lib/presentation/widgets/custom_alert_dialog.dart index 832369a..af5b45a 100644 --- a/lib/presentation/widgets/custom_alert_dialog.dart +++ b/lib/presentation/widgets/custom_alert_dialog.dart @@ -1,17 +1,13 @@ import 'package:flutter/material.dart'; import 'package:game_tracker/core/custom_theme.dart'; -/// A custom alert dialog widget that follows the application's design theme. -/// -/// This widget provides a styled alternative to the default Flutter AlertDialog, -/// with consistent colors, borders, and layout that match the app's custom theme. -/// -/// Parameters: -/// - [title]: The title text displayed at the top of the dialog. -/// - [content]: The main content text displayed in the body of the dialog. -/// - [actions]: A list of action widgets (typically buttons) displayed at the bottom -/// of the dialog. These actions are horizontally spaced around the dialog's width. class CustomAlertDialog extends StatelessWidget { + /// A custom alert dialog widget that provides a os unspecific AlertDialog, + /// with consistent colors, borders, and layout that match the app's custom theme. + /// - [title]: The title text displayed at the top of the dialog. + /// - [content]: The main content text displayed in the body of the dialog. + /// - [actions]: A list of action widgets (typically buttons) displayed at the bottom + /// of the dialog. These actions are horizontally spaced around the dialog's width. const CustomAlertDialog({ super.key, required this.title, @@ -26,8 +22,11 @@ class CustomAlertDialog extends StatelessWidget { @override Widget build(BuildContext context) { return AlertDialog( - title: Text(title, style: const TextStyle(color: CustomTheme.textColor,),), - content: Text(content, style: const TextStyle(color: CustomTheme.textColor),), + title: Text(title, style: const TextStyle(color: CustomTheme.textColor)), + content: Text( + content, + style: const TextStyle(color: CustomTheme.textColor), + ), actions: actions, backgroundColor: CustomTheme.boxColor, actionsAlignment: MainAxisAlignment.spaceAround, diff --git a/pubspec.yaml b/pubspec.yaml index 83d5079..46efd94 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: game_tracker description: "Game Tracking App for Card Games" publish_to: 'none' -version: 0.0.6+209 +version: 0.0.7+211 environment: sdk: ^3.8.1 From 2cadab004d0b8204fa0164db2b0981d36db94ec9 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Tue, 13 Jan 2026 22:58:35 +0100 Subject: [PATCH 12/12] Merge cleaning --- .../main_menu/settings_view/settings_view.dart | 16 +++++++++++++--- pubspec.yaml | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/presentation/views/main_menu/settings_view/settings_view.dart b/lib/presentation/views/main_menu/settings_view/settings_view.dart index e34d75b..b51cad0 100644 --- a/lib/presentation/views/main_menu/settings_view/settings_view.dart +++ b/lib/presentation/views/main_menu/settings_view/settings_view.dart @@ -123,11 +123,21 @@ class _SettingsViewState extends State { actions: [ AnimatedDialogButton( onPressed: () => Navigator.of(context).pop(false), - child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor)), + child: Text( + loc.cancel, + style: const TextStyle( + color: CustomTheme.textColor, + ), + ), ), AnimatedDialogButton( onPressed: () => Navigator.of(context).pop(true), - child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor)), + child: Text( + loc.delete, + style: TextStyle( + color: CustomTheme.secondaryColor, + ), + ), ), ], ), @@ -135,7 +145,7 @@ class _SettingsViewState extends State { if (confirmed == true && context.mounted) { DataTransferService.deleteAllData(context); showSnackbar( - context: context, + context: scaffoldMessengerContext, message: AppLocalizations.of( context, ).data_successfully_deleted, diff --git a/pubspec.yaml b/pubspec.yaml index 46efd94..e9fd894 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: game_tracker description: "Game Tracking App for Card Games" publish_to: 'none' -version: 0.0.7+211 +version: 0.0.7+212 environment: sdk: ^3.8.1