Skip to content

Commit

Permalink
Merge pull request #48 from msi-se/ui-adjustments
Browse files Browse the repository at this point in the history
fixed overflow of dashboard images
  • Loading branch information
Leon-Jerke authored Apr 17, 2024
2 parents fe39ff1 + fe58b01 commit 1eae0cc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions frontend/lib/components/dashboard_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class DashboardCard extends StatefulWidget {
State<DashboardCard> createState() => _DashboardCardState();
}

class _DashboardCardState extends State<DashboardCard>
with SingleTickerProviderStateMixin {
class _DashboardCardState extends State<DashboardCard> with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;

Expand All @@ -31,15 +30,13 @@ class _DashboardCardState extends State<DashboardCard>
duration: const Duration(milliseconds: 400),
vsync: this,
);

_animation = CurvedAnimation(
parent: _controller,
curve: Curves.easeOut,
);

_controller.forward();
}

void _displayDisabledDialog() {
showDialog(
context: context,
Expand All @@ -60,6 +57,10 @@ class _DashboardCardState extends State<DashboardCard>

@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(
Expand All @@ -74,8 +75,8 @@ class _DashboardCardState extends State<DashboardCard>
children: [
SvgPicture.asset(
widget.svgImage,
height: 110,
width: 110,
height: imageSize,
width: imageSize,
colorFilter: widget.enabled
? null
: ColorFilter.mode(Colors.grey[300]!, BlendMode.saturation),
Expand Down

0 comments on commit 1eae0cc

Please sign in to comment.