3 Commits

Author SHA1 Message Date
9c4eff5056 Moved button
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 46s
Pull Request Pipeline / lint (pull_request) Successful in 48s
2026-04-19 16:02:14 +02:00
ad2e4bc398 Added constraint parameter 2026-04-19 15:56:11 +02:00
2ad3698067 Updated documentation 2026-04-19 15:25:22 +02:00
2 changed files with 17 additions and 11 deletions

View File

@@ -5,19 +5,22 @@ 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.
/// - [buttonText]: The text to be displayed on the button.
/// - [buttonType]: The type of the button, which determines its styling.
/// - [buttonConstraints]: Optional constraints to control the button's size.
const AnimatedDialogButton({
super.key,
required this.buttonText,
required this.onPressed,
required this.text,
this.buttonConstraints,
this.buttonType = ButtonType.primary,
});
/// Callback function that is triggered when the button is pressed.
final String buttonText;
final VoidCallback onPressed;
/// The text to be displayed on the button.
final String text;
final BoxConstraints? buttonConstraints;
final ButtonType buttonType;
@@ -66,12 +69,12 @@ class _AnimatedDialogButtonState extends State<AnimatedDialogButton> {
duration: const Duration(milliseconds: 100),
child: Center(
child: Container(
constraints: const BoxConstraints(minWidth: 300),
constraints: widget.buttonConstraints,
decoration: buttonDecoration,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
margin: const EdgeInsets.symmetric(vertical: 8),
child: Text(
widget.text,
widget.buttonText,
style: textStyling,
textAlign: TextAlign.center,
),

View File

@@ -1,8 +1,12 @@
import 'package:flutter/cupertino.dart';
import 'package:tallee/core/enums.dart';
import 'package:tallee/presentation/widgets/dialog/animated_dialog_button.dart';
import 'package:tallee/presentation/widgets/buttons/animated_dialog_button.dart';
class CustomDialogAction extends StatelessWidget {
/// A custom dialog action widget that represents a button in a dialog.
/// - [text]: The text to be displayed on the button.
/// - [buttonType]: The type of the button, which determines its styling.
/// - [onPressed]: Callback function that is triggered when the button is pressed.
const CustomDialogAction({
super.key,
required this.onPressed,
@@ -10,10 +14,8 @@ class CustomDialogAction extends StatelessWidget {
this.buttonType = ButtonType.primary,
});
// The text displaed on the button
final String text;
// The type of the button, which determines its styling
final ButtonType buttonType;
final VoidCallback onPressed;
@@ -22,8 +24,9 @@ class CustomDialogAction extends StatelessWidget {
Widget build(BuildContext context) {
return AnimatedDialogButton(
onPressed: onPressed,
text: text,
buttonText: text,
buttonType: buttonType,
buttonConstraints: const BoxConstraints(minWidth: 300),
);
}
}