feat: styling adjustments
parent
af5a4384c6
commit
5553a521d1
|
@ -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"}
|
|
@ -8,9 +8,11 @@ import '../../pages/nav_pages/search_food.dart';
|
||||||
|
|
||||||
class CardComponent extends StatelessWidget {
|
class CardComponent extends StatelessWidget {
|
||||||
final String title;
|
final String title;
|
||||||
|
final Color color;
|
||||||
final List<dynamic> foods;
|
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) {
|
Route createRoute(String cardName) {
|
||||||
return PageRouteBuilder(
|
return PageRouteBuilder(
|
||||||
|
@ -44,38 +46,47 @@ class CardComponent extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 300,
|
decoration: BoxDecoration(
|
||||||
decoration: const BoxDecoration(
|
color: color,
|
||||||
color: Color(0xFF6E7BFB),
|
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
|
||||||
),
|
),
|
||||||
margin: const EdgeInsets.fromLTRB(0, 16, 0, 16),
|
margin: const EdgeInsets.fromLTRB(0, 0, 0, 16),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
CardTitleComponent(
|
CardTitleComponent(
|
||||||
StringUtils.capitalize(title), "${countCalories(castDynamicToListFood(foods))} Kalorien"),
|
StringUtils.capitalize(title),
|
||||||
|
"${countCalories(castDynamicToListFood(foods))} Kalorien",
|
||||||
|
),
|
||||||
CardDataFoodComponent(
|
CardDataFoodComponent(
|
||||||
castDynamicToListFood(foods)
|
castDynamicToListFood(foods),
|
||||||
|
color,
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8),
|
padding: const EdgeInsets.only(left: 8, right: 8,bottom: 8),
|
||||||
child: Container(
|
|
||||||
margin: const EdgeInsets.fromLTRB(0, 8, 0, 0),
|
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
minimumSize: const Size.fromHeight(40), //
|
minimumSize: const Size.fromHeight(40),
|
||||||
backgroundColor: const Color(0xFFffffff),
|
backgroundColor: const Color(0xFFffffff),
|
||||||
foregroundColor: const Color(0xFF6E7BFB),
|
foregroundColor: color,
|
||||||
shape: const StadiumBorder(),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.of(context).push(createRoute(title));
|
Navigator.of(context).push(createRoute(title));
|
||||||
},
|
},
|
||||||
child: Text('Gericht zum ${StringUtils.capitalize(title)} hinzufügen'),
|
child: const Text(
|
||||||
|
'+ Gericht hinzufügen',
|
||||||
|
style:TextStyle(
|
||||||
|
fontSize: 17
|
||||||
) ,
|
) ,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
));
|
),
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,18 +4,16 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class CardDataFoodComponent extends StatelessWidget {
|
class CardDataFoodComponent extends StatelessWidget {
|
||||||
final List<Food> foods;
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return Padding(
|
||||||
height: 180,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||||
child: foods.isNotEmpty
|
child: foods.isNotEmpty ?
|
||||||
? SingleChildScrollView(
|
Column(
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
ListView.builder(
|
ListView.builder(
|
||||||
|
@ -34,12 +32,15 @@ class CardDataFoodComponent extends StatelessWidget {
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
),
|
|
||||||
)
|
)
|
||||||
: const Center(
|
: const Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"Die Liste ist momentan leer, aber Sie können sie ändern!"),
|
"Füge jetzt neue Gerichte hinzu!",
|
||||||
)),
|
style: TextStyle(
|
||||||
);
|
fontSize: 14,
|
||||||
|
color: Colors.white
|
||||||
|
),
|
||||||
|
)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,16 @@ class CardFoodItemComponent extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
food.name.toString(),
|
food.name.toString(),
|
||||||
style: const TextStyle(color: Colors.white),
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
|
maxLines: 2,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
food.calories.toString(),
|
"\n${food.calories.toString()} kcal | 100g",
|
||||||
style: const TextStyle(color: Colors.white),
|
style: const TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -11,18 +11,26 @@ class CardTitleComponent extends StatelessWidget {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.all(Radius.circular(16))
|
borderRadius: BorderRadius.all(Radius.circular(12))
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets
|
const EdgeInsets.symmetric(vertical: 16,horizontal: 16),
|
||||||
.symmetric(
|
|
||||||
vertical: 16,
|
|
||||||
horizontal: 8
|
|
||||||
),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [Text(title), Text(calories)],
|
children: [
|
||||||
|
Text(title,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
calories,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 17
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -85,7 +85,7 @@ class _SearchFoodComponentState extends State<SearchedFoodComponent> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
child: Text(
|
child: Text(
|
||||||
"${widget.food.calories} kcal/100g",
|
"${widget.food.calories} kcal | 100g",
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
softWrap: false,
|
softWrap: false,
|
||||||
|
|
|
@ -14,9 +14,9 @@ class MainPage extends StatefulWidget {
|
||||||
|
|
||||||
class MainPageState extends State<MainPage> {
|
class MainPageState extends State<MainPage> {
|
||||||
List pages = [
|
List pages = [
|
||||||
const TodayPage(title: 'Today'),
|
const TodayPage(title: 'Essensplan'),
|
||||||
const MealPlanPage(title: 'Meal Plan'),
|
const MealPlanPage(title: 'Gesamtübersicht'),
|
||||||
const ProgressPage(title: 'Progress')
|
const ProgressPage(title: 'Statistiken')
|
||||||
];
|
];
|
||||||
|
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import 'package:hive_flutter/adapters.dart';
|
||||||
class TodayPage extends StatefulWidget {
|
class TodayPage extends StatefulWidget {
|
||||||
final String title;
|
final String title;
|
||||||
final Color backgroundColor = const Color(0xff47a44b);
|
final Color backgroundColor = const Color(0xff47a44b);
|
||||||
|
|
||||||
const TodayPage({Key? key, required this.title}) : super(key: key);
|
const TodayPage({Key? key, required this.title}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -15,6 +14,8 @@ class TodayPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TodayPageState extends State<TodayPage> {
|
class _TodayPageState extends State<TodayPage> {
|
||||||
|
final List<Color> colors = [Colors.teal,Colors.red,Colors.green];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -30,7 +31,8 @@ class _TodayPageState extends State<TodayPage> {
|
||||||
String mealTypeAsString = box.keyAt(i).toString();
|
String mealTypeAsString = box.keyAt(i).toString();
|
||||||
return CardComponent(
|
return CardComponent(
|
||||||
mealTypeAsString,
|
mealTypeAsString,
|
||||||
StatisticsService.instance.getMealsOfTodayByMealtype(mealTypeAsString)
|
StatisticsService.instance.getMealsOfTodayByMealtype(mealTypeAsString),
|
||||||
|
color: colors[i],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
})));
|
})));
|
||||||
|
|
Loading…
Reference in New Issue