forked from eatvio/eatvio_app
feat: Add user recipe management and creation functionality, including models, widgets, cubits, repositories, and tests.
This commit is contained in:
@@ -19,8 +19,9 @@ import 'package:go_router/go_router.dart';
|
||||
|
||||
class RecipeCreateScreen extends StatefulWidget {
|
||||
final Recipe? recipe;
|
||||
final bool autoValidate;
|
||||
|
||||
const RecipeCreateScreen({super.key, this.recipe});
|
||||
const RecipeCreateScreen({super.key, this.recipe, this.autoValidate = false});
|
||||
|
||||
static const name = 'recipeCreateScreen';
|
||||
static const path = '/recipe-create-screen';
|
||||
@@ -40,6 +41,11 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
|
||||
createRecipeCubit = sl<CreateRecipeCubit>();
|
||||
if (widget.recipe != null) {
|
||||
createRecipeCubit.recipeToEntity(widget.recipe!);
|
||||
if (widget.autoValidate) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
createRecipeCubit.validateAll();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
createRecipeCubit.disableLoading();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user