Add models for nutritional plans

This commit is contained in:
Roland Geider
2020-11-07 14:04:29 +01:00
parent e6a2daebd1
commit 07a5c47474
7 changed files with 125 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import 'package:flutter/foundation.dart';
class Ingredient {
final int id;
final String name;
final DateTime creationDate;
final int energy;
final double carbohydrates;
final double carbohydrates_sugar;
final double fat;
final double fat_saturated;
final double fibres;
Ingredient({
@required this.id,
@required this.name,
@required this.creationDate,
@required this.energy,
@required this.carbohydrates,
@required this.carbohydrates_sugar,
@required this.fat,
@required this.fat_saturated,
@required this.fibres,
});
}

View File

@@ -0,0 +1,19 @@
import 'package:flutter/foundation.dart';
import 'package:wger/models/nutrition/ingredient.dart';
import 'package:wger/models/nutrition/weight_unit.dart';
class IngredientWeightUnit {
final int id;
final Ingredient weightUnit;
final WeightUnit ingredient;
final int grams;
final double amount;
IngredientWeightUnit({
@required this.id,
@required this.weightUnit,
@required this.ingredient,
@required this.grams,
@required this.amount,
});
}

View File

@@ -0,0 +1,23 @@
import 'package:flutter/foundation.dart';
import 'package:wger/models/nutrition/ingredient.dart';
import 'package:wger/models/nutrition/ingredient_weight_unit.dart';
class Log {
final int id;
final int nutritionalPlanId;
final DateTime date;
final String comment;
final Ingredient ingredient;
final IngredientWeightUnit weightUnit;
final double amount;
Log({
@required this.id,
@required this.ingredient,
@required this.weightUnit,
@required this.amount,
@required this.nutritionalPlanId,
@required this.date,
@required this.comment,
});
}

View File

@@ -0,0 +1,14 @@
import 'package:flutter/foundation.dart';
import 'package:wger/models/nutrition/meal_item.dart';
class Meal {
final int id;
final DateTime time;
final List<MealItem> mealItems;
Meal({
@required this.id,
@required this.time,
@required this.mealItems,
});
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/foundation.dart';
import 'package:wger/models/nutrition/ingredient.dart';
import 'package:wger/models/nutrition/ingredient_weight_unit.dart';
class MealItem {
final int id;
final Ingredient ingredient;
final IngredientWeightUnit weightUnit;
final double amount;
MealItem({
@required this.id,
@required this.ingredient,
@required this.weightUnit,
@required this.amount,
});
}

View File

@@ -0,0 +1,16 @@
import 'package:flutter/foundation.dart';
import 'package:wger/models/nutrition/meal.dart';
class NutritionalPlan {
final int id;
final String description;
final DateTime date;
final List<Meal> meals;
NutritionalPlan({
@required this.id,
@required this.description,
@required this.date,
@required this.meals,
});
}

View File

@@ -0,0 +1,11 @@
import 'package:flutter/foundation.dart';
class WeightUnit {
final int id;
final String name;
WeightUnit({
@required this.id,
@required this.name,
});
}