forked from eatvio/eatvio_app
feat: introduce My Diets and Create Diet features with associated UI, state management, and data handling.
This commit is contained in:
@@ -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
|
||||
? () {}
|
||||
|
||||
Reference in New Issue
Block a user