From 403b63dee0721e52c531ffa6b615bd0f80167cde Mon Sep 17 00:00:00 2001 From: Leon-Jerke Date: Wed, 17 Apr 2024 20:29:59 +0200 Subject: [PATCH] fixed overflow error in dashboard cards --- frontend/lib/components/dashboard_card.dart | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/lib/components/dashboard_card.dart b/frontend/lib/components/dashboard_card.dart index a34fcb7..abad19d 100644 --- a/frontend/lib/components/dashboard_card.dart +++ b/frontend/lib/components/dashboard_card.dart @@ -19,8 +19,7 @@ class DashboardCard extends StatefulWidget { State createState() => _DashboardCardState(); } -class _DashboardCardState extends State - with SingleTickerProviderStateMixin { +class _DashboardCardState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; @@ -31,15 +30,13 @@ class _DashboardCardState extends State duration: const Duration(milliseconds: 400), vsync: this, ); - _animation = CurvedAnimation( parent: _controller, curve: Curves.easeOut, ); - _controller.forward(); } - + void _displayDisabledDialog() { showDialog( context: context, @@ -60,6 +57,10 @@ class _DashboardCardState extends State @override Widget build(BuildContext context) { + double screenWidth = MediaQuery.of(context).size.width; + double imageSize = screenWidth * 0.25; // 25% der Bildschirmbreite + imageSize = imageSize.clamp(80.0, 150.0); // Begrenzung der Größe zwischen 80 und 150 Pixeln + return GestureDetector( onTap: widget.enabled ? widget.onTap : _displayDisabledDialog, child: ScaleTransition( @@ -74,8 +75,8 @@ class _DashboardCardState extends State children: [ SvgPicture.asset( widget.svgImage, - height: 110, - width: 110, + height: imageSize, + width: imageSize, colorFilter: widget.enabled ? null : ColorFilter.mode(Colors.grey[300]!, BlendMode.saturation),