@@ -226,6 +226,9 @@ class IngredientLogForm extends StatelessWidget {
226
226
227
227
@override
228
228
Widget build (BuildContext context) {
229
+ final diaryEntries = _plan.logs;
230
+ final String unit = AppLocalizations .of (context).g;
231
+
229
232
return Container (
230
233
margin: const EdgeInsets .all (20 ),
231
234
child: Form (
@@ -295,6 +298,34 @@ class IngredientLogForm extends StatelessWidget {
295
298
Navigator .of (context).pop ();
296
299
},
297
300
),
301
+ if (diaryEntries.isNotEmpty) const SizedBox (height: 10.0 ),
302
+ Container (
303
+ child: Text (AppLocalizations .of (context).recentlyUsedIngredients),
304
+ padding: const EdgeInsets .all (10.0 ),
305
+ ),
306
+ Expanded (
307
+ child: ListView .builder (
308
+ itemCount: diaryEntries.length,
309
+ shrinkWrap: true ,
310
+ itemBuilder: (context, index) {
311
+ return Card (
312
+ child: ListTile (
313
+ onTap: () {
314
+ _ingredientController.text = diaryEntries[index].ingredientObj.name;
315
+ _ingredientIdController.text =
316
+ diaryEntries[index].ingredientObj.id.toString ();
317
+ _amountController.text = diaryEntries[index].amount.toStringAsFixed (0 );
318
+ _mealItem.ingredientId = diaryEntries[index].ingredientId;
319
+ _mealItem.amount = diaryEntries[index].amount;
320
+ },
321
+ title: Text (_plan.logs[index].ingredientObj.name),
322
+ subtitle: Text ('${diaryEntries [index ].amount .toStringAsFixed (0 )}$unit ' ),
323
+ trailing: const Icon (Icons .copy),
324
+ ),
325
+ );
326
+ },
327
+ ),
328
+ )
298
329
],
299
330
),
300
331
),
0 commit comments