From 4019ed083ff75e6abecffcf6e9a2247f64a69401 Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Tue, 13 Jan 2026 21:53:45 +0100 Subject: [PATCH] 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, ),