Updated documentation
This commit is contained in:
@@ -5,22 +5,24 @@ class AnimatedDialogButton extends StatefulWidget {
|
|||||||
/// A custom animated button widget that provides a scaling and opacity effect
|
/// A custom animated button widget that provides a scaling and opacity effect
|
||||||
/// when pressed.
|
/// when pressed.
|
||||||
/// - [onPressed]: Callback function that is triggered when the button is 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.
|
||||||
const AnimatedDialogButton({
|
const AnimatedDialogButton({
|
||||||
super.key,
|
super.key,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
required this.text,
|
required this.buttonText,
|
||||||
|
this.constraints,
|
||||||
this.buttonType = ButtonType.primary,
|
this.buttonType = ButtonType.primary,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Callback function that is triggered when the button is pressed.
|
final BoxConstraints? constraints;
|
||||||
final VoidCallback onPressed;
|
|
||||||
|
|
||||||
/// The text to be displayed on the button.
|
|
||||||
final String text;
|
|
||||||
|
|
||||||
final ButtonType buttonType;
|
final ButtonType buttonType;
|
||||||
|
|
||||||
|
final String buttonText;
|
||||||
|
|
||||||
|
final VoidCallback onPressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AnimatedDialogButton> createState() => _AnimatedDialogButtonState();
|
State<AnimatedDialogButton> createState() => _AnimatedDialogButtonState();
|
||||||
}
|
}
|
||||||
@@ -66,12 +68,12 @@ class _AnimatedDialogButtonState extends State<AnimatedDialogButton> {
|
|||||||
duration: const Duration(milliseconds: 100),
|
duration: const Duration(milliseconds: 100),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: const BoxConstraints(minWidth: 300),
|
constraints: widget.constraints,
|
||||||
decoration: buttonDecoration,
|
decoration: buttonDecoration,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||||
margin: const EdgeInsets.symmetric(vertical: 8),
|
margin: const EdgeInsets.symmetric(vertical: 8),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.text,
|
widget.buttonText,
|
||||||
style: textStyling,
|
style: textStyling,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ import 'package:tallee/core/enums.dart';
|
|||||||
import 'package:tallee/presentation/widgets/dialog/animated_dialog_button.dart';
|
import 'package:tallee/presentation/widgets/dialog/animated_dialog_button.dart';
|
||||||
|
|
||||||
class CustomDialogAction extends StatelessWidget {
|
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({
|
const CustomDialogAction({
|
||||||
super.key,
|
super.key,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
@@ -10,10 +14,8 @@ class CustomDialogAction extends StatelessWidget {
|
|||||||
this.buttonType = ButtonType.primary,
|
this.buttonType = ButtonType.primary,
|
||||||
});
|
});
|
||||||
|
|
||||||
// The text displaed on the button
|
|
||||||
final String text;
|
final String text;
|
||||||
|
|
||||||
// The type of the button, which determines its styling
|
|
||||||
final ButtonType buttonType;
|
final ButtonType buttonType;
|
||||||
|
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
@@ -22,8 +24,9 @@ class CustomDialogAction extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AnimatedDialogButton(
|
return AnimatedDialogButton(
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
text: text,
|
buttonText: text,
|
||||||
buttonType: buttonType,
|
buttonType: buttonType,
|
||||||
|
constraints: const BoxConstraints(minWidth: 300),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user