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 fat;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  const Entry({
 | 
			
		||||
  const Product({
 | 
			
		||||
    required this.id,
 | 
			
		||||
    required this.name;
 | 
			
		||||
    required this.calories;
 | 
			
		||||
    required this.protein;
 | 
			
		||||
    required this.carb;
 | 
			
		||||
    required this.fat;
 | 
			
		||||
    required this.name,
 | 
			
		||||
    required this.calories,
 | 
			
		||||
    required this.protein,
 | 
			
		||||
    required this.carb,
 | 
			
		||||
    required this.fat,
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,48 +14,21 @@ class MainScreen extends BasedScreen {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
class _MainScreen extends State<MainScreen> {
 | 
			
		||||
  Diary? diary;
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
    var testDiary = Diary(
 | 
			
		||||
      meals: <Meal>[
 | 
			
		||||
        Meal(
 | 
			
		||||
          entries: <Entry>[
 | 
			
		||||
            Entry(
 | 
			
		||||
              name: "DUPA",
 | 
			
		||||
              calories: 123.21,
 | 
			
		||||
              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,
 | 
			
		||||
            ),
 | 
			
		||||
          ]
 | 
			
		||||
        ),
 | 
			
		||||
      ]
 | 
			
		||||
    );
 | 
			
		||||
    var content;
 | 
			
		||||
 | 
			
		||||
    if (diary != null) {
 | 
			
		||||
        content = Container(
 | 
			
		||||
          constraints: const BoxConstraints(maxWidth: 600),
 | 
			
		||||
          padding: const EdgeInsets.all(10),
 | 
			
		||||
          child: DiaryWidget(diary: diary!),
 | 
			
		||||
        );
 | 
			
		||||
    } else {
 | 
			
		||||
      content = const CircularProgressIndicator();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return Scaffold(
 | 
			
		||||
      appBar: AppBar(
 | 
			
		||||
| 
						 | 
				
			
			@ -63,11 +36,7 @@ class _MainScreen extends State<MainScreen> {
 | 
			
		|||
        title: Text("FOODER"),
 | 
			
		||||
      ),
 | 
			
		||||
      body: Center(
 | 
			
		||||
        child: Container(
 | 
			
		||||
          constraints: const BoxConstraints(maxWidth: 600),
 | 
			
		||||
          padding: const EdgeInsets.all(10),
 | 
			
		||||
          child: DiaryWidget(diary: testDiary),
 | 
			
		||||
        ),
 | 
			
		||||
        child: content,
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ class EntryWidget extends StatelessWidget {
 | 
			
		|||
  Widget build(BuildContext context) {
 | 
			
		||||
    return Container(
 | 
			
		||||
      padding: const EdgeInsets.all(8),
 | 
			
		||||
      child: Text(entry.name),
 | 
			
		||||
      child: Text(entry.product.name),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue