Merge branch 'development' into refactoring/157-class-doc-comment-zu-konstruktor-verschieben
This commit is contained in:
50
lib/presentation/widgets/buttons/animated_dialog_button.dart
Normal file
50
lib/presentation/widgets/buttons/animated_dialog_button.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
39
lib/presentation/widgets/custom_alert_dialog.dart
Normal file
39
lib/presentation/widgets/custom_alert_dialog.dart
Normal 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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user