feat: sort meals
parent
98b45aabca
commit
2e22914cc2
|
@ -14,14 +14,15 @@ class FoodComponent extends StatelessWidget {
|
|||
return ValueListenableBuilder(
|
||||
valueListenable: box.listenable(),
|
||||
builder: (context, box, widget) {
|
||||
final mealTypes = ['FRÜHSTÜCK','MITTAGESSEN','ABENDESSEN']; // Specify the desired orde
|
||||
return ListView.builder(
|
||||
primary: false,
|
||||
shrinkWrap: true,
|
||||
itemCount: box.keys.length,
|
||||
itemBuilder: (context, i) {
|
||||
return CardComponent(
|
||||
eatingMealName: box.keyAt(i).toString(),
|
||||
selectedMeal: castDynamicToListFood(box.getAt(i)),
|
||||
eatingMealName: mealTypes[i],
|
||||
selectedMeal: castDynamicToListFood(box.get(mealTypes[i])),
|
||||
addButtonVisible: box.name != StatisticsService.instance.todayStatisticsBoxName.toLowerCase(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -16,12 +16,13 @@ class MealsComponent extends StatelessWidget {
|
|||
return ValueListenableBuilder(
|
||||
valueListenable: Hive.box(dotenv.env['MEALPLAN_BOX'] ?? 'MEALPLAN').listenable(),
|
||||
builder: (context, box, widget) {
|
||||
final mealTypes = ['FRÜHSTÜCK','MITTAGESSEN','ABENDESSEN']; // Specify the desired order of meal types
|
||||
return ListView.builder(
|
||||
primary: false,
|
||||
shrinkWrap: true,
|
||||
itemCount: box.keys.length,
|
||||
itemBuilder: (context, i) {
|
||||
String mealTypeAsString = box.keyAt(i).toString();
|
||||
String mealTypeAsString = mealTypes[i];
|
||||
return CardComponent(
|
||||
mealTypeAsString,
|
||||
StatisticsService.instance.getMealsOfTodayByMealtype(mealTypeAsString),
|
||||
|
|
Loading…
Reference in New Issue