RADOM JAZDA

This commit is contained in:
doman 2023-07-29 20:10:59 +02:00
parent 5da576e7d1
commit cccdc04dee
3 changed files with 22 additions and 54 deletions

View file

@ -6,13 +6,12 @@ class Product {
final double carb; final double carb;
final double fat; final double fat;
const Product({
const Entry({
required this.id, required this.id,
required this.name; required this.name,
required this.calories; required this.calories,
required this.protein; required this.protein,
required this.carb; required this.carb,
required this.fat; required this.fat,
}); });
} }

View file

@ -14,48 +14,21 @@ class MainScreen extends BasedScreen {
} }
class _MainScreen extends State<MainScreen> { class _MainScreen extends State<MainScreen> {
Diary? diary;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var testDiary = Diary( var content;
meals: <Meal>[
Meal( if (diary != null) {
entries: <Entry>[ content = Container(
Entry( constraints: const BoxConstraints(maxWidth: 600),
name: "DUPA", padding: const EdgeInsets.all(10),
calories: 123.21, child: DiaryWidget(diary: diary!),
protein: 20.13,
fat: 99.99,
carb: -15.02,
),
Entry(
name: "SRAKA",
calories: 123.21,
protein: 20.13,
fat: 99.99,
carb: -15.02,
),
]
),
Meal(
entries: <Entry>[
Entry(
name: "MADA",
calories: 123.21,
protein: 20.13,
fat: 99.99,
carb: -15.02,
),
Entry(
name: "FAKA",
calories: 123.21,
protein: 20.13,
fat: 99.99,
carb: -15.02,
),
]
),
]
); );
} else {
content = const CircularProgressIndicator();
}
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@ -63,11 +36,7 @@ class _MainScreen extends State<MainScreen> {
title: Text("FOODER"), title: Text("FOODER"),
), ),
body: Center( body: Center(
child: Container( child: content,
constraints: const BoxConstraints(maxWidth: 600),
padding: const EdgeInsets.all(10),
child: DiaryWidget(diary: testDiary),
),
), ),
); );
} }

View file

@ -12,7 +12,7 @@ class EntryWidget extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: Text(entry.name), child: Text(entry.product.name),
); );
} }
} }