feat: introduce My Diets and Create Diet features with associated UI, state management, and data handling.

This commit is contained in:
mso7nueh
2026-01-28 17:32:29 +03:00
parent 62fe5ebfa0
commit 2d7407ce99
10 changed files with 118 additions and 201 deletions

View File

@@ -180,40 +180,6 @@ class _CreateDietScreenContentState extends State<CreateDietScreenContent> {
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
children: [
CustomOutlinedButton(
onPressed: () async {
context.read<CreateDietCubit>().setDietState(DietState.draft);
if (widget.diet != null) {
final result = await context.read<CreateDietCubit>().updateDiet(widget.diet!.id);
if (result == 'error') {
if (!context.mounted) return;
showErrorDialog(context, title: '${s.could_not_update_diet} ${state.dietData.name}');
}
} else {
final result = await context.read<CreateDietCubit>().createDiet();
if (result == 'error') {
if (!context.mounted) return;
showErrorDialog(context, title: '${s.could_not_publish_diet} ${state.dietData.name}');
}
}
},
// onPressed: state.isDietPublishing
// ? () {}
// : () async {
// final diet = await context.read<CreateDietCubit>().getDietForPreview();
// if (diet == null) return;
// if (!context.mounted) return;
// GoRouter.of(context).pushNamed(DietPreviewScreen.name, extra: diet);
// },
text: "В черновик",
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.gray),
buttonStyle: ButtonStyle(
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.dottedBorder),
),
),
const SizedBox(height: 12),
CustomOutlinedButton(
onPressed: state.isDietPublishing
? () {}