Design angepasst

welcome
Bogdan Kotikov 2023-05-29 22:04:44 +02:00
parent 873819dea1
commit de561a4b90
12 changed files with 280 additions and 46 deletions

View File

@ -37,6 +37,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.18" "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", "name": "boolean_selector",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1", "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1",
@ -253,6 +259,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "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", "name": "http_multi_server",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/http_multi_server-3.2.1", "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/http_multi_server-3.2.1",
@ -391,6 +403,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.17" "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", "name": "pool",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/pool-1.5.1", "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/pool-1.5.1",
@ -566,7 +584,7 @@
"languageVersion": "2.19" "languageVersion": "2.19"
} }
], ],
"generated": "2023-05-25T21:42:31.568902Z", "generated": "2023-05-26T21:55:36.197535Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "2.19.6" "generatorVersion": "2.19.6"
} }

View File

@ -22,6 +22,10 @@ async
2.18 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/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/async-2.10.0/lib/ 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 boolean_selector
2.17 2.17
file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/ file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/
@ -158,6 +162,10 @@ hive_generator
2.12 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/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/hive_generator-2.0.0/lib/ 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 http_multi_server
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/http_multi_server-3.2.1/ file:///Users/bogdan/.pub-cache/hosted/pub.dev/http_multi_server-3.2.1/
@ -250,6 +258,10 @@ plugin_platform_interface
2.17 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/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/plugin_platform_interface-2.1.4/lib/ 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 pool
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/pool-1.5.1/ file:///Users/bogdan/.pub-cache/hosted/pub.dev/pool-1.5.1/

View File

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

View File

@ -10,7 +10,7 @@ class AndroidApp extends StatelessWidget {
return MaterialApp( return MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, scaffoldBackgroundColor: Colors.grey.shade100, //<-- SEE
), ),
home: const MainPage(), home: const MainPage(),
routes: { routes: {

View File

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

View File

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

View File

@ -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("+")))
],
),
);
}
}

View File

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

View File

@ -18,23 +18,25 @@ class MainPageState extends State<MainPage> {
]; ];
int currentIndex = 0; int currentIndex = 0;
void onTap(int index){
void onTap(int index) {
setState(() { setState(() {
currentIndex = index; currentIndex = index;
pages[currentIndex]; pages[currentIndex];
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(pages[currentIndex].title), 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( bottomNavigationBar: BottomNavigationBar(
currentIndex: currentIndex, currentIndex: currentIndex,
selectedItemColor: Colors.black54, selectedItemColor: Colors.black54,
@ -44,18 +46,10 @@ class MainPageState extends State<MainPage> {
elevation: 0, elevation: 0,
onTap: onTap, onTap: onTap,
items: const [ items: const [
BottomNavigationBarItem(icon: Icon(Icons.today), label: 'Today'),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Icons.today), icon: Icon(Icons.area_chart), label: 'Progress'),
label: 'Today' BottomNavigationBarItem(icon: Icon(Icons.apple), label: 'Meal Plan'),
),
BottomNavigationBarItem(
icon: Icon(Icons.area_chart),
label: 'Progress'
),
BottomNavigationBarItem(
icon: Icon(Icons.apple),
label: 'Meal Plan'
),
], ],
), ),
); );

View File

@ -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 'package:flutter/material.dart';
import '../../components/diet_chart_component.dart'; import 'package:hive_flutter/adapters.dart';
import '../../components/statistics_circular_indicator_component.dart';
class TodayPage extends StatefulWidget { class TodayPage extends StatefulWidget {
final String title; final String title;
@ -14,32 +14,27 @@ class TodayPage extends StatefulWidget {
} }
class _TodayPageState extends State<TodayPage> { class _TodayPageState extends State<TodayPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: SizedBox( body: SingleChildScrollView(
width: double.infinity, child: ValueListenableBuilder(
height: double.infinity, valueListenable: Hive.box("TODAY").listenable(),
child: Container( builder: (context, box, widget) {
decoration: const BoxDecoration( return ListView.builder(
gradient: LinearGradient( primary: false,
colors: [Color(0xff000000), Color(0xff47a44b)], shrinkWrap: true,
stops: [0.1, 5], itemCount: box.keys.length,
begin: Alignment.bottomCenter, itemBuilder: (context, i) {
end: Alignment.topCenter, if (box.keyAt(i).toString() == "DATE") {
)), return const SizedBox.shrink();
child: SingleChildScrollView( } else {
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 0), return CardComponent(
child: Column( StringUtils.capitalize(box.keyAt(i).toString()),
children: [ box.getAt(i)
StatisticsPercentComponent(300, 100, 400), );
DietChatComponent(1500), }
const FoodComponent(), });
], })));
),
)),
));
} }
} }

View File

@ -49,6 +49,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.10.0" 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: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -331,6 +339,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.0" 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: http_multi_server:
dependency: transitive dependency: transitive
description: description:
@ -515,6 +531,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
pointycastle:
dependency: transitive
description:
name: pointycastle
sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c"
url: "https://pub.dev"
source: hosted
version: "3.7.3"
pool: pool:
dependency: transitive dependency: transitive
description: description:

View File

@ -46,6 +46,7 @@ dependencies:
responsive_framework: ^1.0.0 responsive_framework: ^1.0.0
sizer: ^2.0.15 sizer: ^2.0.15
fl_chart: ^0.62.0 fl_chart: ^0.62.0
basic_utils: ^5.5.4
dev_dependencies: dev_dependencies: