forked from eatvio/eatvio_app
fat(recipes, diets): added list refreshing
This commit is contained in:
@@ -155,7 +155,13 @@ class _MyRecipeWidgetState extends State<MyRecipeWidget> {
|
||||
final fullRecipe = await context.read<MyRecipesCubit>().getRecipeById(widget.recipe.slug);
|
||||
if (context.mounted) {
|
||||
Navigator.pop(context); // close dialog
|
||||
context.push(RecipeCreateScreen.path, extra: fullRecipe);
|
||||
final result = await context.push(RecipeCreateScreen.path, extra: fullRecipe);
|
||||
if (!context.mounted) return;
|
||||
if (result == MyRecipesCubit.drafted) {
|
||||
await context.read<MyRecipesCubit>().setDraftedState();
|
||||
} else if (result == MyRecipesCubit.active) {
|
||||
await context.read<MyRecipesCubit>().setActiveState();
|
||||
}
|
||||
}
|
||||
},
|
||||
height: 52,
|
||||
@@ -236,10 +242,16 @@ class _MyRecipeWidgetState extends State<MyRecipeWidget> {
|
||||
} else {
|
||||
showErrorToast('Заполните все необходимые поля для публикации рецепта');
|
||||
if (context.mounted) {
|
||||
context.push(RecipeCreateScreen.path, extra: {
|
||||
final result = await context.push(RecipeCreateScreen.path, extra: {
|
||||
'recipe': fullRecipe,
|
||||
'autoValidate': true,
|
||||
});
|
||||
if (!context.mounted) return;
|
||||
if (result == MyRecipesCubit.drafted) {
|
||||
await context.read<MyRecipesCubit>().setDraftedState();
|
||||
} else if (result == MyRecipesCubit.active) {
|
||||
await context.read<MyRecipesCubit>().setActiveState();
|
||||
}
|
||||
}
|
||||
}
|
||||
await createCubit.close();
|
||||
|
||||
Reference in New Issue
Block a user