Merge branch 'development' into refactoring/157-class-doc-comment-zu-konstruktor-verschieben
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m5s
Pull Request Pipeline / lint (pull_request) Successful in 2m10s

This commit is contained in:
2026-01-14 09:12:03 +00:00
9 changed files with 120 additions and 24 deletions

View File

@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
class AnimatedDialogButton extends StatefulWidget {
/// 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;
@override
State<AnimatedDialogButton> createState() => _AnimatedDialogButtonState();
}
class _AnimatedDialogButtonState extends State<AnimatedDialogButton> {
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: const EdgeInsets.symmetric(horizontal: 26, vertical: 6),
child: widget.child,
),
),
),
);
}
}

View File

@@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
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,
required this.content,
required this.actions,
});
final String title;
final String content;
final List<Widget> 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,
actionsAlignment: MainAxisAlignment.spaceAround,
shape: RoundedRectangleBorder(
borderRadius: CustomTheme.standardBorderRadiusAll,
side: BorderSide(color: CustomTheme.boxBorder),
),
);
}
}