feat: styling adjustments

pull/5/head
2211260 2023-06-02 19:21:06 +02:00
parent af5a4384c6
commit 5553a521d1
8 changed files with 97 additions and 70 deletions

View File

@ -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"}
{"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"}

View File

@ -8,9 +8,11 @@ import '../../pages/nav_pages/search_food.dart';
class CardComponent extends StatelessWidget {
final String title;
final Color color;
final List<dynamic> 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
) ,
),
),
)
),
],
));
),
);
}
}

View File

@ -4,42 +4,43 @@ import 'package:flutter/material.dart';
class CardDataFoodComponent extends StatelessWidget {
final List<Food> 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!"),
)),
);
));
}
}

View File

@ -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),
),
],

View File

@ -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
),
)
],
),
),
);

View File

@ -85,7 +85,7 @@ class _SearchFoodComponentState extends State<SearchedFoodComponent> {
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,

View File

@ -14,9 +14,9 @@ class MainPage extends StatefulWidget {
class MainPageState extends State<MainPage> {
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;

View File

@ -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<TodayPage> {
final List<Color> colors = [Colors.teal,Colors.red,Colors.green];
@override
Widget build(BuildContext context) {
return Scaffold(
@ -30,7 +31,8 @@ class _TodayPageState extends State<TodayPage> {
String mealTypeAsString = box.keyAt(i).toString();
return CardComponent(
mealTypeAsString,
StatisticsService.instance.getMealsOfTodayByMealtype(mealTypeAsString)
StatisticsService.instance.getMealsOfTodayByMealtype(mealTypeAsString),
color: colors[i],
);
});
})));