diff --git a/lib/main.dart b/lib/main.dart index 8c24583..23225e4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -26,14 +26,14 @@ Future main() async { runApp( ChangeNotifierProvider( create: (context) => Categories.instance, - child: MyApp(), + child: const MyApp(), ), ); } /// Supabase client final supabase = Supabase.instance.client; -final timeSpan = ""; +const timeSpan = ""; /// Error message to display the user when unexpected error occurs. const unexpectedErrorMessage = 'Unexpected error occurred.'; diff --git a/lib/screens/MainScreen.dart b/lib/screens/MainScreen.dart index 27c6764..898ad19 100644 --- a/lib/screens/MainScreen.dart +++ b/lib/screens/MainScreen.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'subheader_Datepicker.dart'; class MainScreen extends StatefulWidget { + const MainScreen({super.key}); + @override _MainScreenState createState() => _MainScreenState(); } @@ -42,7 +44,7 @@ class _MainScreenState extends State with SingleTickerProviderStateM ),), title: Row( children: [ -SizedBox( +const SizedBox( height: 10, //height of button width: 20, //width of button child: Icon(Icons.keyboard_arrow_down), @@ -55,7 +57,7 @@ SizedBox( width: 100.0, child: TextField( controller: TextEditingController(text: "Ingolstadt"), - decoration: InputDecoration( + decoration: const InputDecoration( border: UnderlineInputBorder(), ), ), @@ -64,12 +66,12 @@ SizedBox( ), actions: [ IconButton( - icon: Icon(Icons.search), + icon: const Icon(Icons.search), onPressed: () { // Perform search action }, ), - SizedBox( + const SizedBox( height: 40, child: VerticalDivider( thickness: 1, @@ -86,7 +88,7 @@ SizedBox( ), ], bottom: PreferredSize( - preferredSize: Size.fromHeight(1.0), + preferredSize: const Size.fromHeight(1.0), child: Container( color: Colors.black, height: 1.0, @@ -102,11 +104,11 @@ SizedBox( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ IconButton( - icon: Icon(Icons.home), + icon: const Icon(Icons.home), onPressed: () => _changeBody(HomeBody()), ), IconButton( - icon: Icon(Icons.settings), + icon: const Icon(Icons.settings), onPressed: () => _changeBody(SettingsBody()), ), // Add more buttons as needed @@ -118,15 +120,19 @@ SizedBox( } class HomeBody extends StatelessWidget { + const HomeBody({super.key}); + @override Widget build(BuildContext context) { - return Center(child: Text('Home Screen')); + return const Center(child: Text('Home Screen')); } } class SettingsBody extends StatelessWidget { + const SettingsBody({super.key}); + @override Widget build(BuildContext context) { - return Center(child: Text('Settings Screen')); + return const Center(child: Text('Settings Screen')); } } \ No newline at end of file diff --git a/lib/screens/detail_widget.dart b/lib/screens/detail_widget.dart index 9efa943..9bb81e2 100644 --- a/lib/screens/detail_widget.dart +++ b/lib/screens/detail_widget.dart @@ -10,8 +10,7 @@ class Frame28 extends StatelessWidget { final Color color; final MediaQueryData screen_size; - const Frame28({Key? key, required this.events, required this.color, required this.screen_size}) - : super(key: key); + const Frame28({super.key, required this.events, required this.color, required this.screen_size}); /* void initState() { super.initState(); @@ -21,6 +20,72 @@ class Frame28 extends StatelessWidget { @override Widget build(BuildContext context) { + var appBar = AppBar( + leading: SizedBox( + height: 60, + width: 63, + child: IconButton( + icon: Image.asset('assets/images/logo.png'), + onPressed: () { + // Open drawer or perform action + }, + ), + ), + title: Row( + children: [ + const SizedBox( + height: 10, //height of button + width: 20, //width of button + child: Icon(Icons.keyboard_arrow_down), + ), + const SizedBox( + //width of button + width: 10, + ), + SizedBox( + width: 100.0, + child: TextField( + controller: TextEditingController(text: "Ingolstadt"), + decoration: const InputDecoration( + border: UnderlineInputBorder(), + ), + ), + ), + ], + ), + actions: [ + IconButton( + icon: const Icon(Icons.search), + onPressed: () { + // Perform search action + }, + ), + const SizedBox( + height: 40, + child: VerticalDivider( + thickness: 1, + width: 20, + color: Colors.black, + ), + ), + SizedBox( + height: 50, //height of button + //width of button + child: IconButton( + icon: Image.asset('assets/images/Login.png'), + onPressed: () {}, + ), + ), + ], + bottom: PreferredSize( + preferredSize: const Size.fromHeight(1.0), + child: Container( + color: Colors.black, + height: 1.0, + ), + ), + flexibleSpace: Container(), + ); //_loadData(); var body = CustomScrollView(slivers: [ SliverSafeArea( @@ -31,23 +96,24 @@ class Frame28 extends StatelessWidget { alignment: Alignment.center, child: Column(children: [ //Header Container - HeaderSection(), + //HeaderSection(), + Container(height: 10), Container( height: 35, padding: const EdgeInsets.all(0), - child: TimeButtonSection(), // Dein Button-Bereich + child: const TimeButtonSection(), // Dein Button-Bereich ), Container( height: 10, ), - Container( + SizedBox( height: 35, child: MusikHeader(), ), //Container(), Column( children: [ - Container( + SizedBox( width: 380, //height: 259, @@ -114,6 +180,7 @@ class Frame28 extends StatelessWidget { ]); return Scaffold( backgroundColor: Colors.white, + appBar: appBar, body: body, ); } @@ -136,12 +203,12 @@ String extractTime24h(String timestamp) { // Dann den richtigen Eintrag in Data identifizieren udn die Farbe auswählen Color extractColor(String categoryID) { - var single_categories = Categories.instance; - final result = single_categories.categories.where((recipe) => recipe.category == categoryID).firstOrNull; - Color categorie_color= Color.fromARGB(255, 255, 255, 255); + var singleCategories = Categories.instance; + final result = singleCategories.categories.where((recipe) => recipe.category == categoryID).firstOrNull; + Color categorieColor= const Color.fromARGB(255, 255, 255, 255); if (result!=null) { - categorie_color=result.color; + categorieColor=result.color; } - return categorie_color; + return categorieColor; } \ No newline at end of file diff --git a/lib/screens/details_db.dart b/lib/screens/details_db.dart index 9603dcd..75d38e3 100644 --- a/lib/screens/details_db.dart +++ b/lib/screens/details_db.dart @@ -5,11 +5,13 @@ import 'package:supabase_flutter/supabase_flutter.dart'; //import 'dart:async'; class DetailsPage extends StatelessWidget { + const DetailsPage({super.key}); + @override Widget build(BuildContext context) { - final _future2 = Supabase.instance.client + final future2 = Supabase.instance.client .from('events') .select(); // 1. Daten anahdn von Filter einstellungen abrufen @@ -18,7 +20,7 @@ class DetailsPage extends StatelessWidget { return Scaffold( body: FutureBuilder( - future: _future2, + future: future2, builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return const Center(child: CircularProgressIndicator()); diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 7fbb8ed..7b099b1 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -9,6 +9,8 @@ import 'package:Emma_home/main.dart'; import 'package:Emma_home/utils/data.dart'; class HomePage extends StatefulWidget { + const HomePage({super.key}); + @override _HomePage createState() => _HomePage(); } @@ -21,9 +23,9 @@ class _HomePage extends State { } Future>> _loadData() async { - final _data = await supabase.from('events').select(); + final data = await supabase.from('events').select(); //get the id of the event - return _data; + return data; //Create a date entry and connect it with the event // Überprüfe, ob der Insert erfolgreich war @@ -98,7 +100,7 @@ class _HomePage extends State { //var single_categories = Categories.instance; //single_categories.updateCategoryAmount('Ingolstadt'); /*24 is for notification bar on Android*/ - final double itemHeight = (size.height - kToolbarHeight - 180) / 5; + final double itemHeight = (size.height - kToolbarHeight - 270) / 4; final double itemWidth = (size.width-40)/ 2; MediaQueryData queryData; queryData = MediaQuery.of(context); @@ -116,7 +118,7 @@ class _HomePage extends State { ), title: Row( children: [ - SizedBox( + const SizedBox( height: 10, //height of button width: 20, //width of button child: Icon(Icons.keyboard_arrow_down), @@ -129,7 +131,7 @@ class _HomePage extends State { width: 100.0, child: TextField( controller: TextEditingController(text: "Ingolstadt"), - decoration: InputDecoration( + decoration: const InputDecoration( border: UnderlineInputBorder(), ), ), @@ -138,12 +140,12 @@ class _HomePage extends State { ), actions: [ IconButton( - icon: Icon(Icons.search), + icon: const Icon(Icons.search), onPressed: () { // Perform search action }, ), - SizedBox( + const SizedBox( height: 40, child: VerticalDivider( thickness: 1, @@ -161,7 +163,7 @@ class _HomePage extends State { ), ], bottom: PreferredSize( - preferredSize: Size.fromHeight(1.0), + preferredSize: const Size.fromHeight(1.0), child: Container( color: Colors.black, height: 1.0, @@ -171,7 +173,7 @@ class _HomePage extends State { ); var body = SafeArea( child:Consumer( - builder: (context, single_categories, child) {return + builder: (context, singleCategories, child) {return Column( children: [ //Header Container @@ -187,7 +189,7 @@ class _HomePage extends State { child: Container( height: 35, padding: const EdgeInsets.all(0), - child: TimeButtonSection(), // Dein Button-Bereich + child: const TimeButtonSection(), // Dein Button-Bereich ), ), ]; @@ -199,12 +201,13 @@ class _HomePage extends State { true, // Damit der GridView korrekt in die Column passt //physics: NeverScrollableScrollPhysics(), // Deaktiviert das Scrolling des GridView gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - childAspectRatio: (itemWidth / - itemHeight), // Anzahl der Spalten im Grid + crossAxisCount: 2,// Anzahl der Spalten im Grid + //crossAxisSpacing: 10.0, + mainAxisSpacing: 10.0, + childAspectRatio: (itemWidth /itemHeight), ), itemCount: - single_categories.categories.length, // Anzahl der Elemente im Grid + singleCategories.categories.length, // Anzahl der Elemente im Grid itemBuilder: (BuildContext context, int index) { return Padding( padding: const EdgeInsets.all(6.0), @@ -213,18 +216,18 @@ class _HomePage extends State { /* List> events = await _loadData(); */ List> events2 = - await fetchEvents(single_categories.categories[index].category); + await fetchEvents(singleCategories.categories[index].category); Navigator.push( context, MaterialPageRoute( builder: (context) => Frame28( events: events2, - color: single_categories.categories[index].color, + color: singleCategories.categories[index].color, screen_size: queryData, ))); }, child: - Container( + SizedBox( width: itemWidth, height: itemHeight, child: Stack( @@ -238,16 +241,16 @@ class _HomePage extends State { decoration: ShapeDecoration( image: DecorationImage( image: - AssetImage(single_categories.categories[index].imageUrl), + AssetImage(singleCategories.categories[index].imageUrl), fit: BoxFit.cover, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8)), shadows: [ BoxShadow( - color: single_categories.categories[index].color, + color: singleCategories.categories[index].color, blurRadius: 0, - offset: Offset(0, 10), + offset: const Offset(0, 10), spreadRadius: 0, ) ], @@ -258,8 +261,8 @@ class _HomePage extends State { left: 16, top: 15, child: Text( - single_categories.categories[index].amount.toString(), - style: TextStyle( + singleCategories.categories[index].amount.toString(), + style: const TextStyle( color: Colors.white, fontSize: 18, fontFamily: 'Inter', @@ -270,15 +273,15 @@ class _HomePage extends State { ), Positioned( left: 13, - top: single_categories.categories[index].textheight, //86, //TODO Bootom? + top: singleCategories.categories[index].textheight, //86, //TODO Bootom? child: - Container( + SizedBox( width: itemWidth-20,// Set a fixed width or use constraints child: Wrap( children: [ Text( - single_categories.categories[index].title, - style: TextStyle( + singleCategories.categories[index].title, + style: const TextStyle( color: Colors.white, fontSize: 24, fontFamily: 'Inter', @@ -292,11 +295,11 @@ class _HomePage extends State { right:20, top:10, child: - Container( + SizedBox( width: 32, height: 32, child: Image.asset( - single_categories.categories[index].iconUrl, + singleCategories.categories[index].iconUrl, ), ), ), @@ -307,7 +310,7 @@ class _HomePage extends State { width: 31, height: 31, clipBehavior: Clip.antiAlias, - decoration: BoxDecoration(), + decoration: const BoxDecoration(), ), ), ], @@ -335,7 +338,7 @@ class _HomePage extends State { backgroundColor: Colors.white, appBar: appBar, body: Consumer( - builder: (context, single_categories, child) {return body;}), + builder: (context, singleCategories, child) {return body;}), ); } } diff --git a/lib/screens/subheader_Datepicker.dart b/lib/screens/subheader_Datepicker.dart index 2648dae..9f9ee1a 100644 --- a/lib/screens/subheader_Datepicker.dart +++ b/lib/screens/subheader_Datepicker.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:Emma_home/utils/helper_functions.dart'; class TimeButtonSection extends StatefulWidget { - const TimeButtonSection(); + const TimeButtonSection({super.key}); @override _TimeButtonSection createState() => _TimeButtonSection(); @@ -27,18 +27,18 @@ class _TimeButtonSection extends State { _isWEActive = false; }); }, - child: Text('Heute'), style: OutlinedButton.styleFrom( backgroundColor: _isToDayActive ? Colors.black : Colors.white, foregroundColor: _isToDayActive ? Colors.white : Colors.black, side: _isToDayActive - ? BorderSide(color: Colors.white) - : BorderSide(color: Colors.black), - minimumSize: Size(85, 39), // Breite und Höhe + ? const BorderSide(color: Colors.white) + : const BorderSide(color: Colors.black), + minimumSize: const Size(85, 39), // Breite und Höhe shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), ), + child: Text('Heute'), ), // Button "Morgen" (outlined style) OutlinedButton( @@ -49,18 +49,18 @@ class _TimeButtonSection extends State { _isWEActive = false; }); }, - child: Text('Morgen'), style: OutlinedButton.styleFrom( backgroundColor: _isToMorrowActive ? Colors.black : Colors.white, foregroundColor: _isToMorrowActive ? Colors.white : Colors.black, side: _isToMorrowActive - ? BorderSide(color: Colors.white) - : BorderSide(color: Colors.black), // Border color - minimumSize: Size(90, 39), // Breite und Höhe + ? const BorderSide(color: Colors.white) + : const BorderSide(color: Colors.black), // Border color + minimumSize: const Size(90, 39), // Breite und Höhe shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), ), + child: Text('Morgen'), ), // Button "Wochenende" (outlined style) OutlinedButton( @@ -71,23 +71,23 @@ class _TimeButtonSection extends State { _isWEActive = !_isWEActive; }); }, - child: Text('Wochenende'), style: OutlinedButton.styleFrom( backgroundColor: _isWEActive ? Colors.black : Colors.white, foregroundColor: _isWEActive ? Colors.white : Colors.black, side: _isWEActive - ? BorderSide(color: Colors.white) - : BorderSide(color: Colors.black), // Border color - minimumSize: Size(100, 39), // Breite und Höhe + ? const BorderSide(color: Colors.white) + : const BorderSide(color: Colors.black), // Border color + minimumSize: const Size(100, 39), // Breite und Höhe shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), ), + child: Text('Wochenende'), ), // Button with calendar icon IconButton( onPressed: () {}, - icon: Icon(Icons.calendar_today, color: Colors.black), + icon: const Icon(Icons.calendar_today, color: Colors.black), ), ], ); @@ -95,6 +95,8 @@ class _TimeButtonSection extends State { } class HeaderSection extends StatelessWidget { + const HeaderSection({super.key}); + @override Widget build(BuildContext context) { return Container( @@ -121,7 +123,7 @@ class HeaderSection extends StatelessWidget { //width of button width: 10, ), - SizedBox( + const SizedBox( height: 10, //height of button width: 20, //width of button child: Icon(Icons.keyboard_arrow_down), @@ -134,7 +136,7 @@ class HeaderSection extends StatelessWidget { width: 100.0, child: TextField( controller: TextEditingController(text: "Ingolstadt"), - decoration: InputDecoration( + decoration: const InputDecoration( border: UnderlineInputBorder(), ), ), @@ -143,8 +145,8 @@ class HeaderSection extends StatelessWidget { // //width of button // width: 40, // ), - SizedBox(width: 3), - Spacer(), + const SizedBox(width: 3), + const Spacer(), SizedBox( height: 41, //height of button //width of button @@ -194,24 +196,24 @@ class EventCard2Section extends StatelessWidget { final MediaQueryData screen_size; const EventCard2Section({ - Key? key, + super.key, required this.title, required this.description, required this.location, required this.start_time, required this.color, required this.screen_size, - }) : super(key: key); + }); @override Widget build(BuildContext context) { return Container( width: (screen_size.size.width-40), height: 107, - margin: new EdgeInsets.fromLTRB(20.0, 0, 20.0, 20.0), + margin: const EdgeInsets.fromLTRB(20.0, 0, 20.0, 20.0), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), - border: Border( + border: const Border( left: BorderSide(width: 1, color: Color(0xFFBFBCBC)), top: BorderSide(width: 1, color: Color(0xFFBFBCBC)), right: BorderSide(color: Color(0xFFBFBCBC)), @@ -221,7 +223,7 @@ class EventCard2Section extends StatelessWidget { BoxShadow( color: color, //Color(0xFFF8AB14), blurRadius: 0, - offset: Offset(0, 10), + offset: const Offset(0, 10), spreadRadius: 0, ) ],), @@ -244,14 +246,14 @@ class EventCard2Section extends StatelessWidget { child: Container( width: 32, height: 32, - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Color.fromARGB( 196, 171, 170, 170), // Hintergrundfarbe des Buttons shape: BoxShape.circle, // Runde Form ), child: IconButton( padding: EdgeInsets.zero, // Entfernt zusätzlichen Abstand - icon: Icon(Icons.bookmark_border_outlined), + icon: const Icon(Icons.bookmark_border_outlined), color: Colors.white, // Icon-Farbe iconSize: 19, // Größe des Icons onPressed: () { @@ -272,7 +274,7 @@ class EventCard2Section extends StatelessWidget { children: [ Text( title, - style: TextStyle( + style: const TextStyle( color: Color(0xFF0A0A0A), fontSize: 18, fontFamily: 'Inter', @@ -285,7 +287,7 @@ class EventCard2Section extends StatelessWidget { height:24, child:Text( location, - style: TextStyle( + style: const TextStyle( color: Color(0xFF0A0A0A), fontSize: 18, fontFamily: 'Inter', @@ -296,7 +298,7 @@ class EventCard2Section extends StatelessWidget { Text.rich( TextSpan( text: 'Beginn: ', // Standard-Text - style: TextStyle( + style: const TextStyle( color: Color(0xFF0A0A0A), fontSize: 12, fontFamily: 'Inter', @@ -306,7 +308,7 @@ class EventCard2Section extends StatelessWidget { children: [ TextSpan( text: start_time, // Variabler Text - style: TextStyle( + style: const TextStyle( fontWeight: FontWeight.w800, // Bold ), ), @@ -376,7 +378,7 @@ class EventCard2Section extends StatelessWidget { //height: 15, child: Text( shortenText(description, 30), - style: TextStyle( + style: const TextStyle( color: Color(0xFF0A0A0A), fontSize: 12, fontFamily: 'Inter', @@ -415,11 +417,13 @@ class EventCard2Section extends StatelessWidget { } class TagSlider extends StatelessWidget { + const TagSlider({super.key}); + @override Widget build(BuildContext context) { return Column( children: [ - Container( + SizedBox( width: 390, height: 73, child: Row( @@ -442,11 +446,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -471,11 +475,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -500,11 +504,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -529,11 +533,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -558,11 +562,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -587,11 +591,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -616,11 +620,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -645,11 +649,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -674,11 +678,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -703,11 +707,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -732,11 +736,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -761,11 +765,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -790,11 +794,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -819,11 +823,11 @@ class TagSlider extends StatelessWidget { clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1), + side: const BorderSide(width: 1), borderRadius: BorderRadius.circular(10), ), ), - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -853,11 +857,13 @@ class TagSlider extends StatelessWidget { } class MusikHeader extends StatelessWidget { + const MusikHeader({super.key}); + @override Widget build(BuildContext context) { return Column( children: [ - Container( + SizedBox( width: 390, height: 32, child: Row( @@ -868,7 +874,7 @@ class MusikHeader extends StatelessWidget { Align( alignment: Alignment.centerLeft, child: IconButton( - icon: Icon(Icons.keyboard_arrow_left), + icon: const Icon(Icons.keyboard_arrow_left), onPressed: () { Navigator.pop(context); }, @@ -878,13 +884,13 @@ class MusikHeader extends StatelessWidget { alignment: Alignment.center, child: Row( children: [ - Container( + SizedBox( width: 32, height: 32, child: Image.asset( 'assets/images/Icons/Icon_Musik.png', ), ), - Text( + const Text( 'Musik', style: TextStyle( color: Color(0xFF171717), @@ -909,11 +915,13 @@ class MusikHeader extends StatelessWidget { } class CardGenre extends StatelessWidget { + const CardGenre({super.key}); + @override Widget build(BuildContext context) { return Column( children: [ - Container( + SizedBox( width: 368, height: 121, child: Column( @@ -921,7 +929,7 @@ class CardGenre extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( + const SizedBox( width: double.infinity, child: Text( 'Heute', @@ -940,14 +948,14 @@ class CardGenre extends StatelessWidget { decoration: ShapeDecoration( color: Colors.white, shape: RoundedRectangleBorder( - side: BorderSide( + side: const BorderSide( width: 1, strokeAlign: BorderSide.strokeAlignOutside, color: Color(0xFFDADADA), ), borderRadius: BorderRadius.circular(10), ), - shadows: [ + shadows: const [ BoxShadow( color: Color(0xFFF8AB14), blurRadius: 0, @@ -968,7 +976,7 @@ class CardGenre extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Eventname', style: TextStyle( color: Color(0xFF0A0A0A), @@ -985,14 +993,14 @@ class CardGenre extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( + SizedBox( width: 226, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( + const SizedBox( width: 83, height: 24, child: Text( @@ -1007,9 +1015,9 @@ class CardGenre extends StatelessWidget { ), ), const SizedBox(width: 24), - Container( + SizedBox( height: 20, - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, @@ -1054,7 +1062,7 @@ class CardGenre extends StatelessWidget { ), ), const SizedBox(height: 4), - SizedBox( + const SizedBox( width: 226, height: 15, child: Text( @@ -1071,14 +1079,14 @@ class CardGenre extends StatelessWidget { ], ), ), - Container( + SizedBox( width: 32, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( + SizedBox( width: 32, height: 32, child: Row( @@ -1091,7 +1099,7 @@ class CardGenre extends StatelessWidget { height: 32, decoration: ShapeDecoration( color: Colors.white.withOpacity(0.800000011920929), - shape: OvalBorder( + shape: const OvalBorder( side: BorderSide(width: 1, color: Color(0xFFABA9A9)), ), ), @@ -1103,7 +1111,7 @@ class CardGenre extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), ), - child: FlutterLogo(), + child: const FlutterLogo(), ), ], ), @@ -1124,11 +1132,13 @@ class CardGenre extends StatelessWidget { class CardGenre_temp extends StatelessWidget { + const CardGenre_temp({super.key}); + @override Widget build(BuildContext context) { return Column( children: [ - Container( + SizedBox( width: 368, height: 121, child: Column( @@ -1136,7 +1146,7 @@ class CardGenre_temp extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( + const SizedBox( width: double.infinity, child: Text( 'Heute', @@ -1155,14 +1165,14 @@ class CardGenre_temp extends StatelessWidget { decoration: ShapeDecoration( color: Colors.white, shape: RoundedRectangleBorder( - side: BorderSide( + side: const BorderSide( width: 1, strokeAlign: BorderSide.strokeAlignOutside, color: Color(0xFFDADADA), ), borderRadius: BorderRadius.circular(10), ), - shadows: [ + shadows: const [ ], ), @@ -1178,7 +1188,7 @@ class CardGenre_temp extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Eventname', style: TextStyle( color: Color(0xFF0A0A0A), @@ -1195,14 +1205,14 @@ class CardGenre_temp extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( + SizedBox( width: 226, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( + const SizedBox( width: 83, height: 24, child: Text( @@ -1217,9 +1227,9 @@ class CardGenre_temp extends StatelessWidget { ), ), const SizedBox(width: 24), - Container( + SizedBox( height: 20, - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, @@ -1264,7 +1274,7 @@ class CardGenre_temp extends StatelessWidget { ), ), const SizedBox(height: 4), - SizedBox( + const SizedBox( width: 226, height: 15, child: Text( @@ -1281,14 +1291,14 @@ class CardGenre_temp extends StatelessWidget { ], ), ), - Container( + SizedBox( width: 32, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( + SizedBox( width: 32, height: 32, child: Row( @@ -1301,7 +1311,7 @@ class CardGenre_temp extends StatelessWidget { height: 32, decoration: ShapeDecoration( color: Colors.white.withOpacity(0.800000011920929), - shape: OvalBorder( + shape: const OvalBorder( side: BorderSide(width: 1, color: Color(0xFFABA9A9)), ), ), @@ -1313,7 +1323,7 @@ class CardGenre_temp extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), ), - child: FlutterLogo(), + child: const FlutterLogo(), ), ], ), @@ -1333,6 +1343,8 @@ class CardGenre_temp extends StatelessWidget { } class Event_Card extends StatelessWidget { + const Event_Card({super.key}); + @override Widget build(BuildContext context) { return Column( @@ -1344,14 +1356,14 @@ class Event_Card extends StatelessWidget { decoration: ShapeDecoration( color: Colors.white, shape: RoundedRectangleBorder( - side: BorderSide( + side: const BorderSide( width: 1, strokeAlign: BorderSide.strokeAlignOutside, color: Color(0xFFDADADA), ), borderRadius: BorderRadius.circular(9), ), - shadows: [ + shadows: const [ BoxShadow( color: Color(0xFFF8AB14), blurRadius: 0, @@ -1372,10 +1384,10 @@ class Event_Card extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( + SizedBox( width: double.infinity, height: 48, - child: Column( + child: const Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -1408,7 +1420,7 @@ class Event_Card extends StatelessWidget { ), ), Container( - child: Column( + child: const Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -1469,14 +1481,14 @@ class Event_Card extends StatelessWidget { ], ), ), - Container( + SizedBox( width: 32, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( + SizedBox( width: 32, height: 32, child: Row( @@ -1489,7 +1501,7 @@ class Event_Card extends StatelessWidget { height: 32, decoration: ShapeDecoration( color: Colors.white.withOpacity(0.800000011920929), - shape: OvalBorder( + shape: const OvalBorder( side: BorderSide(width: 1, color: Color(0xFFABA9A9)), ), ), @@ -1501,7 +1513,7 @@ class Event_Card extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), ), - child: FlutterLogo(), + child: const FlutterLogo(), ), ], ), diff --git a/lib/utils/data.dart b/lib/utils/data.dart index d55a84a..f763a3c 100644 --- a/lib/utils/data.dart +++ b/lib/utils/data.dart @@ -20,13 +20,13 @@ class Categories extends ChangeNotifier{ static Categories get instance => _instance; // Your singleton methods and properties - static List _categories = [ + static final List _categories = [ Category( id: '1', title: 'Musik', imageUrl: 'assets/images/Musik.png', iconUrl:'assets/images/Icons/Icon_Musik.png', - color: Color.fromARGB(255, 249, 171, 21), //FD4949 //Musik + color: const Color.fromARGB(255, 249, 171, 21), //FD4949 //Musik category: '34725c49-740b-45c5-8a51-7c742f92a621', textheight: 86, amount:0, @@ -36,7 +36,7 @@ class Categories extends ChangeNotifier{ title: 'Nachtleben', imageUrl: 'assets/images/Nachtleben.png', iconUrl:'assets/images/Icons/Icon_Nachtleben.png', - color: Color.fromARGB(255, 253, 73, 73), //FD4949 //Nachtleben + color: const Color.fromARGB(255, 253, 73, 73), //FD4949 //Nachtleben category: '2d8c714e-3290-4d8c-8a95-e3b100ad8599', textheight: 86, amount:0, @@ -46,7 +46,7 @@ class Categories extends ChangeNotifier{ title: 'Kunst & Kultur', imageUrl: 'assets/images/Kultur.png', iconUrl:'assets/images/Icons/Icon_Kultur.png', - color: Color.fromARGB(255, 80, 168, 250), //50A8FA//Kunst + color: const Color.fromARGB(255, 80, 168, 250), //50A8FA//Kunst category: '09d1f862-2b56-47af-8ee6-3c50056e3fa2', textheight: 58, amount:0, @@ -56,7 +56,7 @@ class Categories extends ChangeNotifier{ title: 'Sport & Verein', imageUrl: 'assets/images/Sport.png', iconUrl:'assets/images/Icons/Icon_Sport.png', - color: Color.fromARGB(255, 80, 240, 250), //50F0FA //Sport + color: const Color.fromARGB(255, 80, 240, 250), //50F0FA //Sport category: '15119876-9ff0-41e5-8fe5-c3675af5e054', textheight: 58, amount:0, @@ -66,7 +66,7 @@ class Categories extends ChangeNotifier{ title: 'Gesundheit', imageUrl: 'assets/images/Gesundheit.png', iconUrl:'assets/images/Icons/Icon_Gesundheit.png', - color: Color.fromARGB(255,130, 73, 253), //8249FD //Gesundheit + color: const Color.fromARGB(255,130, 73, 253), //8249FD //Gesundheit category: '4ad3ac2d-04fc-4aa1-afae-17ec7bfc1714', textheight: 86, amount:0, @@ -76,7 +76,7 @@ class Categories extends ChangeNotifier{ title: 'Essen & Trinken', imageUrl: 'assets/images/Essen.png', iconUrl:'assets/images/Icons/Icon_Essen.png', - color: Color.fromARGB(255,253, 73,73), //FD4949//Essen + color: const Color.fromARGB(255,253, 73,73), //FD4949//Essen category: 'ef83c4d3-228a-44e1-8a5d-8b47d2dfc351', textheight: 58, amount:0, @@ -86,7 +86,7 @@ class Categories extends ChangeNotifier{ title: 'Soziales', imageUrl: 'assets/images/Soziales.png', iconUrl:'assets/images/Icons/Icon_Soziales.png', - color: Color.fromARGB(255,255,0,199), //FF00C7//Essen + color: const Color.fromARGB(255,255,0,199), //FF00C7//Essen category: '53a1782b-e07b-491d-b778-d99ef9cf57e2', textheight: 86, amount:0, @@ -96,7 +96,7 @@ class Categories extends ChangeNotifier{ title: 'Familie', imageUrl: 'assets/images/Familie.png', iconUrl:'assets/images/Icons/Icon_Familie.png', - color: Color.fromARGB(255,66,255,0), //42FF00//Essen //HSL 104 100 50 100 + color: const Color.fromARGB(255,66,255,0), //42FF00//Essen //HSL 104 100 50 100 category: '30cb3481-c425-4068-9714-adc86df85d3f', textheight: 86, amount:0, @@ -186,7 +186,7 @@ class SupabaseDataService { .single(); - return response as Map; + return response; } catch (e) { throw Exception('Failed to fetch record: $e'); }