Design angepasst
parent
873819dea1
commit
de561a4b90
|
@ -37,6 +37,12 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.18"
|
||||
},
|
||||
{
|
||||
"name": "basic_utils",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/basic_utils-5.5.4",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.18"
|
||||
},
|
||||
{
|
||||
"name": "boolean_selector",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1",
|
||||
|
@ -253,6 +259,12 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "http",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/http-0.13.6",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.19"
|
||||
},
|
||||
{
|
||||
"name": "http_multi_server",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/http_multi_server-3.2.1",
|
||||
|
@ -391,6 +403,12 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.17"
|
||||
},
|
||||
{
|
||||
"name": "pointycastle",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/pointycastle-3.7.3",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.14"
|
||||
},
|
||||
{
|
||||
"name": "pool",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/pool-1.5.1",
|
||||
|
@ -566,7 +584,7 @@
|
|||
"languageVersion": "2.19"
|
||||
}
|
||||
],
|
||||
"generated": "2023-05-25T21:42:31.568902Z",
|
||||
"generated": "2023-05-26T21:55:36.197535Z",
|
||||
"generator": "pub",
|
||||
"generatorVersion": "2.19.6"
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ async
|
|||
2.18
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/async-2.10.0/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/async-2.10.0/lib/
|
||||
basic_utils
|
||||
2.18
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/basic_utils-5.5.4/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/basic_utils-5.5.4/lib/
|
||||
boolean_selector
|
||||
2.17
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/
|
||||
|
@ -158,6 +162,10 @@ hive_generator
|
|||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/hive_generator-2.0.0/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/hive_generator-2.0.0/lib/
|
||||
http
|
||||
2.19
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/http-0.13.6/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/http-0.13.6/lib/
|
||||
http_multi_server
|
||||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/http_multi_server-3.2.1/
|
||||
|
@ -250,6 +258,10 @@ plugin_platform_interface
|
|||
2.17
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/plugin_platform_interface-2.1.4/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/plugin_platform_interface-2.1.4/lib/
|
||||
pointycastle
|
||||
2.14
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/pointycastle-3.7.3/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/pointycastle-3.7.3/lib/
|
||||
pool
|
||||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/pool-1.5.1/
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_android-2.0.27/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.10/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.6/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"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-05-25 23:42:32.742938","version":"3.7.9"}
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_android-2.0.27/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.10/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.6/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"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-05-26 23:55:36.338503","version":"3.7.9"}
|
|
@ -10,7 +10,7 @@ class AndroidApp extends StatelessWidget {
|
|||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
scaffoldBackgroundColor: Colors.grey.shade100, //<-- SEE
|
||||
),
|
||||
home: const MainPage(),
|
||||
routes: {
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
import 'package:ernaehrung/android/components/card/card_data_food_component.dart';
|
||||
import 'package:ernaehrung/android/components/card/card_title_component.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../models/food.dart';
|
||||
import '../../pages/nav_pages/search_food.dart';
|
||||
|
||||
class CardComponent extends StatelessWidget {
|
||||
final String title;
|
||||
final List<dynamic> foods;
|
||||
|
||||
const CardComponent(this.title, this.foods, {super.key});
|
||||
|
||||
List<Food> castDynamicToListFood(List<dynamic> dynamicList) {
|
||||
List<Food> foodList = [];
|
||||
for (Food element in dynamicList) {
|
||||
foodList.add(element);
|
||||
}
|
||||
|
||||
return foodList;
|
||||
}
|
||||
|
||||
Route createRoute(String cardName) {
|
||||
return PageRouteBuilder(
|
||||
pageBuilder: (context, animation, secondaryAnimation) =>
|
||||
SearchFoodPage(cardName),
|
||||
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
||||
const begin = Offset(0.0, 1.0);
|
||||
const end = Offset.zero;
|
||||
const curve = Curves.ease;
|
||||
|
||||
var tween =
|
||||
Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
|
||||
|
||||
return SlideTransition(
|
||||
position: animation.drive(tween),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 300,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF6E7BFB),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
border: Border.all(
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
margin: const EdgeInsets.fromLTRB(0, 16, 0, 16),
|
||||
child: Column(
|
||||
children: [
|
||||
CardTitleComponent(
|
||||
title, "${castDynamicToListFood(foods).length} Kalorien"),
|
||||
CardDataFoodComponent(
|
||||
castDynamicToListFood(foods)
|
||||
),
|
||||
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(),
|
||||
),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).push(createRoute(title));
|
||||
},
|
||||
child: Text('Text Of Button'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
import 'package:ernaehrung/android/components/card/card_food_item_component.dart';
|
||||
import 'package:ernaehrung/android/models/food.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CardDataFoodComponent extends StatelessWidget {
|
||||
final List<Food> foods;
|
||||
|
||||
const CardDataFoodComponent(this.foods, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 180,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.pink,
|
||||
borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
ListView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemCount: foods.length,
|
||||
itemBuilder: (context, i) {
|
||||
return CardFoodItemComponent(foods[i]);
|
||||
})
|
||||
],
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
import 'package:ernaehrung/android/models/food.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CardFoodItemComponent extends StatelessWidget {
|
||||
final Food food;
|
||||
|
||||
const CardFoodItemComponent(this.food, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.fromLTRB(0, 8, 0, 4),
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
food.name.toString(),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
softWrap: true,
|
||||
),
|
||||
Text(
|
||||
food.calories.toString(),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1, child: TextButton(onPressed: () {}, child: Text("+")))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class CardTitleComponent extends StatelessWidget {
|
||||
final String title;
|
||||
final String calories;
|
||||
|
||||
const CardTitleComponent(this.title, this.calories, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(16))
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets
|
||||
.symmetric(
|
||||
vertical: 16,
|
||||
horizontal: 8
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [Text(title), Text(calories)],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -18,23 +18,25 @@ class MainPageState extends State<MainPage> {
|
|||
];
|
||||
|
||||
int currentIndex = 0;
|
||||
void onTap(int index){
|
||||
|
||||
void onTap(int index) {
|
||||
setState(() {
|
||||
currentIndex = index;
|
||||
pages[currentIndex];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(pages[currentIndex].title),
|
||||
backgroundColor: pages[currentIndex].backgroundColor
|
||||
backgroundColor: Colors.grey.shade100,
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8),
|
||||
child: pages[currentIndex],
|
||||
),
|
||||
body: pages[currentIndex],
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
currentIndex: currentIndex,
|
||||
selectedItemColor: Colors.black54,
|
||||
|
@ -44,18 +46,10 @@ class MainPageState extends State<MainPage> {
|
|||
elevation: 0,
|
||||
onTap: onTap,
|
||||
items: const [
|
||||
BottomNavigationBarItem(icon: Icon(Icons.today), label: 'Today'),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.today),
|
||||
label: 'Today'
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.area_chart),
|
||||
label: 'Progress'
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.apple),
|
||||
label: 'Meal Plan'
|
||||
),
|
||||
icon: Icon(Icons.area_chart), label: 'Progress'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.apple), label: 'Meal Plan'),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:ernaehrung/android/components/food_list_component.dart';
|
||||
import 'package:basic_utils/basic_utils.dart';
|
||||
import 'package:ernaehrung/android/components/card/card_component.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../components/diet_chart_component.dart';
|
||||
import '../../components/statistics_circular_indicator_component.dart';
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
|
||||
class TodayPage extends StatefulWidget {
|
||||
final String title;
|
||||
|
@ -14,32 +14,27 @@ class TodayPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _TodayPageState extends State<TodayPage> {
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SizedBox(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xff000000), Color(0xff47a44b)],
|
||||
stops: [0.1, 5],
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
)),
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 0),
|
||||
child: Column(
|
||||
children: [
|
||||
StatisticsPercentComponent(300, 100, 400),
|
||||
DietChatComponent(1500),
|
||||
const FoodComponent(),
|
||||
],
|
||||
),
|
||||
)),
|
||||
));
|
||||
body: SingleChildScrollView(
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: Hive.box("TODAY").listenable(),
|
||||
builder: (context, box, widget) {
|
||||
return ListView.builder(
|
||||
primary: false,
|
||||
shrinkWrap: true,
|
||||
itemCount: box.keys.length,
|
||||
itemBuilder: (context, i) {
|
||||
if (box.keyAt(i).toString() == "DATE") {
|
||||
return const SizedBox.shrink();
|
||||
} else {
|
||||
return CardComponent(
|
||||
StringUtils.capitalize(box.keyAt(i).toString()),
|
||||
box.getAt(i)
|
||||
);
|
||||
}
|
||||
});
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
|
24
pubspec.lock
24
pubspec.lock
|
@ -49,6 +49,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.10.0"
|
||||
basic_utils:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: basic_utils
|
||||
sha256: "8815477fcf58499e42326bd858e391442425fa57db9a45e48e15224c62049262"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.5.4"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -331,6 +339,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.13.6"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -515,6 +531,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
pointycastle:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pointycastle
|
||||
sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.7.3"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -46,6 +46,7 @@ dependencies:
|
|||
responsive_framework: ^1.0.0
|
||||
sizer: ^2.0.15
|
||||
fl_chart: ^0.62.0
|
||||
basic_utils: ^5.5.4
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
|
Loading…
Reference in New Issue