Teamspiele implementieren #217

Open
flixcoo wants to merge 55 commits from feature/168-teamspiele-implementieren into development
Showing only changes of commit ec1182b560 - Show all commits

View File

@@ -15,11 +15,12 @@ class AnimatedDialogButton extends StatefulWidget {
this.buttonConstraints, this.buttonConstraints,
this.buttonType = ButtonType.primary, this.buttonType = ButtonType.primary,
this.isDescructive = false, this.isDescructive = false,
this.content,
}); });
final String buttonText; final String buttonText;
final VoidCallback onPressed; final VoidCallback? onPressed;
final BoxConstraints? buttonConstraints; final BoxConstraints? buttonConstraints;
@@ -27,6 +28,8 @@ class AnimatedDialogButton extends StatefulWidget {
final bool isDescructive; final bool isDescructive;
final Widget? content;
@override @override
State<AnimatedDialogButton> createState() => _AnimatedDialogButtonState(); State<AnimatedDialogButton> createState() => _AnimatedDialogButtonState();
} }
@@ -38,8 +41,13 @@ class _AnimatedDialogButtonState extends State<AnimatedDialogButton> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final textStyling = _getTextStyling(); final textStyling = _getTextStyling();
final buttonDecoration = _getButtonDecoration(); final buttonDecoration = _getButtonDecoration();
final isDisabled = widget.onPressed == null;
return GestureDetector( return IgnorePointer(
ignoring: isDisabled,
child: Opacity(
opacity: isDisabled ? 0.4 : 1.0,
child: GestureDetector(
onTapDown: (_) => setState(() => _isPressed = true), onTapDown: (_) => setState(() => _isPressed = true),
onTapUp: (_) => setState(() => _isPressed = false), onTapUp: (_) => setState(() => _isPressed = false),
onTapCancel: () => setState(() => _isPressed = false), onTapCancel: () => setState(() => _isPressed = false),
@@ -54,9 +62,14 @@ class _AnimatedDialogButtonState extends State<AnimatedDialogButton> {
child: Container( child: Container(
constraints: widget.buttonConstraints, constraints: widget.buttonConstraints,
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: widget.buttonText == ''
? widget.content!
: Text(
widget.buttonText, widget.buttonText,
style: textStyling, style: textStyling,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@@ -65,6 +78,8 @@ class _AnimatedDialogButtonState extends State<AnimatedDialogButton> {
), ),
), ),
), ),
),
),
); );
} }