RADOM JAZDA
This commit is contained in:
		
							parent
							
								
									5da576e7d1
								
							
						
					
					
						commit
						cccdc04dee
					
				
					 3 changed files with 22 additions and 54 deletions
				
			
		| 
						 | 
					@ -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,
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,60 +14,29 @@ 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,
 | 
					    } else {
 | 
				
			||||||
              carb: -15.02,
 | 
					      content = const CircularProgressIndicator();
 | 
				
			||||||
            ),
 | 
					    }
 | 
				
			||||||
            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,
 | 
					 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
          ]
 | 
					 | 
				
			||||||
        ),
 | 
					 | 
				
			||||||
      ]
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
    return Scaffold(
 | 
					    return Scaffold(
 | 
				
			||||||
      appBar: AppBar(
 | 
					      appBar: AppBar(
 | 
				
			||||||
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
 | 
					        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
 | 
				
			||||||
        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),
 | 
					 | 
				
			||||||
        ),
 | 
					 | 
				
			||||||
      ),
 | 
					      ),
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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),
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue