[meal] view

This commit is contained in:
doman 2023-10-27 20:16:16 +02:00
parent 985ed670e4
commit 8b7f8b7011
3 changed files with 7 additions and 3 deletions

View file

@ -5,8 +5,9 @@ import 'package:fooder/widgets/macro.dart';
class MealScreen extends BasedScreen { class MealScreen extends BasedScreen {
final Meal meal; final Meal meal;
final Function() refresh;
const MealScreen({super.key, required super.apiClient, required this.meal}); const MealScreen({super.key, required super.apiClient, required this.refresh, required this.meal});
@override @override
State<MealScreen> createState() => _AddMealScreen(); State<MealScreen> createState() => _AddMealScreen();
@ -69,6 +70,8 @@ class _AddMealScreen extends State<MealScreen> {
onPressed: () { onPressed: () {
_deleteMeal(widget.meal); _deleteMeal(widget.meal);
Navigator.pop(context); Navigator.pop(context);
Navigator.pop(context);
widget.refresh();
}, },
), ),
], ],

View file

@ -57,8 +57,8 @@ class DiaryWidget extends StatelessWidget {
), ),
)), )),
SliverToBoxAdapter( SliverToBoxAdapter(
child: SizedBox( child: Container(
height: 30, padding: const EdgeInsets.all(8),
child: TextButton( child: TextButton(
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(

View file

@ -29,6 +29,7 @@ class MealWidget extends StatelessWidget {
builder: (context) => MealScreen( builder: (context) => MealScreen(
apiClient: apiClient, apiClient: apiClient,
meal: meal, meal: meal,
refresh: refreshParent,
), ),
), ),
).then((_) { ).then((_) {