From 06de6c5d1cd5d208c80cfc5aa61cf055e417c3f2 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 19 May 2025 17:50:52 +0300 Subject: [PATCH 1/6] fix(recipe): tags error --- lib/core/const.dart | 4 +- .../presentation/widgets/tags_widget.dart | 125 +++++++++--------- .../presentation/pages/profile_screen.dart | 1 + 3 files changed, 63 insertions(+), 67 deletions(-) diff --git a/lib/core/const.dart b/lib/core/const.dart index 4f38a54e..31c47e9c 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,5 +1,5 @@ -// String baseUrl = 'https://eatvio.ru'; -String baseUrl = 'https://dev2.eatvio.com'; +String baseUrl = 'https://eatvio.ru'; +// String baseUrl = 'https://dev2.eatvio.com'; const List durationValues = [7, 14, 21]; diff --git a/lib/features/create_recipe/presentation/widgets/tags_widget.dart b/lib/features/create_recipe/presentation/widgets/tags_widget.dart index baac0c3b..affc9e90 100644 --- a/lib/features/create_recipe/presentation/widgets/tags_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/tags_widget.dart @@ -1,6 +1,7 @@ import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart'; +import 'package:eatvio_app/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -14,79 +15,73 @@ class TagsWidget extends StatefulWidget { class _TagsWidgetState extends State { late final CreateRecipeCubit createRecipeCubit; final tagController = TextEditingController(); - late final List tags; - - @override - void initState() { - super.initState(); - createRecipeCubit = context.read(); - tags = createRecipeCubit.state.entity.tags; - } @override Widget build(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('Теги'), - const SizedBox(height: 4), - CustomTextFormField( - hintText: 'Например: без майонеза', - controller: tagController, - suffix: IconButton( - onPressed: () { - if (tagController.text.isNotEmpty) { - setState(() { - tags.add(tagController.text); - tagController.clear(); - }); - } - }, - icon: Icon( - Icons.done, - color: appTheme.blueA400, - ), - ), - ), - const SizedBox(height: 12), - Wrap( - spacing: 8, - runSpacing: 8, + return BlocBuilder( + builder: (BuildContext context, CreateRecipeState state) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - for (int i = 0; i < tags.length; i++) ...[ - InkWell( - onTap: () { - setState(() { - tags.remove(tags[i]); - }); + const Text('Теги'), + const SizedBox(height: 4), + CustomTextFormField( + hintText: 'Например: без майонеза', + controller: tagController, + suffix: IconButton( + onPressed: () { + if (tagController.text.isNotEmpty) { + context.read().addTag(tagController.text); + setState(() { + tagController.clear(); + }); + } }, - borderRadius: BorderRadius.circular(16), - child: Ink( - padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - color: Colors.grey.shade200, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - tags[i], - ), - const SizedBox(width: 4), - Icon( - Icons.delete_outline_rounded, - color: Colors.grey.shade600, - size: 20, - ), - ], - ), + icon: Icon( + Icons.done, + color: appTheme.blueA400, ), ), - ], + ), + const SizedBox(height: 12), + Wrap( + spacing: 8, + runSpacing: 8, + children: [ + for (int i = 0; i < state.entity.tags.length; i++) ...[ + InkWell( + onTap: () { + context.read().removeTag(state.entity.tags[i]); + }, + borderRadius: BorderRadius.circular(16), + child: Ink( + padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + color: Colors.grey.shade200, + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + state.entity.tags[i], + ), + const SizedBox(width: 4), + Icon( + Icons.delete_outline_rounded, + color: Colors.grey.shade600, + size: 20, + ), + ], + ), + ), + ), + ], + ], + ), ], - ), - ], + ); + }, ); } } diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index 699aa021..ad6c9b9d 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -756,6 +756,7 @@ class _ProfileScreenState extends State { ) : Tooltip( message: state.profile.badges[i].description, + margin: const EdgeInsets.symmetric(horizontal: 32), triggerMode: TooltipTriggerMode.tap, textStyle: const TextStyle( color: Colors.black, From 42deaea426bda0f0e04bd1395b82dcf1511b8b9a Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 19 May 2025 17:53:00 +0300 Subject: [PATCH 2/6] fix(testflight): upd ver --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- ios/Runner/Info.plist | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 485b5cb9..2566b21b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -388,7 +388,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 15; + CURRENT_PROJECT_VERSION = 16; DEVELOPMENT_TEAM = VL68C36HYS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -538,7 +538,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 15; + CURRENT_PROJECT_VERSION = 16; DEVELOPMENT_TEAM = VL68C36HYS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -576,7 +576,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 15; + CURRENT_PROJECT_VERSION = 16; DEVELOPMENT_TEAM = VL68C36HYS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 93558f26..24f859fd 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 15 + 16 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS From 941cfb04cc2e4dc12f7c4a1a69540d2b5595070e Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Tue, 20 May 2025 18:28:32 +0300 Subject: [PATCH 3/6] feat(diet): add diet editing --- lib/core/widgets/custom_popup.dart | 10 ++++++- lib/core/widgets/show_error_dialog.dart | 4 +-- .../presentation/create_diet_screen.dart | 28 ++++++++----------- .../presentation/cubit/create_diet_cubit.dart | 26 +++++++++++++++-- .../widgets/status_drop_down_widget.dart | 14 ++++++++-- .../presentation/pages/about_diet_screen.dart | 3 ++ .../feed/models/diets_pagination_model.dart | 4 +-- .../presentation/widgets/diets_widget.dart | 1 + .../presentation/widgets/my_diet_widget.dart | 2 ++ 9 files changed, 66 insertions(+), 26 deletions(-) diff --git a/lib/core/widgets/custom_popup.dart b/lib/core/widgets/custom_popup.dart index 837c165b..011de1cd 100644 --- a/lib/core/widgets/custom_popup.dart +++ b/lib/core/widgets/custom_popup.dart @@ -6,7 +6,9 @@ import 'package:eatvio_app/core/utils/toasts.dart'; import 'package:eatvio_app/core/widgets/show_error_dialog.dart'; import 'package:eatvio_app/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_cubit.dart'; import 'package:eatvio_app/features/complaining/presentation/complaining_bottom_sheet.dart'; +import 'package:eatvio_app/features/create_diet/presentation/create_diet_screen.dart'; import 'package:eatvio_app/features/create_recipe/presentation/pages/recipe_create_screen.dart'; +import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart'; import 'package:eatvio_app/features/feed/models/recipes_model.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart'; @@ -28,6 +30,7 @@ class CustomPopup extends StatelessWidget { final int? id; final FeedBlogPostModel? feedBlogPostModel; final Recipe? recipe; + final Diet? diet; const CustomPopup({ super.key, @@ -38,6 +41,7 @@ class CustomPopup extends StatelessWidget { this.slug, this.feedBlogPostModel, this.recipe, + this.diet, }); @override @@ -94,11 +98,15 @@ class CustomPopup extends StatelessWidget { sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }); - addItem('assets/icons/edit_paint.svg', 'Редактировать', () { + addItem('assets/icons/edit_paint.svg', 'Редактировать', () async { if (complainedContentType == ComplainedContent.posts) { GoRouter.of(context).pushNamed('blogPostCreateScreen', extra: feedBlogPostModel); } else if (complainedContentType == ComplainedContent.recipe) { GoRouter.of(context).pushNamed(RecipeCreateScreen.name, extra: recipe); + } else if (complainedContentType == ComplainedContent.diet) { + await showErrorDialog(context, title: 'Предупреждение', description: 'Диета будет перенесена в архив. Вы создаете новую диету на основе существующей.'); + await sl().unpublishDiet(id!); + GoRouter.of(context).pushNamed(CreateDietScreen.name, extra: diet); } else { showInfoToast('В разработке'); return; diff --git a/lib/core/widgets/show_error_dialog.dart b/lib/core/widgets/show_error_dialog.dart index a064538c..9685ad14 100644 --- a/lib/core/widgets/show_error_dialog.dart +++ b/lib/core/widgets/show_error_dialog.dart @@ -5,8 +5,8 @@ import 'package:eatvio_app/generated/l10n.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -void showErrorDialog(BuildContext context, {String? title, String? description}) { - showDialog( +Future showErrorDialog(BuildContext context, {String? title, String? description}) async { + return await showDialog( context: context, barrierColor: Colors.transparent, builder: (BuildContext context) { diff --git a/lib/features/create_diet/presentation/create_diet_screen.dart b/lib/features/create_diet/presentation/create_diet_screen.dart index 48d1d27e..f0f729d4 100644 --- a/lib/features/create_diet/presentation/create_diet_screen.dart +++ b/lib/features/create_diet/presentation/create_diet_screen.dart @@ -27,8 +27,11 @@ import 'package:go_router/go_router.dart'; class CreateDietScreen extends StatelessWidget { static const name = 'createDietScreen'; static const path = '/create-diet-screen'; + const CreateDietScreen({super.key, this.diet}); + final Diet? diet; + @override Widget build(BuildContext context) { return BlocProvider( @@ -40,6 +43,7 @@ class CreateDietScreen extends StatelessWidget { class CreateDietScreenContent extends StatefulWidget { const CreateDietScreenContent({super.key, this.diet}); + final Diet? diet; @override @@ -95,7 +99,7 @@ class _CreateDietScreenContentState extends State { appBar: AppBar( centerTitle: true, title: Text( - widget.diet != null ? 'Редактирование диеты' : s.create_diet, + s.create_diet, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, softWrap: true, @@ -151,7 +155,7 @@ class _CreateDietScreenContentState extends State { const SizedBox(height: 12), const DietDurationDropDownWidget(), const SizedBox(height: 12), - const StatusDropDownWidget(), + StatusDropDownWidget(dietState: widget.diet?.state), const SizedBox(height: 16), const DietTypeChoiceWidget(), const SizedBox(height: 16), @@ -247,23 +251,13 @@ class _CreateDietScreenContentState extends State { else CustomOutlinedButton( onPressed: () async { - if (widget.diet != null) { - final result = await context.read().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().createDiet(); - if (result == 'error') { - if (!context.mounted) return; - showErrorDialog(context, title: '${s.could_not_publish_diet} ${state.dietData.name}'); - } + final result = await context.read().createDiet(); + if (result == 'error') { + if (!context.mounted) return; + showErrorDialog(context, title: '${s.could_not_publish_diet} ${state.dietData.name}'); } }, - text: widget.diet != null ? s.save : s.publish, + text: s.publish, height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( diff --git a/lib/features/create_diet/presentation/cubit/create_diet_cubit.dart b/lib/features/create_diet/presentation/cubit/create_diet_cubit.dart index 820d36b7..8e0d4a8b 100644 --- a/lib/features/create_diet/presentation/cubit/create_diet_cubit.dart +++ b/lib/features/create_diet/presentation/cubit/create_diet_cubit.dart @@ -12,6 +12,8 @@ import 'package:eatvio_app/features/glossary/repositories/glossary_repository.da import 'package:eatvio_app/features/profile/repositories/profile_repository.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_image_compress/flutter_image_compress.dart'; +import 'package:http/http.dart' as http; +import 'package:path_provider/path_provider.dart'; class CreateDietCubit extends Cubit { final CreateDietRepository createDietRepository; @@ -319,18 +321,38 @@ class CreateDietCubit extends Cubit { return diet; } + Future downloadImageAsFile(String imageUrl) async { + final response = await http.get(Uri.parse(imageUrl)); + + if (response.statusCode == 200) { + final tempDir = await getTemporaryDirectory(); + final filePath = '${tempDir.path}/${imageUrl.split('/').last}'; + final file = File(filePath); + return await file.writeAsBytes(response.bodyBytes); + } else { + throw Exception('Не удалось загрузить изображение'); + } + } + Future createDiet() async { emit(state.copyWith(isDietPublishing: true)); if (!_isFromValid()) return 'validation'; try { - final image = await ImageCompressUtility.compressFile(File(state.dietData.image!.path)); + File? file; + if (state.dietData.imageUrl != null) { + file = await downloadImageAsFile(state.dietData.imageUrl!); + } + File? image; + if (state.dietData.image?.path != null) { + image = await ImageCompressUtility.compressFile(File(state.dietData.image!.path)); + } final dietState = state.dietData.state!; final dailySchedule = state.dietData.dailySchedule; await createDietRepository.createDiet( name: state.dietData.name ?? '', duration: state.dietData.duration ?? 7, state: dietState, - image: image, + image: image ?? file!, meatType: state.dietData.type['meat'] == true ? '1' : '0', carbType: state.dietData.type['carb'] == true ? '1' : '0', vegType: state.dietData.type['veg'] == true ? '1' : '0', diff --git a/lib/features/create_diet/presentation/widgets/status_drop_down_widget.dart b/lib/features/create_diet/presentation/widgets/status_drop_down_widget.dart index 75b30b59..249e897a 100644 --- a/lib/features/create_diet/presentation/widgets/status_drop_down_widget.dart +++ b/lib/features/create_diet/presentation/widgets/status_drop_down_widget.dart @@ -11,7 +11,9 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:collection/collection.dart'; class StatusDropDownWidget extends StatefulWidget { - const StatusDropDownWidget({super.key}); + final DietState? dietState; + + const StatusDropDownWidget({super.key, this.dietState}); @override State createState() => _StatusDropDownWidgetState(); @@ -19,6 +21,7 @@ class StatusDropDownWidget extends StatefulWidget { class _StatusDropDownWidgetState extends State { final List dietStateTitles = []; + String? currentState; // late final List dietStates = DietState.values; @override @@ -39,6 +42,13 @@ class _StatusDropDownWidgetState extends State { // } // } } + if (widget.dietState != null) { + if (widget.dietState == DietState.active) { + currentState = dietStateTitles[0]; + } else if (widget.dietState == DietState.personal) { + currentState = dietStateTitles[1]; + } + } } @override @@ -77,7 +87,7 @@ class _StatusDropDownWidgetState extends State { ), ) .toList(), - value: state.dietState == DietState.active ? dietStateTitles[0] : state.dietState == DietState.personal ? dietStateTitles[1] : null, + value: currentState, ), if (state.dietStateError != null) ...[ const SizedBox( diff --git a/lib/features/diets/presentation/pages/about_diet_screen.dart b/lib/features/diets/presentation/pages/about_diet_screen.dart index 8a21395a..4dd3878d 100644 --- a/lib/features/diets/presentation/pages/about_diet_screen.dart +++ b/lib/features/diets/presentation/pages/about_diet_screen.dart @@ -321,6 +321,7 @@ class _AboutDietScreenState extends State { path: 'diet/${widget.diet.id}', complainedContentType: ComplainedContent.diet, id: widget.diet.id, + diet: widget.diet, ), const SizedBox(width: 16), ], @@ -501,6 +502,7 @@ class _AboutDietScreenState extends State { path: 'diet/${widget.diet.id}', complainedContentType: ComplainedContent.diet, id: widget.diet.id, + diet: widget.diet, ), const SizedBox(width: 16), ], @@ -527,6 +529,7 @@ class _AboutDietScreenState extends State { path: 'diet/${widget.diet.id}', complainedContentType: ComplainedContent.diet, id: widget.diet.id, + diet: widget.diet, ), const SizedBox(width: 16), ], diff --git a/lib/features/feed/models/diets_pagination_model.dart b/lib/features/feed/models/diets_pagination_model.dart index 14538a30..4c1f41fd 100644 --- a/lib/features/feed/models/diets_pagination_model.dart +++ b/lib/features/feed/models/diets_pagination_model.dart @@ -42,7 +42,7 @@ class Diet with _$Diet { enum DietState { @JsonKey(name: 'active') active, - @JsonKey(name: 'draft') + @JsonKey(name: 'drafted') draft, @JsonKey(name: 'personal') personal; @@ -53,7 +53,7 @@ enum DietState { case DietState.active: return 'active'; case DietState.draft: - return 'draft'; + return 'drafted'; case DietState.personal: return 'personal'; } diff --git a/lib/features/feed/presentation/widgets/diets_widget.dart b/lib/features/feed/presentation/widgets/diets_widget.dart index 87091ad8..bcf1056a 100644 --- a/lib/features/feed/presentation/widgets/diets_widget.dart +++ b/lib/features/feed/presentation/widgets/diets_widget.dart @@ -93,6 +93,7 @@ class _DietsWidgetState extends State { path: 'diet/${widget.diet.id}', id: widget.diet.id, complainedContentType: ComplainedContent.diet, + diet: widget.diet, ), ), ), diff --git a/lib/features/my_diets/presentation/widgets/my_diet_widget.dart b/lib/features/my_diets/presentation/widgets/my_diet_widget.dart index cfbd39d5..99489f9d 100644 --- a/lib/features/my_diets/presentation/widgets/my_diet_widget.dart +++ b/lib/features/my_diets/presentation/widgets/my_diet_widget.dart @@ -7,6 +7,7 @@ import 'package:eatvio_app/core/utils/toasts.dart'; import 'package:eatvio_app/core/widgets/bottom_sheet_with_blur.dart'; import 'package:eatvio_app/core/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/core/widgets/info_row.dart'; +import 'package:eatvio_app/core/widgets/show_error_dialog.dart'; import 'package:eatvio_app/core/widgets/success_published_diet_bottom_sheet.dart'; import 'package:eatvio_app/features/create_diet/presentation/create_diet_screen.dart'; import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; @@ -194,6 +195,7 @@ class _MyDietWidgetState extends State { showErrorToast('Произошла ошибка. Попробуйте ещё раз через некоторое время'); } } else { + await showErrorDialog(context, title: 'Предупреждение', description: 'Вы можете создать новую диету на основе существующей.'); GoRouter.of(context).pushNamed(CreateDietScreen.name, extra: widget.diet); } }, From 067e0929eda6f76d7308e8c0179001f321b4f47f Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Wed, 21 May 2025 17:42:43 +0300 Subject: [PATCH 4/6] feat(verify): phone --- lib/core/app_router.dart | 6 + lib/core/const.dart | 3 +- .../selection_popup_model.dart | 2 +- lib/core/models/pagination_model.dart | 6 +- .../auth/models/credentials_model.dart | 2 +- lib/features/auth/models/token_model.dart | 2 +- .../auth/presentation/bloc/auth_state.dart | 2 +- .../blog_post_create_credentials_model.dart | 2 +- .../calendar/models/calendar_model.dart | 2 +- .../cubit/cancel_plan_state.dart | 2 +- .../models/cancelation_model.dart | 2 +- .../chat/models/chat_message_model.dart | 2 +- .../chat/models/chat_messages_model.dart | 2 +- lib/features/chat/models/chat_meta_model.dart | 2 +- lib/features/chat/models/chat_room_model.dart | 4 +- .../models/chat_room_pagination_model.dart | 10 +- .../chat/models/chat_room_settings_model.dart | 2 +- lib/features/chat/models/chat_user_model.dart | 2 +- lib/features/chat/models/payment_model.dart | 2 +- .../chat/models/plan_complain_model.dart | 2 +- .../chat/models/websocket_info_model.dart | 2 +- .../bloc/chats_cubit/chats_state.dart | 2 +- .../complaining/models/complain_model.dart | 2 +- .../presentation/cubit/complaining_state.dart | 2 +- .../models/consultant_profile_model.dart | 6 +- .../models/consultation_request_model.dart | 4 +- .../models/rating_model.dart | 2 +- .../models/consultation_model.dart | 6 +- .../cubit/consultations_state.dart | 2 +- .../create_diet/models/create_diet_model.dart | 2 +- .../presentation/cubit/create_diet_state.dart | 2 +- .../widgets/diet_image_picker_widget.dart | 11 +- .../create_plan/models/create_plan_model.dart | 2 +- .../create_plan/models/plan_slug_model.dart | 2 +- .../presentation/cubit/create_plan_state.dart | 6 +- .../widgets/plan_image_picker_widget.dart | 11 +- .../entities/recipe_create_entity.dart | 4 +- .../create_recipe/models/ingredient.dart | 2 +- .../create_recipe/models/product.dart | 2 +- .../models/recipe_create_model.dart | 2 +- .../create_recipe/models/recipe_model.dart | 2 +- .../models/recipe_tag_model.dart | 4 +- lib/features/create_recipe/models/step.dart | 2 +- .../create_recipe_state.dart | 2 +- .../models/consultant_comment_model.dart | 6 +- .../diary/models/consultant_review_model.dart | 8 +- .../consultant_review_model.freezed.dart | 1101 ++++++++--------- .../models/consultant_review_model.g.dart | 28 +- .../diary/models/diary_day_model.dart | 14 +- .../diary/models/diary_index_model.dart | 2 +- .../diary/models/finish_diary_day_model.dart | 2 +- .../diary/models/nutrition_model.dart | 4 +- .../models/product_moderation_model.dart | 2 +- .../consultant_comments_state.dart | 2 +- .../diary/presentation/bloc/diary_state.dart | 2 +- .../presentation/widgets/product_widget.dart | 13 +- .../diets/models/diet_likes_model.dart | 2 +- .../presentation/cubit/about_diet_state.dart | 2 +- lib/features/feed/models/comment_model.dart | 4 +- .../feed/models/diets_pagination_model.dart | 14 +- .../feed/models/feed_blog_post_model.dart | 2 +- .../models/feed_blog_post_settings_model.dart | 2 +- .../feed/models/feed_consultant_model.dart | 4 +- .../feed/models/plan_pagination_model.dart | 8 +- lib/features/feed/models/recipes_model.dart | 8 +- .../feed/models/recipes_pagination_model.dart | 2 +- .../bloc/diets_cubit/diets_state.dart | 4 +- .../bloc/plans_cubit/plans_state.dart | 2 +- .../bloc/profile_cubit/profile_state.dart | 2 +- .../glossary/models/glossary_model.dart | 6 +- .../presentation/cubit/my_diets_state.dart | 2 +- .../my_finance/models/card_model.dart | 2 +- .../my_finance/models/payment_url_model.dart | 2 +- .../user_cards_cubit/user_cards_state.dart | 2 +- .../presentation/cubit/my_plans_state.dart | 2 +- .../models/notification_model.dart | 2 +- .../order_info/cubit/order_info_state.dart | 2 +- .../plans/models/chosen_plan_model.dart | 2 +- .../presentation/cubit/about_plan_state.dart | 2 +- lib/features/profile/models/badge_model.dart | 2 +- .../models/chosen_diets_pagination_model.dart | 4 +- .../profile/models/circumference_model.dart | 2 +- .../profile/models/profile_model.dart | 14 +- lib/features/profile/models/sub_model.dart | 4 +- lib/features/profile/models/weight_model.dart | 2 +- .../bloc/profile_cubit/profile_cubit.dart | 4 + .../presentation/pages/profile_screen.dart | 4 + .../repositories/profile_repository.dart | 5 + .../profile/services/profile_service.dart | 5 + .../cubit/about_recipe_state.dart | 2 +- .../registration/models/location_model.dart | 2 +- .../models/user_registration_model.dart | 2 +- .../registration_state.dart | 2 +- .../presentation/pages/verify_screen.dart | 40 + .../models/profile_settings_model.dart | 2 +- .../cubit/user_details_state.dart | 2 +- pubspec.yaml | 49 +- .../services/profile_service_test.mocks.dart | 27 + 98 files changed, 821 insertions(+), 760 deletions(-) create mode 100644 lib/features/registration/presentation/pages/verify_screen.dart diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 1c7210ac..83030559 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -43,6 +43,7 @@ import 'package:eatvio_app/features/profile/presentation/pages/subs_screen.dart' import 'package:eatvio_app/features/recipe/presentation/about_recipe_screen.dart'; import 'package:eatvio_app/features/create_recipe/presentation/pages/recipe_create_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/registration_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/verify_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/webview_registration_screen.dart'; import 'package:eatvio_app/features/settings/entities/settings_entity.dart'; import 'package:eatvio_app/features/settings/presentation/pages/change_email_screen.dart'; @@ -342,6 +343,11 @@ class AppRouter { ); }, ), + GoRoute( + path: '/verify-screen', + name: 'verifyScreen', + builder: (context, state) => VerifyScreen(passKey: state.extra as String), + ), ], ); } diff --git a/lib/core/const.dart b/lib/core/const.dart index 31c47e9c..4022dfbe 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,4 +1,5 @@ -String baseUrl = 'https://eatvio.ru'; +String baseUrl = 'https://apoloz-nauch-vei9nieng5er.eatv.io'; +// String baseUrl = 'https://eatvio.ru'; // String baseUrl = 'https://dev2.eatvio.com'; const List durationValues = [7, 14, 21]; diff --git a/lib/core/data/selectionPopupModel/selection_popup_model.dart b/lib/core/data/selectionPopupModel/selection_popup_model.dart index f304e8d1..6c93499f 100644 --- a/lib/core/data/selectionPopupModel/selection_popup_model.dart +++ b/lib/core/data/selectionPopupModel/selection_popup_model.dart @@ -3,7 +3,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'selection_popup_model.freezed.dart'; @freezed -class SelectionPopupModel with _$SelectionPopupModel { +abstract class SelectionPopupModel with _$SelectionPopupModel { const factory SelectionPopupModel({ int? id, required String title, diff --git a/lib/core/models/pagination_model.dart b/lib/core/models/pagination_model.dart index 36f21ed7..947e2f9d 100644 --- a/lib/core/models/pagination_model.dart +++ b/lib/core/models/pagination_model.dart @@ -4,7 +4,7 @@ part 'pagination_model.freezed.dart'; part 'pagination_model.g.dart'; @freezed -class Links with _$Links { +abstract class Links with _$Links { const factory Links({ @JsonKey(name: "first") required String first, @JsonKey(name: "last") required String last, @@ -16,7 +16,7 @@ class Links with _$Links { } @freezed -class Meta with _$Meta { +abstract class Meta with _$Meta { const factory Meta({ @JsonKey(name: "current_page") required int currentPage, @JsonKey(name: "from") required dynamic from, @@ -34,7 +34,7 @@ class Meta with _$Meta { } @freezed -class Link with _$Link { +abstract class Link with _$Link { const factory Link({ @JsonKey(name: "url") String? url, @JsonKey(name: "label") String? label, diff --git a/lib/features/auth/models/credentials_model.dart b/lib/features/auth/models/credentials_model.dart index c5c02ca4..04fa0381 100644 --- a/lib/features/auth/models/credentials_model.dart +++ b/lib/features/auth/models/credentials_model.dart @@ -5,7 +5,7 @@ part 'credentials_model.freezed.dart'; part 'credentials_model.g.dart'; @freezed -class CredentialsModel with _$CredentialsModel { +abstract class CredentialsModel with _$CredentialsModel { const factory CredentialsModel({ required String email, required String password, diff --git a/lib/features/auth/models/token_model.dart b/lib/features/auth/models/token_model.dart index ca352260..0f9e8f9f 100644 --- a/lib/features/auth/models/token_model.dart +++ b/lib/features/auth/models/token_model.dart @@ -5,7 +5,7 @@ part 'token_model.freezed.dart'; part 'token_model.g.dart'; @freezed -class TokenModel with _$TokenModel { +abstract class TokenModel with _$TokenModel { const factory TokenModel({ required String token, }) = _TokenModel; diff --git a/lib/features/auth/presentation/bloc/auth_state.dart b/lib/features/auth/presentation/bloc/auth_state.dart index 994ec3a0..364a8659 100644 --- a/lib/features/auth/presentation/bloc/auth_state.dart +++ b/lib/features/auth/presentation/bloc/auth_state.dart @@ -3,7 +3,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'auth_state.freezed.dart'; @freezed -class AuthState with _$AuthState { +abstract class AuthState with _$AuthState { const factory AuthState() = _AuthState; const factory AuthState.loading() = AuthStateLoading; diff --git a/lib/features/blog_post_create/models/blog_post_create_credentials_model.dart b/lib/features/blog_post_create/models/blog_post_create_credentials_model.dart index ab3111c3..35c12538 100644 --- a/lib/features/blog_post_create/models/blog_post_create_credentials_model.dart +++ b/lib/features/blog_post_create/models/blog_post_create_credentials_model.dart @@ -5,7 +5,7 @@ part '../../../presentation/feed/blog_post_create_screen/models/blog_post_create part '../../../presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.g.dart'; @freezed -class BlogPostCreateCredentialsModel with _$BlogPostCreateCredentialsModel { +abstract class BlogPostCreateCredentialsModel with _$BlogPostCreateCredentialsModel { const factory BlogPostCreateCredentialsModel({ required String title, required String description, diff --git a/lib/features/calendar/models/calendar_model.dart b/lib/features/calendar/models/calendar_model.dart index 26eabe15..40e31ffb 100644 --- a/lib/features/calendar/models/calendar_model.dart +++ b/lib/features/calendar/models/calendar_model.dart @@ -5,7 +5,7 @@ part 'calendar_model.freezed.dart'; part 'calendar_model.g.dart'; @freezed -class CalendarModel with _$CalendarModel { +abstract class CalendarModel with _$CalendarModel { const factory CalendarModel({ required String date, @JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') required bool isCurrentDayIncludedInTheChosenDietProgression, diff --git a/lib/features/cancel_plan_bottom_sheet/cubit/cancel_plan_state.dart b/lib/features/cancel_plan_bottom_sheet/cubit/cancel_plan_state.dart index 3c5b52d7..917ccadf 100644 --- a/lib/features/cancel_plan_bottom_sheet/cubit/cancel_plan_state.dart +++ b/lib/features/cancel_plan_bottom_sheet/cubit/cancel_plan_state.dart @@ -3,7 +3,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'cancel_plan_state.freezed.dart'; @freezed -class CancelPlanState with _$CancelPlanState { +abstract class CancelPlanState with _$CancelPlanState { factory CancelPlanState() = _CancelPlanState; } \ No newline at end of file diff --git a/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.dart b/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.dart index 0ddfa748..2b50f4c1 100644 --- a/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.dart +++ b/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.dart @@ -4,7 +4,7 @@ part 'cancelation_model.freezed.dart'; part 'cancelation_model.g.dart'; @freezed -class CancelationModel with _$CancelationModel { +abstract class CancelationModel with _$CancelationModel { factory CancelationModel({ required String description, required int price, diff --git a/lib/features/chat/models/chat_message_model.dart b/lib/features/chat/models/chat_message_model.dart index 591e5993..7224912a 100644 --- a/lib/features/chat/models/chat_message_model.dart +++ b/lib/features/chat/models/chat_message_model.dart @@ -5,7 +5,7 @@ part 'chat_message_model.freezed.dart'; part 'chat_message_model.g.dart'; @freezed -class ChatMessageModel with _$ChatMessageModel { +abstract class ChatMessageModel with _$ChatMessageModel { const factory ChatMessageModel({ required int id, required String data, diff --git a/lib/features/chat/models/chat_messages_model.dart b/lib/features/chat/models/chat_messages_model.dart index 999f598e..aa7c03ee 100644 --- a/lib/features/chat/models/chat_messages_model.dart +++ b/lib/features/chat/models/chat_messages_model.dart @@ -6,7 +6,7 @@ part 'chat_messages_model.freezed.dart'; part 'chat_messages_model.g.dart'; @freezed -class ChatMessagesModel with _$ChatMessagesModel { +abstract class ChatMessagesModel with _$ChatMessagesModel { const factory ChatMessagesModel({ @JsonKey(name: 'data') required List messagesList, required ChatMetaModel meta, diff --git a/lib/features/chat/models/chat_meta_model.dart b/lib/features/chat/models/chat_meta_model.dart index b1e68a41..60a61b48 100644 --- a/lib/features/chat/models/chat_meta_model.dart +++ b/lib/features/chat/models/chat_meta_model.dart @@ -4,7 +4,7 @@ part 'chat_meta_model.freezed.dart'; part 'chat_meta_model.g.dart'; @freezed -class ChatMetaModel with _$ChatMetaModel { +abstract class ChatMetaModel with _$ChatMetaModel { const factory ChatMetaModel({ @JsonKey(name: "last_page") required int lastPage, }) = _ChatMetaModel; diff --git a/lib/features/chat/models/chat_room_model.dart b/lib/features/chat/models/chat_room_model.dart index 73daf1be..d7bf450a 100644 --- a/lib/features/chat/models/chat_room_model.dart +++ b/lib/features/chat/models/chat_room_model.dart @@ -7,7 +7,7 @@ part 'chat_room_model.freezed.dart'; part 'chat_room_model.g.dart'; @freezed -class ChatRoomModel with _$ChatRoomModel { +abstract class ChatRoomModel with _$ChatRoomModel { const factory ChatRoomModel({ required String id, @JsonKey(name: 'chat_room_setting') required ChatRoomSettingsModel chatRoomSettings, @@ -20,7 +20,7 @@ class ChatRoomModel with _$ChatRoomModel { } @freezed -class Users with _$Users { +abstract class Users with _$Users { const factory Users({ @JsonKey(name: 'from_chat_user') required ChatUserModel sender, diff --git a/lib/features/chat/models/chat_room_pagination_model.dart b/lib/features/chat/models/chat_room_pagination_model.dart index 2d7e875d..7bb8ceb5 100644 --- a/lib/features/chat/models/chat_room_pagination_model.dart +++ b/lib/features/chat/models/chat_room_pagination_model.dart @@ -6,7 +6,7 @@ part 'chat_room_pagination_model.freezed.dart'; part 'chat_room_pagination_model.g.dart'; @freezed -class ChatRoomPaginationModel with _$ChatRoomPaginationModel { +abstract class ChatRoomPaginationModel with _$ChatRoomPaginationModel { const factory ChatRoomPaginationModel({ @JsonKey(name: "chatRooms") required ChatRooms chatRooms, @JsonKey(name: "number_of_unread_chat_rooms") required int unreadChatsCount, @@ -16,7 +16,7 @@ class ChatRoomPaginationModel with _$ChatRoomPaginationModel { } @freezed -class ChatRooms with _$ChatRooms { +abstract class ChatRooms with _$ChatRooms { const factory ChatRooms({ @JsonKey(name: "data") required List data, @JsonKey(name: "last_page") required int lastPage, @@ -27,7 +27,7 @@ class ChatRooms with _$ChatRooms { } @freezed -class ChatRoom with _$ChatRoom { +abstract class ChatRoom with _$ChatRoom { const factory ChatRoom({ @JsonKey(name: "id") required String id, @JsonKey(name: "room_name") required String roomName, @@ -48,7 +48,7 @@ ChatMessageModel? parseLastMessage(dynamic json) { } @freezed -class Users with _$Users { +abstract class Users with _$Users { const factory Users({ @JsonKey(name: "from_chat_user") required ChatUser fromChatUser, @JsonKey(name: "to_chat_user") required ChatUser toChatUser, @@ -58,7 +58,7 @@ class Users with _$Users { } @freezed -class ChatUser with _$ChatUser { +abstract class ChatUser with _$ChatUser { const factory ChatUser({ @JsonKey(name: "id") required int id, @JsonKey(name: "name") required String name, diff --git a/lib/features/chat/models/chat_room_settings_model.dart b/lib/features/chat/models/chat_room_settings_model.dart index de41f221..5298d3d9 100644 --- a/lib/features/chat/models/chat_room_settings_model.dart +++ b/lib/features/chat/models/chat_room_settings_model.dart @@ -4,7 +4,7 @@ part 'chat_room_settings_model.freezed.dart'; part 'chat_room_settings_model.g.dart'; @freezed -class ChatRoomSettingsModel with _$ChatRoomSettingsModel { +abstract class ChatRoomSettingsModel with _$ChatRoomSettingsModel { const factory ChatRoomSettingsModel({ required int id, @JsonKey(name: 'room_name') required String roomName, diff --git a/lib/features/chat/models/chat_user_model.dart b/lib/features/chat/models/chat_user_model.dart index b68c11ad..14feb316 100644 --- a/lib/features/chat/models/chat_user_model.dart +++ b/lib/features/chat/models/chat_user_model.dart @@ -4,7 +4,7 @@ part 'chat_user_model.freezed.dart'; part 'chat_user_model.g.dart'; @freezed -class ChatUserModel with _$ChatUserModel { +abstract class ChatUserModel with _$ChatUserModel { const factory ChatUserModel({ required int id, required String name, diff --git a/lib/features/chat/models/payment_model.dart b/lib/features/chat/models/payment_model.dart index 746c095a..e2c5fbba 100644 --- a/lib/features/chat/models/payment_model.dart +++ b/lib/features/chat/models/payment_model.dart @@ -4,7 +4,7 @@ part 'payment_model.freezed.dart'; part 'payment_model.g.dart'; @freezed -class PaymentModel with _$PaymentModel { +abstract class PaymentModel with _$PaymentModel { factory PaymentModel({ @JsonKey(name: 'checkout_url') required String paymentUrl, diff --git a/lib/features/chat/models/plan_complain_model.dart b/lib/features/chat/models/plan_complain_model.dart index 63e2af8e..d4c11f7b 100644 --- a/lib/features/chat/models/plan_complain_model.dart +++ b/lib/features/chat/models/plan_complain_model.dart @@ -4,7 +4,7 @@ part 'plan_complain_model.freezed.dart'; part 'plan_complain_model.g.dart'; @freezed -class PlanComplainModel with _$PlanComplainModel { +abstract class PlanComplainModel with _$PlanComplainModel { factory PlanComplainModel({ @JsonKey(name: 'description') required String description, diff --git a/lib/features/chat/models/websocket_info_model.dart b/lib/features/chat/models/websocket_info_model.dart index ed6167a0..2681626b 100644 --- a/lib/features/chat/models/websocket_info_model.dart +++ b/lib/features/chat/models/websocket_info_model.dart @@ -4,7 +4,7 @@ part 'websocket_info_model.freezed.dart'; part 'websocket_info_model.g.dart'; @freezed -class WebsocketInfoModel with _$WebsocketInfoModel { +abstract class WebsocketInfoModel with _$WebsocketInfoModel { const factory WebsocketInfoModel({ required String key, required String host, diff --git a/lib/features/chat/presentation/bloc/chats_cubit/chats_state.dart b/lib/features/chat/presentation/bloc/chats_cubit/chats_state.dart index 700542d0..ca83eb4c 100644 --- a/lib/features/chat/presentation/bloc/chats_cubit/chats_state.dart +++ b/lib/features/chat/presentation/bloc/chats_cubit/chats_state.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'chats_state.freezed.dart'; @freezed -class ChatsState with _$ChatsState { +abstract class ChatsState with _$ChatsState { factory ChatsState({ @Default(BaseState.initial) BaseState state, diff --git a/lib/features/complaining/models/complain_model.dart b/lib/features/complaining/models/complain_model.dart index aa7be75f..34a8d91a 100644 --- a/lib/features/complaining/models/complain_model.dart +++ b/lib/features/complaining/models/complain_model.dart @@ -4,7 +4,7 @@ part 'complain_model.freezed.dart'; part 'complain_model.g.dart'; @freezed -class ComplainModel with _$ComplainModel { +abstract class ComplainModel with _$ComplainModel { const factory ComplainModel({ @Default(null) String? description, diff --git a/lib/features/complaining/presentation/cubit/complaining_state.dart b/lib/features/complaining/presentation/cubit/complaining_state.dart index 1f3e69a2..95c5e761 100644 --- a/lib/features/complaining/presentation/cubit/complaining_state.dart +++ b/lib/features/complaining/presentation/cubit/complaining_state.dart @@ -6,7 +6,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'complaining_state.freezed.dart'; @freezed -class ComplainingState with _$ComplainingState { +abstract class ComplainingState with _$ComplainingState { factory ComplainingState({ @Default(false) bool isLoading, diff --git a/lib/features/consultant/become_consultant/models/consultant_profile_model.dart b/lib/features/consultant/become_consultant/models/consultant_profile_model.dart index 2298d812..535b58fd 100644 --- a/lib/features/consultant/become_consultant/models/consultant_profile_model.dart +++ b/lib/features/consultant/become_consultant/models/consultant_profile_model.dart @@ -5,7 +5,7 @@ part 'consultant_profile_model.freezed.dart'; part 'consultant_profile_model.g.dart'; @freezed -class ConsultantProfileModel with _$ConsultantProfileModel { +abstract class ConsultantProfileModel with _$ConsultantProfileModel { const factory ConsultantProfileModel({ @JsonKey(name: 'has_medical_education', includeIfNull: false) bool? hasMedicalEducation, @JsonKey(name: 'social_links', includeIfNull: false) SocialLinksModel? socialLinks, @@ -17,7 +17,7 @@ class ConsultantProfileModel with _$ConsultantProfileModel { } @freezed -class SocialLinksModel with _$SocialLinksModel { +abstract class SocialLinksModel with _$SocialLinksModel { const factory SocialLinksModel({ @JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink, @JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink, @@ -30,7 +30,7 @@ class SocialLinksModel with _$SocialLinksModel { } @freezed -class CertificatesModel with _$CertificatesModel { +abstract class CertificatesModel with _$CertificatesModel { const factory CertificatesModel({ required String title, required String date, diff --git a/lib/features/consultant/become_consultant/models/consultation_request_model.dart b/lib/features/consultant/become_consultant/models/consultation_request_model.dart index aa7377b1..1579fab5 100644 --- a/lib/features/consultant/become_consultant/models/consultation_request_model.dart +++ b/lib/features/consultant/become_consultant/models/consultation_request_model.dart @@ -6,7 +6,7 @@ part 'consultation_request_model.freezed.dart'; part 'consultation_request_model.g.dart'; @freezed -class ConsultationRequestModel with _$ConsultationRequestModel { +abstract class ConsultationRequestModel with _$ConsultationRequestModel { const factory ConsultationRequestModel({ @JsonKey(name: 'rating_place') required int ratingPlace, @JsonKey(name: 'education_resource') required EducationModel educationModel, @@ -17,7 +17,7 @@ class ConsultationRequestModel with _$ConsultationRequestModel { } @freezed -class CertPhotosModel with _$CertPhotosModel { +abstract class CertPhotosModel with _$CertPhotosModel { const factory CertPhotosModel({ required String url, }) = _CertPhotosModel; diff --git a/lib/features/consultant_rating/models/rating_model.dart b/lib/features/consultant_rating/models/rating_model.dart index fbd4fe74..164008dd 100644 --- a/lib/features/consultant_rating/models/rating_model.dart +++ b/lib/features/consultant_rating/models/rating_model.dart @@ -4,7 +4,7 @@ part 'rating_model.freezed.dart'; part 'rating_model.g.dart'; @freezed -class RatingModel with _$RatingModel { +abstract class RatingModel with _$RatingModel { factory RatingModel({ required DateTime date, diff --git a/lib/features/consultations/models/consultation_model.dart b/lib/features/consultations/models/consultation_model.dart index 4c9464bf..9c32736f 100644 --- a/lib/features/consultations/models/consultation_model.dart +++ b/lib/features/consultations/models/consultation_model.dart @@ -6,7 +6,7 @@ part 'consultation_model.freezed.dart'; part 'consultation_model.g.dart'; @freezed -class ConsultationModel with _$ConsultationModel { +abstract class ConsultationModel with _$ConsultationModel { factory ConsultationModel({ required int id, @JsonKey(name: 'last_state') required ChosenPlanStateEnum chosenPlanState, @@ -26,7 +26,7 @@ class ConsultationModel with _$ConsultationModel { } @freezed -class DiaryModel with _$DiaryModel { +abstract class DiaryModel with _$DiaryModel { factory DiaryModel({ required int id, required DiaryStateEnum state, @@ -58,7 +58,7 @@ enum DiaryStateEnum { } @freezed -class ConsultationPaginationModel with _$ConsultationPaginationModel { +abstract class ConsultationPaginationModel with _$ConsultationPaginationModel { factory ConsultationPaginationModel({required List data}) = _ConsultationPaginationModel; factory ConsultationPaginationModel.fromJson(Map json) => _$ConsultationPaginationModelFromJson(json); diff --git a/lib/features/consultations/presentation/cubit/consultations_state.dart b/lib/features/consultations/presentation/cubit/consultations_state.dart index e4988f03..30b9b009 100644 --- a/lib/features/consultations/presentation/cubit/consultations_state.dart +++ b/lib/features/consultations/presentation/cubit/consultations_state.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'consultations_state.freezed.dart'; @freezed -class ConsultationsState with _$ConsultationsState { +abstract class ConsultationsState with _$ConsultationsState { factory ConsultationsState({ @Default(BaseState.initial) BaseState state, diff --git a/lib/features/create_diet/models/create_diet_model.dart b/lib/features/create_diet/models/create_diet_model.dart index 49f1b752..cab10faf 100644 --- a/lib/features/create_diet/models/create_diet_model.dart +++ b/lib/features/create_diet/models/create_diet_model.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'create_diet_model.freezed.dart'; @freezed -class CreateDietModel with _$CreateDietModel { +abstract class CreateDietModel with _$CreateDietModel { const CreateDietModel._(); const factory CreateDietModel({ diff --git a/lib/features/create_diet/presentation/cubit/create_diet_state.dart b/lib/features/create_diet/presentation/cubit/create_diet_state.dart index 8e97a087..dc280baa 100644 --- a/lib/features/create_diet/presentation/cubit/create_diet_state.dart +++ b/lib/features/create_diet/presentation/cubit/create_diet_state.dart @@ -6,7 +6,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'create_diet_state.freezed.dart'; @freezed -class CreateDietState with _$CreateDietState { +abstract class CreateDietState with _$CreateDietState { const factory CreateDietState({ required bool isLoading, required bool isDietPublishing, diff --git a/lib/features/create_diet/presentation/widgets/diet_image_picker_widget.dart b/lib/features/create_diet/presentation/widgets/diet_image_picker_widget.dart index dd0e44aa..c6250bb4 100644 --- a/lib/features/create_diet/presentation/widgets/diet_image_picker_widget.dart +++ b/lib/features/create_diet/presentation/widgets/diet_image_picker_widget.dart @@ -127,11 +127,12 @@ class _DietImagePickerWidgetState extends State { : Stack( children: [ DottedBorder( - stackFit: StackFit.expand, - dashPattern: const [14, 14], - color: state.dietImageError != null ? appTheme.red : appTheme.dottedBorder, - borderType: BorderType.RRect, - radius: const Radius.circular(12), + options: RoundedRectDottedBorderOptions( + stackFit: StackFit.expand, + dashPattern: const [14, 14], + color: state.dietImageError != null ? appTheme.red : appTheme.dottedBorder, + radius: const Radius.circular(12), + ), child: const SizedBox.expand(), ), Center( diff --git a/lib/features/create_plan/models/create_plan_model.dart b/lib/features/create_plan/models/create_plan_model.dart index 623bcae4..1d4d7854 100644 --- a/lib/features/create_plan/models/create_plan_model.dart +++ b/lib/features/create_plan/models/create_plan_model.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'create_plan_model.freezed.dart'; @freezed -class CreatePlanModel with _$CreatePlanModel { +abstract class CreatePlanModel with _$CreatePlanModel { const CreatePlanModel._(); const factory CreatePlanModel({ diff --git a/lib/features/create_plan/models/plan_slug_model.dart b/lib/features/create_plan/models/plan_slug_model.dart index b440cb07..0ddfc5c7 100644 --- a/lib/features/create_plan/models/plan_slug_model.dart +++ b/lib/features/create_plan/models/plan_slug_model.dart @@ -4,7 +4,7 @@ part 'plan_slug_model.freezed.dart'; part 'plan_slug_model.g.dart'; @freezed -class PlanSlugModel with _$PlanSlugModel { +abstract class PlanSlugModel with _$PlanSlugModel { factory PlanSlugModel({@JsonKey(name: 'slug') required String slug}) = _PlanSlugModel; factory PlanSlugModel.fromJson(Map json) => _$PlanSlugModelFromJson(json); diff --git a/lib/features/create_plan/presentation/cubit/create_plan_state.dart b/lib/features/create_plan/presentation/cubit/create_plan_state.dart index 7a70be54..df4d3f03 100644 --- a/lib/features/create_plan/presentation/cubit/create_plan_state.dart +++ b/lib/features/create_plan/presentation/cubit/create_plan_state.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'create_plan_state.freezed.dart'; @freezed -class CreatePlanState with _$CreatePlanState { +abstract class CreatePlanState with _$CreatePlanState { const factory CreatePlanState({ required bool isLoading, required String? errorMessage, @@ -29,7 +29,7 @@ class CreatePlanState with _$CreatePlanState { } @freezed -class PlanValidationState with _$PlanValidationState { +abstract class PlanValidationState with _$PlanValidationState { factory PlanValidationState({ required bool titleHasError, required bool durationHasError, @@ -54,7 +54,7 @@ class PlanValidationState with _$PlanValidationState { } @freezed -class OptionValidationState with _$OptionValidationState { +abstract class OptionValidationState with _$OptionValidationState { factory OptionValidationState({ required bool titleHasError, required bool priceHasError, diff --git a/lib/features/create_plan/presentation/widgets/plan_image_picker_widget.dart b/lib/features/create_plan/presentation/widgets/plan_image_picker_widget.dart index 0e744a37..d5041035 100644 --- a/lib/features/create_plan/presentation/widgets/plan_image_picker_widget.dart +++ b/lib/features/create_plan/presentation/widgets/plan_image_picker_widget.dart @@ -116,11 +116,12 @@ class _PlanImagePickerWidgetState extends State { : Stack( children: [ DottedBorder( - stackFit: StackFit.expand, - dashPattern: const [14, 14], - color: state.validationState.imageHasError ? appTheme.red : appTheme.dottedBorder, - borderType: BorderType.RRect, - radius: const Radius.circular(12), + options: RoundedRectDottedBorderOptions( + stackFit: StackFit.expand, + dashPattern: const [14, 14], + color: state.validationState.imageHasError ? appTheme.red : appTheme.dottedBorder, + radius: const Radius.circular(12), + ), child: const SizedBox.expand(), ), Center( diff --git a/lib/features/create_recipe/entities/recipe_create_entity.dart b/lib/features/create_recipe/entities/recipe_create_entity.dart index 69d04e8c..3d87ff33 100644 --- a/lib/features/create_recipe/entities/recipe_create_entity.dart +++ b/lib/features/create_recipe/entities/recipe_create_entity.dart @@ -99,7 +99,7 @@ enum TypeOfRecipe { } @freezed -class RecipeCreateEntity with _$RecipeCreateEntity { +abstract class RecipeCreateEntity with _$RecipeCreateEntity { const RecipeCreateEntity._(); const factory RecipeCreateEntity({ @@ -138,7 +138,7 @@ class RecipeCreateEntity with _$RecipeCreateEntity { } @freezed -class StepEntity with _$StepEntity { +abstract class StepEntity with _$StepEntity { const StepEntity._(); const factory StepEntity({ diff --git a/lib/features/create_recipe/models/ingredient.dart b/lib/features/create_recipe/models/ingredient.dart index a891a529..e8c0816a 100644 --- a/lib/features/create_recipe/models/ingredient.dart +++ b/lib/features/create_recipe/models/ingredient.dart @@ -5,7 +5,7 @@ part 'ingredient.freezed.dart'; part 'ingredient.g.dart'; @freezed -class Ingredient with _$Ingredient { +abstract class Ingredient with _$Ingredient { const factory Ingredient({ required String name, required String unit, diff --git a/lib/features/create_recipe/models/product.dart b/lib/features/create_recipe/models/product.dart index 48b1de0e..738c175f 100644 --- a/lib/features/create_recipe/models/product.dart +++ b/lib/features/create_recipe/models/product.dart @@ -5,7 +5,7 @@ part 'product.freezed.dart'; part 'product.g.dart'; @freezed -class Product with _$Product { +abstract class Product with _$Product { const factory Product({ required int id, required String name, diff --git a/lib/features/create_recipe/models/recipe_create_model.dart b/lib/features/create_recipe/models/recipe_create_model.dart index e98f3f20..49aee4bf 100644 --- a/lib/features/create_recipe/models/recipe_create_model.dart +++ b/lib/features/create_recipe/models/recipe_create_model.dart @@ -17,7 +17,7 @@ enum RecipeType { } @freezed -class RecipeCreateModel with _$RecipeCreateModel { +abstract class RecipeCreateModel with _$RecipeCreateModel { const factory RecipeCreateModel({ required String title, required String state, diff --git a/lib/features/create_recipe/models/recipe_model.dart b/lib/features/create_recipe/models/recipe_model.dart index 87cd6bda..0264da90 100644 --- a/lib/features/create_recipe/models/recipe_model.dart +++ b/lib/features/create_recipe/models/recipe_model.dart @@ -7,7 +7,7 @@ part 'recipe_model.freezed.dart'; part 'recipe_model.g.dart'; @freezed -class RecipeModel with _$RecipeModel { +abstract class RecipeModel with _$RecipeModel { const factory RecipeModel({ List? ingredients, List? steps, diff --git a/lib/features/create_recipe/models/recipe_tag_model.dart b/lib/features/create_recipe/models/recipe_tag_model.dart index 11850791..6f0a0402 100644 --- a/lib/features/create_recipe/models/recipe_tag_model.dart +++ b/lib/features/create_recipe/models/recipe_tag_model.dart @@ -6,7 +6,7 @@ part 'recipe_tag_model.freezed.dart'; part 'recipe_tag_model.g.dart'; @freezed -class RecipeTagModel with _$RecipeTagModel { +abstract class RecipeTagModel with _$RecipeTagModel { const factory RecipeTagModel({ @JsonKey(name: "data") required List data, @JsonKey(name: "links") required Links links, @@ -17,7 +17,7 @@ class RecipeTagModel with _$RecipeTagModel { } @freezed -class RecipeTag with _$RecipeTag { +abstract class RecipeTag with _$RecipeTag { const factory RecipeTag({ @JsonKey(name: "id") required int id, @JsonKey(name: "name") required String name, diff --git a/lib/features/create_recipe/models/step.dart b/lib/features/create_recipe/models/step.dart index 9c22eb76..4cabea68 100644 --- a/lib/features/create_recipe/models/step.dart +++ b/lib/features/create_recipe/models/step.dart @@ -5,7 +5,7 @@ part 'step.freezed.dart'; part 'step.g.dart'; @freezed -class Step with _$Step { +abstract class Step with _$Step { const factory Step({ String? image, String? description, diff --git a/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.dart b/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.dart index 5aac99df..41e88611 100644 --- a/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.dart +++ b/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.dart @@ -4,7 +4,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'create_recipe_state.freezed.dart'; @freezed -class CreateRecipeState with _$CreateRecipeState { +abstract class CreateRecipeState with _$CreateRecipeState { const factory CreateRecipeState({ required RecipeCreateEntity entity, required bool loading, diff --git a/lib/features/diary/models/consultant_comment_model.dart b/lib/features/diary/models/consultant_comment_model.dart index 20cf7d39..3ea05f45 100644 --- a/lib/features/diary/models/consultant_comment_model.dart +++ b/lib/features/diary/models/consultant_comment_model.dart @@ -4,7 +4,7 @@ part 'consultant_comment_model.freezed.dart'; part 'consultant_comment_model.g.dart'; @freezed -class ConsultantCommentModel with _$ConsultantCommentModel { +abstract class ConsultantCommentModel with _$ConsultantCommentModel { factory ConsultantCommentModel({ String? comment, @Default({}) @JsonKey(name: 'meals') Map mealsComments, @@ -15,7 +15,7 @@ class ConsultantCommentModel with _$ConsultantCommentModel { } @freezed -class PortionCommentModel with _$PortionCommentModel { +abstract class PortionCommentModel with _$PortionCommentModel { factory PortionCommentModel({ required String comment, required int id, @@ -25,7 +25,7 @@ class PortionCommentModel with _$PortionCommentModel { } @freezed -class MealCommentModel with _$MealCommentModel { +abstract class MealCommentModel with _$MealCommentModel { factory MealCommentModel({ required String comment, diff --git a/lib/features/diary/models/consultant_review_model.dart b/lib/features/diary/models/consultant_review_model.dart index f31b21c9..9d32701f 100644 --- a/lib/features/diary/models/consultant_review_model.dart +++ b/lib/features/diary/models/consultant_review_model.dart @@ -4,7 +4,7 @@ part 'consultant_review_model.freezed.dart'; part 'consultant_review_model.g.dart'; @freezed -class ConsultantReviewModel with _$ConsultantReviewModel { +abstract class ConsultantReviewModel with _$ConsultantReviewModel { factory ConsultantReviewModel({ required String planName, @@ -18,7 +18,7 @@ class ConsultantReviewModel with _$ConsultantReviewModel { @freezed -class ConsultantComments with _$ConsultantComments { +abstract class ConsultantComments with _$ConsultantComments { factory ConsultantComments({ required String? dayComment, @@ -32,7 +32,7 @@ class ConsultantComments with _$ConsultantComments { @freezed -class MealComment with _$MealComment { +abstract class MealComment with _$MealComment { factory MealComment({ required String comment, @@ -43,7 +43,7 @@ class MealComment with _$MealComment { } @freezed -class PortionComment with _$PortionComment { +abstract class PortionComment with _$PortionComment { factory PortionComment({ @JsonKey(name: 'id') required int portionId, diff --git a/lib/features/diary/models/consultant_review_model.freezed.dart b/lib/features/diary/models/consultant_review_model.freezed.dart index 44d803d4..a6f79469 100644 --- a/lib/features/diary/models/consultant_review_model.freezed.dart +++ b/lib/features/diary/models/consultant_review_model.freezed.dart @@ -1,3 +1,4 @@ +// dart format width=80 // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint @@ -9,192 +10,32 @@ part of 'consultant_review_model.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -ConsultantReviewModel _$ConsultantReviewModelFromJson( - Map json) { - return _ConsultantReviewModel.fromJson(json); -} - /// @nodoc mixin _$ConsultantReviewModel { - String get planName => throw _privateConstructorUsedError; - int get planDuration => throw _privateConstructorUsedError; - int get currentPlanDay => throw _privateConstructorUsedError; - ConsultantComments get consultantComments => - throw _privateConstructorUsedError; - - /// Serializes this ConsultantReviewModel to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + String get planName; + int get planDuration; + int get currentPlanDay; + ConsultantComments get consultantComments; /// Create a copy of ConsultantReviewModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') $ConsultantReviewModelCopyWith get copyWith => - throw _privateConstructorUsedError; -} + _$ConsultantReviewModelCopyWithImpl( + this as ConsultantReviewModel, _$identity); -/// @nodoc -abstract class $ConsultantReviewModelCopyWith<$Res> { - factory $ConsultantReviewModelCopyWith(ConsultantReviewModel value, - $Res Function(ConsultantReviewModel) then) = - _$ConsultantReviewModelCopyWithImpl<$Res, ConsultantReviewModel>; - @useResult - $Res call( - {String planName, - int planDuration, - int currentPlanDay, - ConsultantComments consultantComments}); - - $ConsultantCommentsCopyWith<$Res> get consultantComments; -} - -/// @nodoc -class _$ConsultantReviewModelCopyWithImpl<$Res, - $Val extends ConsultantReviewModel> - implements $ConsultantReviewModelCopyWith<$Res> { - _$ConsultantReviewModelCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? planName = null, - Object? planDuration = null, - Object? currentPlanDay = null, - Object? consultantComments = null, - }) { - return _then(_value.copyWith( - planName: null == planName - ? _value.planName - : planName // ignore: cast_nullable_to_non_nullable - as String, - planDuration: null == planDuration - ? _value.planDuration - : planDuration // ignore: cast_nullable_to_non_nullable - as int, - currentPlanDay: null == currentPlanDay - ? _value.currentPlanDay - : currentPlanDay // ignore: cast_nullable_to_non_nullable - as int, - consultantComments: null == consultantComments - ? _value.consultantComments - : consultantComments // ignore: cast_nullable_to_non_nullable - as ConsultantComments, - ) as $Val); - } - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ConsultantCommentsCopyWith<$Res> get consultantComments { - return $ConsultantCommentsCopyWith<$Res>(_value.consultantComments, - (value) { - return _then(_value.copyWith(consultantComments: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$ConsultantReviewModelImplCopyWith<$Res> - implements $ConsultantReviewModelCopyWith<$Res> { - factory _$$ConsultantReviewModelImplCopyWith( - _$ConsultantReviewModelImpl value, - $Res Function(_$ConsultantReviewModelImpl) then) = - __$$ConsultantReviewModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String planName, - int planDuration, - int currentPlanDay, - ConsultantComments consultantComments}); - - @override - $ConsultantCommentsCopyWith<$Res> get consultantComments; -} - -/// @nodoc -class __$$ConsultantReviewModelImplCopyWithImpl<$Res> - extends _$ConsultantReviewModelCopyWithImpl<$Res, - _$ConsultantReviewModelImpl> - implements _$$ConsultantReviewModelImplCopyWith<$Res> { - __$$ConsultantReviewModelImplCopyWithImpl(_$ConsultantReviewModelImpl _value, - $Res Function(_$ConsultantReviewModelImpl) _then) - : super(_value, _then); - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? planName = null, - Object? planDuration = null, - Object? currentPlanDay = null, - Object? consultantComments = null, - }) { - return _then(_$ConsultantReviewModelImpl( - planName: null == planName - ? _value.planName - : planName // ignore: cast_nullable_to_non_nullable - as String, - planDuration: null == planDuration - ? _value.planDuration - : planDuration // ignore: cast_nullable_to_non_nullable - as int, - currentPlanDay: null == currentPlanDay - ? _value.currentPlanDay - : currentPlanDay // ignore: cast_nullable_to_non_nullable - as int, - consultantComments: null == consultantComments - ? _value.consultantComments - : consultantComments // ignore: cast_nullable_to_non_nullable - as ConsultantComments, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$ConsultantReviewModelImpl implements _ConsultantReviewModel { - _$ConsultantReviewModelImpl( - {required this.planName, - required this.planDuration, - required this.currentPlanDay, - required this.consultantComments}); - - factory _$ConsultantReviewModelImpl.fromJson(Map json) => - _$$ConsultantReviewModelImplFromJson(json); - - @override - final String planName; - @override - final int planDuration; - @override - final int currentPlanDay; - @override - final ConsultantComments consultantComments; - - @override - String toString() { - return 'ConsultantReviewModel(planName: $planName, planDuration: $planDuration, currentPlanDay: $currentPlanDay, consultantComments: $consultantComments)'; - } + /// Serializes this ConsultantReviewModel to a JSON map. + Map toJson(); @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ConsultantReviewModelImpl && + other is ConsultantReviewModel && (identical(other.planName, planName) || other.planName == planName) && (identical(other.planDuration, planDuration) || @@ -210,127 +51,254 @@ class _$ConsultantReviewModelImpl implements _ConsultantReviewModel { int get hashCode => Object.hash( runtimeType, planName, planDuration, currentPlanDay, consultantComments); - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) @override - @pragma('vm:prefer-inline') - _$$ConsultantReviewModelImplCopyWith<_$ConsultantReviewModelImpl> - get copyWith => __$$ConsultantReviewModelImplCopyWithImpl< - _$ConsultantReviewModelImpl>(this, _$identity); - - @override - Map toJson() { - return _$$ConsultantReviewModelImplToJson( - this, - ); + String toString() { + return 'ConsultantReviewModel(planName: $planName, planDuration: $planDuration, currentPlanDay: $currentPlanDay, consultantComments: $consultantComments)'; } } -abstract class _ConsultantReviewModel implements ConsultantReviewModel { - factory _ConsultantReviewModel( - {required final String planName, - required final int planDuration, - required final int currentPlanDay, - required final ConsultantComments consultantComments}) = - _$ConsultantReviewModelImpl; +/// @nodoc +abstract mixin class $ConsultantReviewModelCopyWith<$Res> { + factory $ConsultantReviewModelCopyWith(ConsultantReviewModel value, + $Res Function(ConsultantReviewModel) _then) = + _$ConsultantReviewModelCopyWithImpl; + @useResult + $Res call( + {String planName, + int planDuration, + int currentPlanDay, + ConsultantComments consultantComments}); - factory _ConsultantReviewModel.fromJson(Map json) = - _$ConsultantReviewModelImpl.fromJson; + $ConsultantCommentsCopyWith<$Res> get consultantComments; +} + +/// @nodoc +class _$ConsultantReviewModelCopyWithImpl<$Res> + implements $ConsultantReviewModelCopyWith<$Res> { + _$ConsultantReviewModelCopyWithImpl(this._self, this._then); + + final ConsultantReviewModel _self; + final $Res Function(ConsultantReviewModel) _then; + + /// Create a copy of ConsultantReviewModel + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? planName = null, + Object? planDuration = null, + Object? currentPlanDay = null, + Object? consultantComments = null, + }) { + return _then(_self.copyWith( + planName: null == planName + ? _self.planName + : planName // ignore: cast_nullable_to_non_nullable + as String, + planDuration: null == planDuration + ? _self.planDuration + : planDuration // ignore: cast_nullable_to_non_nullable + as int, + currentPlanDay: null == currentPlanDay + ? _self.currentPlanDay + : currentPlanDay // ignore: cast_nullable_to_non_nullable + as int, + consultantComments: null == consultantComments + ? _self.consultantComments + : consultantComments // ignore: cast_nullable_to_non_nullable + as ConsultantComments, + )); + } + + /// Create a copy of ConsultantReviewModel + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ConsultantCommentsCopyWith<$Res> get consultantComments { + return $ConsultantCommentsCopyWith<$Res>(_self.consultantComments, (value) { + return _then(_self.copyWith(consultantComments: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _ConsultantReviewModel implements ConsultantReviewModel { + _ConsultantReviewModel( + {required this.planName, + required this.planDuration, + required this.currentPlanDay, + required this.consultantComments}); + factory _ConsultantReviewModel.fromJson(Map json) => + _$ConsultantReviewModelFromJson(json); @override - String get planName; + final String planName; @override - int get planDuration; + final int planDuration; @override - int get currentPlanDay; + final int currentPlanDay; @override - ConsultantComments get consultantComments; + final ConsultantComments consultantComments; /// Create a copy of ConsultantReviewModel /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) - _$$ConsultantReviewModelImplCopyWith<_$ConsultantReviewModelImpl> - get copyWith => throw _privateConstructorUsedError; + @pragma('vm:prefer-inline') + _$ConsultantReviewModelCopyWith<_ConsultantReviewModel> get copyWith => + __$ConsultantReviewModelCopyWithImpl<_ConsultantReviewModel>( + this, _$identity); + + @override + Map toJson() { + return _$ConsultantReviewModelToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ConsultantReviewModel && + (identical(other.planName, planName) || + other.planName == planName) && + (identical(other.planDuration, planDuration) || + other.planDuration == planDuration) && + (identical(other.currentPlanDay, currentPlanDay) || + other.currentPlanDay == currentPlanDay) && + (identical(other.consultantComments, consultantComments) || + other.consultantComments == consultantComments)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, planName, planDuration, currentPlanDay, consultantComments); + + @override + String toString() { + return 'ConsultantReviewModel(planName: $planName, planDuration: $planDuration, currentPlanDay: $currentPlanDay, consultantComments: $consultantComments)'; + } } -ConsultantComments _$ConsultantCommentsFromJson(Map json) { - return _ConsultantComments.fromJson(json); +/// @nodoc +abstract mixin class _$ConsultantReviewModelCopyWith<$Res> + implements $ConsultantReviewModelCopyWith<$Res> { + factory _$ConsultantReviewModelCopyWith(_ConsultantReviewModel value, + $Res Function(_ConsultantReviewModel) _then) = + __$ConsultantReviewModelCopyWithImpl; + @override + @useResult + $Res call( + {String planName, + int planDuration, + int currentPlanDay, + ConsultantComments consultantComments}); + + @override + $ConsultantCommentsCopyWith<$Res> get consultantComments; +} + +/// @nodoc +class __$ConsultantReviewModelCopyWithImpl<$Res> + implements _$ConsultantReviewModelCopyWith<$Res> { + __$ConsultantReviewModelCopyWithImpl(this._self, this._then); + + final _ConsultantReviewModel _self; + final $Res Function(_ConsultantReviewModel) _then; + + /// Create a copy of ConsultantReviewModel + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? planName = null, + Object? planDuration = null, + Object? currentPlanDay = null, + Object? consultantComments = null, + }) { + return _then(_ConsultantReviewModel( + planName: null == planName + ? _self.planName + : planName // ignore: cast_nullable_to_non_nullable + as String, + planDuration: null == planDuration + ? _self.planDuration + : planDuration // ignore: cast_nullable_to_non_nullable + as int, + currentPlanDay: null == currentPlanDay + ? _self.currentPlanDay + : currentPlanDay // ignore: cast_nullable_to_non_nullable + as int, + consultantComments: null == consultantComments + ? _self.consultantComments + : consultantComments // ignore: cast_nullable_to_non_nullable + as ConsultantComments, + )); + } + + /// Create a copy of ConsultantReviewModel + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ConsultantCommentsCopyWith<$Res> get consultantComments { + return $ConsultantCommentsCopyWith<$Res>(_self.consultantComments, (value) { + return _then(_self.copyWith(consultantComments: value)); + }); + } } /// @nodoc mixin _$ConsultantComments { - String? get dayComment => throw _privateConstructorUsedError; - List get mealsComments => throw _privateConstructorUsedError; - List get portionsComments => - throw _privateConstructorUsedError; - - /// Serializes this ConsultantComments to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + String? get dayComment; + List get mealsComments; + List get portionsComments; /// Create a copy of ConsultantComments /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) - $ConsultantCommentsCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ConsultantCommentsCopyWith<$Res> { - factory $ConsultantCommentsCopyWith( - ConsultantComments value, $Res Function(ConsultantComments) then) = - _$ConsultantCommentsCopyWithImpl<$Res, ConsultantComments>; - @useResult - $Res call( - {String? dayComment, - List mealsComments, - List portionsComments}); -} - -/// @nodoc -class _$ConsultantCommentsCopyWithImpl<$Res, $Val extends ConsultantComments> - implements $ConsultantCommentsCopyWith<$Res> { - _$ConsultantCommentsCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') + $ConsultantCommentsCopyWith get copyWith => + _$ConsultantCommentsCopyWithImpl( + this as ConsultantComments, _$identity); + + /// Serializes this ConsultantComments to a JSON map. + Map toJson(); + @override - $Res call({ - Object? dayComment = freezed, - Object? mealsComments = null, - Object? portionsComments = null, - }) { - return _then(_value.copyWith( - dayComment: freezed == dayComment - ? _value.dayComment - : dayComment // ignore: cast_nullable_to_non_nullable - as String?, - mealsComments: null == mealsComments - ? _value.mealsComments - : mealsComments // ignore: cast_nullable_to_non_nullable - as List, - portionsComments: null == portionsComments - ? _value.portionsComments - : portionsComments // ignore: cast_nullable_to_non_nullable - as List, - ) as $Val); + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ConsultantComments && + (identical(other.dayComment, dayComment) || + other.dayComment == dayComment) && + const DeepCollectionEquality() + .equals(other.mealsComments, mealsComments) && + const DeepCollectionEquality() + .equals(other.portionsComments, portionsComments)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + dayComment, + const DeepCollectionEquality().hash(mealsComments), + const DeepCollectionEquality().hash(portionsComments)); + + @override + String toString() { + return 'ConsultantComments(dayComment: $dayComment, mealsComments: $mealsComments, portionsComments: $portionsComments)'; } } /// @nodoc -abstract class _$$ConsultantCommentsImplCopyWith<$Res> - implements $ConsultantCommentsCopyWith<$Res> { - factory _$$ConsultantCommentsImplCopyWith(_$ConsultantCommentsImpl value, - $Res Function(_$ConsultantCommentsImpl) then) = - __$$ConsultantCommentsImplCopyWithImpl<$Res>; - @override +abstract mixin class $ConsultantCommentsCopyWith<$Res> { + factory $ConsultantCommentsCopyWith( + ConsultantComments value, $Res Function(ConsultantComments) _then) = + _$ConsultantCommentsCopyWithImpl; @useResult $Res call( {String? dayComment, @@ -339,12 +307,12 @@ abstract class _$$ConsultantCommentsImplCopyWith<$Res> } /// @nodoc -class __$$ConsultantCommentsImplCopyWithImpl<$Res> - extends _$ConsultantCommentsCopyWithImpl<$Res, _$ConsultantCommentsImpl> - implements _$$ConsultantCommentsImplCopyWith<$Res> { - __$$ConsultantCommentsImplCopyWithImpl(_$ConsultantCommentsImpl _value, - $Res Function(_$ConsultantCommentsImpl) _then) - : super(_value, _then); +class _$ConsultantCommentsCopyWithImpl<$Res> + implements $ConsultantCommentsCopyWith<$Res> { + _$ConsultantCommentsCopyWithImpl(this._self, this._then); + + final ConsultantComments _self; + final $Res Function(ConsultantComments) _then; /// Create a copy of ConsultantComments /// with the given fields replaced by the non-null parameter values. @@ -355,17 +323,17 @@ class __$$ConsultantCommentsImplCopyWithImpl<$Res> Object? mealsComments = null, Object? portionsComments = null, }) { - return _then(_$ConsultantCommentsImpl( + return _then(_self.copyWith( dayComment: freezed == dayComment - ? _value.dayComment + ? _self.dayComment : dayComment // ignore: cast_nullable_to_non_nullable as String?, mealsComments: null == mealsComments - ? _value._mealsComments + ? _self.mealsComments : mealsComments // ignore: cast_nullable_to_non_nullable as List, portionsComments: null == portionsComments - ? _value._portionsComments + ? _self.portionsComments : portionsComments // ignore: cast_nullable_to_non_nullable as List, )); @@ -374,16 +342,15 @@ class __$$ConsultantCommentsImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$ConsultantCommentsImpl implements _ConsultantComments { - _$ConsultantCommentsImpl( +class _ConsultantComments implements ConsultantComments { + _ConsultantComments( {required this.dayComment, required final List mealsComments, required final List portionsComments}) : _mealsComments = mealsComments, _portionsComments = portionsComments; - - factory _$ConsultantCommentsImpl.fromJson(Map json) => - _$$ConsultantCommentsImplFromJson(json); + factory _ConsultantComments.fromJson(Map json) => + _$ConsultantCommentsFromJson(json); @override final String? dayComment; @@ -404,16 +371,26 @@ class _$ConsultantCommentsImpl implements _ConsultantComments { return EqualUnmodifiableListView(_portionsComments); } + /// Create a copy of ConsultantComments + /// with the given fields replaced by the non-null parameter values. @override - String toString() { - return 'ConsultantComments(dayComment: $dayComment, mealsComments: $mealsComments, portionsComments: $portionsComments)'; + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ConsultantCommentsCopyWith<_ConsultantComments> get copyWith => + __$ConsultantCommentsCopyWithImpl<_ConsultantComments>(this, _$identity); + + @override + Map toJson() { + return _$ConsultantCommentsToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ConsultantCommentsImpl && + other is _ConsultantComments && (identical(other.dayComment, dayComment) || other.dayComment == dayComment) && const DeepCollectionEquality() @@ -430,170 +407,80 @@ class _$ConsultantCommentsImpl implements _ConsultantComments { const DeepCollectionEquality().hash(_mealsComments), const DeepCollectionEquality().hash(_portionsComments)); - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) @override - @pragma('vm:prefer-inline') - _$$ConsultantCommentsImplCopyWith<_$ConsultantCommentsImpl> get copyWith => - __$$ConsultantCommentsImplCopyWithImpl<_$ConsultantCommentsImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$ConsultantCommentsImplToJson( - this, - ); - } -} - -abstract class _ConsultantComments implements ConsultantComments { - factory _ConsultantComments( - {required final String? dayComment, - required final List mealsComments, - required final List portionsComments}) = - _$ConsultantCommentsImpl; - - factory _ConsultantComments.fromJson(Map json) = - _$ConsultantCommentsImpl.fromJson; - - @override - String? get dayComment; - @override - List get mealsComments; - @override - List get portionsComments; - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ConsultantCommentsImplCopyWith<_$ConsultantCommentsImpl> get copyWith => - throw _privateConstructorUsedError; -} - -MealComment _$MealCommentFromJson(Map json) { - return _MealComment.fromJson(json); -} - -/// @nodoc -mixin _$MealComment { - String get comment => throw _privateConstructorUsedError; - int get typeNo => throw _privateConstructorUsedError; - - /// Serializes this MealComment to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $MealCommentCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $MealCommentCopyWith<$Res> { - factory $MealCommentCopyWith( - MealComment value, $Res Function(MealComment) then) = - _$MealCommentCopyWithImpl<$Res, MealComment>; - @useResult - $Res call({String comment, int typeNo}); -} - -/// @nodoc -class _$MealCommentCopyWithImpl<$Res, $Val extends MealComment> - implements $MealCommentCopyWith<$Res> { - _$MealCommentCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? comment = null, - Object? typeNo = null, - }) { - return _then(_value.copyWith( - comment: null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeNo: null == typeNo - ? _value.typeNo - : typeNo // ignore: cast_nullable_to_non_nullable - as int, - ) as $Val); + String toString() { + return 'ConsultantComments(dayComment: $dayComment, mealsComments: $mealsComments, portionsComments: $portionsComments)'; } } /// @nodoc -abstract class _$$MealCommentImplCopyWith<$Res> - implements $MealCommentCopyWith<$Res> { - factory _$$MealCommentImplCopyWith( - _$MealCommentImpl value, $Res Function(_$MealCommentImpl) then) = - __$$MealCommentImplCopyWithImpl<$Res>; +abstract mixin class _$ConsultantCommentsCopyWith<$Res> + implements $ConsultantCommentsCopyWith<$Res> { + factory _$ConsultantCommentsCopyWith( + _ConsultantComments value, $Res Function(_ConsultantComments) _then) = + __$ConsultantCommentsCopyWithImpl; @override @useResult - $Res call({String comment, int typeNo}); + $Res call( + {String? dayComment, + List mealsComments, + List portionsComments}); } /// @nodoc -class __$$MealCommentImplCopyWithImpl<$Res> - extends _$MealCommentCopyWithImpl<$Res, _$MealCommentImpl> - implements _$$MealCommentImplCopyWith<$Res> { - __$$MealCommentImplCopyWithImpl( - _$MealCommentImpl _value, $Res Function(_$MealCommentImpl) _then) - : super(_value, _then); +class __$ConsultantCommentsCopyWithImpl<$Res> + implements _$ConsultantCommentsCopyWith<$Res> { + __$ConsultantCommentsCopyWithImpl(this._self, this._then); - /// Create a copy of MealComment + final _ConsultantComments _self; + final $Res Function(_ConsultantComments) _then; + + /// Create a copy of ConsultantComments /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') @override + @pragma('vm:prefer-inline') $Res call({ - Object? comment = null, - Object? typeNo = null, + Object? dayComment = freezed, + Object? mealsComments = null, + Object? portionsComments = null, }) { - return _then(_$MealCommentImpl( - comment: null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeNo: null == typeNo - ? _value.typeNo - : typeNo // ignore: cast_nullable_to_non_nullable - as int, + return _then(_ConsultantComments( + dayComment: freezed == dayComment + ? _self.dayComment + : dayComment // ignore: cast_nullable_to_non_nullable + as String?, + mealsComments: null == mealsComments + ? _self._mealsComments + : mealsComments // ignore: cast_nullable_to_non_nullable + as List, + portionsComments: null == portionsComments + ? _self._portionsComments + : portionsComments // ignore: cast_nullable_to_non_nullable + as List, )); } } /// @nodoc -@JsonSerializable() -class _$MealCommentImpl implements _MealComment { - _$MealCommentImpl({required this.comment, required this.typeNo}); +mixin _$MealComment { + String get comment; + int get typeNo; - factory _$MealCommentImpl.fromJson(Map json) => - _$$MealCommentImplFromJson(json); + /// Create a copy of MealComment + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MealCommentCopyWith get copyWith => + _$MealCommentCopyWithImpl(this as MealComment, _$identity); - @override - final String comment; - @override - final int typeNo; - - @override - String toString() { - return 'MealComment(comment: $comment, typeNo: $typeNo)'; - } + /// Serializes this MealComment to a JSON map. + Map toJson(); @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$MealCommentImpl && + other is MealComment && (identical(other.comment, comment) || other.comment == comment) && (identical(other.typeNo, typeNo) || other.typeNo == typeNo)); } @@ -602,168 +489,156 @@ class _$MealCommentImpl implements _MealComment { @override int get hashCode => Object.hash(runtimeType, comment, typeNo); - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) @override - @pragma('vm:prefer-inline') - _$$MealCommentImplCopyWith<_$MealCommentImpl> get copyWith => - __$$MealCommentImplCopyWithImpl<_$MealCommentImpl>(this, _$identity); - - @override - Map toJson() { - return _$$MealCommentImplToJson( - this, - ); - } -} - -abstract class _MealComment implements MealComment { - factory _MealComment( - {required final String comment, - required final int typeNo}) = _$MealCommentImpl; - - factory _MealComment.fromJson(Map json) = - _$MealCommentImpl.fromJson; - - @override - String get comment; - @override - int get typeNo; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$MealCommentImplCopyWith<_$MealCommentImpl> get copyWith => - throw _privateConstructorUsedError; -} - -PortionComment _$PortionCommentFromJson(Map json) { - return _PortionComment.fromJson(json); -} - -/// @nodoc -mixin _$PortionComment { - @JsonKey(name: 'id') - int get portionId => throw _privateConstructorUsedError; - String get comment => throw _privateConstructorUsedError; - - /// Serializes this PortionComment to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PortionCommentCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PortionCommentCopyWith<$Res> { - factory $PortionCommentCopyWith( - PortionComment value, $Res Function(PortionComment) then) = - _$PortionCommentCopyWithImpl<$Res, PortionComment>; - @useResult - $Res call({@JsonKey(name: 'id') int portionId, String comment}); -} - -/// @nodoc -class _$PortionCommentCopyWithImpl<$Res, $Val extends PortionComment> - implements $PortionCommentCopyWith<$Res> { - _$PortionCommentCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? portionId = null, - Object? comment = null, - }) { - return _then(_value.copyWith( - portionId: null == portionId - ? _value.portionId - : portionId // ignore: cast_nullable_to_non_nullable - as int, - comment: null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); + String toString() { + return 'MealComment(comment: $comment, typeNo: $typeNo)'; } } /// @nodoc -abstract class _$$PortionCommentImplCopyWith<$Res> - implements $PortionCommentCopyWith<$Res> { - factory _$$PortionCommentImplCopyWith(_$PortionCommentImpl value, - $Res Function(_$PortionCommentImpl) then) = - __$$PortionCommentImplCopyWithImpl<$Res>; - @override +abstract mixin class $MealCommentCopyWith<$Res> { + factory $MealCommentCopyWith( + MealComment value, $Res Function(MealComment) _then) = + _$MealCommentCopyWithImpl; @useResult - $Res call({@JsonKey(name: 'id') int portionId, String comment}); + $Res call({String comment, int typeNo}); } /// @nodoc -class __$$PortionCommentImplCopyWithImpl<$Res> - extends _$PortionCommentCopyWithImpl<$Res, _$PortionCommentImpl> - implements _$$PortionCommentImplCopyWith<$Res> { - __$$PortionCommentImplCopyWithImpl( - _$PortionCommentImpl _value, $Res Function(_$PortionCommentImpl) _then) - : super(_value, _then); +class _$MealCommentCopyWithImpl<$Res> implements $MealCommentCopyWith<$Res> { + _$MealCommentCopyWithImpl(this._self, this._then); - /// Create a copy of PortionComment + final MealComment _self; + final $Res Function(MealComment) _then; + + /// Create a copy of MealComment /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ - Object? portionId = null, Object? comment = null, + Object? typeNo = null, }) { - return _then(_$PortionCommentImpl( - portionId: null == portionId - ? _value.portionId - : portionId // ignore: cast_nullable_to_non_nullable - as int, + return _then(_self.copyWith( comment: null == comment - ? _value.comment + ? _self.comment : comment // ignore: cast_nullable_to_non_nullable as String, + typeNo: null == typeNo + ? _self.typeNo + : typeNo // ignore: cast_nullable_to_non_nullable + as int, )); } } /// @nodoc @JsonSerializable() -class _$PortionCommentImpl implements _PortionComment { - _$PortionCommentImpl( - {@JsonKey(name: 'id') required this.portionId, required this.comment}); +class _MealComment implements MealComment { + _MealComment({required this.comment, required this.typeNo}); + factory _MealComment.fromJson(Map json) => + _$MealCommentFromJson(json); - factory _$PortionCommentImpl.fromJson(Map json) => - _$$PortionCommentImplFromJson(json); - - @override - @JsonKey(name: 'id') - final int portionId; @override final String comment; + @override + final int typeNo; + + /// Create a copy of MealComment + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$MealCommentCopyWith<_MealComment> get copyWith => + __$MealCommentCopyWithImpl<_MealComment>(this, _$identity); @override - String toString() { - return 'PortionComment(portionId: $portionId, comment: $comment)'; + Map toJson() { + return _$MealCommentToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PortionCommentImpl && + other is _MealComment && + (identical(other.comment, comment) || other.comment == comment) && + (identical(other.typeNo, typeNo) || other.typeNo == typeNo)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, comment, typeNo); + + @override + String toString() { + return 'MealComment(comment: $comment, typeNo: $typeNo)'; + } +} + +/// @nodoc +abstract mixin class _$MealCommentCopyWith<$Res> + implements $MealCommentCopyWith<$Res> { + factory _$MealCommentCopyWith( + _MealComment value, $Res Function(_MealComment) _then) = + __$MealCommentCopyWithImpl; + @override + @useResult + $Res call({String comment, int typeNo}); +} + +/// @nodoc +class __$MealCommentCopyWithImpl<$Res> implements _$MealCommentCopyWith<$Res> { + __$MealCommentCopyWithImpl(this._self, this._then); + + final _MealComment _self; + final $Res Function(_MealComment) _then; + + /// Create a copy of MealComment + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? comment = null, + Object? typeNo = null, + }) { + return _then(_MealComment( + comment: null == comment + ? _self.comment + : comment // ignore: cast_nullable_to_non_nullable + as String, + typeNo: null == typeNo + ? _self.typeNo + : typeNo // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +mixin _$PortionComment { + @JsonKey(name: 'id') + int get portionId; + String get comment; + + /// Create a copy of PortionComment + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PortionCommentCopyWith get copyWith => + _$PortionCommentCopyWithImpl( + this as PortionComment, _$identity); + + /// Serializes this PortionComment to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PortionComment && (identical(other.portionId, portionId) || other.portionId == portionId) && (identical(other.comment, comment) || other.comment == comment)); @@ -773,41 +648,137 @@ class _$PortionCommentImpl implements _PortionComment { @override int get hashCode => Object.hash(runtimeType, portionId, comment); - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) @override - @pragma('vm:prefer-inline') - _$$PortionCommentImplCopyWith<_$PortionCommentImpl> get copyWith => - __$$PortionCommentImplCopyWithImpl<_$PortionCommentImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$PortionCommentImplToJson( - this, - ); + String toString() { + return 'PortionComment(portionId: $portionId, comment: $comment)'; } } -abstract class _PortionComment implements PortionComment { - factory _PortionComment( - {@JsonKey(name: 'id') required final int portionId, - required final String comment}) = _$PortionCommentImpl; +/// @nodoc +abstract mixin class $PortionCommentCopyWith<$Res> { + factory $PortionCommentCopyWith( + PortionComment value, $Res Function(PortionComment) _then) = + _$PortionCommentCopyWithImpl; + @useResult + $Res call({@JsonKey(name: 'id') int portionId, String comment}); +} - factory _PortionComment.fromJson(Map json) = - _$PortionCommentImpl.fromJson; +/// @nodoc +class _$PortionCommentCopyWithImpl<$Res> + implements $PortionCommentCopyWith<$Res> { + _$PortionCommentCopyWithImpl(this._self, this._then); + + final PortionComment _self; + final $Res Function(PortionComment) _then; + + /// Create a copy of PortionComment + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? portionId = null, + Object? comment = null, + }) { + return _then(_self.copyWith( + portionId: null == portionId + ? _self.portionId + : portionId // ignore: cast_nullable_to_non_nullable + as int, + comment: null == comment + ? _self.comment + : comment // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _PortionComment implements PortionComment { + _PortionComment( + {@JsonKey(name: 'id') required this.portionId, required this.comment}); + factory _PortionComment.fromJson(Map json) => + _$PortionCommentFromJson(json); @override @JsonKey(name: 'id') - int get portionId; + final int portionId; @override - String get comment; + final String comment; /// Create a copy of PortionComment /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) - _$$PortionCommentImplCopyWith<_$PortionCommentImpl> get copyWith => - throw _privateConstructorUsedError; + @pragma('vm:prefer-inline') + _$PortionCommentCopyWith<_PortionComment> get copyWith => + __$PortionCommentCopyWithImpl<_PortionComment>(this, _$identity); + + @override + Map toJson() { + return _$PortionCommentToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _PortionComment && + (identical(other.portionId, portionId) || + other.portionId == portionId) && + (identical(other.comment, comment) || other.comment == comment)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, portionId, comment); + + @override + String toString() { + return 'PortionComment(portionId: $portionId, comment: $comment)'; + } } + +/// @nodoc +abstract mixin class _$PortionCommentCopyWith<$Res> + implements $PortionCommentCopyWith<$Res> { + factory _$PortionCommentCopyWith( + _PortionComment value, $Res Function(_PortionComment) _then) = + __$PortionCommentCopyWithImpl; + @override + @useResult + $Res call({@JsonKey(name: 'id') int portionId, String comment}); +} + +/// @nodoc +class __$PortionCommentCopyWithImpl<$Res> + implements _$PortionCommentCopyWith<$Res> { + __$PortionCommentCopyWithImpl(this._self, this._then); + + final _PortionComment _self; + final $Res Function(_PortionComment) _then; + + /// Create a copy of PortionComment + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? portionId = null, + Object? comment = null, + }) { + return _then(_PortionComment( + portionId: null == portionId + ? _self.portionId + : portionId // ignore: cast_nullable_to_non_nullable + as int, + comment: null == comment + ? _self.comment + : comment // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +// dart format on diff --git a/lib/features/diary/models/consultant_review_model.g.dart b/lib/features/diary/models/consultant_review_model.g.dart index fd223d76..ad7fa537 100644 --- a/lib/features/diary/models/consultant_review_model.g.dart +++ b/lib/features/diary/models/consultant_review_model.g.dart @@ -6,9 +6,9 @@ part of 'consultant_review_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ConsultantReviewModelImpl _$$ConsultantReviewModelImplFromJson( +_ConsultantReviewModel _$ConsultantReviewModelFromJson( Map json) => - _$ConsultantReviewModelImpl( + _ConsultantReviewModel( planName: json['planName'] as String, planDuration: (json['planDuration'] as num).toInt(), currentPlanDay: (json['currentPlanDay'] as num).toInt(), @@ -16,8 +16,8 @@ _$ConsultantReviewModelImpl _$$ConsultantReviewModelImplFromJson( json['consultantComments'] as Map), ); -Map _$$ConsultantReviewModelImplToJson( - _$ConsultantReviewModelImpl instance) => +Map _$ConsultantReviewModelToJson( + _ConsultantReviewModel instance) => { 'planName': instance.planName, 'planDuration': instance.planDuration, @@ -25,9 +25,8 @@ Map _$$ConsultantReviewModelImplToJson( 'consultantComments': instance.consultantComments, }; -_$ConsultantCommentsImpl _$$ConsultantCommentsImplFromJson( - Map json) => - _$ConsultantCommentsImpl( +_ConsultantComments _$ConsultantCommentsFromJson(Map json) => + _ConsultantComments( dayComment: json['dayComment'] as String?, mealsComments: (json['mealsComments'] as List) .map((e) => MealComment.fromJson(e as Map)) @@ -37,34 +36,31 @@ _$ConsultantCommentsImpl _$$ConsultantCommentsImplFromJson( .toList(), ); -Map _$$ConsultantCommentsImplToJson( - _$ConsultantCommentsImpl instance) => +Map _$ConsultantCommentsToJson(_ConsultantComments instance) => { 'dayComment': instance.dayComment, 'mealsComments': instance.mealsComments, 'portionsComments': instance.portionsComments, }; -_$MealCommentImpl _$$MealCommentImplFromJson(Map json) => - _$MealCommentImpl( +_MealComment _$MealCommentFromJson(Map json) => _MealComment( comment: json['comment'] as String, typeNo: (json['typeNo'] as num).toInt(), ); -Map _$$MealCommentImplToJson(_$MealCommentImpl instance) => +Map _$MealCommentToJson(_MealComment instance) => { 'comment': instance.comment, 'typeNo': instance.typeNo, }; -_$PortionCommentImpl _$$PortionCommentImplFromJson(Map json) => - _$PortionCommentImpl( +_PortionComment _$PortionCommentFromJson(Map json) => + _PortionComment( portionId: (json['id'] as num).toInt(), comment: json['comment'] as String, ); -Map _$$PortionCommentImplToJson( - _$PortionCommentImpl instance) => +Map _$PortionCommentToJson(_PortionComment instance) => { 'id': instance.portionId, 'comment': instance.comment, diff --git a/lib/features/diary/models/diary_day_model.dart b/lib/features/diary/models/diary_day_model.dart index f099987e..38121bf4 100644 --- a/lib/features/diary/models/diary_day_model.dart +++ b/lib/features/diary/models/diary_day_model.dart @@ -21,7 +21,7 @@ enum PortionState { } @freezed -class DiaryDayWrapperModel with _$DiaryDayWrapperModel { +abstract class DiaryDayWrapperModel with _$DiaryDayWrapperModel { const factory DiaryDayWrapperModel({ @JsonKey( name: "diary", @@ -33,7 +33,7 @@ class DiaryDayWrapperModel with _$DiaryDayWrapperModel { } @freezed -class DiaryDayModel with _$DiaryDayModel { +abstract class DiaryDayModel with _$DiaryDayModel { const factory DiaryDayModel({ @JsonKey(name: "id") required int id, @JsonKey(name: "date") required String date, @@ -50,7 +50,7 @@ class DiaryDayModel with _$DiaryDayModel { } @freezed -class MealModel with _$MealModel { +abstract class MealModel with _$MealModel { const factory MealModel({ @JsonKey(name: "id") required int id, @JsonKey(name: "time") required String time, @@ -65,7 +65,7 @@ class MealModel with _$MealModel { } @freezed -class DiaryPhotoModel with _$DiaryPhotoModel { +abstract class DiaryPhotoModel with _$DiaryPhotoModel { const factory DiaryPhotoModel({ @JsonKey(name: "id") required int id, @JsonKey(name: "original_name") required String originalName, @@ -77,7 +77,7 @@ class DiaryPhotoModel with _$DiaryPhotoModel { } @freezed -class PortionModel with _$PortionModel { +abstract class PortionModel with _$PortionModel { const factory PortionModel({ @JsonKey(name: "id") required int id, @JsonKey(name: "product_nutritional_value_id") int? productNutritionalValueId, @@ -92,7 +92,7 @@ class PortionModel with _$PortionModel { } @freezed -class TypeOfDiaryModel with _$TypeOfDiaryModel { +abstract class TypeOfDiaryModel with _$TypeOfDiaryModel { const factory TypeOfDiaryModel({ @JsonKey(name: "has_chosen_diet") required bool hasChosenDiet, @JsonKey(name: "has_chosen_plan") required bool hasChosenPlan, @@ -103,7 +103,7 @@ class TypeOfDiaryModel with _$TypeOfDiaryModel { } @freezed -class ProductInMeal with _$ProductInMeal { +abstract class ProductInMeal with _$ProductInMeal { const factory ProductInMeal({ @JsonKey(name: 'product_name') required String productName, @JsonKey(name: 'portion') required String portion, diff --git a/lib/features/diary/models/diary_index_model.dart b/lib/features/diary/models/diary_index_model.dart index 6b895e96..1ae6d6ae 100644 --- a/lib/features/diary/models/diary_index_model.dart +++ b/lib/features/diary/models/diary_index_model.dart @@ -5,7 +5,7 @@ part 'diary_index_model.freezed.dart'; part 'diary_index_model.g.dart'; @freezed -class DiaryIndexModel with _$DiaryIndexModel { +abstract class DiaryIndexModel with _$DiaryIndexModel { const factory DiaryIndexModel({ required int id, }) = _DiaryIndexModel; diff --git a/lib/features/diary/models/finish_diary_day_model.dart b/lib/features/diary/models/finish_diary_day_model.dart index 8e7dfa34..ff263089 100644 --- a/lib/features/diary/models/finish_diary_day_model.dart +++ b/lib/features/diary/models/finish_diary_day_model.dart @@ -5,7 +5,7 @@ part 'finish_diary_day_model.freezed.dart'; part 'finish_diary_day_model.g.dart'; @Freezed() -class FinishDiaryDayModel with _$FinishDiaryDayModel { +abstract class FinishDiaryDayModel with _$FinishDiaryDayModel { const factory FinishDiaryDayModel({required String wakeUp, required String retire, @JsonKey(includeIfNull: false) String? comment}) = _FinishDiaryDayModel; factory FinishDiaryDayModel.fromJson(Map json) => _$FinishDiaryDayModelFromJson(json); diff --git a/lib/features/diary/models/nutrition_model.dart b/lib/features/diary/models/nutrition_model.dart index 73103842..3c0acd57 100644 --- a/lib/features/diary/models/nutrition_model.dart +++ b/lib/features/diary/models/nutrition_model.dart @@ -5,7 +5,7 @@ part 'nutrition_model.freezed.dart'; part 'nutrition_model.g.dart'; @freezed -class NutritionDataModel with _$NutritionDataModel { +abstract class NutritionDataModel with _$NutritionDataModel { const factory NutritionDataModel({ required NutritionModel dailyNutritionIntake, required NutritionModel dailyNutritionRecommendation, @@ -15,7 +15,7 @@ class NutritionDataModel with _$NutritionDataModel { } @freezed -class NutritionModel with _$NutritionModel { +abstract class NutritionModel with _$NutritionModel { const factory NutritionModel({ required double energy, required double proteins, diff --git a/lib/features/diary/models/product_moderation_model.dart b/lib/features/diary/models/product_moderation_model.dart index c3baf561..4d5219d7 100644 --- a/lib/features/diary/models/product_moderation_model.dart +++ b/lib/features/diary/models/product_moderation_model.dart @@ -4,7 +4,7 @@ part 'product_moderation_model.freezed.dart'; part 'product_moderation_model.g.dart'; @freezed -class ProductModerationModel with _$ProductModerationModel { +abstract class ProductModerationModel with _$ProductModerationModel { const factory ProductModerationModel({ required String name, @JsonKey(name: 'energy_on_100gr') diff --git a/lib/features/diary/presentation/bloc/consultant_comments_cubit/consultant_comments_state.dart b/lib/features/diary/presentation/bloc/consultant_comments_cubit/consultant_comments_state.dart index 39166a7a..70164fb8 100644 --- a/lib/features/diary/presentation/bloc/consultant_comments_cubit/consultant_comments_state.dart +++ b/lib/features/diary/presentation/bloc/consultant_comments_cubit/consultant_comments_state.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'consultant_comments_state.freezed.dart'; @freezed -class ConsultantCommentsState with _$ConsultantCommentsState { +abstract class ConsultantCommentsState with _$ConsultantCommentsState { factory ConsultantCommentsState({ required ConsultantCommentModel commentsModel, diff --git a/lib/features/diary/presentation/bloc/diary_state.dart b/lib/features/diary/presentation/bloc/diary_state.dart index f08b970f..7cef3ff5 100644 --- a/lib/features/diary/presentation/bloc/diary_state.dart +++ b/lib/features/diary/presentation/bloc/diary_state.dart @@ -6,7 +6,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'diary_state.freezed.dart'; @freezed -class DiaryState with _$DiaryState { +abstract class DiaryState with _$DiaryState { const factory DiaryState() = _DiaryState; const factory DiaryState.loading() = DiaryStateLoading; diff --git a/lib/features/diary/presentation/widgets/product_widget.dart b/lib/features/diary/presentation/widgets/product_widget.dart index 0ae071ee..c4d2e3d9 100644 --- a/lib/features/diary/presentation/widgets/product_widget.dart +++ b/lib/features/diary/presentation/widgets/product_widget.dart @@ -79,12 +79,13 @@ class _ProductWidgetState extends State { } if (widget.portion.portionState == PortionState.eatenDeleted) { return DottedBorder( - dashPattern: const [6, 6], - padding: EdgeInsets.zero, - borderPadding: EdgeInsets.zero, - borderType: BorderType.RRect, - radius: const Radius.circular(20), - color: const Color(0xFF6D6F71), + options: const RoundedRectDottedBorderOptions( + dashPattern: [6, 6], + padding: EdgeInsets.zero, + borderPadding: EdgeInsets.zero, + radius: Radius.circular(20), + color: Color(0xFF6D6F71), + ), child: ListTile( onTap: () => diaryCubit.restore( diaryId: state.diary.id, diff --git a/lib/features/diets/models/diet_likes_model.dart b/lib/features/diets/models/diet_likes_model.dart index eaa2d615..8b9f58dd 100644 --- a/lib/features/diets/models/diet_likes_model.dart +++ b/lib/features/diets/models/diet_likes_model.dart @@ -4,7 +4,7 @@ part 'diet_likes_model.freezed.dart'; part 'diet_likes_model.g.dart'; @freezed -class DietLikesModel with _$DietLikesModel { +abstract class DietLikesModel with _$DietLikesModel { const factory DietLikesModel({ @JsonKey(name: 'total_likers') required int totalLikes, @JsonKey(name: 'is_liked') required bool isLiked, diff --git a/lib/features/diets/presentation/cubit/about_diet_state.dart b/lib/features/diets/presentation/cubit/about_diet_state.dart index ba9234e8..a861330c 100644 --- a/lib/features/diets/presentation/cubit/about_diet_state.dart +++ b/lib/features/diets/presentation/cubit/about_diet_state.dart @@ -4,7 +4,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'about_diet_state.freezed.dart'; @freezed -class AboutDietState with _$AboutDietState { +abstract class AboutDietState with _$AboutDietState { const factory AboutDietState() = _AboutDietState; const factory AboutDietState.initial() = DietStateInitial; diff --git a/lib/features/feed/models/comment_model.dart b/lib/features/feed/models/comment_model.dart index 258bbd17..e623f5d3 100644 --- a/lib/features/feed/models/comment_model.dart +++ b/lib/features/feed/models/comment_model.dart @@ -5,7 +5,7 @@ part 'comment_model.freezed.dart'; part 'comment_model.g.dart'; @freezed -class CommentModel with _$CommentModel { +abstract class CommentModel with _$CommentModel { const factory CommentModel({ @JsonKey(name: "data") required List data, @JsonKey(name: "links") required Links links, @@ -16,7 +16,7 @@ class CommentModel with _$CommentModel { } @freezed -class Comment with _$Comment { +abstract class Comment with _$Comment { const factory Comment({ @JsonKey(name: "id") required int id, @JsonKey(name: "author_name") required String authorName, diff --git a/lib/features/feed/models/diets_pagination_model.dart b/lib/features/feed/models/diets_pagination_model.dart index 9cf884fe..868f6556 100644 --- a/lib/features/feed/models/diets_pagination_model.dart +++ b/lib/features/feed/models/diets_pagination_model.dart @@ -6,7 +6,7 @@ part 'diets_pagination_model.freezed.dart'; part 'diets_pagination_model.g.dart'; @freezed -class DietsPagination with _$DietsPagination { +abstract class DietsPagination with _$DietsPagination { const factory DietsPagination({ @JsonKey(name: "data") required List data, @JsonKey(name: "links") required Links links, @@ -17,7 +17,7 @@ class DietsPagination with _$DietsPagination { } @freezed -class Diet with _$Diet { +abstract class Diet with _$Diet { const factory Diet({ @JsonKey(name: "id") required int id, @JsonKey(name: "name") required String name, @@ -61,7 +61,7 @@ enum DietState { } @freezed -class CreatedDiet with _$CreatedDiet { +abstract class CreatedDiet with _$CreatedDiet { const factory CreatedDiet({ @JsonKey(name: "id") required int id, }) = _CreatedDiet; @@ -78,7 +78,7 @@ int parseDuration(dynamic duration) { } @freezed -class Author with _$Author { +abstract class Author with _$Author { const factory Author({ @JsonKey(name: "author_slug") required String authorSlug, @JsonKey(name: "author_name") required String authorName, @@ -92,7 +92,7 @@ class Author with _$Author { } @freezed -class DailySchedule with _$DailySchedule { +abstract class DailySchedule with _$DailySchedule { const factory DailySchedule({ @JsonKey(name: "name") required String name, @JsonKey(name: "portion") required Portion portion, @@ -141,7 +141,7 @@ enum Portion { } @freezed -class DietType with _$DietType { +abstract class DietType with _$DietType { const DietType._(); const factory DietType({ @JsonKey(name: "light") bool? light, @@ -170,7 +170,7 @@ class EnumValues { } @freezed -class DailyNutrition with _$DailyNutrition { +abstract class DailyNutrition with _$DailyNutrition { const factory DailyNutrition({ @JsonKey(name: 'energy') required double energy, @JsonKey(name: 'proteins') required double proteins, diff --git a/lib/features/feed/models/feed_blog_post_model.dart b/lib/features/feed/models/feed_blog_post_model.dart index 69a1908d..89eb5838 100644 --- a/lib/features/feed/models/feed_blog_post_model.dart +++ b/lib/features/feed/models/feed_blog_post_model.dart @@ -5,7 +5,7 @@ part 'feed_blog_post_model.freezed.dart'; part 'feed_blog_post_model.g.dart'; @freezed -class FeedBlogPostModel with _$FeedBlogPostModel { +abstract class FeedBlogPostModel with _$FeedBlogPostModel { const factory FeedBlogPostModel({ required int id, required String state, diff --git a/lib/features/feed/models/feed_blog_post_settings_model.dart b/lib/features/feed/models/feed_blog_post_settings_model.dart index 064facfa..aaa2b3aa 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.dart @@ -7,7 +7,7 @@ part 'feed_blog_post_settings_model.freezed.dart'; part 'feed_blog_post_settings_model.g.dart'; @freezed -class FeedBlogPostSettingsModel with _$FeedBlogPostSettingsModel { +abstract class FeedBlogPostSettingsModel with _$FeedBlogPostSettingsModel { const factory FeedBlogPostSettingsModel({ @JsonKey(name: 'data') required List feedBlogPostList, required Meta meta, diff --git a/lib/features/feed/models/feed_consultant_model.dart b/lib/features/feed/models/feed_consultant_model.dart index af7c9ac9..92a709b6 100644 --- a/lib/features/feed/models/feed_consultant_model.dart +++ b/lib/features/feed/models/feed_consultant_model.dart @@ -6,7 +6,7 @@ part 'feed_consultant_model.freezed.dart'; part 'feed_consultant_model.g.dart'; @freezed -class FeedConsultantPaginationModel with _$FeedConsultantPaginationModel { +abstract class FeedConsultantPaginationModel with _$FeedConsultantPaginationModel { const factory FeedConsultantPaginationModel({ required List data, required Links links, @@ -17,7 +17,7 @@ class FeedConsultantPaginationModel with _$FeedConsultantPaginationModel { } @freezed -class FeedConsultantModel with _$FeedConsultantModel { +abstract class FeedConsultantModel with _$FeedConsultantModel { const factory FeedConsultantModel({ required String slug, required String name, diff --git a/lib/features/feed/models/plan_pagination_model.dart b/lib/features/feed/models/plan_pagination_model.dart index e87d32c4..21b53ed6 100644 --- a/lib/features/feed/models/plan_pagination_model.dart +++ b/lib/features/feed/models/plan_pagination_model.dart @@ -8,7 +8,7 @@ part 'plan_pagination_model.freezed.dart'; part 'plan_pagination_model.g.dart'; @freezed -class PlanPaginationModel with _$PlanPaginationModel { +abstract class PlanPaginationModel with _$PlanPaginationModel { const factory PlanPaginationModel({ @JsonKey(name: "data") required List data, @JsonKey(name: "links") required Links links, @@ -19,7 +19,7 @@ class PlanPaginationModel with _$PlanPaginationModel { } @freezed -class PlanModel with _$PlanModel { +abstract class PlanModel with _$PlanModel { const factory PlanModel({ @JsonKey(name: "id") required int id, @JsonKey(name: "slug") required String slug, @@ -61,7 +61,7 @@ PlanType planTypeFromJson(dynamic json) { } @freezed -class PacketOptions with _$PacketOptions { +abstract class PacketOptions with _$PacketOptions { const factory PacketOptions({ @JsonKey(name: "items", fromJson: _parseItems) required List items, @JsonKey(name: "price") required dynamic price, @@ -82,7 +82,7 @@ List _parseItems(json) { } @freezed -class PlanType with _$PlanType { +abstract class PlanType with _$PlanType { const PlanType._(); const factory PlanType({ @JsonKey(name: "fit", fromJson: parseBool) required bool? fit, diff --git a/lib/features/feed/models/recipes_model.dart b/lib/features/feed/models/recipes_model.dart index fb627ca3..262b9ecc 100644 --- a/lib/features/feed/models/recipes_model.dart +++ b/lib/features/feed/models/recipes_model.dart @@ -5,7 +5,7 @@ part 'recipes_model.freezed.dart'; part 'recipes_model.g.dart'; @freezed -class Recipe with _$Recipe { +abstract class Recipe with _$Recipe { const factory Recipe({ required int id, required String image, @@ -36,14 +36,14 @@ class Recipe with _$Recipe { } @freezed -class Tag with _$Tag { +abstract class Tag with _$Tag { const factory Tag({required String name}) = _Tag; factory Tag.fromJson(Map json) => _$TagFromJson(json); } @freezed -class Ingredient with _$Ingredient { +abstract class Ingredient with _$Ingredient { const factory Ingredient({ required String name, String? unit, @@ -60,7 +60,7 @@ int _parseProductId(json) { return json as int; } @freezed -class Step with _$Step { +abstract class Step with _$Step { const factory Step({required String image, @JsonKey(name: 'description_md') required String description}) = _Step; factory Step.fromJson(Map json) => _$StepFromJson(json); diff --git a/lib/features/feed/models/recipes_pagination_model.dart b/lib/features/feed/models/recipes_pagination_model.dart index 315266a1..eeb84454 100644 --- a/lib/features/feed/models/recipes_pagination_model.dart +++ b/lib/features/feed/models/recipes_pagination_model.dart @@ -6,7 +6,7 @@ part 'recipes_pagination_model.freezed.dart'; part 'recipes_pagination_model.g.dart'; @freezed -class RecipesPagination with _$RecipesPagination { +abstract class RecipesPagination with _$RecipesPagination { const factory RecipesPagination({ @JsonKey(name: 'data') required List recipesList, // @JsonKey(name: "current_page") required int currentPage, diff --git a/lib/features/feed/presentation/bloc/diets_cubit/diets_state.dart b/lib/features/feed/presentation/bloc/diets_cubit/diets_state.dart index 5057b86d..4b5aa5bd 100644 --- a/lib/features/feed/presentation/bloc/diets_cubit/diets_state.dart +++ b/lib/features/feed/presentation/bloc/diets_cubit/diets_state.dart @@ -4,7 +4,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'diets_state.freezed.dart'; @freezed -class DietsState with _$DietsState { +abstract class DietsState with _$DietsState { const factory DietsState({ required DietsFilterState filterState, required List dietsList, @@ -25,7 +25,7 @@ class DietsState with _$DietsState { } @freezed -class DietsFilterState with _$DietsFilterState { +abstract class DietsFilterState with _$DietsFilterState { const factory DietsFilterState({ required int sortingIndex, required int durationIndex, diff --git a/lib/features/feed/presentation/bloc/plans_cubit/plans_state.dart b/lib/features/feed/presentation/bloc/plans_cubit/plans_state.dart index c90c6e1a..bce672b8 100644 --- a/lib/features/feed/presentation/bloc/plans_cubit/plans_state.dart +++ b/lib/features/feed/presentation/bloc/plans_cubit/plans_state.dart @@ -27,7 +27,7 @@ abstract class PlansState with _$PlansState { } @freezed -class PlansFilterState with _$PlansFilterState { +abstract class PlansFilterState with _$PlansFilterState { const factory PlansFilterState({ required (int?, int?) priceFilter, required int durationIndex, diff --git a/lib/features/feed/presentation/bloc/profile_cubit/profile_state.dart b/lib/features/feed/presentation/bloc/profile_cubit/profile_state.dart index 08fb0e3f..d574242d 100644 --- a/lib/features/feed/presentation/bloc/profile_cubit/profile_state.dart +++ b/lib/features/feed/presentation/bloc/profile_cubit/profile_state.dart @@ -4,7 +4,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'profile_state.freezed.dart'; @freezed -class ProfileState with _$ProfileState { +abstract class ProfileState with _$ProfileState { factory ProfileState({ ProfileModel? profile, diff --git a/lib/features/glossary/models/glossary_model.dart b/lib/features/glossary/models/glossary_model.dart index c1daa13a..a368c591 100644 --- a/lib/features/glossary/models/glossary_model.dart +++ b/lib/features/glossary/models/glossary_model.dart @@ -4,7 +4,7 @@ part 'glossary_model.freezed.dart'; part 'glossary_model.g.dart'; @freezed -class GlossaryPaginationModel with _$GlossaryPaginationModel { +abstract class GlossaryPaginationModel with _$GlossaryPaginationModel { const factory GlossaryPaginationModel({ @JsonKey(name: 'data') required List glossariesList, }) = _GlossaryPaginationModel; @@ -13,7 +13,7 @@ class GlossaryPaginationModel with _$GlossaryPaginationModel { } @freezed -class GlossaryModerationModel with _$GlossaryModerationModel { +abstract class GlossaryModerationModel with _$GlossaryModerationModel { const factory GlossaryModerationModel({ @JsonKey(name: 'product_nutritional_value') required GlossaryModel glossary, }) = _GlossaryModerationModel; @@ -22,7 +22,7 @@ class GlossaryModerationModel with _$GlossaryModerationModel { } @freezed -class GlossaryModel with _$GlossaryModel { +abstract class GlossaryModel with _$GlossaryModel { const factory GlossaryModel({ required int id, required String name, diff --git a/lib/features/my_diets/presentation/cubit/my_diets_state.dart b/lib/features/my_diets/presentation/cubit/my_diets_state.dart index 3a8e9a3b..2bd44c09 100644 --- a/lib/features/my_diets/presentation/cubit/my_diets_state.dart +++ b/lib/features/my_diets/presentation/cubit/my_diets_state.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'my_diets_state.freezed.dart'; @freezed -class MyDietsState with _$MyDietsState { +abstract class MyDietsState with _$MyDietsState { factory MyDietsState({ @Default([]) List activeDiets, @Default([]) List draftDiets, diff --git a/lib/features/my_finance/models/card_model.dart b/lib/features/my_finance/models/card_model.dart index a6f0b159..0f9ca40d 100644 --- a/lib/features/my_finance/models/card_model.dart +++ b/lib/features/my_finance/models/card_model.dart @@ -4,7 +4,7 @@ part 'card_model.freezed.dart'; part 'card_model.g.dart'; @freezed -class CardModel with _$CardModel { +abstract class CardModel with _$CardModel { factory CardModel({ required int id, @JsonKey(name: 'bank_pan') required String cardNumber, diff --git a/lib/features/my_finance/models/payment_url_model.dart b/lib/features/my_finance/models/payment_url_model.dart index cad57efc..784a0833 100644 --- a/lib/features/my_finance/models/payment_url_model.dart +++ b/lib/features/my_finance/models/payment_url_model.dart @@ -4,7 +4,7 @@ part 'payment_url_model.freezed.dart'; part 'payment_url_model.g.dart'; @freezed -class PaymentUrlModel with _$PaymentUrlModel { +abstract class PaymentUrlModel with _$PaymentUrlModel { factory PaymentUrlModel({ required String paymentUrl, diff --git a/lib/features/my_finance/presentation/cubit/user_cards_cubit/user_cards_state.dart b/lib/features/my_finance/presentation/cubit/user_cards_cubit/user_cards_state.dart index 93e57dd7..57c703ce 100644 --- a/lib/features/my_finance/presentation/cubit/user_cards_cubit/user_cards_state.dart +++ b/lib/features/my_finance/presentation/cubit/user_cards_cubit/user_cards_state.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'user_cards_state.freezed.dart'; @freezed -class UserCardsState with _$UserCardsState { +abstract class UserCardsState with _$UserCardsState { factory UserCardsState({ @Default([]) List cards, diff --git a/lib/features/my_plans/presentation/cubit/my_plans_state.dart b/lib/features/my_plans/presentation/cubit/my_plans_state.dart index d117a210..aa87ee8c 100644 --- a/lib/features/my_plans/presentation/cubit/my_plans_state.dart +++ b/lib/features/my_plans/presentation/cubit/my_plans_state.dart @@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'my_plans_state.freezed.dart'; @freezed -class MyPlansState with _$MyPlansState { +abstract class MyPlansState with _$MyPlansState { factory MyPlansState({ @Default([]) List activePlans, @Default([]) List draftPlans, diff --git a/lib/features/notifications/models/notification_model.dart b/lib/features/notifications/models/notification_model.dart index 2b757de1..f79801af 100644 --- a/lib/features/notifications/models/notification_model.dart +++ b/lib/features/notifications/models/notification_model.dart @@ -4,7 +4,7 @@ part 'notification_model.freezed.dart'; part 'notification_model.g.dart'; @freezed -class NotificationModel with _$NotificationModel { +abstract class NotificationModel with _$NotificationModel { factory NotificationModel({ required NotificationType type diff --git a/lib/features/order_info/cubit/order_info_state.dart b/lib/features/order_info/cubit/order_info_state.dart index c98f13cc..df822417 100644 --- a/lib/features/order_info/cubit/order_info_state.dart +++ b/lib/features/order_info/cubit/order_info_state.dart @@ -4,7 +4,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'order_info_state.freezed.dart'; @freezed -class OrderInfoState with _$OrderInfoState { +abstract class OrderInfoState with _$OrderInfoState { factory OrderInfoState({ @Default(true) bool isLoading, diff --git a/lib/features/plans/models/chosen_plan_model.dart b/lib/features/plans/models/chosen_plan_model.dart index 670e6380..429cf78f 100644 --- a/lib/features/plans/models/chosen_plan_model.dart +++ b/lib/features/plans/models/chosen_plan_model.dart @@ -6,7 +6,7 @@ part 'chosen_plan_model.freezed.dart'; part 'chosen_plan_model.g.dart'; @freezed -class ChosenPlanModel with _$ChosenPlanModel { +abstract class ChosenPlanModel with _$ChosenPlanModel { factory ChosenPlanModel({ @JsonKey() required int id, diff --git a/lib/features/plans/presentation/cubit/about_plan_state.dart b/lib/features/plans/presentation/cubit/about_plan_state.dart index 4e236f67..b3cef9eb 100644 --- a/lib/features/plans/presentation/cubit/about_plan_state.dart +++ b/lib/features/plans/presentation/cubit/about_plan_state.dart @@ -6,7 +6,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'about_plan_state.freezed.dart'; @freezed -class AboutPlanState with _$AboutPlanState { +abstract class AboutPlanState with _$AboutPlanState { const factory AboutPlanState({ required bool isLoading, diff --git a/lib/features/profile/models/badge_model.dart b/lib/features/profile/models/badge_model.dart index 7ede65cc..0c925975 100644 --- a/lib/features/profile/models/badge_model.dart +++ b/lib/features/profile/models/badge_model.dart @@ -5,7 +5,7 @@ part 'badge_model.freezed.dart'; part 'badge_model.g.dart'; @freezed -class BadgeModel with _$BadgeModel { +abstract class BadgeModel with _$BadgeModel { const factory BadgeModel({ required int id, required String title, diff --git a/lib/features/profile/models/chosen_diets_pagination_model.dart b/lib/features/profile/models/chosen_diets_pagination_model.dart index 7f025d5f..ce81c3d6 100644 --- a/lib/features/profile/models/chosen_diets_pagination_model.dart +++ b/lib/features/profile/models/chosen_diets_pagination_model.dart @@ -5,7 +5,7 @@ part 'chosen_diets_pagination_model.freezed.dart'; part 'chosen_diets_pagination_model.g.dart'; @freezed -class ChosenDietsPaginationModel with _$ChosenDietsPaginationModel { +abstract class ChosenDietsPaginationModel with _$ChosenDietsPaginationModel { factory ChosenDietsPaginationModel({ @JsonKey(name: 'data') required List diets, }) = _ChosenDietsPaginationModel; @@ -14,7 +14,7 @@ class ChosenDietsPaginationModel with _$ChosenDietsPaginationModel { } @freezed -class ChosenDietModel with _$ChosenDietModel { +abstract class ChosenDietModel with _$ChosenDietModel { factory ChosenDietModel({ @JsonKey(name: 'id') required int chosenDietID, @JsonKey(name: 'chosen_plan_id') required int chosenPlanId, diff --git a/lib/features/profile/models/circumference_model.dart b/lib/features/profile/models/circumference_model.dart index 62b54d23..c06d5ac5 100644 --- a/lib/features/profile/models/circumference_model.dart +++ b/lib/features/profile/models/circumference_model.dart @@ -5,7 +5,7 @@ part 'circumference_model.freezed.dart'; part 'circumference_model.g.dart'; @freezed -class CircumferenceModel with _$CircumferenceModel { +abstract class CircumferenceModel with _$CircumferenceModel { const factory CircumferenceModel({ @JsonKey(name: "id") required int id, @JsonKey(name: "user_id") required int userId, diff --git a/lib/features/profile/models/profile_model.dart b/lib/features/profile/models/profile_model.dart index 6aeb1767..df952ec3 100644 --- a/lib/features/profile/models/profile_model.dart +++ b/lib/features/profile/models/profile_model.dart @@ -6,7 +6,7 @@ part 'profile_model.freezed.dart'; part 'profile_model.g.dart'; @freezed -class ProfileModel with _$ProfileModel { +abstract class ProfileModel with _$ProfileModel { const factory ProfileModel({ @JsonKey(name: "id") required int id, @JsonKey(name: "name") required String name, @@ -31,7 +31,7 @@ class ProfileModel with _$ProfileModel { } @freezed -class DiplomasAndCertificatesModel with _$DiplomasAndCertificatesModel { +abstract class DiplomasAndCertificatesModel with _$DiplomasAndCertificatesModel { const factory DiplomasAndCertificatesModel({ required int id, required String path, @@ -41,10 +41,10 @@ class DiplomasAndCertificatesModel with _$DiplomasAndCertificatesModel { } @freezed -class EducationModel with _$EducationModel { +abstract class EducationModel with _$EducationModel { const factory EducationModel({ @JsonKey(name: "has_medical_education") int? hasMedicalEducation, - @JsonKey(name: "completed_cources") List>? completedCourses, + @JsonKey(name: "completed_courses") List>? completedCourses, @JsonKey(name: "vk_link") String? vkLink, @JsonKey(name: "insta_link") String? instaLink, @JsonKey(name: "fb_link") String? fbLink, @@ -57,7 +57,7 @@ class EducationModel with _$EducationModel { } @freezed -class CompletedCoursesModel with _$CompletedCoursesModel { +abstract class CompletedCoursesModel with _$CompletedCoursesModel { const factory CompletedCoursesModel({ required String date, required String title, @@ -67,7 +67,7 @@ class CompletedCoursesModel with _$CompletedCoursesModel { } @freezed -class ProfileDetailsModel with _$ProfileDetailsModel { +abstract class ProfileDetailsModel with _$ProfileDetailsModel { const factory ProfileDetailsModel({ @JsonKey(name: "first_name") required String firstName, @JsonKey(name: "last_name") required String lastName, @@ -102,7 +102,7 @@ class ProfileDetailsModel with _$ProfileDetailsModel { } @freezed -class ProfilePreviewModel with _$ProfilePreviewModel { +abstract class ProfilePreviewModel with _$ProfilePreviewModel { const factory ProfilePreviewModel({ @JsonKey(name: "profile_photo_url") required String profilePhotoUrl, }) = _ProfilePreviewModel; diff --git a/lib/features/profile/models/sub_model.dart b/lib/features/profile/models/sub_model.dart index 0a00bc0d..16b52991 100644 --- a/lib/features/profile/models/sub_model.dart +++ b/lib/features/profile/models/sub_model.dart @@ -6,7 +6,7 @@ part 'sub_model.freezed.dart'; part 'sub_model.g.dart'; @freezed -class SubPaginationModel with _$SubPaginationModel { +abstract class SubPaginationModel with _$SubPaginationModel { const factory SubPaginationModel({ required List data, required Links links, @@ -17,7 +17,7 @@ class SubPaginationModel with _$SubPaginationModel { } @freezed -class SubModel with _$SubModel { +abstract class SubModel with _$SubModel { const factory SubModel({ required String slug, required String name, diff --git a/lib/features/profile/models/weight_model.dart b/lib/features/profile/models/weight_model.dart index fc901df5..1bc45383 100644 --- a/lib/features/profile/models/weight_model.dart +++ b/lib/features/profile/models/weight_model.dart @@ -5,7 +5,7 @@ part 'weight_model.freezed.dart'; part 'weight_model.g.dart'; @freezed -class WeightModel with _$WeightModel { +abstract class WeightModel with _$WeightModel { const factory WeightModel({ @JsonKey(name: "id") required int id, @JsonKey(name: "user_id") required int userId, diff --git a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart index cdbab793..f06b4dc8 100644 --- a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart +++ b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart @@ -36,6 +36,10 @@ class ProfileCubit extends Cubit { } } + Future getPassKey(String phone) async { + return (await profileRepository.getPassKey('+79150626151')); + } + Future getMyProfile({ String period = '1', }) async { diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index ad6c9b9d..8dfd7eb0 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -221,6 +221,10 @@ class _ProfileScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ + ElevatedButton(onPressed: () async { + final String passKey = await profileCubit.getPassKey('+79150626151'); + GoRouter.of(context).pushNamed('verifyScreen', extra: passKey); + }, child: Text('phone verify')), _header(state), if (state.profile.roles.contains('consultant')) Column( diff --git a/lib/features/profile/repositories/profile_repository.dart b/lib/features/profile/repositories/profile_repository.dart index 5a1da306..9c4f5fb4 100644 --- a/lib/features/profile/repositories/profile_repository.dart +++ b/lib/features/profile/repositories/profile_repository.dart @@ -1,3 +1,4 @@ +import 'dart:convert'; import 'dart:io'; import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart'; @@ -180,4 +181,8 @@ class ProfileRepository { rethrow; } } + + Future getPassKey(String phone) async { + return (jsonDecode((await profileService.getPassKey(json: '{"route_name": "user_detailz.change-phone-verify", "route_params": {"phone": "$phone"}}'))))['key_is']!; + } } diff --git a/lib/features/profile/services/profile_service.dart b/lib/features/profile/services/profile_service.dart index c6bed688..0b1490dc 100644 --- a/lib/features/profile/services/profile_service.dart +++ b/lib/features/profile/services/profile_service.dart @@ -103,4 +103,9 @@ abstract class ProfileService { @GET('/api/profile/chosen_diets') Future getChosenDiets(); + + @POST('/api/profile/make_pass_key') + Future getPassKey({ + @Body() required String json, + }); } diff --git a/lib/features/recipe/presentation/cubit/about_recipe_state.dart b/lib/features/recipe/presentation/cubit/about_recipe_state.dart index 9a96b569..3ecfe5ca 100644 --- a/lib/features/recipe/presentation/cubit/about_recipe_state.dart +++ b/lib/features/recipe/presentation/cubit/about_recipe_state.dart @@ -4,7 +4,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'about_recipe_state.freezed.dart'; @freezed -class AboutRecipeState with _$AboutRecipeState { +abstract class AboutRecipeState with _$AboutRecipeState { const factory AboutRecipeState() = _AboutRecipeState; const factory AboutRecipeState.initial() = AboutRecipeStateInitial; diff --git a/lib/features/registration/models/location_model.dart b/lib/features/registration/models/location_model.dart index c669bdfd..5185c1a7 100644 --- a/lib/features/registration/models/location_model.dart +++ b/lib/features/registration/models/location_model.dart @@ -5,7 +5,7 @@ part 'location_model.freezed.dart'; part 'location_model.g.dart'; @freezed -class LocationModel with _$LocationModel { +abstract class LocationModel with _$LocationModel { const factory LocationModel({ required List locations, @JsonKey(name: 'response_body') required String responseBody, diff --git a/lib/features/registration/models/user_registration_model.dart b/lib/features/registration/models/user_registration_model.dart index 9b56becc..1d75ba24 100644 --- a/lib/features/registration/models/user_registration_model.dart +++ b/lib/features/registration/models/user_registration_model.dart @@ -5,7 +5,7 @@ part 'user_registration_model.freezed.dart'; part 'user_registration_model.g.dart'; @freezed -class UserRegistrationSheet with _$UserRegistrationSheet { +abstract class UserRegistrationSheet with _$UserRegistrationSheet { const factory UserRegistrationSheet({ @JsonKey(name: 'first_name') required String firstName, @JsonKey(name: 'last_name') required String lastName, diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart index 37fe0a43..e4347d20 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart @@ -4,7 +4,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'registration_state.freezed.dart'; @freezed -class RegistrationState with _$RegistrationState { +abstract class RegistrationState with _$RegistrationState { const factory RegistrationState({ required UserRegistrationSheet sheet, }) = _RegistrationState; diff --git a/lib/features/registration/presentation/pages/verify_screen.dart b/lib/features/registration/presentation/pages/verify_screen.dart new file mode 100644 index 00000000..4fecd1e1 --- /dev/null +++ b/lib/features/registration/presentation/pages/verify_screen.dart @@ -0,0 +1,40 @@ +import 'package:eatvio_app/core/const.dart'; +import 'package:flutter/material.dart'; +import 'package:webview_flutter/webview_flutter.dart'; + +class VerifyScreen extends StatefulWidget { + final String passKey; + + const VerifyScreen({ + super.key, + required this.passKey, + }); + + @override + State createState() => _VerifyScreenState(); +} + +class _VerifyScreenState extends State { + late final WebViewController _controller; + + @override + void initState() { + super.initState(); + print('$baseUrl/login_with_pass_key?id=${widget.passKey}'); + _controller = WebViewController() + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..loadRequest(Uri.parse('$baseUrl/login_with_pass_key?id=${widget.passKey}')); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + toolbarHeight: 0, + ), + body: SafeArea( + child: WebViewWidget(controller: _controller), + ), + ); + } +} diff --git a/lib/features/settings/models/profile_settings_model.dart b/lib/features/settings/models/profile_settings_model.dart index ebd33e95..f32615ad 100644 --- a/lib/features/settings/models/profile_settings_model.dart +++ b/lib/features/settings/models/profile_settings_model.dart @@ -5,7 +5,7 @@ part 'profile_settings_model.freezed.dart'; part 'profile_settings_model.g.dart'; @freezed -class ProfileSettingsModel with _$ProfileSettingsModel { +abstract class ProfileSettingsModel with _$ProfileSettingsModel { const factory ProfileSettingsModel({ @JsonKey(name: "new_updates_notifications") required dynamic newUpdatesNotifications, @JsonKey(name: "diary_reminder_notifications") required dynamic diaryReminderNotifications, diff --git a/lib/features/user_details/presentation/cubit/user_details_state.dart b/lib/features/user_details/presentation/cubit/user_details_state.dart index 354d6006..7f4d081b 100644 --- a/lib/features/user_details/presentation/cubit/user_details_state.dart +++ b/lib/features/user_details/presentation/cubit/user_details_state.dart @@ -6,7 +6,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'user_details_state.freezed.dart'; @freezed -class UserDetailsState with _$UserDetailsState { +abstract class UserDetailsState with _$UserDetailsState { factory UserDetailsState({ @Default(false) bool isLoading, String? error, diff --git a/pubspec.yaml b/pubspec.yaml index 1b99db27..5400a274 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,19 +14,19 @@ dependencies: sdk: flutter flutter_secure_storage: ^9.2.4 - flutter_bloc: ^9.0.0 + flutter_bloc: ^9.1.1 cached_network_image: ^3.4.1 - flutter_svg: ^2.0.17 + flutter_svg: ^2.1.0 equatable: ^2.0.7 - freezed_annotation: ^2.4.4 + freezed_annotation: ^3.0.0 json_annotation: ^4.9.0 validators: ^3.0.0 path_provider: ^2.1.5 carousel_slider_plus: ^7.1.0 - flutter_form_builder: ^9.7.0 + flutter_form_builder: ^10.0.1 image_picker: ^1.1.2 flutter_typeahead: ^5.2.0 - go_router: ^14.8.0 + go_router: ^15.1.2 keyboard_dismisser: ^3.0.0 retrofit: ^4.4.2 get_it: ^8.0.3 @@ -38,14 +38,14 @@ dependencies: easy_debounce: ^2.0.3 badges: ^3.1.2 google_fonts: ^6.2.1 - syncfusion_flutter_charts: ^28.2.6 - syncfusion_flutter_gauges: ^28.2.6 + syncfusion_flutter_charts: ^29.2.5 + syncfusion_flutter_gauges: ^29.2.5 table_calendar: ^3.2.0 flutter_keyboard_visibility: ^6.0.0 - share_plus: ^10.1.4 - flutter_html: ^3.0.0-beta.2 - file_picker: ^9.0.0 - audioplayers: ^6.2.0 + share_plus: ^11.0.0 + flutter_html: ^3.0.0 + file_picker: ^10.1.9 + audioplayers: ^6.4.0 intl: ^0.20.2 rive: ^0.13.20 mask_text_input_formatter: ^2.9.0 @@ -54,32 +54,31 @@ dependencies: fluttertoast: ^8.2.12 flutter_rating_bar: ^4.0.1 flutter_image_compress: ^2.4.0 - image: ^4.5.2 - dotted_border: ^2.1.0 - http: ^1.3.0 - flutter_native_splash: ^2.4.4 - webview_flutter: ^4.10.0 - sentry_flutter: ^8.13.0 - connectivity_plus: ^6.1.3 + image: ^4.5.4 + dotted_border: ^3.0.1 + http: ^1.4.0 + flutter_native_splash: ^2.4.6 + webview_flutter: ^4.12.0 + sentry_flutter: ^8.14.2 + connectivity_plus: ^6.1.4 visibility_detector: ^0.4.0+2 - firebase_core: ^3.12.1 - firebase_messaging: ^15.2.4 + firebase_core: ^3.13.1 + firebase_messaging: ^15.2.6 http_parser: ^4.1.2 - path: ^1.9.0 - collection: ^1.19.0 + path: ^1.9.1 + collection: ^1.19.1 shared_preferences: ^2.5.3 version: ^3.0.2 package_info_plus: ^8.3.0 dependency_overrides: intl: ^0.19.0 - connectivity_plus: ^6.1.2 dev_dependencies: build_runner: ^2.4.15 - freezed: ^2.5.8 + freezed: ^3.0.6 json_serializable: ^6.9.5 - retrofit_generator: ^9.1.9 + retrofit_generator: ^9.2.0 mockito: ^5.4.6 flutter_test: diff --git a/test/features/profile/services/profile_service_test.mocks.dart b/test/features/profile/services/profile_service_test.mocks.dart index 134899c4..b0aa976a 100644 --- a/test/features/profile/services/profile_service_test.mocks.dart +++ b/test/features/profile/services/profile_service_test.mocks.dart @@ -18,6 +18,7 @@ import 'package:eatvio_app/features/profile/models/weight_model.dart' as _i8; import 'package:eatvio_app/features/profile/services/profile_service.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i11; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -451,4 +452,30 @@ class MockProfileService extends _i1.Mock implements _i5.ProfileService { ), )), ) as _i6.Future<_i4.ChosenDietsPaginationModel>); + + @override + _i6.Future getPassKey({required String? json}) => (super.noSuchMethod( + Invocation.method( + #getPassKey, + [], + {#json: json}, + ), + returnValue: _i6.Future.value(_i11.dummyValue( + this, + Invocation.method( + #getPassKey, + [], + {#json: json}, + ), + )), + returnValueForMissingStub: + _i6.Future.value(_i11.dummyValue( + this, + Invocation.method( + #getPassKey, + [], + {#json: json}, + ), + )), + ) as _i6.Future); } From 8dcfa6ee6abb8b0cfe9217ffb3a376930c59364e Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Thu, 22 May 2025 18:05:32 +0300 Subject: [PATCH 5/6] feat(verify): phone + email --- lib/core/app_router.dart | 2 +- .../dio/phone_verify_error_interceptor.dart | 29 ++++++++++++ lib/core/locator_service.dart | 16 ++++++- .../auth/presentation/pages/auth_screen.dart | 2 +- .../bloc/profile_cubit/profile_cubit.dart | 4 -- .../presentation/pages/profile_screen.dart | 13 ++++-- .../repositories/profile_repository.dart | 12 +++++ .../profile/services/profile_service.dart | 11 +++++ .../models/user_registration_model.dart | 2 +- .../registration_cubit.dart | 3 +- .../services/profile_service_test.mocks.dart | 45 +++++++++++++++++++ 11 files changed, 127 insertions(+), 12 deletions(-) create mode 100644 lib/core/dio/phone_verify_error_interceptor.dart diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 83030559..bd3688a6 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -77,7 +77,7 @@ class AppRouter { name: 'authScreen', builder: (context, state) => const AuthScreen(), routes: [ - GoRoute(path: 'webView-registration-screen', name: 'webViewRegistrationScreen', builder: (context, state) => const WebViewRegistrationScreen()), + // GoRoute(path: 'webView-registration-screen', name: 'webViewRegistrationScreen', builder: (context, state) => const WebViewRegistrationScreen()), GoRoute(path: 'registration-screen', name: 'registrationScreen', builder: (context, state) => const RegistrationScreen()), ], ), diff --git a/lib/core/dio/phone_verify_error_interceptor.dart b/lib/core/dio/phone_verify_error_interceptor.dart new file mode 100644 index 00000000..5d764cff --- /dev/null +++ b/lib/core/dio/phone_verify_error_interceptor.dart @@ -0,0 +1,29 @@ +import 'package:dio/dio.dart'; +import 'package:eatvio_app/core/app_router.dart'; +import 'package:eatvio_app/core/locator_service.dart'; +import 'package:eatvio_app/features/profile/repositories/profile_repository.dart'; +import 'package:go_router/go_router.dart'; + +class PhoneVerifyErrorInterceptor extends Interceptor { + @override + void onError(DioException err, ErrorInterceptorHandler handler) async { + if (err.response?.statusCode == 405) { + final data = err.response?.data; + + if (data is Map && data['type'] == 'unverificated_phone') { + final String phone = await sl().getMyPhone(); + final String passKey = await sl().getPassKey(phone); + AppRouter.navigatorKey.currentContext?.pushNamed('verifyScreen', extra: passKey); + return handler.reject( + DioException( + requestOptions: err.requestOptions, + response: err.response, + error: 'Phone number not verified', + type: DioExceptionType.badResponse, + ), + ); + } + } + return handler.next(err); + } +} diff --git a/lib/core/locator_service.dart b/lib/core/locator_service.dart index 15bb5270..fb5b82fa 100644 --- a/lib/core/locator_service.dart +++ b/lib/core/locator_service.dart @@ -1,5 +1,6 @@ import 'package:dio/dio.dart'; import 'package:eatvio_app/core/const.dart'; +import 'package:eatvio_app/core/dio/phone_verify_error_interceptor.dart'; import 'package:eatvio_app/core/interceptors/token_interceptor.dart'; import 'package:eatvio_app/core/websockets/ws_manager.dart'; import 'package:eatvio_app/core/websockets/ws_service.dart'; @@ -191,7 +192,20 @@ Future init() async { // External sl.registerLazySingleton( - () => Dio(BaseOptions(baseUrl: baseUrl, headers: {'accept': 'application/json', 'content-type': 'application/json'}))..interceptors.add(TokenInterceptor()), + () => Dio( + BaseOptions( + baseUrl: baseUrl, + headers: { + 'accept': 'application/json', + 'content-type': 'application/json', + }, + ), + )..interceptors.addAll( + [ + TokenInterceptor(), + PhoneVerifyErrorInterceptor(), + ], + ), ); sl.registerLazySingleton(() async => const FlutterSecureStorage()); } diff --git a/lib/features/auth/presentation/pages/auth_screen.dart b/lib/features/auth/presentation/pages/auth_screen.dart index cbd82a44..8c068755 100644 --- a/lib/features/auth/presentation/pages/auth_screen.dart +++ b/lib/features/auth/presentation/pages/auth_screen.dart @@ -119,7 +119,7 @@ class _AuthScreenState extends State { children: [ const Text('Нет аккаунта? '), GestureDetector( - onTap: () => GoRouter.of(context).goNamed('webViewRegistrationScreen'), + onTap: () => GoRouter.of(context).goNamed('registrationScreen'), child: Text( 'Зарегистрироваться', style: TextStyle( diff --git a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart index f06b4dc8..cdbab793 100644 --- a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart +++ b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart @@ -36,10 +36,6 @@ class ProfileCubit extends Cubit { } } - Future getPassKey(String phone) async { - return (await profileRepository.getPassKey('+79150626151')); - } - Future getMyProfile({ String period = '1', }) async { diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index 8dfd7eb0..f9a3961c 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -26,6 +26,7 @@ import 'package:eatvio_app/features/profile/presentation/widgets/profile_blog_po import 'package:eatvio_app/features/profile/presentation/widgets/weight_chart_widget.dart'; import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/features/profile/repositories/profile_repository.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -54,6 +55,7 @@ class _ProfileScreenState extends State { final List chipsLabelList = ['Вес', 'Замеры', 'ИМТ']; final List chipsIntervalLabelList = ['1М', '3М', '6М', '1Г', 'ВСЁ ВРЕМЯ']; final List chipsIntervalList = ['1', '3', '6', '12', 'all']; + final TextEditingController controller = TextEditingController(); List weightPoints = []; List circumferencePoints = []; @@ -222,9 +224,14 @@ class _ProfileScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ ElevatedButton(onPressed: () async { - final String passKey = await profileCubit.getPassKey('+79150626151'); - GoRouter.of(context).pushNamed('verifyScreen', extra: passKey); - }, child: Text('phone verify')), + await sl().sendEmailCode(); + }, child: Text('send email verify code')), + TextFormField( + controller: controller, + ), + ElevatedButton(onPressed: () async { + await sl().tryVerifyEmailByCode(controller.text); + }, child: Text('try verify email by code')), _header(state), if (state.profile.roles.contains('consultant')) Column( diff --git a/lib/features/profile/repositories/profile_repository.dart b/lib/features/profile/repositories/profile_repository.dart index 9c4f5fb4..46b3bcf6 100644 --- a/lib/features/profile/repositories/profile_repository.dart +++ b/lib/features/profile/repositories/profile_repository.dart @@ -185,4 +185,16 @@ class ProfileRepository { Future getPassKey(String phone) async { return (jsonDecode((await profileService.getPassKey(json: '{"route_name": "user_detailz.change-phone-verify", "route_params": {"phone": "$phone"}}'))))['key_is']!; } + + Future getMyPhone() async { + return (jsonDecode(await profileService.getMyPhone())['phone']); + } + + Future sendEmailCode() async { + return await profileService.sendEmailCode(); + } + + Future tryVerifyEmailByCode(String code) async { + return await profileService.tryVerifyEmailByCode(code: "{\"code\": \"$code\"}"); + } } diff --git a/lib/features/profile/services/profile_service.dart b/lib/features/profile/services/profile_service.dart index 0b1490dc..06af37b9 100644 --- a/lib/features/profile/services/profile_service.dart +++ b/lib/features/profile/services/profile_service.dart @@ -108,4 +108,15 @@ abstract class ProfileService { Future getPassKey({ @Body() required String json, }); + + @GET('/api/profile/my_phone') + Future getMyPhone(); + + @POST('/api/profile/send_email_code') + Future sendEmailCode(); + + @POST('/api/profile/verificate_email_code') + Future tryVerifyEmailByCode({ + @Body() required String code, + }); } diff --git a/lib/features/registration/models/user_registration_model.dart b/lib/features/registration/models/user_registration_model.dart index 1d75ba24..b999a077 100644 --- a/lib/features/registration/models/user_registration_model.dart +++ b/lib/features/registration/models/user_registration_model.dart @@ -16,7 +16,7 @@ abstract class UserRegistrationSheet with _$UserRegistrationSheet { required String birthdate, required String gender, required String location, - @JsonKey(name: 'response_body') required String responseBody, + @JsonKey(name: 'response_body', defaultValue: '{}') required String responseBody, required String lang, required int weight, required int height, diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart index 33688c9c..7b371f22 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -25,7 +25,7 @@ class RegistrationCubit extends Cubit { birthdate: '', gender: '', location: '', - responseBody: '', + responseBody: '{}', lang: 'Русский', weight: 0, height: 0, @@ -54,6 +54,7 @@ class RegistrationCubit extends Cubit { final token = await registrationRepository.tryRegister( state.sheet.copyWith( phone: state.sheet.phone.replaceAll(' ', '').replaceAll('(', '').replaceAll(')', ''), + responseBody: '{}', ), ); await TokenStorage.saveTokenInStorage(token); diff --git a/test/features/profile/services/profile_service_test.mocks.dart b/test/features/profile/services/profile_service_test.mocks.dart index b0aa976a..22c3af52 100644 --- a/test/features/profile/services/profile_service_test.mocks.dart +++ b/test/features/profile/services/profile_service_test.mocks.dart @@ -478,4 +478,49 @@ class MockProfileService extends _i1.Mock implements _i5.ProfileService { ), )), ) as _i6.Future); + + @override + _i6.Future getMyPhone() => (super.noSuchMethod( + Invocation.method( + #getMyPhone, + [], + ), + returnValue: _i6.Future.value(_i11.dummyValue( + this, + Invocation.method( + #getMyPhone, + [], + ), + )), + returnValueForMissingStub: + _i6.Future.value(_i11.dummyValue( + this, + Invocation.method( + #getMyPhone, + [], + ), + )), + ) as _i6.Future); + + @override + _i6.Future sendEmailCode() => (super.noSuchMethod( + Invocation.method( + #sendEmailCode, + [], + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); + + @override + _i6.Future tryVerifyEmailByCode({required String? code}) => + (super.noSuchMethod( + Invocation.method( + #tryVerifyEmailByCode, + [], + {#code: code}, + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } From b59190e4e843dd03cf3082d9c7df0ad0510ebbd2 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 23 May 2025 12:03:04 +0300 Subject: [PATCH 6/6] fix: analyzer --- lib/core/app_router.dart | 1 - lib/core/const.dart | 3 +-- lib/core/widgets/custom_popup.dart | 23 +++++++++++-------- .../presentation/pages/blog_post_screen.dart | 8 ++++--- .../presentation/widgets/more_options.dart | 8 +++---- .../widgets/blog_post_widget.dart | 8 +++---- .../presentation/widgets/diets_widget.dart | 8 +++---- .../presentation/widgets/plan_widget.dart | 8 +++---- .../presentation/widgets/recipes_widget.dart | 8 +++---- .../presentation/widgets/my_diet_widget.dart | 11 +++++---- .../presentation/widgets/my_plan_widget.dart | 8 +++---- .../presentation/pages/profile_screen.dart | 18 ++++----------- .../widgets/profile_blog_post_widget.dart | 8 +++---- .../presentation/pages/verify_screen.dart | 1 - 14 files changed, 58 insertions(+), 63 deletions(-) diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index bd3688a6..8ae1696e 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -44,7 +44,6 @@ import 'package:eatvio_app/features/recipe/presentation/about_recipe_screen.dart import 'package:eatvio_app/features/create_recipe/presentation/pages/recipe_create_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/registration_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/verify_screen.dart'; -import 'package:eatvio_app/features/registration/presentation/pages/webview_registration_screen.dart'; import 'package:eatvio_app/features/settings/entities/settings_entity.dart'; import 'package:eatvio_app/features/settings/presentation/pages/change_email_screen.dart'; import 'package:eatvio_app/features/settings/presentation/pages/change_password_screen.dart'; diff --git a/lib/core/const.dart b/lib/core/const.dart index 4022dfbe..31c47e9c 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,5 +1,4 @@ -String baseUrl = 'https://apoloz-nauch-vei9nieng5er.eatv.io'; -// String baseUrl = 'https://eatvio.ru'; +String baseUrl = 'https://eatvio.ru'; // String baseUrl = 'https://dev2.eatvio.com'; const List durationValues = [7, 14, 21]; diff --git a/lib/core/widgets/custom_popup.dart b/lib/core/widgets/custom_popup.dart index 011de1cd..67d87da5 100644 --- a/lib/core/widgets/custom_popup.dart +++ b/lib/core/widgets/custom_popup.dart @@ -91,11 +91,13 @@ class CustomPopup extends StatelessWidget { }); addItem('assets/icons/share2.svg', 'Поделиться', () { final box = context.findRenderObject() as RenderBox?; - Share.shareUri( - Uri.parse( - '$baseUrl/ru/$path', + SharePlus.instance.share( + ShareParams( + uri: Uri.parse( + '$baseUrl/ru/$path', + ), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }); addItem('assets/icons/edit_paint.svg', 'Редактировать', () async { @@ -104,7 +106,8 @@ class CustomPopup extends StatelessWidget { } else if (complainedContentType == ComplainedContent.recipe) { GoRouter.of(context).pushNamed(RecipeCreateScreen.name, extra: recipe); } else if (complainedContentType == ComplainedContent.diet) { - await showErrorDialog(context, title: 'Предупреждение', description: 'Диета будет перенесена в архив. Вы создаете новую диету на основе существующей.'); + await showErrorDialog(context, + title: 'Предупреждение', description: 'Диета будет перенесена в архив. Вы создаете новую диету на основе существующей.'); await sl().unpublishDiet(id!); GoRouter.of(context).pushNamed(CreateDietScreen.name, extra: diet); } else { @@ -169,11 +172,13 @@ class CustomPopup extends StatelessWidget { }); addItem('assets/icons/share2.svg', 'Поделиться', () { final box = context.findRenderObject() as RenderBox?; - Share.shareUri( - Uri.parse( - '$baseUrl/ru/$path', + SharePlus.instance.share( + ShareParams( + uri: Uri.parse( + '$baseUrl/ru/$path', + ), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }); addItem('assets/icons/complain.svg', 'Пожаловаться', () { diff --git a/lib/features/blog_post/presentation/pages/blog_post_screen.dart b/lib/features/blog_post/presentation/pages/blog_post_screen.dart index e963a812..fe3e7bda 100644 --- a/lib/features/blog_post/presentation/pages/blog_post_screen.dart +++ b/lib/features/blog_post/presentation/pages/blog_post_screen.dart @@ -242,9 +242,11 @@ class _BlogPostScreenState extends State { icon: Icons.reply_rounded, onTap: () { final box = context.findRenderObject() as RenderBox?; - Share.shareUri( - Uri.parse('$baseUrl/ru/blog_post/${widget.blogPost.id}'), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, + SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/blog_post/${widget.blogPost.id}'), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, + ), ); }, ), diff --git a/lib/features/diets/presentation/widgets/more_options.dart b/lib/features/diets/presentation/widgets/more_options.dart index 63494590..4c28e5c9 100644 --- a/lib/features/diets/presentation/widgets/more_options.dart +++ b/lib/features/diets/presentation/widgets/more_options.dart @@ -60,11 +60,11 @@ class MoreOptions extends StatelessWidget { ? null : () { final box = context.findRenderObject() as RenderBox?; - Share.shareUri( - Uri.parse( - '$baseUrl/ru/$path', + SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/$path',), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, child: Row( diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index f5b8dd2d..c5f6ff5f 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -243,11 +243,11 @@ class _BlogPostWidgetState extends State { ), onTap: () { final box = context.findRenderObject() as RenderBox?; - Share.shareUri( - Uri.parse( - '$baseUrl/ru/blog_post/${state.feedBlogPostList[widget.index].id}', + SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/blog_post/${state.feedBlogPostList[widget.index].id}',), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, ), diff --git a/lib/features/feed/presentation/widgets/diets_widget.dart b/lib/features/feed/presentation/widgets/diets_widget.dart index bcf1056a..e857e979 100644 --- a/lib/features/feed/presentation/widgets/diets_widget.dart +++ b/lib/features/feed/presentation/widgets/diets_widget.dart @@ -186,11 +186,11 @@ class _DietsWidgetState extends State { svgIcon: SvgPicture.asset('assets/icons/repost.svg'), onTap: () async { final box = context.findRenderObject() as RenderBox?; - final result = await Share.shareUri( - Uri.parse( - '$baseUrl/ru/diet/${widget.diet.id}', + final result = await SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/diet/${widget.diet.id}'), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); switch (result.status) { case ShareResultStatus.success: diff --git a/lib/features/feed/presentation/widgets/plan_widget.dart b/lib/features/feed/presentation/widgets/plan_widget.dart index 608d647b..849549e8 100644 --- a/lib/features/feed/presentation/widgets/plan_widget.dart +++ b/lib/features/feed/presentation/widgets/plan_widget.dart @@ -257,11 +257,11 @@ class _PlanWidgetState extends State { svgIcon: SvgPicture.asset('assets/icons/repost.svg'), onTap: () async { final box = context.findRenderObject() as RenderBox?; - final result = await Share.shareUri( - Uri.parse( - '$baseUrl/ru/diet/${widget.plan.id}', + final result = await SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/diet/${widget.plan.id}'), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); switch (result.status) { case ShareResultStatus.success: diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart index 53022a92..47a8ab0f 100644 --- a/lib/features/feed/presentation/widgets/recipes_widget.dart +++ b/lib/features/feed/presentation/widgets/recipes_widget.dart @@ -226,11 +226,11 @@ class _RecipesWidgetState extends State { ), onTap: () { final box = context.findRenderObject() as RenderBox?; - Share.shareUri( - Uri.parse( - '$baseUrl/ru/blog_post/${widget.recipe.id}', + SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/blog_post/${widget.recipe.id}'), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, ), diff --git a/lib/features/my_diets/presentation/widgets/my_diet_widget.dart b/lib/features/my_diets/presentation/widgets/my_diet_widget.dart index 99489f9d..7eb7f15c 100644 --- a/lib/features/my_diets/presentation/widgets/my_diet_widget.dart +++ b/lib/features/my_diets/presentation/widgets/my_diet_widget.dart @@ -1,4 +1,5 @@ import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_router.dart'; import 'package:eatvio_app/core/const.dart'; import 'package:eatvio_app/core/theme/custom_text_style.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; @@ -149,11 +150,11 @@ class _MyDietWidgetState extends State { CustomOutlinedButton( onPressed: () async { final box = context.findRenderObject() as RenderBox?; - await Share.shareUri( - Uri.parse( - '$baseUrl/ru/diet/${widget.diet.id}', + await SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/diet/${widget.diet.id}'), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, height: 52, @@ -196,7 +197,7 @@ class _MyDietWidgetState extends State { } } else { await showErrorDialog(context, title: 'Предупреждение', description: 'Вы можете создать новую диету на основе существующей.'); - GoRouter.of(context).pushNamed(CreateDietScreen.name, extra: widget.diet); + AppRouter.navigatorKey.currentContext?.pushNamed(CreateDietScreen.name, extra: widget.diet); } }, text: switch (state.selectedStateIndex) { diff --git a/lib/features/my_plans/presentation/widgets/my_plan_widget.dart b/lib/features/my_plans/presentation/widgets/my_plan_widget.dart index f9594340..baea0c01 100644 --- a/lib/features/my_plans/presentation/widgets/my_plan_widget.dart +++ b/lib/features/my_plans/presentation/widgets/my_plan_widget.dart @@ -138,11 +138,11 @@ class _MyPlanWidgetState extends State { CustomOutlinedButton( onPressed: () async { final box = context.findRenderObject() as RenderBox?; - await Share.shareUri( - Uri.parse( - '$baseUrl/ru/plan/${widget.plan.id}', + await SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/plan/${widget.plan.id}'), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, height: 52, diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index f9a3961c..79c41c54 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -26,7 +26,6 @@ import 'package:eatvio_app/features/profile/presentation/widgets/profile_blog_po import 'package:eatvio_app/features/profile/presentation/widgets/weight_chart_widget.dart'; import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; -import 'package:eatvio_app/features/profile/repositories/profile_repository.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -223,15 +222,6 @@ class _ProfileScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - ElevatedButton(onPressed: () async { - await sl().sendEmailCode(); - }, child: Text('send email verify code')), - TextFormField( - controller: controller, - ), - ElevatedButton(onPressed: () async { - await sl().tryVerifyEmailByCode(controller.text); - }, child: Text('try verify email by code')), _header(state), if (state.profile.roles.contains('consultant')) Column( @@ -1136,11 +1126,11 @@ class _ProfileScreenState extends State { onSelected: (value) { if (value == 'share') { final box = context.findRenderObject() as RenderBox?; - Share.shareUri( - Uri.parse( - '$baseUrl/ru/profile/${state.profile.slug}', + SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/profile/${state.profile.slug}'), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); } else { showModalBottomSheet( diff --git a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart index ab920ea2..43ade18c 100644 --- a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart +++ b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart @@ -214,11 +214,11 @@ class _ProfileBlogPostWidgetState extends State { ), onTap: () { final box = context.findRenderObject() as RenderBox?; - Share.shareUri( - Uri.parse( - '$baseUrl/ru/blog_post/${state.blogPosts[widget.index].id}', + SharePlus.instance.share( + ShareParams( + uri: Uri.parse('$baseUrl/ru/blog_post/${state.blogPosts[widget.index].id}'), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ), - sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, ), diff --git a/lib/features/registration/presentation/pages/verify_screen.dart b/lib/features/registration/presentation/pages/verify_screen.dart index 4fecd1e1..69fa009c 100644 --- a/lib/features/registration/presentation/pages/verify_screen.dart +++ b/lib/features/registration/presentation/pages/verify_screen.dart @@ -20,7 +20,6 @@ class _VerifyScreenState extends State { @override void initState() { super.initState(); - print('$baseUrl/login_with_pass_key?id=${widget.passKey}'); _controller = WebViewController() ..setJavaScriptMode(JavaScriptMode.unrestricted) ..loadRequest(Uri.parse('$baseUrl/login_with_pass_key?id=${widget.passKey}'));