From 9998a90fc0ad6e8ef596e0d3c60b8f39c8cf690b Mon Sep 17 00:00:00 2001 From: Niklas Date: Tue, 22 Oct 2024 20:11:43 +0200 Subject: [PATCH] Smaller Changes --- lib/screens/detail_widget.dart | 6 +++-- lib/screens/home.dart | 6 ++++- lib/screens/subheader_Datepicker.dart | 33 +++++++++++++++++++-------- lib/utils/helper_functions.dart | 2 +- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/lib/screens/detail_widget.dart b/lib/screens/detail_widget.dart index 9bb81e2..564b794 100644 --- a/lib/screens/detail_widget.dart +++ b/lib/screens/detail_widget.dart @@ -1,3 +1,4 @@ +import 'package:Emma_home/utils/class.dart'; import 'package:flutter/material.dart'; import 'package:Emma_home/screens/subheader_Datepicker.dart'; //import 'package:learn_project/main.dart'; @@ -9,8 +10,9 @@ class Frame28 extends StatelessWidget { final List> events; final Color color; final MediaQueryData screen_size; + final Category category; - const Frame28({super.key, required this.events, required this.color, required this.screen_size}); + const Frame28({super.key, required this.events, required this.color, required this.screen_size, required this.category}); /* void initState() { super.initState(); @@ -108,7 +110,7 @@ class Frame28 extends StatelessWidget { ), SizedBox( height: 35, - child: MusikHeader(), + child: MusikHeader(name:category.title , icon: category.iconUrl), ), //Container(), Column( diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 7b099b1..313e2f6 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -97,10 +97,13 @@ class _HomePage extends State { @override Widget build(BuildContext context) { var size = MediaQuery.of(context).size; + //var appBarHeight = Scaffold.of(context).appBarMaxHeight; + //var single_categories = Categories.instance; //single_categories.updateCategoryAmount('Ingolstadt'); /*24 is for notification bar on Android*/ - final double itemHeight = (size.height - kToolbarHeight - 270) / 4; + //final double itemHeight = (size.height - kToolbarHeight - 270) / 4; 290 for iOs 230 android + final double itemHeight = (size.height - 230-90) / 4; final double itemWidth = (size.width-40)/ 2; MediaQueryData queryData; queryData = MediaQuery.of(context); @@ -224,6 +227,7 @@ class _HomePage extends State { events: events2, color: singleCategories.categories[index].color, screen_size: queryData, + category: singleCategories.categories[index], ))); }, child: diff --git a/lib/screens/subheader_Datepicker.dart b/lib/screens/subheader_Datepicker.dart index 9f9ee1a..28af6db 100644 --- a/lib/screens/subheader_Datepicker.dart +++ b/lib/screens/subheader_Datepicker.dart @@ -273,12 +273,13 @@ class EventCard2Section extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - title, + shortenText(title, 30), style: const TextStyle( color: Color(0xFF0A0A0A), fontSize: 18, fontFamily: 'Inter', - fontWeight: FontWeight.w400, + fontWeight: FontWeight.w800, + //fontWeight: FontWeight.w400, height: 1.5, ), ), @@ -291,7 +292,8 @@ class EventCard2Section extends StatelessWidget { color: Color(0xFF0A0A0A), fontSize: 18, fontFamily: 'Inter', - fontWeight: FontWeight.w800, + fontWeight: FontWeight.w400, + //fontWeight: FontWeight.w800, height: 1.2, ), ),), @@ -857,15 +859,22 @@ class TagSlider extends StatelessWidget { } class MusikHeader extends StatelessWidget { - const MusikHeader({super.key}); + final String name; // First variable + final String icon; // Second variable + + const MusikHeader({ + super.key, + required this.name, + required this.icon, + }); @override Widget build(BuildContext context) { return Column( children: [ SizedBox( - width: 390, - height: 32, + //width: 390, + height: 35, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, @@ -888,10 +897,14 @@ class MusikHeader extends StatelessWidget { width: 32, height: 32, child: Image.asset( - 'assets/images/Icons/Icon_Musik.png', + icon, + errorBuilder: (context, error, stackTrace) { + print('Error loading image: $error'); + return const Icon(Icons.error); + }, ), ), - const Text( - 'Musik', + Text( + name, style: TextStyle( color: Color(0xFF171717), fontSize: 20, @@ -905,7 +918,7 @@ class MusikHeader extends StatelessWidget { ), const SizedBox(width: 89), - const SizedBox(width: 89), + ], ), ), diff --git a/lib/utils/helper_functions.dart b/lib/utils/helper_functions.dart index 0d1094f..185b5c9 100644 --- a/lib/utils/helper_functions.dart +++ b/lib/utils/helper_functions.dart @@ -18,7 +18,7 @@ String shortenText(String text, int maxLength) { } // Drei Punkte hinzufügen - return '$shortened...'; + return '$shortened ...'; }