From 5553a521d13a9273eb3348c3b8570e1a25418b60 Mon Sep 17 00:00:00 2001 From: 2211260 <2211260@hs-mannheim.de> Date: Fri, 2 Jun 2023 19:21:06 +0200 Subject: [PATCH] feat: styling adjustments --- .flutter-plugins-dependencies | 2 +- .../components/card/card_component.dart | 57 ++++++++++------- .../card/card_data_food_component.dart | 63 ++++++++++--------- .../card/card_food_item_component.dart | 9 ++- .../components/card/card_title_component.dart | 22 ++++--- .../components/founded_search_component.dart | 2 +- lib/android/pages/nav_pages/main_page.dart | 6 +- lib/android/pages/nav_pages/today_page.dart | 6 +- 8 files changed, 97 insertions(+), 70 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 26a9714..64f681c 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"fluttertoast","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"fluttertoast","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.1.10\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.1.6\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"fluttertoast","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"fluttertoast","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-06-02 18:10:34.082096","version":"3.7.12"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"fluttertoast","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"fluttertoast","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.1.10\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.1.6\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"fluttertoast","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"fluttertoast","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-06-02 19:13:28.478232","version":"3.7.12"} \ No newline at end of file diff --git a/lib/android/components/card/card_component.dart b/lib/android/components/card/card_component.dart index a7a1e68..0f0b634 100644 --- a/lib/android/components/card/card_component.dart +++ b/lib/android/components/card/card_component.dart @@ -8,9 +8,11 @@ import '../../pages/nav_pages/search_food.dart'; class CardComponent extends StatelessWidget { final String title; + final Color color; final List foods; - const CardComponent(this.title, this.foods, {super.key}); + const CardComponent(this.title, this.foods, {super.key, Color? color}) + : color = color ?? Colors.black; Route createRoute(String cardName) { return PageRouteBuilder( @@ -44,38 +46,47 @@ class CardComponent extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - height: 300, - decoration: const BoxDecoration( - color: Color(0xFF6E7BFB), - borderRadius: BorderRadius.all(Radius.circular(16)), + decoration: BoxDecoration( + color: color, + borderRadius: const BorderRadius.all(Radius.circular(12)), ), - margin: const EdgeInsets.fromLTRB(0, 16, 0, 16), + margin: const EdgeInsets.fromLTRB(0, 0, 0, 16), child: Column( children: [ CardTitleComponent( - StringUtils.capitalize(title), "${countCalories(castDynamicToListFood(foods))} Kalorien"), + StringUtils.capitalize(title), + "${countCalories(castDynamicToListFood(foods))} Kalorien", + ), CardDataFoodComponent( - castDynamicToListFood(foods) + castDynamicToListFood(foods), + color, ), Padding( - padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8), - child: Container( - margin: const EdgeInsets.fromLTRB(0, 8, 0, 0), - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size.fromHeight(40), // - backgroundColor: const Color(0xFFffffff), - foregroundColor: const Color(0xFF6E7BFB), - shape: const StadiumBorder(), + padding: const EdgeInsets.only(left: 8, right: 8,bottom: 8), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size.fromHeight(40), + backgroundColor: const Color(0xFFffffff), + foregroundColor: color, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), ), - onPressed: () async { - Navigator.of(context).push(createRoute(title)); - }, - child: Text('Gericht zum ${StringUtils.capitalize(title)} hinzufügen'), + ), + onPressed: () async { + Navigator.of(context).push(createRoute(title)); + }, + child: const Text( + '+ Gericht hinzufügen', + style:TextStyle( + fontSize: 17 + ) , ), ), - ) + ), + ], - )); + ), + ); + } } diff --git a/lib/android/components/card/card_data_food_component.dart b/lib/android/components/card/card_data_food_component.dart index 54151ff..90735ee 100644 --- a/lib/android/components/card/card_data_food_component.dart +++ b/lib/android/components/card/card_data_food_component.dart @@ -4,42 +4,43 @@ import 'package:flutter/material.dart'; class CardDataFoodComponent extends StatelessWidget { final List foods; + final Color color; - const CardDataFoodComponent(this.foods, {Key? key}) : super(key: key); + const CardDataFoodComponent(this.foods,this.color, {Key? key,}) : super(key: key); @override Widget build(BuildContext context) { - return SizedBox( - height: 180, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8), - child: foods.isNotEmpty - ? SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - ListView.builder( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: foods.length, - itemBuilder: (context, i) { - return Column( - children: [ - CardFoodItemComponent(foods[i]), - Divider( - color: Colors.grey.shade300, - thickness: 1.2, - ) - ], - ); - }) - ], + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8), + child: foods.isNotEmpty ? + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: foods.length, + itemBuilder: (context, i) { + return Column( + children: [ + CardFoodItemComponent(foods[i]), + Divider( + color: Colors.grey.shade300, + thickness: 1.2, + ) + ], + ); + }) + ], + ) + : const Center( + child: Text( + "Füge jetzt neue Gerichte hinzu!", + style: TextStyle( + fontSize: 14, + color: Colors.white ), ) - : const Center( - child: Text( - "Die Liste ist momentan leer, aber Sie können sie ändern!"), - )), - ); + )); } } diff --git a/lib/android/components/card/card_food_item_component.dart b/lib/android/components/card/card_food_item_component.dart index 6d413ab..fbad79c 100644 --- a/lib/android/components/card/card_food_item_component.dart +++ b/lib/android/components/card/card_food_item_component.dart @@ -17,11 +17,16 @@ class CardFoodItemComponent extends StatelessWidget { children: [ Text( food.name.toString(), - style: const TextStyle(color: Colors.white), + style: const TextStyle( + color: Colors.white, + fontSize: 17, + fontWeight: FontWeight.bold, + ), softWrap: true, + maxLines: 2, ), Text( - food.calories.toString(), + "\n${food.calories.toString()} kcal | 100g", style: const TextStyle(color: Colors.white), ), ], diff --git a/lib/android/components/card/card_title_component.dart b/lib/android/components/card/card_title_component.dart index 0e099b2..2fd86cc 100644 --- a/lib/android/components/card/card_title_component.dart +++ b/lib/android/components/card/card_title_component.dart @@ -11,18 +11,26 @@ class CardTitleComponent extends StatelessWidget { return Container( decoration: const BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(16)) + borderRadius: BorderRadius.all(Radius.circular(12)) ), child: Padding( padding: - const EdgeInsets - .symmetric( - vertical: 16, - horizontal: 8 - ), + const EdgeInsets.symmetric(vertical: 16,horizontal: 16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Text(title), Text(calories)], + children: [ + Text(title, + style: const TextStyle( + fontSize: 20 + ), + ), + Text( + calories, + style: const TextStyle( + fontSize: 17 + ), + ) + ], ), ), ); diff --git a/lib/android/components/founded_search_component.dart b/lib/android/components/founded_search_component.dart index 9b68f32..ddcd786 100644 --- a/lib/android/components/founded_search_component.dart +++ b/lib/android/components/founded_search_component.dart @@ -85,7 +85,7 @@ class _SearchFoodComponentState extends State { SizedBox( width: MediaQuery.of(context).size.width * 0.8, child: Text( - "${widget.food.calories} kcal/100g", + "${widget.food.calories} kcal | 100g", maxLines: 1, overflow: TextOverflow.ellipsis, softWrap: false, diff --git a/lib/android/pages/nav_pages/main_page.dart b/lib/android/pages/nav_pages/main_page.dart index ab3e1d2..abce451 100644 --- a/lib/android/pages/nav_pages/main_page.dart +++ b/lib/android/pages/nav_pages/main_page.dart @@ -14,9 +14,9 @@ class MainPage extends StatefulWidget { class MainPageState extends State { List pages = [ - const TodayPage(title: 'Today'), - const MealPlanPage(title: 'Meal Plan'), - const ProgressPage(title: 'Progress') + const TodayPage(title: 'Essensplan'), + const MealPlanPage(title: 'Gesamtübersicht'), + const ProgressPage(title: 'Statistiken') ]; int currentIndex = 0; diff --git a/lib/android/pages/nav_pages/today_page.dart b/lib/android/pages/nav_pages/today_page.dart index 4f894e6..a653411 100644 --- a/lib/android/pages/nav_pages/today_page.dart +++ b/lib/android/pages/nav_pages/today_page.dart @@ -7,7 +7,6 @@ import 'package:hive_flutter/adapters.dart'; class TodayPage extends StatefulWidget { final String title; final Color backgroundColor = const Color(0xff47a44b); - const TodayPage({Key? key, required this.title}) : super(key: key); @override @@ -15,6 +14,8 @@ class TodayPage extends StatefulWidget { } class _TodayPageState extends State { + final List colors = [Colors.teal,Colors.red,Colors.green]; + @override Widget build(BuildContext context) { return Scaffold( @@ -30,7 +31,8 @@ class _TodayPageState extends State { String mealTypeAsString = box.keyAt(i).toString(); return CardComponent( mealTypeAsString, - StatisticsService.instance.getMealsOfTodayByMealtype(mealTypeAsString) + StatisticsService.instance.getMealsOfTodayByMealtype(mealTypeAsString), + color: colors[i], ); }); })));