diff --git a/analysis_options.yaml b/analysis_options.yaml index a614abae..63d4f990 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,5 +1,10 @@ +include: package:flutter_lints/flutter.yaml + linter: rules: + prefer_const_constructors: true + prefer_const_declarations: true + prefer_const_literals_to_create_immutables: true analyzer: exclude: diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 79228258..d12f15f2 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -9,11 +9,12 @@ import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/b import 'package:eatvio_app/features/calendar/presentation/pages/calendar_screen.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_screen.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chats_screen.dart'; +import 'package:eatvio_app/features/chat/presentation/pages/payment_screen.dart'; import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart'; import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart'; import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart'; import 'package:eatvio_app/features/consultations/presentation/pages/consultations_screen.dart'; -import 'package:eatvio_app/features/consultations/presentation/pages/info_by_order_screen.dart'; +import 'package:eatvio_app/features/order_info/presentation/info_by_order_screen.dart'; import 'package:eatvio_app/features/create_diet/presentation/create_diet_screen.dart'; import 'package:eatvio_app/features/create_diet/presentation/diet_preview_screen.dart'; import 'package:eatvio_app/features/create_plan/presentation/create_plan_screen.dart'; @@ -34,6 +35,7 @@ import 'package:eatvio_app/features/my_finance/presentation/pages/user_finance_s import 'package:eatvio_app/features/my_plans/presentation/my_plans_screen.dart'; import 'package:eatvio_app/features/notifications/presentation/pages/notifications_screen.dart'; import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart'; +import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart'; import 'package:eatvio_app/features/plans/presentation/pages/about_plan_screen.dart'; import 'package:eatvio_app/features/profile/presentation/pages/profile_screen.dart'; import 'package:eatvio_app/features/profile/presentation/pages/subs_screen.dart'; @@ -77,9 +79,9 @@ class AppRouter { return BlocBuilder( builder: (BuildContext context, ProfileAvatarState state) { if (state is ProfileAvatarStateLoaded) { - return BottomNavigationBarWidget(child: child, profileModel: state.profile); + return BottomNavigationBarWidget(profileModel: state.profile, child: child); } - return SizedBox.shrink(); + return const SizedBox.shrink(); }, ); }, @@ -92,45 +94,50 @@ class AppRouter { return null; }, pageBuilder: (context, state) { - return NoTransitionPage(child: ProfileScreen()); + return const NoTransitionPage(child: ProfileScreen()); }, ), - GoRoute(path: '/feed-screen', name: 'feedScreen', pageBuilder: (context, state) => NoTransitionPage(child: FeedScreen())), - GoRoute(path: '/diary-screen', name: 'diaryScreen', pageBuilder: (context, state) => NoTransitionPage(child: DiaryScreen())), - GoRoute(path: '/consultations-screen', name: 'consultationsScreen', pageBuilder: (context, state) => NoTransitionPage(child: ConsultationsScreen())), - GoRoute(path: '/chat-select-screen', name: 'chatSelectScreen', pageBuilder: (context, state) => NoTransitionPage(child: ChatsScreen())), - GoRoute(path: '/notifications-screen', name: 'notificationsScreen', pageBuilder: (context, state) => NoTransitionPage(child: NotificationsScreen())), + GoRoute(path: '/feed-screen', name: 'feedScreen', pageBuilder: (context, state) => const NoTransitionPage(child: FeedScreen())), + GoRoute(path: '/diary-screen', name: 'diaryScreen', pageBuilder: (context, state) => const NoTransitionPage(child: DiaryScreen())), + GoRoute( + path: '/consultations-screen', + name: 'consultationsScreen', + pageBuilder: (context, state) => const NoTransitionPage(child: ConsultationsScreen())), + GoRoute(path: '/chat-select-screen', name: 'chatSelectScreen', pageBuilder: (context, state) => const NoTransitionPage(child: ChatsScreen())), + GoRoute( + path: '/notifications-screen', + name: 'notificationsScreen', + pageBuilder: (context, state) => const NoTransitionPage(child: NotificationsScreen())), GoRoute( path: '/menu-screen', name: 'menuScreen', - pageBuilder: - (context, state) => NoTransitionPage( - child: BlocBuilder( - builder: (BuildContext context, ProfileAvatarState state) { - if (state is ProfileAvatarStateLoaded) { - return MenuScreen(profileModel: state.profile); - } - return SizedBox.shrink(); - }, - ), - ), + pageBuilder: (context, state) => NoTransitionPage( + child: BlocBuilder( + builder: (BuildContext context, ProfileAvatarState state) { + if (state is ProfileAvatarStateLoaded) { + return MenuScreen(profileModel: state.profile); + } + return const SizedBox.shrink(); + }, + ), + ), ), ], ), GoRoute( path: '/consultant-finance-screen', name: 'consultantFinanceScreen', - builder: (context, state) => ConsultantFinanceScreen(), + builder: (context, state) => const ConsultantFinanceScreen(), ), GoRoute( path: '/user-finance-screen', name: 'userFinanceScreen', - builder: (context, state) => UserFinanceScreen(), + builder: (context, state) => const UserFinanceScreen(), ), GoRoute( path: CardSettingsScreen.path, name: CardSettingsScreen.name, - builder: (context, state) => CardSettingsScreen(), + builder: (context, state) => const CardSettingsScreen(), ), GoRoute( path: '/about-plan-screen', @@ -140,7 +147,7 @@ class AppRouter { return AboutPlanScreen(plan: data['plan'] as PlanModel, index: data['index'] as int?, navigateToComments: data['navigateToComments'] as bool); }, ), - GoRoute(path: '/glossary-screen', name: 'glossaryScreen', builder: (context, state) => GlossaryScreen()), + GoRoute(path: '/glossary-screen', name: 'glossaryScreen', builder: (context, state) => const GlossaryScreen()), GoRoute( path: '/about-recipes-screen', name: 'aboutRecipesScreen', @@ -149,7 +156,7 @@ class AppRouter { return AboutRecipeScreen(recipe: data['recipe'] as Recipe, index: data['index'] as int?, navigateToComments: data['navigateToComments'] as bool); }, ), - GoRoute(path: RecipeCreateScreen.path, name: RecipeCreateScreen.name, builder: (context, state) => RecipeCreateScreen()), + GoRoute(path: RecipeCreateScreen.path, name: RecipeCreateScreen.name, builder: (context, state) => const RecipeCreateScreen()), GoRoute(path: '/profile-screen', name: 'profileScreen', builder: (context, state) => ProfileScreen(author: state.extra as Author)), GoRoute( path: '/subs-screen/:slug', @@ -182,7 +189,7 @@ class AppRouter { GoRoute( path: '/settings-screen', name: 'settingsScreen', - builder: (context, state) => SettingsScreen(), + builder: (context, state) => const SettingsScreen(), routes: [ GoRoute( path: 'general-info-screen', @@ -217,10 +224,11 @@ class AppRouter { ), ], ), - GoRoute(path: '/become-consultant-screen', name: 'becomeConsultantScreen', builder: (context, state) => BecomeConsultantScreen()), - GoRoute(path: '/stepper-become-consultant-screen', name: 'stepperBecomeConsultantScreen', builder: (context, state) => StepperBecomeConsultantScreen()), - GoRoute(path: '/calendar-screen', name: 'calendarScreen', builder: (context, state) => CalendarScreen()), - GoRoute(path: '/support-screen', name: 'supportScreen', builder: (context, state) => SupportScreen()), + GoRoute(path: '/become-consultant-screen', name: 'becomeConsultantScreen', builder: (context, state) => const BecomeConsultantScreen()), + GoRoute( + path: '/stepper-become-consultant-screen', name: 'stepperBecomeConsultantScreen', builder: (context, state) => const StepperBecomeConsultantScreen()), + GoRoute(path: '/calendar-screen', name: 'calendarScreen', builder: (context, state) => const CalendarScreen()), + GoRoute(path: '/support-screen', name: 'supportScreen', builder: (context, state) => const SupportScreen()), GoRoute( path: '/photo-view-screen/:index', name: 'photoViewScreen', @@ -242,13 +250,24 @@ class AppRouter { return DietPreviewScreen(diet: data); }, ), - GoRoute(path: CreatePlanScreen.path, name: CreatePlanScreen.name, builder: (context, state) => CreatePlanScreen()), - GoRoute(path: MyDietsScreen.path, name: MyDietsScreen.name, builder: (context, state) => MyDietsScreen()), - GoRoute(path: MyPlansScreen.path, name: MyPlansScreen.name, builder: (context, state) => MyPlansScreen()), + GoRoute(path: CreatePlanScreen.path, name: CreatePlanScreen.name, builder: (context, state) => const CreatePlanScreen()), + GoRoute(path: MyDietsScreen.path, name: MyDietsScreen.name, builder: (context, state) => const MyDietsScreen()), + GoRoute(path: MyPlansScreen.path, name: MyPlansScreen.name, builder: (context, state) => const MyPlansScreen()), GoRoute(path: UserDetailsScreen.path, name: UserDetailsScreen.name, builder: (context, state) => UserDetailsScreen(slug: state.extra as String)), - GoRoute(path: DevToolsScreen.path, name: DevToolsScreen.name, builder: (context, state) => DevToolsScreen()), - GoRoute(path: ConsultantRatingScreen.path, name: ConsultantRatingScreen.name, builder: (context, state) => ConsultantRatingScreen()), - GoRoute(path: InfoByOrderScreen.path, name: InfoByOrderScreen.name, builder: (context, state) => InfoByOrderScreen()), + GoRoute(path: DevToolsScreen.path, name: DevToolsScreen.name, builder: (context, state) => const DevToolsScreen()), + GoRoute(path: ConsultantRatingScreen.path, name: ConsultantRatingScreen.name, builder: (context, state) => const ConsultantRatingScreen()), + GoRoute( + path: InfoByOrderScreen.path, + name: InfoByOrderScreen.name, + builder: (context, state) => InfoByOrderScreen( + plan: state.extra as ChosenPlanModel, + )), + GoRoute( + path: PaymentScreen.path, + name: PaymentScreen.name, + builder: (context, state) => PaymentScreen( + url: state.extra as String, + )), ], ); } diff --git a/lib/core/const.dart b/lib/core/const.dart index 31c47e9c..4f38a54e 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/core/credentials_storage.dart b/lib/core/credentials_storage.dart index 6cf97c90..7bbd0bef 100644 --- a/lib/core/credentials_storage.dart +++ b/lib/core/credentials_storage.dart @@ -3,7 +3,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; abstract class CredentialsStorage { static Future haveCredentialsInStorage() async { try { - if (await FlutterSecureStorage().read(key: 'email') == null || await FlutterSecureStorage().read(key: 'password') == null) { + if (await const FlutterSecureStorage().read(key: 'email') == null || await const FlutterSecureStorage().read(key: 'password') == null) { return false; } else { return true; @@ -15,18 +15,18 @@ abstract class CredentialsStorage { static Future> getCredentialsFromStorage() async { return { - 'email': (await FlutterSecureStorage().read(key: 'email'))!, - 'password': (await FlutterSecureStorage().read(key: 'password'))!, + 'email': (await const FlutterSecureStorage().read(key: 'email'))!, + 'password': (await const FlutterSecureStorage().read(key: 'password'))!, }; } static saveCredentials(String email, String password) async { - await FlutterSecureStorage().write(key: 'email', value: email); - await FlutterSecureStorage().write(key: 'password', value: password); + await const FlutterSecureStorage().write(key: 'email', value: email); + await const FlutterSecureStorage().write(key: 'password', value: password); } static removeCredentials() async { - await FlutterSecureStorage().delete(key: 'email'); - await FlutterSecureStorage().delete(key: 'password'); + await const FlutterSecureStorage().delete(key: 'email'); + await const FlutterSecureStorage().delete(key: 'password'); } } diff --git a/lib/core/data/selectionPopupModel/selection_popup_model.freezed.dart b/lib/core/data/selectionPopupModel/selection_popup_model.freezed.dart index 5270e0b2..97ab368c 100644 --- a/lib/core/data/selectionPopupModel/selection_popup_model.freezed.dart +++ b/lib/core/data/selectionPopupModel/selection_popup_model.freezed.dart @@ -12,8 +12,7 @@ part of 'selection_popup_model.dart'; 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', -); + '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'); /// @nodoc mixin _$SelectionPopupModel { @@ -32,9 +31,8 @@ mixin _$SelectionPopupModel { /// @nodoc abstract class $SelectionPopupModelCopyWith<$Res> { factory $SelectionPopupModelCopyWith( - SelectionPopupModel value, - $Res Function(SelectionPopupModel) then, - ) = _$SelectionPopupModelCopyWithImpl<$Res, SelectionPopupModel>; + SelectionPopupModel value, $Res Function(SelectionPopupModel) then) = + _$SelectionPopupModelCopyWithImpl<$Res, SelectionPopupModel>; @useResult $Res call({int? id, String title, dynamic value, bool isSelected}); } @@ -59,41 +57,33 @@ class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> Object? value = freezed, Object? isSelected = null, }) { - return _then( - _value.copyWith( - id: - freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int?, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - value: - freezed == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as dynamic, - isSelected: - null == isSelected - ? _value.isSelected - : isSelected // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + return _then(_value.copyWith( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int?, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + value: freezed == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as dynamic, + isSelected: null == isSelected + ? _value.isSelected + : isSelected // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } } /// @nodoc abstract class _$$SelectionPopupModelImplCopyWith<$Res> implements $SelectionPopupModelCopyWith<$Res> { - factory _$$SelectionPopupModelImplCopyWith( - _$SelectionPopupModelImpl value, - $Res Function(_$SelectionPopupModelImpl) then, - ) = __$$SelectionPopupModelImplCopyWithImpl<$Res>; + factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value, + $Res Function(_$SelectionPopupModelImpl) then) = + __$$SelectionPopupModelImplCopyWithImpl<$Res>; @override @useResult $Res call({int? id, String title, dynamic value, bool isSelected}); @@ -103,10 +93,9 @@ abstract class _$$SelectionPopupModelImplCopyWith<$Res> class __$$SelectionPopupModelImplCopyWithImpl<$Res> extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl> implements _$$SelectionPopupModelImplCopyWith<$Res> { - __$$SelectionPopupModelImplCopyWithImpl( - _$SelectionPopupModelImpl _value, - $Res Function(_$SelectionPopupModelImpl) _then, - ) : super(_value, _then); + __$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value, + $Res Function(_$SelectionPopupModelImpl) _then) + : super(_value, _then); /// Create a copy of SelectionPopupModel /// with the given fields replaced by the non-null parameter values. @@ -118,42 +107,32 @@ class __$$SelectionPopupModelImplCopyWithImpl<$Res> Object? value = freezed, Object? isSelected = null, }) { - return _then( - _$SelectionPopupModelImpl( - id: - freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int?, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - value: - freezed == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as dynamic, - isSelected: - null == isSelected - ? _value.isSelected - : isSelected // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + return _then(_$SelectionPopupModelImpl( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int?, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + value: freezed == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as dynamic, + isSelected: null == isSelected + ? _value.isSelected + : isSelected // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc class _$SelectionPopupModelImpl implements _SelectionPopupModel { - const _$SelectionPopupModelImpl({ - this.id, - required this.title, - this.value, - this.isSelected = false, - }); + const _$SelectionPopupModelImpl( + {this.id, required this.title, this.value, this.isSelected = false}); @override final int? id; @@ -183,13 +162,8 @@ class _$SelectionPopupModelImpl implements _SelectionPopupModel { } @override - int get hashCode => Object.hash( - runtimeType, - id, - title, - const DeepCollectionEquality().hash(value), - isSelected, - ); + int get hashCode => Object.hash(runtimeType, id, title, + const DeepCollectionEquality().hash(value), isSelected); /// Create a copy of SelectionPopupModel /// with the given fields replaced by the non-null parameter values. @@ -198,18 +172,15 @@ class _$SelectionPopupModelImpl implements _SelectionPopupModel { @pragma('vm:prefer-inline') _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => __$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _SelectionPopupModel implements SelectionPopupModel { - const factory _SelectionPopupModel({ - final int? id, - required final String title, - final dynamic value, - final bool isSelected, - }) = _$SelectionPopupModelImpl; + const factory _SelectionPopupModel( + {final int? id, + required final String title, + final dynamic value, + final bool isSelected}) = _$SelectionPopupModelImpl; @override int? get id; diff --git a/lib/core/locator_service.dart b/lib/core/locator_service.dart index 4320423a..87d05fba 100644 --- a/lib/core/locator_service.dart +++ b/lib/core/locator_service.dart @@ -79,7 +79,7 @@ import 'package:eatvio_app/features/settings/services/settings_service.dart'; import 'package:eatvio_app/features/user_details/presentation/cubit/user_details_cubit.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:get_it/get_it.dart'; -import 'package:eatvio_app/features/profile/presentation/bloc/plans_cubit/plans_cubit.dart' as profilePlans; +import 'package:eatvio_app/features/profile/presentation/bloc/plans_cubit/plans_cubit.dart' as profile_plans; final sl = GetIt.instance; @@ -98,7 +98,7 @@ Future init() async { sl.registerFactory(() => RecipesCubit(feedRepository: sl(), recipeRepository: sl(), aboutRecipeRepository: sl())); sl.registerFactory(() => CalendarCubit(calendarRepository: sl())); sl.registerFactory(() => ProfileCubit(profileRepository: sl(), chatRepository: sl())); - sl.registerFactory(() => profilePlans.PlansCubit(plansRepository: sl())); + sl.registerFactory(() => profile_plans.PlansCubit(plansRepository: sl())); sl.registerFactory(() => DietsCubit(feedRepository: sl(), dietsRepository: sl())); sl.registerFactory(() => CommentsCubit(feedRepository: sl())); sl.registerFactory(() => PlansCubit(feedRepository: sl(), planRepository: sl())); @@ -173,5 +173,5 @@ Future init() async { sl.registerLazySingleton( () => Dio(BaseOptions(baseUrl: baseUrl, headers: {'accept': 'application/json', 'content-type': 'application/json'}))..interceptors.add(TokenInterceptor()), ); - sl.registerLazySingleton(() async => await FlutterSecureStorage()); + sl.registerLazySingleton(() async => const FlutterSecureStorage()); } diff --git a/lib/core/models/pagination_model.freezed.dart b/lib/core/models/pagination_model.freezed.dart index daeb8b5f..4d014abf 100644 --- a/lib/core/models/pagination_model.freezed.dart +++ b/lib/core/models/pagination_model.freezed.dart @@ -12,8 +12,7 @@ part of 'pagination_model.dart'; 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', -); + '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'); Links _$LinksFromJson(Map json) { return _Links.fromJson(json); @@ -44,12 +43,11 @@ abstract class $LinksCopyWith<$Res> { factory $LinksCopyWith(Links value, $Res Function(Links) then) = _$LinksCopyWithImpl<$Res, Links>; @useResult - $Res call({ - @JsonKey(name: "first") String first, - @JsonKey(name: "last") String last, - @JsonKey(name: "prev") dynamic prev, - @JsonKey(name: "next") dynamic next, - }); + $Res call( + {@JsonKey(name: "first") String first, + @JsonKey(name: "last") String last, + @JsonKey(name: "prev") dynamic prev, + @JsonKey(name: "next") dynamic next}); } /// @nodoc @@ -72,48 +70,39 @@ class _$LinksCopyWithImpl<$Res, $Val extends Links> Object? prev = freezed, Object? next = freezed, }) { - return _then( - _value.copyWith( - first: - null == first - ? _value.first - : first // ignore: cast_nullable_to_non_nullable - as String, - last: - null == last - ? _value.last - : last // ignore: cast_nullable_to_non_nullable - as String, - prev: - freezed == prev - ? _value.prev - : prev // ignore: cast_nullable_to_non_nullable - as dynamic, - next: - freezed == next - ? _value.next - : next // ignore: cast_nullable_to_non_nullable - as dynamic, - ) - as $Val, - ); + return _then(_value.copyWith( + first: null == first + ? _value.first + : first // ignore: cast_nullable_to_non_nullable + as String, + last: null == last + ? _value.last + : last // ignore: cast_nullable_to_non_nullable + as String, + prev: freezed == prev + ? _value.prev + : prev // ignore: cast_nullable_to_non_nullable + as dynamic, + next: freezed == next + ? _value.next + : next // ignore: cast_nullable_to_non_nullable + as dynamic, + ) as $Val); } } /// @nodoc abstract class _$$LinksImplCopyWith<$Res> implements $LinksCopyWith<$Res> { factory _$$LinksImplCopyWith( - _$LinksImpl value, - $Res Function(_$LinksImpl) then, - ) = __$$LinksImplCopyWithImpl<$Res>; + _$LinksImpl value, $Res Function(_$LinksImpl) then) = + __$$LinksImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "first") String first, - @JsonKey(name: "last") String last, - @JsonKey(name: "prev") dynamic prev, - @JsonKey(name: "next") dynamic next, - }); + $Res call( + {@JsonKey(name: "first") String first, + @JsonKey(name: "last") String last, + @JsonKey(name: "prev") dynamic prev, + @JsonKey(name: "next") dynamic next}); } /// @nodoc @@ -121,9 +110,8 @@ class __$$LinksImplCopyWithImpl<$Res> extends _$LinksCopyWithImpl<$Res, _$LinksImpl> implements _$$LinksImplCopyWith<$Res> { __$$LinksImplCopyWithImpl( - _$LinksImpl _value, - $Res Function(_$LinksImpl) _then, - ) : super(_value, _then); + _$LinksImpl _value, $Res Function(_$LinksImpl) _then) + : super(_value, _then); /// Create a copy of Links /// with the given fields replaced by the non-null parameter values. @@ -135,42 +123,35 @@ class __$$LinksImplCopyWithImpl<$Res> Object? prev = freezed, Object? next = freezed, }) { - return _then( - _$LinksImpl( - first: - null == first - ? _value.first - : first // ignore: cast_nullable_to_non_nullable - as String, - last: - null == last - ? _value.last - : last // ignore: cast_nullable_to_non_nullable - as String, - prev: - freezed == prev - ? _value.prev - : prev // ignore: cast_nullable_to_non_nullable - as dynamic, - next: - freezed == next - ? _value.next - : next // ignore: cast_nullable_to_non_nullable - as dynamic, - ), - ); + return _then(_$LinksImpl( + first: null == first + ? _value.first + : first // ignore: cast_nullable_to_non_nullable + as String, + last: null == last + ? _value.last + : last // ignore: cast_nullable_to_non_nullable + as String, + prev: freezed == prev + ? _value.prev + : prev // ignore: cast_nullable_to_non_nullable + as dynamic, + next: freezed == next + ? _value.next + : next // ignore: cast_nullable_to_non_nullable + as dynamic, + )); } } /// @nodoc @JsonSerializable() class _$LinksImpl implements _Links { - const _$LinksImpl({ - @JsonKey(name: "first") required this.first, - @JsonKey(name: "last") required this.last, - @JsonKey(name: "prev") required this.prev, - @JsonKey(name: "next") required this.next, - }); + const _$LinksImpl( + {@JsonKey(name: "first") required this.first, + @JsonKey(name: "last") required this.last, + @JsonKey(name: "prev") required this.prev, + @JsonKey(name: "next") required this.next}); factory _$LinksImpl.fromJson(Map json) => _$$LinksImplFromJson(json); @@ -207,12 +188,11 @@ class _$LinksImpl implements _Links { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - first, - last, - const DeepCollectionEquality().hash(prev), - const DeepCollectionEquality().hash(next), - ); + runtimeType, + first, + last, + const DeepCollectionEquality().hash(prev), + const DeepCollectionEquality().hash(next)); /// Create a copy of Links /// with the given fields replaced by the non-null parameter values. @@ -224,17 +204,18 @@ class _$LinksImpl implements _Links { @override Map toJson() { - return _$$LinksImplToJson(this); + return _$$LinksImplToJson( + this, + ); } } abstract class _Links implements Links { - const factory _Links({ - @JsonKey(name: "first") required final String first, - @JsonKey(name: "last") required final String last, - @JsonKey(name: "prev") required final dynamic prev, - @JsonKey(name: "next") required final dynamic next, - }) = _$LinksImpl; + const factory _Links( + {@JsonKey(name: "first") required final String first, + @JsonKey(name: "last") required final String last, + @JsonKey(name: "prev") required final dynamic prev, + @JsonKey(name: "next") required final dynamic next}) = _$LinksImpl; factory _Links.fromJson(Map json) = _$LinksImpl.fromJson; @@ -300,18 +281,17 @@ abstract class $MetaCopyWith<$Res> { factory $MetaCopyWith(Meta value, $Res Function(Meta) then) = _$MetaCopyWithImpl<$Res, Meta>; @useResult - $Res call({ - @JsonKey(name: "current_page") int currentPage, - @JsonKey(name: "from") dynamic from, - @JsonKey(name: "last_page") int lastPage, - @JsonKey(name: "links") List links, - @JsonKey(name: "path") String? path, - @JsonKey(name: "per_page") int perPage, - @JsonKey(name: "to") dynamic to, - @JsonKey(name: "total") int total, - @JsonKey(name: "total_min_price") int? totalMinPrice, - @JsonKey(name: "total_max_price") int? totalMaxPrice, - }); + $Res call( + {@JsonKey(name: "current_page") int currentPage, + @JsonKey(name: "from") dynamic from, + @JsonKey(name: "last_page") int lastPage, + @JsonKey(name: "links") List links, + @JsonKey(name: "path") String? path, + @JsonKey(name: "per_page") int perPage, + @JsonKey(name: "to") dynamic to, + @JsonKey(name: "total") int total, + @JsonKey(name: "total_min_price") int? totalMinPrice, + @JsonKey(name: "total_max_price") int? totalMaxPrice}); } /// @nodoc @@ -340,84 +320,69 @@ class _$MetaCopyWithImpl<$Res, $Val extends Meta> Object? totalMinPrice = freezed, Object? totalMaxPrice = freezed, }) { - return _then( - _value.copyWith( - currentPage: - null == currentPage - ? _value.currentPage - : currentPage // ignore: cast_nullable_to_non_nullable - as int, - from: - freezed == from - ? _value.from - : from // ignore: cast_nullable_to_non_nullable - as dynamic, - lastPage: - null == lastPage - ? _value.lastPage - : lastPage // ignore: cast_nullable_to_non_nullable - as int, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as List, - path: - freezed == path - ? _value.path - : path // ignore: cast_nullable_to_non_nullable - as String?, - perPage: - null == perPage - ? _value.perPage - : perPage // ignore: cast_nullable_to_non_nullable - as int, - to: - freezed == to - ? _value.to - : to // ignore: cast_nullable_to_non_nullable - as dynamic, - total: - null == total - ? _value.total - : total // ignore: cast_nullable_to_non_nullable - as int, - totalMinPrice: - freezed == totalMinPrice - ? _value.totalMinPrice - : totalMinPrice // ignore: cast_nullable_to_non_nullable - as int?, - totalMaxPrice: - freezed == totalMaxPrice - ? _value.totalMaxPrice - : totalMaxPrice // ignore: cast_nullable_to_non_nullable - as int?, - ) - as $Val, - ); + return _then(_value.copyWith( + currentPage: null == currentPage + ? _value.currentPage + : currentPage // ignore: cast_nullable_to_non_nullable + as int, + from: freezed == from + ? _value.from + : from // ignore: cast_nullable_to_non_nullable + as dynamic, + lastPage: null == lastPage + ? _value.lastPage + : lastPage // ignore: cast_nullable_to_non_nullable + as int, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as List, + path: freezed == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String?, + perPage: null == perPage + ? _value.perPage + : perPage // ignore: cast_nullable_to_non_nullable + as int, + to: freezed == to + ? _value.to + : to // ignore: cast_nullable_to_non_nullable + as dynamic, + total: null == total + ? _value.total + : total // ignore: cast_nullable_to_non_nullable + as int, + totalMinPrice: freezed == totalMinPrice + ? _value.totalMinPrice + : totalMinPrice // ignore: cast_nullable_to_non_nullable + as int?, + totalMaxPrice: freezed == totalMaxPrice + ? _value.totalMaxPrice + : totalMaxPrice // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); } } /// @nodoc abstract class _$$MetaImplCopyWith<$Res> implements $MetaCopyWith<$Res> { factory _$$MetaImplCopyWith( - _$MetaImpl value, - $Res Function(_$MetaImpl) then, - ) = __$$MetaImplCopyWithImpl<$Res>; + _$MetaImpl value, $Res Function(_$MetaImpl) then) = + __$$MetaImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "current_page") int currentPage, - @JsonKey(name: "from") dynamic from, - @JsonKey(name: "last_page") int lastPage, - @JsonKey(name: "links") List links, - @JsonKey(name: "path") String? path, - @JsonKey(name: "per_page") int perPage, - @JsonKey(name: "to") dynamic to, - @JsonKey(name: "total") int total, - @JsonKey(name: "total_min_price") int? totalMinPrice, - @JsonKey(name: "total_max_price") int? totalMaxPrice, - }); + $Res call( + {@JsonKey(name: "current_page") int currentPage, + @JsonKey(name: "from") dynamic from, + @JsonKey(name: "last_page") int lastPage, + @JsonKey(name: "links") List links, + @JsonKey(name: "path") String? path, + @JsonKey(name: "per_page") int perPage, + @JsonKey(name: "to") dynamic to, + @JsonKey(name: "total") int total, + @JsonKey(name: "total_min_price") int? totalMinPrice, + @JsonKey(name: "total_max_price") int? totalMaxPrice}); } /// @nodoc @@ -425,7 +390,7 @@ class __$$MetaImplCopyWithImpl<$Res> extends _$MetaCopyWithImpl<$Res, _$MetaImpl> implements _$$MetaImplCopyWith<$Res> { __$$MetaImplCopyWithImpl(_$MetaImpl _value, $Res Function(_$MetaImpl) _then) - : super(_value, _then); + : super(_value, _then); /// Create a copy of Meta /// with the given fields replaced by the non-null parameter values. @@ -443,78 +408,66 @@ class __$$MetaImplCopyWithImpl<$Res> Object? totalMinPrice = freezed, Object? totalMaxPrice = freezed, }) { - return _then( - _$MetaImpl( - currentPage: - null == currentPage - ? _value.currentPage - : currentPage // ignore: cast_nullable_to_non_nullable - as int, - from: - freezed == from - ? _value.from - : from // ignore: cast_nullable_to_non_nullable - as dynamic, - lastPage: - null == lastPage - ? _value.lastPage - : lastPage // ignore: cast_nullable_to_non_nullable - as int, - links: - null == links - ? _value._links - : links // ignore: cast_nullable_to_non_nullable - as List, - path: - freezed == path - ? _value.path - : path // ignore: cast_nullable_to_non_nullable - as String?, - perPage: - null == perPage - ? _value.perPage - : perPage // ignore: cast_nullable_to_non_nullable - as int, - to: - freezed == to - ? _value.to - : to // ignore: cast_nullable_to_non_nullable - as dynamic, - total: - null == total - ? _value.total - : total // ignore: cast_nullable_to_non_nullable - as int, - totalMinPrice: - freezed == totalMinPrice - ? _value.totalMinPrice - : totalMinPrice // ignore: cast_nullable_to_non_nullable - as int?, - totalMaxPrice: - freezed == totalMaxPrice - ? _value.totalMaxPrice - : totalMaxPrice // ignore: cast_nullable_to_non_nullable - as int?, - ), - ); + return _then(_$MetaImpl( + currentPage: null == currentPage + ? _value.currentPage + : currentPage // ignore: cast_nullable_to_non_nullable + as int, + from: freezed == from + ? _value.from + : from // ignore: cast_nullable_to_non_nullable + as dynamic, + lastPage: null == lastPage + ? _value.lastPage + : lastPage // ignore: cast_nullable_to_non_nullable + as int, + links: null == links + ? _value._links + : links // ignore: cast_nullable_to_non_nullable + as List, + path: freezed == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String?, + perPage: null == perPage + ? _value.perPage + : perPage // ignore: cast_nullable_to_non_nullable + as int, + to: freezed == to + ? _value.to + : to // ignore: cast_nullable_to_non_nullable + as dynamic, + total: null == total + ? _value.total + : total // ignore: cast_nullable_to_non_nullable + as int, + totalMinPrice: freezed == totalMinPrice + ? _value.totalMinPrice + : totalMinPrice // ignore: cast_nullable_to_non_nullable + as int?, + totalMaxPrice: freezed == totalMaxPrice + ? _value.totalMaxPrice + : totalMaxPrice // ignore: cast_nullable_to_non_nullable + as int?, + )); } } /// @nodoc @JsonSerializable() class _$MetaImpl implements _Meta { - const _$MetaImpl({ - @JsonKey(name: "current_page") required this.currentPage, - @JsonKey(name: "from") required this.from, - @JsonKey(name: "last_page") required this.lastPage, - @JsonKey(name: "links") required final List links, - @JsonKey(name: "path") this.path, - @JsonKey(name: "per_page") required this.perPage, - @JsonKey(name: "to") required this.to, - @JsonKey(name: "total") required this.total, - @JsonKey(name: "total_min_price") this.totalMinPrice, - @JsonKey(name: "total_max_price") this.totalMaxPrice, - }) : _links = links; + const _$MetaImpl( + {@JsonKey(name: "current_page") required this.currentPage, + @JsonKey(name: "from") required this.from, + @JsonKey(name: "last_page") required this.lastPage, + @JsonKey(name: "links") required final List links, + @JsonKey(name: "path") this.path, + @JsonKey(name: "per_page") required this.perPage, + @JsonKey(name: "to") required this.to, + @JsonKey(name: "total") required this.total, + @JsonKey(name: "total_min_price") this.totalMinPrice, + @JsonKey(name: "total_max_price") this.totalMaxPrice}) + : _links = links; factory _$MetaImpl.fromJson(Map json) => _$$MetaImplFromJson(json); @@ -585,18 +538,17 @@ class _$MetaImpl implements _Meta { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - currentPage, - const DeepCollectionEquality().hash(from), - lastPage, - const DeepCollectionEquality().hash(_links), - path, - perPage, - const DeepCollectionEquality().hash(to), - total, - totalMinPrice, - totalMaxPrice, - ); + runtimeType, + currentPage, + const DeepCollectionEquality().hash(from), + lastPage, + const DeepCollectionEquality().hash(_links), + path, + perPage, + const DeepCollectionEquality().hash(to), + total, + totalMinPrice, + totalMaxPrice); /// Create a copy of Meta /// with the given fields replaced by the non-null parameter values. @@ -608,23 +560,24 @@ class _$MetaImpl implements _Meta { @override Map toJson() { - return _$$MetaImplToJson(this); + return _$$MetaImplToJson( + this, + ); } } abstract class _Meta implements Meta { - const factory _Meta({ - @JsonKey(name: "current_page") required final int currentPage, - @JsonKey(name: "from") required final dynamic from, - @JsonKey(name: "last_page") required final int lastPage, - @JsonKey(name: "links") required final List links, - @JsonKey(name: "path") final String? path, - @JsonKey(name: "per_page") required final int perPage, - @JsonKey(name: "to") required final dynamic to, - @JsonKey(name: "total") required final int total, - @JsonKey(name: "total_min_price") final int? totalMinPrice, - @JsonKey(name: "total_max_price") final int? totalMaxPrice, - }) = _$MetaImpl; + const factory _Meta( + {@JsonKey(name: "current_page") required final int currentPage, + @JsonKey(name: "from") required final dynamic from, + @JsonKey(name: "last_page") required final int lastPage, + @JsonKey(name: "links") required final List links, + @JsonKey(name: "path") final String? path, + @JsonKey(name: "per_page") required final int perPage, + @JsonKey(name: "to") required final dynamic to, + @JsonKey(name: "total") required final int total, + @JsonKey(name: "total_min_price") final int? totalMinPrice, + @JsonKey(name: "total_max_price") final int? totalMaxPrice}) = _$MetaImpl; factory _Meta.fromJson(Map json) = _$MetaImpl.fromJson; @@ -694,11 +647,10 @@ abstract class $LinkCopyWith<$Res> { factory $LinkCopyWith(Link value, $Res Function(Link) then) = _$LinkCopyWithImpl<$Res, Link>; @useResult - $Res call({ - @JsonKey(name: "url") String? url, - @JsonKey(name: "label") String? label, - @JsonKey(name: "active") bool? active, - }); + $Res call( + {@JsonKey(name: "url") String? url, + @JsonKey(name: "label") String? label, + @JsonKey(name: "active") bool? active}); } /// @nodoc @@ -720,42 +672,34 @@ class _$LinkCopyWithImpl<$Res, $Val extends Link> Object? label = freezed, Object? active = freezed, }) { - return _then( - _value.copyWith( - url: - freezed == url - ? _value.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - label: - freezed == label - ? _value.label - : label // ignore: cast_nullable_to_non_nullable - as String?, - active: - freezed == active - ? _value.active - : active // ignore: cast_nullable_to_non_nullable - as bool?, - ) - as $Val, - ); + return _then(_value.copyWith( + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + label: freezed == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String?, + active: freezed == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool?, + ) as $Val); } } /// @nodoc abstract class _$$LinkImplCopyWith<$Res> implements $LinkCopyWith<$Res> { factory _$$LinkImplCopyWith( - _$LinkImpl value, - $Res Function(_$LinkImpl) then, - ) = __$$LinkImplCopyWithImpl<$Res>; + _$LinkImpl value, $Res Function(_$LinkImpl) then) = + __$$LinkImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "url") String? url, - @JsonKey(name: "label") String? label, - @JsonKey(name: "active") bool? active, - }); + $Res call( + {@JsonKey(name: "url") String? url, + @JsonKey(name: "label") String? label, + @JsonKey(name: "active") bool? active}); } /// @nodoc @@ -763,7 +707,7 @@ class __$$LinkImplCopyWithImpl<$Res> extends _$LinkCopyWithImpl<$Res, _$LinkImpl> implements _$$LinkImplCopyWith<$Res> { __$$LinkImplCopyWithImpl(_$LinkImpl _value, $Res Function(_$LinkImpl) _then) - : super(_value, _then); + : super(_value, _then); /// Create a copy of Link /// with the given fields replaced by the non-null parameter values. @@ -774,36 +718,30 @@ class __$$LinkImplCopyWithImpl<$Res> Object? label = freezed, Object? active = freezed, }) { - return _then( - _$LinkImpl( - url: - freezed == url - ? _value.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - label: - freezed == label - ? _value.label - : label // ignore: cast_nullable_to_non_nullable - as String?, - active: - freezed == active - ? _value.active - : active // ignore: cast_nullable_to_non_nullable - as bool?, - ), - ); + return _then(_$LinkImpl( + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + label: freezed == label + ? _value.label + : label // ignore: cast_nullable_to_non_nullable + as String?, + active: freezed == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool?, + )); } } /// @nodoc @JsonSerializable() class _$LinkImpl implements _Link { - const _$LinkImpl({ - @JsonKey(name: "url") this.url, - @JsonKey(name: "label") this.label, - @JsonKey(name: "active") this.active, - }); + const _$LinkImpl( + {@JsonKey(name: "url") this.url, + @JsonKey(name: "label") this.label, + @JsonKey(name: "active") this.active}); factory _$LinkImpl.fromJson(Map json) => _$$LinkImplFromJson(json); @@ -847,16 +785,17 @@ class _$LinkImpl implements _Link { @override Map toJson() { - return _$$LinkImplToJson(this); + return _$$LinkImplToJson( + this, + ); } } abstract class _Link implements Link { - const factory _Link({ - @JsonKey(name: "url") final String? url, - @JsonKey(name: "label") final String? label, - @JsonKey(name: "active") final bool? active, - }) = _$LinkImpl; + const factory _Link( + {@JsonKey(name: "url") final String? url, + @JsonKey(name: "label") final String? label, + @JsonKey(name: "active") final bool? active}) = _$LinkImpl; factory _Link.fromJson(Map json) = _$LinkImpl.fromJson; diff --git a/lib/core/models/pagination_model.g.dart b/lib/core/models/pagination_model.g.dart index f9ac6cc1..b89eb0b8 100644 --- a/lib/core/models/pagination_model.g.dart +++ b/lib/core/models/pagination_model.g.dart @@ -7,11 +7,11 @@ part of 'pagination_model.dart'; // ************************************************************************** _$LinksImpl _$$LinksImplFromJson(Map json) => _$LinksImpl( - first: json['first'] as String, - last: json['last'] as String, - prev: json['prev'], - next: json['next'], -); + first: json['first'] as String, + last: json['last'] as String, + prev: json['prev'], + next: json['next'], + ); Map _$$LinksImplToJson(_$LinksImpl instance) => { @@ -22,20 +22,19 @@ Map _$$LinksImplToJson(_$LinksImpl instance) => }; _$MetaImpl _$$MetaImplFromJson(Map json) => _$MetaImpl( - currentPage: (json['current_page'] as num).toInt(), - from: json['from'], - lastPage: (json['last_page'] as num).toInt(), - links: - (json['links'] as List) + currentPage: (json['current_page'] as num).toInt(), + from: json['from'], + lastPage: (json['last_page'] as num).toInt(), + links: (json['links'] as List) .map((e) => Link.fromJson(e as Map)) .toList(), - path: json['path'] as String?, - perPage: (json['per_page'] as num).toInt(), - to: json['to'], - total: (json['total'] as num).toInt(), - totalMinPrice: (json['total_min_price'] as num?)?.toInt(), - totalMaxPrice: (json['total_max_price'] as num?)?.toInt(), -); + path: json['path'] as String?, + perPage: (json['per_page'] as num).toInt(), + to: json['to'], + total: (json['total'] as num).toInt(), + totalMinPrice: (json['total_min_price'] as num?)?.toInt(), + totalMaxPrice: (json['total_max_price'] as num?)?.toInt(), + ); Map _$$MetaImplToJson(_$MetaImpl instance) => { @@ -52,10 +51,10 @@ Map _$$MetaImplToJson(_$MetaImpl instance) => }; _$LinkImpl _$$LinkImplFromJson(Map json) => _$LinkImpl( - url: json['url'] as String?, - label: json['label'] as String?, - active: json['active'] as bool?, -); + url: json['url'] as String?, + label: json['label'] as String?, + active: json['active'] as bool?, + ); Map _$$LinkImplToJson(_$LinkImpl instance) => { diff --git a/lib/core/theme/app_decoration.dart b/lib/core/theme/app_decoration.dart index 528abdfb..0eaf1bb5 100644 --- a/lib/core/theme/app_decoration.dart +++ b/lib/core/theme/app_decoration.dart @@ -80,7 +80,7 @@ class BorderRadiusStyle { color: appTheme.black900.withValues(alpha: 0.15), spreadRadius: 2, blurRadius: 2, - offset: Offset( + offset: const Offset( 0, 2, ), @@ -110,15 +110,15 @@ class BorderRadiusStyle { ); // Custom borders - static BorderRadius get customBorderBL8 => BorderRadius.only( + static BorderRadius get customBorderBL8 => const BorderRadius.only( bottomLeft: Radius.circular(8), ); - static BorderRadius get customBorderTL5 => BorderRadius.vertical( + static BorderRadius get customBorderTL5 => const BorderRadius.vertical( top: Radius.circular(5), ); - static BorderRadius get customBorderTL51 => BorderRadius.only( + static BorderRadius get customBorderTL51 => const BorderRadius.only( topLeft: Radius.circular(5), bottomRight: Radius.circular(5), ); diff --git a/lib/core/theme/theme_helper.dart b/lib/core/theme/theme_helper.dart index d4326bf4..a919944d 100644 --- a/lib/core/theme/theme_helper.dart +++ b/lib/core/theme/theme_helper.dart @@ -5,15 +5,15 @@ import 'package:google_fonts/google_fonts.dart'; /// Helper class for managing themes and colors. class ThemeHelper { // The current app theme - var _appTheme = 'primary'; + final _appTheme = 'primary'; // A map of custom color themes supported by the app - Map _supportedCustomColor = { + final Map _supportedCustomColor = { 'primary': PrimaryColors(), }; // A map of color schemes supported by the app - Map _supportedColorScheme = { + final Map _supportedColorScheme = { 'primary': ColorSchemes.primaryColorScheme, }; @@ -46,7 +46,7 @@ class ThemeHelper { visualDensity: VisualDensity.standard, colorScheme: colorScheme, scaffoldBackgroundColor: colorScheme.onPrimary, - appBarTheme: AppBarTheme( + appBarTheme: const AppBarTheme( scrolledUnderElevation: 0, elevation: 0, systemOverlayStyle: SystemUiOverlayStyle( @@ -86,7 +86,7 @@ class ThemeHelper { /// Class containing the supported color schemes. class ColorSchemes { - static final primaryColorScheme = ColorScheme.light( + static const primaryColorScheme = ColorScheme.light( // Primary colors primary: Color(0XFF323F4B), @@ -99,102 +99,103 @@ class ColorSchemes { /// Class containing custom colors for a primary theme. class PrimaryColors { // Blue - Color get blue400 => Color(0XFF43A6F2); + Color get blue400 => const Color(0XFF43A6F2); - Color get blueA400 => Color(0XFF2F80ED); + Color get blueA400 => const Color(0XFF2F80ED); // BlueGray - Color get blueGray400 => Color(0XFF7B8794); + Color get blueGray400 => const Color(0XFF7B8794); - Color get black900 => Color(0XFF000000); + Color get black900 => const Color(0XFF000000); // Blue - Color get blue800 => Color(0XFF1F78B4); + Color get blue800 => const Color(0XFF1F78B4); // BlueGray - Color get blueGray300 => Color(0XFF9AA5B1); + Color get blueGray300 => const Color(0XFF9AA5B1); - Color get black => Color(0XFF323F4B); + Color get black => const Color(0XFF323F4B); - Color get blueGray900 => Color(0XFF2A2F4C); + Color get blueGray900 => const Color(0XFF2A2F4C); // DeepOrange - Color get deepOrange900 => Color(0XFF9A4A00); + Color get deepOrange900 => const Color(0XFF9A4A00); // Gray - Color get gray100 => Color(0XFFF0F2F5); + Color get gray100 => const Color(0XFFF0F2F5); - Color get gray200 => Color(0XFFF0F0F0); + Color get gray200 => const Color(0XFFF0F0F0); - Color get gray400 => Color(0XFFC1C1C1); + Color get gray400 => const Color(0XFFC1C1C1); - Color get gray40001 => Color(0XFFC8C8C8); + Color get gray40001 => const Color(0XFFC8C8C8); - Color get gray50 => Color(0XFFF6FAFF); + Color get gray50 => const Color(0XFFF6FAFF); - Color get gray500 => Color(0XFFA3A3A3); + Color get gray500 => const Color(0XFFA3A3A3); - Color get gray600 => Color(0XFF6D6D6D); + Color get gray600 => const Color(0XFF6D6D6D); - Color get gray60001 => Color(0XFF848484); + Color get gray60001 => const Color(0XFF848484); - Color get gray60002 => Color(0XFF757575); + Color get gray60002 => const Color(0XFF757575); - Color get gray60003 => Color(0XFF707070); + Color get gray60003 => const Color(0XFF707070); // Green - Color get greenA700 => Color(0XFF019A3E); + Color get greenA700 => const Color(0XFF019A3E); - Color get greenA70001 => Color(0XFF00BE13); + Color get greenA70001 => const Color(0XFF00BE13); // LightGreen - Color get lightGreen300 => Color(0XFFB2DF8A); + Color get lightGreen300 => const Color(0XFFB2DF8A); - Color get lightGreenA700 => Color(0XFF18FF14); + Color get lightGreenA700 => const Color(0XFF18FF14); // Red - Color get red200 => Color(0XFFE3A6A6); + Color get red200 => const Color(0XFFE3A6A6); // Teal - Color get teal100 => Color(0XFFA6CEE3); + Color get teal100 => const Color(0XFFA6CEE3); - Color get teal900 => Color(0XFF0B3F56); + Color get teal900 => const Color(0XFF0B3F56); // White - Color get whiteA700 => Color(0XFFFFFFFF); + Color get whiteA700 => const Color(0XFFFFFFFF); - Color get backgroundAvatar => Color(0xFFEBF4FF); + Color get backgroundAvatar => const Color(0xFFEBF4FF); - Color get cardBackground => Color(0xFFF7FAFF); + Color get cardBackground => const Color(0xFFF7FAFF); - Color get dividerColor => Color(0xFFF1F2F6); + Color get dividerColor => const Color(0xFFF1F2F6); - Color get gray => Color(0xFF6D6F71); + Color get gray => const Color(0xFF6D6F71); - Color get lightGray600 => Color(0xFFB0B0B0); + Color get lightGray600 => const Color(0xFFB0B0B0); - Color get lightGray => Color(0xFFCECECE); + Color get lightGray => const Color(0xFFCECECE); - Color get transparentBlue => Color(0xFF2F80ED).withValues(alpha: 0.1); + Color get transparentBlue => const Color(0xFF2F80ED).withValues(alpha: 0.1); - Color get lightGray0 => Color(0xFFF6F6F6); + Color get lightGray0 => const Color(0xFFF6F6F6); - Color get lightGray00 => Color(0xFFE9E9EA); + Color get lightGray00 => const Color(0xFFE9E9EA); - Color get dottedBorder => Color(0xFFE6E6E6); + Color get dottedBorder => const Color(0xFFE6E6E6); - Color get red => Color(0xFFCD4141); - Color get strongRed => Color(0xFFD01717); + Color get red => const Color(0xFFCD4141); + Color get strongRed => const Color(0xFFD01717); - Color get transparentRed => Color(0xFFCD4141).withValues(alpha: 0.75); + Color get transparentRed => const Color(0xFFCD4141).withValues(alpha: 0.75); - Color get transparentBlack => Color(0xFF1313264).withValues(alpha: 0.3); + // ignore: use_full_hex_values_for_flutter_colors + Color get transparentBlack => const Color(0xff1313264).withValues(alpha: 0.3); - Color get gray60004 => Color(0xFFD4DAE2).withValues(alpha: 0.2); + Color get gray60004 => const Color(0xFFD4DAE2).withValues(alpha: 0.2); - Color get blueGray => Color(0xFF809CB9); + Color get blueGray => const Color(0xFF809CB9); - Color get dialogShadow => Color.fromARGB(125, 0, 0, 0); + Color get dialogShadow => const Color.fromARGB(125, 0, 0, 0); } PrimaryColors get appTheme => ThemeHelper().themeColor(); diff --git a/lib/core/token_storage.dart b/lib/core/token_storage.dart index a3eba6cc..ec16d1ea 100644 --- a/lib/core/token_storage.dart +++ b/lib/core/token_storage.dart @@ -3,7 +3,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; abstract class TokenStorage { static Future haveTokenInStorage() async { try { - if (await FlutterSecureStorage().read(key: 'token') == null) { + if (await const FlutterSecureStorage().read(key: 'token') == null) { return false; } else { return true; @@ -13,11 +13,11 @@ abstract class TokenStorage { } } - static Future getTokenFromStorage() async => await FlutterSecureStorage().read(key: 'token'); + static Future getTokenFromStorage() async => await const FlutterSecureStorage().read(key: 'token'); static saveTokenInStorage(String token) async { - await FlutterSecureStorage().write(key: 'token', value: token); + await const FlutterSecureStorage().write(key: 'token', value: token); } - static Future removeTokenInStorage() async => (await FlutterSecureStorage().delete(key: 'token')); + static Future removeTokenInStorage() async => (await const FlutterSecureStorage().delete(key: 'token')); } diff --git a/lib/core/utils/localization_utils.dart b/lib/core/utils/localization_utils.dart index 2070f626..bc8d30fc 100644 --- a/lib/core/utils/localization_utils.dart +++ b/lib/core/utils/localization_utils.dart @@ -3,11 +3,11 @@ import 'package:eatvio_app/generated/l10n.dart'; String getLocalizedMeasurementUnits(S s, Portion portion) { switch (portion) { - case Portion.GRAMS: + case Portion.grams: return s.gr; - case Portion.MILLILITERS: + case Portion.milliliters: return s.milliliter; - case Portion.PCS: + case Portion.pcs: return s.pcs; } } diff --git a/lib/core/websockets/ws_manager.dart b/lib/core/websockets/ws_manager.dart index e414557d..b22a2048 100644 --- a/lib/core/websockets/ws_manager.dart +++ b/lib/core/websockets/ws_manager.dart @@ -27,7 +27,7 @@ class WsManager { Stream? get clientTypingStream => _privateDirectChatChannel?.bind('client-typing'); Future initialize() async { - if (this.client == null) { + if (client == null) { try { await TokenStorage.haveTokenInStorage(); final wsUrl = await wsService.getWebsocket(); @@ -37,7 +37,7 @@ class WsManager { key: wsUrl.key, host: wsUrl.host, shouldSupplyMetadataQueries: true, - metadata: PusherChannelsOptionsMetadata.byDefault(), + metadata: const PusherChannelsOptionsMetadata.byDefault(), port: 443, ); client = PusherChannelsClient.websocket( @@ -58,7 +58,7 @@ class WsManager { await client?.connect(); - this.client = client; + client = client; userId = wsUrl.userId; await _initPrivateNotificationsChannel(); @@ -82,10 +82,10 @@ class WsManager { Future _initPrivateNotificationsChannel() async { final token = await TokenStorage.getTokenFromStorage(); - _privateNotificationChannel = await client?.privateChannel( + _privateNotificationChannel = client?.privateChannel( '$newNotificationsChannelName.$userId', authorizationDelegate: EndpointAuthorizableChannelTokenAuthorizationDelegate.forPrivateChannel( - authorizationEndpoint: Uri.parse(baseUrl + '/broadcasting/auth'), + authorizationEndpoint: Uri.parse('$baseUrl/broadcasting/auth'), headers: { 'Authorization': 'Bearer $token', }, @@ -95,10 +95,10 @@ class WsManager { Future _initPrivateMessagesChannel() async { final token = await TokenStorage.getTokenFromStorage(); - _privateMessagesChannel = await client?.privateChannel( + _privateMessagesChannel = client?.privateChannel( '$newMessagesChannelName.$userId', authorizationDelegate: EndpointAuthorizableChannelTokenAuthorizationDelegate.forPrivateChannel( - authorizationEndpoint: Uri.parse(baseUrl + '/broadcasting/auth'), + authorizationEndpoint: Uri.parse('$baseUrl/broadcasting/auth'), headers: { 'Authorization': 'Bearer $token', }, @@ -108,10 +108,10 @@ class WsManager { Future initPrivateDirectChatChannel(String chatId) async { final token = await TokenStorage.getTokenFromStorage(); - _privateDirectChatChannel = await client?.privateChannel( + _privateDirectChatChannel = client?.privateChannel( '$directChatChannelName.$chatId', authorizationDelegate: EndpointAuthorizableChannelTokenAuthorizationDelegate.forPrivateChannel( - authorizationEndpoint: Uri.parse(baseUrl + '/broadcasting/auth'), + authorizationEndpoint: Uri.parse('$baseUrl/broadcasting/auth'), headers: { 'Authorization': 'Bearer $token', }, diff --git a/lib/core/widgets/add_item_button.dart b/lib/core/widgets/add_item_button.dart index 4a0f9816..5aa1b010 100644 --- a/lib/core/widgets/add_item_button.dart +++ b/lib/core/widgets/add_item_button.dart @@ -18,12 +18,12 @@ class AddItemButton extends StatelessWidget { color: appTheme.blueA400, shape: BoxShape.circle, ), + width: 40, + height: 40, child: Icon( Icons.add_rounded, color: appTheme.gray100, ), - width: 40, - height: 40, ), ); } diff --git a/lib/core/widgets/animated_option_button.dart b/lib/core/widgets/animated_option_button.dart index 4491293b..596c23ac 100644 --- a/lib/core/widgets/animated_option_button.dart +++ b/lib/core/widgets/animated_option_button.dart @@ -3,7 +3,7 @@ import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:flutter/material.dart'; class AnimatedOptionButton extends StatelessWidget { - const AnimatedOptionButton({required this.text, required this.isSelected, required this.onTap, this.textStyle}); + const AnimatedOptionButton({super.key, required this.text, required this.isSelected, required this.onTap, this.textStyle}); final String text; final bool isSelected; final void Function() onTap; diff --git a/lib/core/widgets/base_button.dart b/lib/core/widgets/base_button.dart index 0a572009..18c5f030 100644 --- a/lib/core/widgets/base_button.dart +++ b/lib/core/widgets/base_button.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; class BaseButton extends StatelessWidget { - BaseButton({ - Key? key, + const BaseButton({ + super.key, required this.text, this.onPressed, this.buttonStyle, @@ -12,9 +12,7 @@ class BaseButton extends StatelessWidget { this.width, this.margin, this.alignment, - }) : super( - key: key, - ); + }); final String text; diff --git a/lib/core/widgets/bottom_sheet_with_blur.dart b/lib/core/widgets/bottom_sheet_with_blur.dart index d6c1b61f..f7cdf3df 100644 --- a/lib/core/widgets/bottom_sheet_with_blur.dart +++ b/lib/core/widgets/bottom_sheet_with_blur.dart @@ -32,7 +32,7 @@ Future showBottomSheetWithBlur({ child: Container( height: height, decoration: BoxDecoration( - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(20), topRight: Radius.circular(20), ), diff --git a/lib/core/widgets/cpfc_container.dart b/lib/core/widgets/cpfc_container.dart index d7e53361..f5026c9a 100644 --- a/lib/core/widgets/cpfc_container.dart +++ b/lib/core/widgets/cpfc_container.dart @@ -15,31 +15,31 @@ class CpfcContainer extends StatelessWidget { final s = S.of(context); return Container( color: appTheme.cardBackground, - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: [ - Text('${calories.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), + Text(calories.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), Text(s.calories, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)), ], ), Column( children: [ - Text('${proteins.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), + Text(proteins.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), Text(s.proteins, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)), ], ), Column( children: [ - Text('${fats.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), + Text(fats.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), Text(s.fats, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)), ], ), Column( children: [ - Text('${carbohydrates.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), + Text(carbohydrates.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), Text(s.carbohydrates, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)), ], ), diff --git a/lib/core/widgets/custom_drop_down.dart b/lib/core/widgets/custom_drop_down.dart index 10edb929..bbd07a09 100644 --- a/lib/core/widgets/custom_drop_down.dart +++ b/lib/core/widgets/custom_drop_down.dart @@ -2,7 +2,7 @@ import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.d import 'package:flutter/material.dart'; class CustomDropDown extends StatelessWidget { - const CustomDropDown({ + const CustomDropDown({super.key, this.alignment, this.width, this.focusNode, @@ -59,7 +59,7 @@ class CustomDropDown extends StatelessWidget { _buildDropDownWidget(BuildContext context) { return DropdownButtonFormField( focusNode: focusNode ?? FocusNode(), - icon: Icon(Icons.keyboard_arrow_down_rounded), + icon: const Icon(Icons.keyboard_arrow_down_rounded), autofocus: autofocus!, value: value, isDense: true, @@ -70,7 +70,7 @@ class CustomDropDown extends StatelessWidget { child: Text( item.title, style: hintStyle ?? - TextStyle( + const TextStyle( fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, @@ -90,7 +90,7 @@ class CustomDropDown extends StatelessWidget { InputDecoration _buildInputDecoration(BuildContext context) { return InputDecoration( - labelStyle: TextStyle( + labelStyle: const TextStyle( fontSize: 16, color: Colors.black, fontWeight: FontWeight.w400, @@ -108,19 +108,19 @@ class CustomDropDown extends StatelessWidget { suffixIcon: suffix, isDense: true, suffixIconConstraints: suffixConstraints, - contentPadding: EdgeInsets.symmetric(vertical: 16, horizontal: 12), - fillColor: Color(0xFFF6F6F6), + contentPadding: const EdgeInsets.symmetric(vertical: 16, horizontal: 12), + fillColor: const Color(0xFFF6F6F6), filled: filled, - border: OutlineInputBorder( - borderRadius: const BorderRadius.all(Radius.circular(20)), + border: const OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), borderSide: BorderSide.none, ), - enabledBorder: OutlineInputBorder( - borderRadius: const BorderRadius.all(Radius.circular(20)), + enabledBorder: const OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), borderSide: BorderSide.none, ), - focusedBorder: OutlineInputBorder( - borderRadius: const BorderRadius.all(Radius.circular(20)), + focusedBorder: const OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), borderSide: BorderSide.none, ), ); diff --git a/lib/core/widgets/custom_outlined_button.dart b/lib/core/widgets/custom_outlined_button.dart index e8692a87..2ac583ce 100644 --- a/lib/core/widgets/custom_outlined_button.dart +++ b/lib/core/widgets/custom_outlined_button.dart @@ -3,32 +3,21 @@ import 'package:eatvio_app/core/widgets/base_button.dart'; import 'package:flutter/material.dart'; class CustomOutlinedButton extends BaseButton { - CustomOutlinedButton({ - Key? key, + const CustomOutlinedButton({super.key, this.decoration, this.leftIcon, this.rightIcon, this.label, - VoidCallback? onPressed, - ButtonStyle? buttonStyle, - TextStyle? buttonTextStyle, - bool? isDisabled, - Alignment? alignment, - double? height, - double? width, - EdgeInsets? margin, - required String text, - }) : super( - text: text, - onPressed: onPressed, - buttonStyle: buttonStyle, - isDisabled: isDisabled, - buttonTextStyle: buttonTextStyle, - height: height, - alignment: alignment, - width: width, - margin: margin, - ); + super.onPressed, + super.buttonStyle, + super.buttonTextStyle, + super.isDisabled, + super.alignment, + super.height, + super.width, + super.margin, + required super.text, + }); final BoxDecoration? decoration; final Widget? leftIcon; @@ -41,8 +30,8 @@ class CustomOutlinedButton extends BaseButton { return Align( alignment: alignment ?? Alignment.center, child: Container( - height: this.height ?? 30, - width: this.width ?? double.maxFinite, + height: height ?? 30, + width: width ?? double.maxFinite, margin: margin, decoration: decoration, child: OutlinedButton( @@ -52,12 +41,12 @@ class CustomOutlinedButton extends BaseButton { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - leftIcon ?? SizedBox.shrink(), + leftIcon ?? const SizedBox.shrink(), Text( text, style: buttonTextStyle ?? CustomTextStyles.titleSmallBold, ), - rightIcon ?? SizedBox.shrink(), + rightIcon ?? const SizedBox.shrink(), ], ), ), @@ -65,8 +54,8 @@ class CustomOutlinedButton extends BaseButton { ); } else { return Container( - height: this.height ?? 30, - width: this.width ?? double.maxFinite, + height: height ?? 30, + width: width ?? double.maxFinite, margin: margin, decoration: decoration, child: OutlinedButton( @@ -76,12 +65,12 @@ class CustomOutlinedButton extends BaseButton { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - leftIcon ?? SizedBox.shrink(), + leftIcon ?? const SizedBox.shrink(), Text( text, style: buttonTextStyle ?? CustomTextStyles.titleSmallBold, ), - rightIcon ?? SizedBox.shrink(), + rightIcon ?? const SizedBox.shrink(), ], ), ), diff --git a/lib/core/widgets/custom_search_bar.dart b/lib/core/widgets/custom_search_bar.dart index dac1e8d7..4ce02f5b 100644 --- a/lib/core/widgets/custom_search_bar.dart +++ b/lib/core/widgets/custom_search_bar.dart @@ -19,7 +19,7 @@ class CustomSearchBar extends StatelessWidget { textCapitalization: TextCapitalization.sentences, controller: searchController, autofocus: false, - style: TextStyle( + style: const TextStyle( fontSize: 12, ), onChanged: onChanged, @@ -38,7 +38,7 @@ class CustomSearchBar extends StatelessWidget { ) : null, isDense: false, - contentPadding: enableIcon ? EdgeInsets.all(8) : EdgeInsets.only(top: 8, left: 16, right: 8, bottom: 8), + contentPadding: enableIcon ? const EdgeInsets.all(8) : const EdgeInsets.only(top: 8, left: 16, right: 8, bottom: 8), fillColor: backgroundColor ?? appTheme.gray100, filled: true, border: OutlineInputBorder( diff --git a/lib/core/widgets/custom_text_form_field.dart b/lib/core/widgets/custom_text_form_field.dart index c58dd23e..aedfda0f 100644 --- a/lib/core/widgets/custom_text_form_field.dart +++ b/lib/core/widgets/custom_text_form_field.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class CustomTextFormField extends StatelessWidget { - CustomTextFormField({ + const CustomTextFormField({ this.alignment, this.width, this.controller, @@ -97,9 +97,9 @@ class CustomTextFormField extends StatelessWidget { maxLength: maxLength, onChanged: onChanged, controller: controller, - focusNode: focusNode ?? null, + focusNode: focusNode, autofocus: autofocus, - style: TextStyle(fontSize: 16, color: Colors.black, fontWeight: FontWeight.w500), + style: const TextStyle(fontSize: 16, color: Colors.black, fontWeight: FontWeight.w500), obscureText: obscureText!, textInputAction: textInputAction, maxLines: maxLines, @@ -110,16 +110,16 @@ class CustomTextFormField extends StatelessWidget { counter: counter, suffixText: suffixText, hintText: hintText ?? "", - hintStyle: hintStyle ?? TextStyle(fontSize: 16, color: Color(0xFF323F4B).withAlpha((255 / 2).toInt()), fontWeight: FontWeight.w500), + hintStyle: hintStyle ?? TextStyle(fontSize: 16, color: const Color(0xFF323F4B).withAlpha((255 / 2).toInt()), fontWeight: FontWeight.w500), prefixIcon: prefix, prefixIconConstraints: prefixConstraints, suffixIcon: suffix, floatingLabelBehavior: FloatingLabelBehavior.always, - suffixStyle: textStyle ?? TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF323F4B)), + suffixStyle: textStyle ?? const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF323F4B)), suffixIconConstraints: suffixConstraints, isDense: false, - contentPadding: EdgeInsets.symmetric(vertical: 16, horizontal: 12), - fillColor: Color(0xFFF6F6F6), + contentPadding: const EdgeInsets.symmetric(vertical: 16, horizontal: 12), + fillColor: const Color(0xFFF6F6F6), filled: true, border: borderDecoration ?? diff --git a/lib/core/widgets/data_error_widget.dart b/lib/core/widgets/data_error_widget.dart index e7330506..7d8562ba 100644 --- a/lib/core/widgets/data_error_widget.dart +++ b/lib/core/widgets/data_error_widget.dart @@ -24,34 +24,36 @@ class _DataErrorWidgetState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset('assets/icons/cloud.svg'), - SizedBox(height: 30), + const SizedBox(height: 30), Text(s.something_went_wrong, style: TextStyles.textLSemibold.copyWith(color: appTheme.black)), - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 32), child: Text(s.can_not_load_data_please_try_again, style: TextStyles.textSMedium.copyWith(color: appTheme.black), textAlign: TextAlign.center), ), - SizedBox(height: 20), + const SizedBox(height: 20), isLoading - ? Loader() + ? const Loader() : Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: CustomOutlinedButton( - text: s.try_again, - height: 52, - buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), - buttonStyle: ButtonStyle(side: WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)), - onPressed: () async { - setState(() { - isLoading = true; - }); - await widget.onReload(); - setState(() { - isLoading = false; - }); - }, + padding: const EdgeInsets.symmetric(horizontal: 16), + child: CustomOutlinedButton( + text: s.try_again, + height: 52, + buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), + buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)), + onPressed: () async { + setState(() { + isLoading = true; + }); + await widget.onReload(); + if (context.mounted) { + setState(() { + isLoading = false; + }); + } + }, + ), ), - ), ], ); } diff --git a/lib/core/widgets/feed_icon_button.dart b/lib/core/widgets/feed_icon_button.dart index c6e5a70d..27caa7cc 100644 --- a/lib/core/widgets/feed_icon_button.dart +++ b/lib/core/widgets/feed_icon_button.dart @@ -18,7 +18,7 @@ class FeedIconButton extends StatelessWidget { onTap: onTap ?? () {}, borderRadius: BorderRadius.circular(16), child: Container( - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration( color: backgroundColor ?? appTheme.gray100, borderRadius: BorderRadius.circular(16), @@ -35,7 +35,7 @@ class FeedIconButton extends StatelessWidget { color: iconColor ?? appTheme.gray600, ), if (text != null) ...[ - SizedBox(width: 8), + const SizedBox(width: 8), Text( text!, style: TextStyles.textSMedium.copyWith( diff --git a/lib/core/widgets/info_row.dart b/lib/core/widgets/info_row.dart index 9f535d91..115dedc0 100644 --- a/lib/core/widgets/info_row.dart +++ b/lib/core/widgets/info_row.dart @@ -55,18 +55,18 @@ class InfoRow extends StatelessWidget { width: 13.3, height: 13.3, ), - SizedBox(width: 4), + const SizedBox(width: 4), Text( switch (type) { ProductType.diet => '${diet?.duration} ${getDayForm(diet?.duration ?? 7, s)}', ProductType.plan => '${plan?.duration} ${getDayForm(plan?.duration ?? 7, s)}', - ProductType.recipe => '${timeTitle ?? ''}', + ProductType.recipe => timeTitle ?? '', }, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], ), - SizedBox(width: 12), + const SizedBox(width: 12), InfoBouble( backgroundColor: itemsBackgroundColor, children: [ @@ -79,18 +79,18 @@ class InfoRow extends StatelessWidget { width: 13.3, height: 13.3, ), - SizedBox(width: 4), + const SizedBox(width: 4), Text( switch (type) { ProductType.diet => '80 человек прошли', ProductType.plan => '80 человек прошли', - ProductType.recipe => (recipe?.calories.toStringAsFixed(0) ?? '0') + ' ккал', + ProductType.recipe => '${recipe?.calories.toStringAsFixed(0) ?? '0'} ккал', }, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], ), - SizedBox(width: 12), + const SizedBox(width: 12), if (type == ProductType.recipe) InfoBouble( backgroundColor: itemsBackgroundColor, @@ -100,7 +100,7 @@ class InfoRow extends StatelessWidget { width: 13.3, height: 13.3, ), - SizedBox(width: 4), + const SizedBox(width: 4), Text( '${recipe?.steps?.length ?? 0} ${getStepForm(recipe?.steps?.length ?? 0)}', style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), diff --git a/lib/core/widgets/item_widget.dart b/lib/core/widgets/item_widget.dart index c7af63c5..ac43f779 100644 --- a/lib/core/widgets/item_widget.dart +++ b/lib/core/widgets/item_widget.dart @@ -18,7 +18,7 @@ class ItemWidget extends StatelessWidget { width: iconSize, height: iconSize, ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: Text( text, diff --git a/lib/core/widgets/loader.dart b/lib/core/widgets/loader.dart index be4e7b56..dd4727dc 100644 --- a/lib/core/widgets/loader.dart +++ b/lib/core/widgets/loader.dart @@ -6,7 +6,7 @@ class Loader extends StatelessWidget { @override Widget build(BuildContext context) { - return Center( + return const Center( child: SizedBox( height: 32, width: 32, diff --git a/lib/core/widgets/main_background_bouble.dart b/lib/core/widgets/main_background_bouble.dart index 0f1a9fe9..cec9c57b 100644 --- a/lib/core/widgets/main_background_bouble.dart +++ b/lib/core/widgets/main_background_bouble.dart @@ -23,10 +23,10 @@ class MainBackgroundBouble extends StatelessWidget { boxShadow: enableShadow ? [ BoxShadow( - color: Color(0x00000000).withValues(alpha: 0.2), + color: const Color(0x00000000).withValues(alpha: 0.2), spreadRadius: 0, blurRadius: 32, - offset: Offset(0, 0), + offset: const Offset(0, 0), ), ] : null, diff --git a/lib/core/widgets/option_widget.dart b/lib/core/widgets/option_widget.dart new file mode 100644 index 00000000..779f6c38 --- /dev/null +++ b/lib/core/widgets/option_widget.dart @@ -0,0 +1,94 @@ +import 'package:eatvio_app/core/theme/custom_text_style.dart'; +import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/core/utils/localization_utils.dart'; +import 'package:eatvio_app/core/widgets/custom_divider.dart'; +import 'package:eatvio_app/core/widgets/main_background_bouble.dart'; +import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart'; +import 'package:eatvio_app/core/widgets/item_widget.dart'; +import 'package:eatvio_app/generated/l10n.dart'; +import 'package:flutter/material.dart'; + +class OptionWidget extends StatelessWidget { + const OptionWidget({super.key, required this.option, this.disableDuration = false}); + final PacketOptions? option; + final bool disableDuration; + @override + Widget build(BuildContext context) { + if (option == null) { + return const SizedBox.shrink(); + } + return MainBackgroundBouble( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 16), + Text( + option?.short ?? '', + style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), + ), + const SizedBox(height: 12), + Text( + option?.description ?? '', + style: TextStyles.textSMedium.copyWith(color: appTheme.black), + ), + const SizedBox(height: 12), + if (!disableDuration) ...[ + const _OptionDurationWidget(duration: 7), + const SizedBox(height: 16), + ], + const CustomDivider(), + const SizedBox(height: 16), + ListView.separated( + physics: const NeverScrollableScrollPhysics(), + separatorBuilder: (context, index) => const SizedBox(height: 12), + itemBuilder: (context, index) => ItemWidget(text: option?.items[index] ?? ''), + itemCount: option?.items.length ?? 0, + shrinkWrap: true, + ), + ], + ), + ); + } +} + + +class _OptionDurationWidget extends StatelessWidget { + const _OptionDurationWidget({required this.duration}); + final int duration; + @override + Widget build(BuildContext context) { + final s = S.of(context); + return Container( + decoration: BoxDecoration(borderRadius: BorderRadius.circular(4), color: appTheme.cardBackground), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 4), + child: Container( + width: 4, + height: 20, + decoration: BoxDecoration( + color: appTheme.blueA400, + borderRadius: const BorderRadius.only( + topRight: Radius.circular(100), + bottomRight: Radius.circular(100), + ), + ), + ), + ), + const SizedBox( + width: 12, + ), + Text( + '${s.option_duration} $duration ${getDayForm(duration, s)}', + style: TextStyles.textSMedium.copyWith(color: appTheme.black), + ), + const SizedBox( + width: 12, + ), + ], + ), + ); + } +} diff --git a/lib/core/widgets/show_error_dialog.dart b/lib/core/widgets/show_error_dialog.dart index 317f3321..a064538c 100644 --- a/lib/core/widgets/show_error_dialog.dart +++ b/lib/core/widgets/show_error_dialog.dart @@ -17,7 +17,7 @@ void showErrorDialog(BuildContext context, {String? title, String? description}) child: Container( decoration: BoxDecoration( color: appTheme.whiteA700, - borderRadius: BorderRadius.all(Radius.circular(20)), + borderRadius: const BorderRadius.all(Radius.circular(20)), boxShadow: [BoxShadow(color: appTheme.dialogShadow, blurRadius: 32)], ), width: MediaQuery.sizeOf(context).width, @@ -27,12 +27,12 @@ void showErrorDialog(BuildContext context, {String? title, String? description}) mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 20), + const SizedBox(height: 20), Text( title ?? s.some_error_occurred, style: TextStyles.textLSemibold.copyWith(color: appTheme.black, decoration: TextDecoration.none), ), - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.only(right: 72), child: Text( @@ -47,7 +47,7 @@ void showErrorDialog(BuildContext context, {String? title, String? description}) child: Text(s.ok, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), ], ), ), diff --git a/lib/core/widgets/success_published_diet_bottom_sheet.dart b/lib/core/widgets/success_published_diet_bottom_sheet.dart index 606aad41..0145d041 100644 --- a/lib/core/widgets/success_published_diet_bottom_sheet.dart +++ b/lib/core/widgets/success_published_diet_bottom_sheet.dart @@ -15,11 +15,11 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget { final s = S.of(context); return Column( children: [ - SizedBox( + const SizedBox( height: 20, ), - BottomSheetHandlerBar(), - SizedBox( + const BottomSheetHandlerBar(), + const SizedBox( height: 20, ), Text( @@ -30,7 +30,7 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget { 'опубликованна', style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox( + const SizedBox( height: 20, ), Padding( @@ -43,12 +43,12 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget { height: 52, buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), ), ), - SizedBox( + const SizedBox( height: 20, ), ], diff --git a/lib/core/widgets/success_published_recipe_bottom_sheet.dart b/lib/core/widgets/success_published_recipe_bottom_sheet.dart index c97736ae..9fb1ddeb 100644 --- a/lib/core/widgets/success_published_recipe_bottom_sheet.dart +++ b/lib/core/widgets/success_published_recipe_bottom_sheet.dart @@ -15,11 +15,11 @@ class SuccessPublishedRecipeBottomSheet extends StatelessWidget { final s = S.of(context); return Column( children: [ - SizedBox( + const SizedBox( height: 20, ), - BottomSheetHandlerBar(), - SizedBox( + const BottomSheetHandlerBar(), + const SizedBox( height: 20, ), Text( @@ -30,7 +30,7 @@ class SuccessPublishedRecipeBottomSheet extends StatelessWidget { '"$title" ${s.successfully_published}', style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox( + const SizedBox( height: 20, ), Padding( @@ -43,12 +43,12 @@ class SuccessPublishedRecipeBottomSheet extends StatelessWidget { height: 52, buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), ), ), - SizedBox( + const SizedBox( height: 20, ), ], diff --git a/lib/features/auth/models/credentials_model.freezed.dart b/lib/features/auth/models/credentials_model.freezed.dart index 73b2871e..270a5a99 100644 --- a/lib/features/auth/models/credentials_model.freezed.dart +++ b/lib/features/auth/models/credentials_model.freezed.dart @@ -12,8 +12,7 @@ part of 'credentials_model.dart'; 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', -); + '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'); CredentialsModel _$CredentialsModelFromJson(Map json) { return _CredentialsModel.fromJson(json); @@ -37,9 +36,8 @@ mixin _$CredentialsModel { /// @nodoc abstract class $CredentialsModelCopyWith<$Res> { factory $CredentialsModelCopyWith( - CredentialsModel value, - $Res Function(CredentialsModel) then, - ) = _$CredentialsModelCopyWithImpl<$Res, CredentialsModel>; + CredentialsModel value, $Res Function(CredentialsModel) then) = + _$CredentialsModelCopyWithImpl<$Res, CredentialsModel>; @useResult $Res call({String email, String password}); } @@ -58,32 +56,29 @@ class _$CredentialsModelCopyWithImpl<$Res, $Val extends CredentialsModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? email = null, Object? password = null}) { - return _then( - _value.copyWith( - email: - null == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String, - password: - null == password - ? _value.password - : password // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? email = null, + Object? password = null, + }) { + return _then(_value.copyWith( + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _value.password + : password // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } /// @nodoc abstract class _$$CredentialsModelImplCopyWith<$Res> implements $CredentialsModelCopyWith<$Res> { - factory _$$CredentialsModelImplCopyWith( - _$CredentialsModelImpl value, - $Res Function(_$CredentialsModelImpl) then, - ) = __$$CredentialsModelImplCopyWithImpl<$Res>; + factory _$$CredentialsModelImplCopyWith(_$CredentialsModelImpl value, + $Res Function(_$CredentialsModelImpl) then) = + __$$CredentialsModelImplCopyWithImpl<$Res>; @override @useResult $Res call({String email, String password}); @@ -93,30 +88,28 @@ abstract class _$$CredentialsModelImplCopyWith<$Res> class __$$CredentialsModelImplCopyWithImpl<$Res> extends _$CredentialsModelCopyWithImpl<$Res, _$CredentialsModelImpl> implements _$$CredentialsModelImplCopyWith<$Res> { - __$$CredentialsModelImplCopyWithImpl( - _$CredentialsModelImpl _value, - $Res Function(_$CredentialsModelImpl) _then, - ) : super(_value, _then); + __$$CredentialsModelImplCopyWithImpl(_$CredentialsModelImpl _value, + $Res Function(_$CredentialsModelImpl) _then) + : super(_value, _then); /// Create a copy of CredentialsModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? email = null, Object? password = null}) { - return _then( - _$CredentialsModelImpl( - email: - null == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String, - password: - null == password - ? _value.password - : password // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? email = null, + Object? password = null, + }) { + return _then(_$CredentialsModelImpl( + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _value.password + : password // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -159,21 +152,20 @@ class _$CredentialsModelImpl implements _CredentialsModel { @pragma('vm:prefer-inline') _$$CredentialsModelImplCopyWith<_$CredentialsModelImpl> get copyWith => __$$CredentialsModelImplCopyWithImpl<_$CredentialsModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$CredentialsModelImplToJson(this); + return _$$CredentialsModelImplToJson( + this, + ); } } abstract class _CredentialsModel implements CredentialsModel { - const factory _CredentialsModel({ - required final String email, - required final String password, - }) = _$CredentialsModelImpl; + const factory _CredentialsModel( + {required final String email, + required final String password}) = _$CredentialsModelImpl; factory _CredentialsModel.fromJson(Map json) = _$CredentialsModelImpl.fromJson; diff --git a/lib/features/auth/models/credentials_model.g.dart b/lib/features/auth/models/credentials_model.g.dart index a7dcefc4..eb2c98e8 100644 --- a/lib/features/auth/models/credentials_model.g.dart +++ b/lib/features/auth/models/credentials_model.g.dart @@ -7,12 +7,15 @@ part of 'credentials_model.dart'; // ************************************************************************** _$CredentialsModelImpl _$$CredentialsModelImplFromJson( - Map json, -) => _$CredentialsModelImpl( - email: json['email'] as String, - password: json['password'] as String, -); + Map json) => + _$CredentialsModelImpl( + email: json['email'] as String, + password: json['password'] as String, + ); Map _$$CredentialsModelImplToJson( - _$CredentialsModelImpl instance, -) => {'email': instance.email, 'password': instance.password}; + _$CredentialsModelImpl instance) => + { + 'email': instance.email, + 'password': instance.password, + }; diff --git a/lib/features/auth/models/token_model.freezed.dart b/lib/features/auth/models/token_model.freezed.dart index d04c0545..ec0210f4 100644 --- a/lib/features/auth/models/token_model.freezed.dart +++ b/lib/features/auth/models/token_model.freezed.dart @@ -12,8 +12,7 @@ part of 'token_model.dart'; 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', -); + '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'); TokenModel _$TokenModelFromJson(Map json) { return _TokenModel.fromJson(json); @@ -36,9 +35,8 @@ mixin _$TokenModel { /// @nodoc abstract class $TokenModelCopyWith<$Res> { factory $TokenModelCopyWith( - TokenModel value, - $Res Function(TokenModel) then, - ) = _$TokenModelCopyWithImpl<$Res, TokenModel>; + TokenModel value, $Res Function(TokenModel) then) = + _$TokenModelCopyWithImpl<$Res, TokenModel>; @useResult $Res call({String token}); } @@ -57,17 +55,15 @@ class _$TokenModelCopyWithImpl<$Res, $Val extends TokenModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? token = null}) { - return _then( - _value.copyWith( - token: - null == token - ? _value.token - : token // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? token = null, + }) { + return _then(_value.copyWith( + token: null == token + ? _value.token + : token // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -75,9 +71,8 @@ class _$TokenModelCopyWithImpl<$Res, $Val extends TokenModel> abstract class _$$TokenModelImplCopyWith<$Res> implements $TokenModelCopyWith<$Res> { factory _$$TokenModelImplCopyWith( - _$TokenModelImpl value, - $Res Function(_$TokenModelImpl) then, - ) = __$$TokenModelImplCopyWithImpl<$Res>; + _$TokenModelImpl value, $Res Function(_$TokenModelImpl) then) = + __$$TokenModelImplCopyWithImpl<$Res>; @override @useResult $Res call({String token}); @@ -88,24 +83,22 @@ class __$$TokenModelImplCopyWithImpl<$Res> extends _$TokenModelCopyWithImpl<$Res, _$TokenModelImpl> implements _$$TokenModelImplCopyWith<$Res> { __$$TokenModelImplCopyWithImpl( - _$TokenModelImpl _value, - $Res Function(_$TokenModelImpl) _then, - ) : super(_value, _then); + _$TokenModelImpl _value, $Res Function(_$TokenModelImpl) _then) + : super(_value, _then); /// Create a copy of TokenModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? token = null}) { - return _then( - _$TokenModelImpl( - token: - null == token - ? _value.token - : token // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? token = null, + }) { + return _then(_$TokenModelImpl( + token: null == token + ? _value.token + : token // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -147,7 +140,9 @@ class _$TokenModelImpl implements _TokenModel { @override Map toJson() { - return _$$TokenModelImplToJson(this); + return _$$TokenModelImplToJson( + this, + ); } } diff --git a/lib/features/auth/models/token_model.g.dart b/lib/features/auth/models/token_model.g.dart index 41be8b6d..f2ea4bd9 100644 --- a/lib/features/auth/models/token_model.g.dart +++ b/lib/features/auth/models/token_model.g.dart @@ -7,7 +7,11 @@ part of 'token_model.dart'; // ************************************************************************** _$TokenModelImpl _$$TokenModelImplFromJson(Map json) => - _$TokenModelImpl(token: json['token'] as String); + _$TokenModelImpl( + token: json['token'] as String, + ); Map _$$TokenModelImplToJson(_$TokenModelImpl instance) => - {'token': instance.token}; + { + 'token': instance.token, + }; diff --git a/lib/features/auth/presentation/bloc/auth_cubit.dart b/lib/features/auth/presentation/bloc/auth_cubit.dart index dc521829..f96f0261 100644 --- a/lib/features/auth/presentation/bloc/auth_cubit.dart +++ b/lib/features/auth/presentation/bloc/auth_cubit.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:eatvio_app/core/app_router.dart'; import 'package:eatvio_app/core/token_storage.dart'; import 'package:eatvio_app/core/utils/toasts.dart'; @@ -11,10 +13,10 @@ class AuthCubit extends Cubit { AuthCubit({ required this.authRepository, - }) : super(AuthState()); + }) : super(const AuthState()); Future getTokenByCredentials(String email, String password) async { - emit(AuthState.loading()); + emit(const AuthState.loading()); try { final token = (await authRepository.getTokenByCredentials( email, @@ -31,7 +33,7 @@ class AuthCubit extends Cubit { AppRouter.navigatorKey.currentContext?.go('/my-profile-screen'); return true; } catch (e) { - print(e); + log(e.toString()); showErrorToast('Неверный адрес электронной почты или пароль'); emit(AuthState.error(errorMessage: '$e')); return false; diff --git a/lib/features/auth/presentation/bloc/auth_state.freezed.dart b/lib/features/auth/presentation/bloc/auth_state.freezed.dart index 0ee0756e..c0be41a8 100644 --- a/lib/features/auth/presentation/bloc/auth_state.freezed.dart +++ b/lib/features/auth/presentation/bloc/auth_state.freezed.dart @@ -12,8 +12,7 @@ part of 'auth_state.dart'; 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', -); + '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'); /// @nodoc mixin _$AuthState { @@ -23,14 +22,16 @@ mixin _$AuthState { required TResult Function() loading, required TResult Function(String token) loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(String token)? loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -38,21 +39,24 @@ mixin _$AuthState { TResult Function(String token)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_AuthState value) $default, { required TResult Function(AuthStateLoading value) loading, required TResult Function(AuthStateLoaded value) loaded, required TResult Function(AuthStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_AuthState value)? $default, { TResult? Function(AuthStateLoading value)? loading, TResult? Function(AuthStateLoaded value)? loaded, TResult? Function(AuthStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_AuthState value)? $default, { @@ -60,7 +64,8 @@ mixin _$AuthState { TResult Function(AuthStateLoaded value)? loaded, TResult Function(AuthStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc @@ -86,9 +91,8 @@ class _$AuthStateCopyWithImpl<$Res, $Val extends AuthState> /// @nodoc abstract class _$$AuthStateImplCopyWith<$Res> { factory _$$AuthStateImplCopyWith( - _$AuthStateImpl value, - $Res Function(_$AuthStateImpl) then, - ) = __$$AuthStateImplCopyWithImpl<$Res>; + _$AuthStateImpl value, $Res Function(_$AuthStateImpl) then) = + __$$AuthStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -96,9 +100,8 @@ class __$$AuthStateImplCopyWithImpl<$Res> extends _$AuthStateCopyWithImpl<$Res, _$AuthStateImpl> implements _$$AuthStateImplCopyWith<$Res> { __$$AuthStateImplCopyWithImpl( - _$AuthStateImpl _value, - $Res Function(_$AuthStateImpl) _then, - ) : super(_value, _then); + _$AuthStateImpl _value, $Res Function(_$AuthStateImpl) _then) + : super(_value, _then); /// Create a copy of AuthState /// with the given fields replaced by the non-null parameter values. @@ -204,20 +207,18 @@ abstract class _AuthState implements AuthState { /// @nodoc abstract class _$$AuthStateLoadingImplCopyWith<$Res> { - factory _$$AuthStateLoadingImplCopyWith( - _$AuthStateLoadingImpl value, - $Res Function(_$AuthStateLoadingImpl) then, - ) = __$$AuthStateLoadingImplCopyWithImpl<$Res>; + factory _$$AuthStateLoadingImplCopyWith(_$AuthStateLoadingImpl value, + $Res Function(_$AuthStateLoadingImpl) then) = + __$$AuthStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$AuthStateLoadingImplCopyWithImpl<$Res> extends _$AuthStateCopyWithImpl<$Res, _$AuthStateLoadingImpl> implements _$$AuthStateLoadingImplCopyWith<$Res> { - __$$AuthStateLoadingImplCopyWithImpl( - _$AuthStateLoadingImpl _value, - $Res Function(_$AuthStateLoadingImpl) _then, - ) : super(_value, _then); + __$$AuthStateLoadingImplCopyWithImpl(_$AuthStateLoadingImpl _value, + $Res Function(_$AuthStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of AuthState /// with the given fields replaced by the non-null parameter values. @@ -323,10 +324,9 @@ abstract class AuthStateLoading implements AuthState { /// @nodoc abstract class _$$AuthStateLoadedImplCopyWith<$Res> { - factory _$$AuthStateLoadedImplCopyWith( - _$AuthStateLoadedImpl value, - $Res Function(_$AuthStateLoadedImpl) then, - ) = __$$AuthStateLoadedImplCopyWithImpl<$Res>; + factory _$$AuthStateLoadedImplCopyWith(_$AuthStateLoadedImpl value, + $Res Function(_$AuthStateLoadedImpl) then) = + __$$AuthStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({String token}); } @@ -336,24 +336,22 @@ class __$$AuthStateLoadedImplCopyWithImpl<$Res> extends _$AuthStateCopyWithImpl<$Res, _$AuthStateLoadedImpl> implements _$$AuthStateLoadedImplCopyWith<$Res> { __$$AuthStateLoadedImplCopyWithImpl( - _$AuthStateLoadedImpl _value, - $Res Function(_$AuthStateLoadedImpl) _then, - ) : super(_value, _then); + _$AuthStateLoadedImpl _value, $Res Function(_$AuthStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of AuthState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? token = null}) { - return _then( - _$AuthStateLoadedImpl( - token: - null == token - ? _value.token - : token // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? token = null, + }) { + return _then(_$AuthStateLoadedImpl( + token: null == token + ? _value.token + : token // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -388,9 +386,7 @@ class _$AuthStateLoadedImpl implements AuthStateLoaded { @pragma('vm:prefer-inline') _$$AuthStateLoadedImplCopyWith<_$AuthStateLoadedImpl> get copyWith => __$$AuthStateLoadedImplCopyWithImpl<_$AuthStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -482,10 +478,9 @@ abstract class AuthStateLoaded implements AuthState { /// @nodoc abstract class _$$AuthStateErrorImplCopyWith<$Res> { - factory _$$AuthStateErrorImplCopyWith( - _$AuthStateErrorImpl value, - $Res Function(_$AuthStateErrorImpl) then, - ) = __$$AuthStateErrorImplCopyWithImpl<$Res>; + factory _$$AuthStateErrorImplCopyWith(_$AuthStateErrorImpl value, + $Res Function(_$AuthStateErrorImpl) then) = + __$$AuthStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -495,24 +490,22 @@ class __$$AuthStateErrorImplCopyWithImpl<$Res> extends _$AuthStateCopyWithImpl<$Res, _$AuthStateErrorImpl> implements _$$AuthStateErrorImplCopyWith<$Res> { __$$AuthStateErrorImplCopyWithImpl( - _$AuthStateErrorImpl _value, - $Res Function(_$AuthStateErrorImpl) _then, - ) : super(_value, _then); + _$AuthStateErrorImpl _value, $Res Function(_$AuthStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of AuthState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$AuthStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$AuthStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -548,9 +541,7 @@ class _$AuthStateErrorImpl implements AuthStateError { @pragma('vm:prefer-inline') _$$AuthStateErrorImplCopyWith<_$AuthStateErrorImpl> get copyWith => __$$AuthStateErrorImplCopyWithImpl<_$AuthStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs diff --git a/lib/features/auth/presentation/pages/auth_screen.dart b/lib/features/auth/presentation/pages/auth_screen.dart index cce986d6..cbd82a44 100644 --- a/lib/features/auth/presentation/pages/auth_screen.dart +++ b/lib/features/auth/presentation/pages/auth_screen.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:easy_debounce/easy_debounce.dart'; import 'package:eatvio_app/core/const.dart'; import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; @@ -22,7 +23,7 @@ import 'package:url_launcher/url_launcher.dart'; import '../bloc/auth_state.dart'; class AuthScreen extends StatefulWidget { - const AuthScreen(); + const AuthScreen({super.key}); @override State createState() => _AuthScreenState(); @@ -36,7 +37,7 @@ class _AuthScreenState extends State { final authCubit = sl(); late StreamSubscription keyboardSubscription; bool isFocused = false; - + int tapsCount = 0; @override void initState() { super.initState(); @@ -60,15 +61,27 @@ class _AuthScreenState extends State { appBar: AppBar( centerTitle: true, toolbarHeight: isFocused ? 64 : MediaQuery.of(context).size.width - 64, - title: SvgPicture.asset( - ImageConstant.imgLogoEatvio, - height: isFocused ? 64 : MediaQuery.of(context).size.width - 64, - fit: BoxFit.contain, + title: GestureDetector( + onTap: () { + tapsCount++; + if (tapsCount == 6) { + tapsCount = 0; + // showModalBottomSheet(context: context, builder: (context) => ); + } + EasyDebounce.debounce('change env', Durations.medium4, () { + tapsCount = 0; + }); + }, + child: SvgPicture.asset( + ImageConstant.imgLogoEatvio, + height: isFocused ? 64 : MediaQuery.of(context).size.width - 64, + fit: BoxFit.contain, + ), ), ), body: SafeArea( child: Padding( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -104,7 +117,7 @@ class _AuthScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text('Нет аккаунта? '), + const Text('Нет аккаунта? '), GestureDetector( onTap: () => GoRouter.of(context).goNamed('webViewRegistrationScreen'), child: Text( @@ -118,18 +131,18 @@ class _AuthScreenState extends State { ), ], ), - Spacer(), + const Spacer(), Center( child: RichText( textAlign: TextAlign.center, text: TextSpan( text: 'Нажимая "Войти", Вы соглашаетесь \n', - style: TextStyle( + style: const TextStyle( fontSize: 12, color: Colors.black, ), children: [ - TextSpan(text: 'c '), + const TextSpan(text: 'c '), TextSpan( text: ' Публичной офертой', style: TextStyle( @@ -138,14 +151,14 @@ class _AuthScreenState extends State { decorationColor: appTheme.blueA400, decoration: TextDecoration.underline, ), - recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse(baseUrl + '/oferta_bs.pdf')), + recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse('$baseUrl/oferta_bs.pdf')), ), ], ), ), ), const SizedBox(height: 16), - Container( + SizedBox( height: 48, width: MediaQuery.of(context).size.width - 32, child: FloatingActionButton.extended( @@ -165,12 +178,14 @@ class _AuthScreenState extends State { passwordController.text, ); if (isAuthenticated) { - context.read().getMyProfile(); - context.read().getChatRoomsWithLoading(); + if (context.mounted) { + context.read().getMyProfile(); + context.read().getChatRoomsWithLoading(); + } } }, label: state is AuthStateLoading - ? CupertinoActivityIndicator() + ? const CupertinoActivityIndicator() : Text( 'Войти', style: theme.textTheme.titleSmall!.copyWith(color: Colors.white), 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 e63da667..29f2f5bc 100644 --- a/lib/features/blog_post/presentation/pages/blog_post_screen.dart +++ b/lib/features/blog_post/presentation/pages/blog_post_screen.dart @@ -24,7 +24,7 @@ import 'package:share_plus/share_plus.dart'; class BlogPostScreen extends StatefulWidget { final FeedBlogPostModel blogPost; - BlogPostScreen({super.key, required this.blogPost}); + const BlogPostScreen({super.key, required this.blogPost}); @override State createState() => _BlogPostScreenState(); @@ -60,7 +60,7 @@ class _BlogPostScreenState extends State { return Scaffold( resizeToAvoidBottomInset: true, bottomSheet: Container( - padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), + padding: const EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), decoration: BoxDecoration(color: Colors.white, border: Border(top: BorderSide(color: Colors.black.withValues(alpha: 0.1)))), child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -79,14 +79,14 @@ class _BlogPostScreenState extends State { decoration: BoxDecoration(color: appTheme.blueA400, shape: BoxShape.circle), height: 32, width: 32, - child: Icon(Icons.close_rounded, size: 18, color: Colors.white), + child: const Icon(Icons.close_rounded, size: 18, color: Colors.white), ), ), - if (replyId != null) SizedBox(width: 8), + if (replyId != null) const SizedBox(width: 8), SizedBox( width: MediaQuery.of(context).size.width - (replyId == null ? 64 : 104), child: ConstrainedBox( - constraints: BoxConstraints(minHeight: 52), + constraints: const BoxConstraints(minHeight: 52), child: TextFormField( textCapitalization: TextCapitalization.sentences, onChanged: (_) { @@ -96,7 +96,7 @@ class _BlogPostScreenState extends State { maxLines: 5, minLines: 1, keyboardType: TextInputType.multiline, - style: TextStyle( + style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, @@ -104,9 +104,9 @@ class _BlogPostScreenState extends State { ), decoration: InputDecoration( isDense: false, // убираем true, чтобы padding учитывался корректно - contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен hintText: 'Комментарий', - hintStyle: TextStyle( + hintStyle: const TextStyle( fontSize: 16, fontWeight: FontWeight.w400, height: 1.2, @@ -115,21 +115,21 @@ class _BlogPostScreenState extends State { filled: true, border: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), ), ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), GestureDetector( onTap: () { if (textEditingController.text.length > 2) { @@ -151,7 +151,7 @@ class _BlogPostScreenState extends State { decoration: BoxDecoration(color: textEditingController.text.length > 2 ? appTheme.blueA400 : Colors.grey, shape: BoxShape.circle), height: 32, width: 32, - child: Icon(Icons.send_rounded, size: 18, color: Colors.white), + child: const Icon(Icons.send_rounded, size: 18, color: Colors.white), ), ), ], @@ -164,6 +164,7 @@ class _BlogPostScreenState extends State { onSelected: (value) async { if (value == 'delete') { final result = await sl().deleteBlogPost(widget.blogPost.id); + if (!context.mounted) return; if (!result) { showErrorDialog(context, title: S.current.could_not_delete_blog_post); return; @@ -175,29 +176,28 @@ class _BlogPostScreenState extends State { GoRouter.of(context).replaceNamed('blogPostCreateScreen', extra: widget.blogPost); } }, - itemBuilder: - (context) => [ - if (widget.blogPost.author.authorIsMe) PopupMenuItem(value: 'edit', child: Text('Редактировать')), - if (widget.blogPost.author.authorIsMe) PopupMenuItem(value: 'delete', child: Text('Удалить')), - if (!widget.blogPost.author.authorIsMe) - PopupMenuItem( - value: 'report', - child: Text('Пожаловаться'), - onTap: () { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (context) => ComplainingBottomSheet(complainedContentType: ComplainedContent.posts, id: widget.blogPost.id), - ); - }, - ), - ], + itemBuilder: (context) => [ + if (widget.blogPost.author.authorIsMe) const PopupMenuItem(value: 'edit', child: Text('Редактировать')), + if (widget.blogPost.author.authorIsMe) const PopupMenuItem(value: 'delete', child: Text('Удалить')), + if (!widget.blogPost.author.authorIsMe) + PopupMenuItem( + value: 'report', + child: const Text('Пожаловаться'), + onTap: () { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (context) => ComplainingBottomSheet(complainedContentType: ComplainedContent.posts, id: widget.blogPost.id), + ); + }, + ), + ], ), ], ), body: SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80), - physics: BouncingScrollPhysics(), + padding: const EdgeInsets.only(bottom: 80), + physics: const BouncingScrollPhysics(), child: Column( children: [ GestureDetector( @@ -209,15 +209,15 @@ class _BlogPostScreenState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ CircleAvatar(radius: 16, backgroundImage: NetworkImage(widget.blogPost.author.authorProfileIcon)), - SizedBox(width: 8), + const SizedBox(width: 8), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( widget.blogPost.author.authorName, - style: TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w400, height: 1), + style: const TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w400, height: 1), ), - SizedBox(height: 2), + const SizedBox(height: 2), Text( widget.blogPost.createdAt.format('dd MMMM', 'ru'), style: TextStyle(color: Colors.grey.shade600, fontSize: 12, fontWeight: FontWeight.w400, height: 1), @@ -233,8 +233,8 @@ class _BlogPostScreenState extends State { padding: const EdgeInsets.symmetric(horizontal: 8), child: Html(data: widget.blogPost.description, style: {"*": Style(color: Colors.black87)}), ), - SizedBox(height: 8), - CachedNetworkImage(imageUrl: baseUrl + '/storage/' + (widget.blogPost.image)), + const SizedBox(height: 8), + CachedNetworkImage(imageUrl: '$baseUrl/storage/${widget.blogPost.image}'), Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), child: Row( @@ -256,20 +256,20 @@ class _BlogPostScreenState extends State { sl().updateFeedBlogPostList(widget.blogPost, isLiked); }, ), - SizedBox(width: 8), + const SizedBox(width: 8), _iconButton( icon: Icons.reply_rounded, onTap: () { final box = context.findRenderObject() as RenderBox?; Share.shareUri( - Uri.parse(baseUrl + '/ru/blog_post/' + widget.blogPost.id.toString()), + Uri.parse('$baseUrl/ru/blog_post/${widget.blogPost.id}'), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, ), - Spacer(), + const Spacer(), Icon(Icons.visibility_rounded, size: 16, color: appTheme.gray500), - SizedBox(width: 4), + const SizedBox(width: 4), Text(widget.blogPost.totalViews.toString(), style: TextStyle(fontSize: 12, color: appTheme.gray500, fontWeight: FontWeight.w400)), ], ), @@ -279,16 +279,16 @@ class _BlogPostScreenState extends State { height: 0.4, decoration: BoxDecoration(color: Colors.black.withValues(alpha: 0.2), borderRadius: BorderRadius.circular(16)), ), - SizedBox(height: 8), + const SizedBox(height: 8), Container( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), alignment: Alignment.centerLeft, child: Text( - widget.blogPost.totalComments.toString() + ' КОММЕНТАРИЕВ', + '${widget.blogPost.totalComments} КОММЕНТАРИЕВ', style: TextStyle(fontSize: 12, color: appTheme.gray500, fontWeight: FontWeight.w400), ), ), - SizedBox(height: 16), + const SizedBox(height: 16), if (state is CommentsStateLoading) const Loader(), if (state is CommentsStateLoaded) CommentsWidget(id: widget.blogPost.id.toString(), commentSourceType: CommentSourceType.blogPost, comment: state.comment, replyId: replyId), @@ -306,14 +306,14 @@ class _BlogPostScreenState extends State { onTap: onTap ?? () {}, borderRadius: BorderRadius.circular(16), child: Ink( - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration(color: backgroundColor ?? appTheme.gray100, borderRadius: BorderRadius.circular(16)), height: 32, child: Row( mainAxisSize: MainAxisSize.min, children: [ Icon(icon, size: 20, color: iconColor ?? appTheme.gray600), - if (text != null) SizedBox(width: 8), + if (text != null) const SizedBox(width: 8), if (text != null) Text(text, style: TextStyle(color: textColor ?? appTheme.gray600, fontWeight: FontWeight.w500)), ], ), diff --git a/lib/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_cubit.dart b/lib/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_cubit.dart index 8d2d1bf0..df228298 100644 --- a/lib/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_cubit.dart +++ b/lib/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_cubit.dart @@ -10,7 +10,7 @@ class BlogPostCreateCubit extends Cubit { BlogPostCreateCubit({ required this.blogPostRepository, - }) : super(BlogPostCreateState()); + }) : super(const BlogPostCreateState()); Future createBlogPost({ String? title, @@ -19,7 +19,7 @@ class BlogPostCreateCubit extends Cubit { XFile? image, }) async { try { - emit(BlogPostCreateState.loading()); + emit(const BlogPostCreateState.loading()); await blogPostRepository.createBlogPost( title, videoUrl, @@ -29,7 +29,7 @@ class BlogPostCreateCubit extends Cubit { return true; } catch (e, st) { log(e.toString(), stackTrace: st); - emit(BlogPostCreateState.loaded()); + emit(const BlogPostCreateState.loaded()); return false; } } @@ -43,7 +43,7 @@ class BlogPostCreateCubit extends Cubit { String? oldImageUrl, }) async { try { - emit(BlogPostCreateState.loading()); + emit(const BlogPostCreateState.loading()); await blogPostRepository.updateBlogPost( id, title, @@ -52,11 +52,11 @@ class BlogPostCreateCubit extends Cubit { image, oldImageUrl, ); - emit(BlogPostCreateState.loaded()); + emit(const BlogPostCreateState.loaded()); return true; } catch (e, st) { log(e.toString(), stackTrace: st); - emit(BlogPostCreateState.loaded()); + emit(const BlogPostCreateState.loaded()); return false; } } diff --git a/lib/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_state.freezed.dart b/lib/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_state.freezed.dart index 973a9bca..d9a702c6 100644 --- a/lib/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_state.freezed.dart +++ b/lib/features/blog_post_create/bloc/blog_post_create_cubit/blog_post_create_state.freezed.dart @@ -12,8 +12,7 @@ part of 'blog_post_create_state.dart'; 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', -); + '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'); /// @nodoc mixin _$BlogPostCreateState { @@ -23,14 +22,16 @@ mixin _$BlogPostCreateState { required TResult Function() loading, required TResult Function() loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function()? loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -38,21 +39,24 @@ mixin _$BlogPostCreateState { TResult Function()? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_BlogPostCreateState value) $default, { required TResult Function(BlogPostCreateStateLoading value) loading, required TResult Function(BlogPostCreateStateLoaded value) loaded, required TResult Function(BlogPostCreateStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_BlogPostCreateState value)? $default, { TResult? Function(BlogPostCreateStateLoading value)? loading, TResult? Function(BlogPostCreateStateLoaded value)? loaded, TResult? Function(BlogPostCreateStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_BlogPostCreateState value)? $default, { @@ -60,15 +64,15 @@ mixin _$BlogPostCreateState { TResult Function(BlogPostCreateStateLoaded value)? loaded, TResult Function(BlogPostCreateStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $BlogPostCreateStateCopyWith<$Res> { factory $BlogPostCreateStateCopyWith( - BlogPostCreateState value, - $Res Function(BlogPostCreateState) then, - ) = _$BlogPostCreateStateCopyWithImpl<$Res, BlogPostCreateState>; + BlogPostCreateState value, $Res Function(BlogPostCreateState) then) = + _$BlogPostCreateStateCopyWithImpl<$Res, BlogPostCreateState>; } /// @nodoc @@ -87,20 +91,18 @@ class _$BlogPostCreateStateCopyWithImpl<$Res, $Val extends BlogPostCreateState> /// @nodoc abstract class _$$BlogPostCreateStateImplCopyWith<$Res> { - factory _$$BlogPostCreateStateImplCopyWith( - _$BlogPostCreateStateImpl value, - $Res Function(_$BlogPostCreateStateImpl) then, - ) = __$$BlogPostCreateStateImplCopyWithImpl<$Res>; + factory _$$BlogPostCreateStateImplCopyWith(_$BlogPostCreateStateImpl value, + $Res Function(_$BlogPostCreateStateImpl) then) = + __$$BlogPostCreateStateImplCopyWithImpl<$Res>; } /// @nodoc class __$$BlogPostCreateStateImplCopyWithImpl<$Res> extends _$BlogPostCreateStateCopyWithImpl<$Res, _$BlogPostCreateStateImpl> implements _$$BlogPostCreateStateImplCopyWith<$Res> { - __$$BlogPostCreateStateImplCopyWithImpl( - _$BlogPostCreateStateImpl _value, - $Res Function(_$BlogPostCreateStateImpl) _then, - ) : super(_value, _then); + __$$BlogPostCreateStateImplCopyWithImpl(_$BlogPostCreateStateImpl _value, + $Res Function(_$BlogPostCreateStateImpl) _then) + : super(_value, _then); /// Create a copy of BlogPostCreateState /// with the given fields replaced by the non-null parameter values. @@ -208,23 +210,20 @@ abstract class _BlogPostCreateState implements BlogPostCreateState { /// @nodoc abstract class _$$BlogPostCreateStateLoadingImplCopyWith<$Res> { factory _$$BlogPostCreateStateLoadingImplCopyWith( - _$BlogPostCreateStateLoadingImpl value, - $Res Function(_$BlogPostCreateStateLoadingImpl) then, - ) = __$$BlogPostCreateStateLoadingImplCopyWithImpl<$Res>; + _$BlogPostCreateStateLoadingImpl value, + $Res Function(_$BlogPostCreateStateLoadingImpl) then) = + __$$BlogPostCreateStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$BlogPostCreateStateLoadingImplCopyWithImpl<$Res> - extends - _$BlogPostCreateStateCopyWithImpl< - $Res, - _$BlogPostCreateStateLoadingImpl - > + extends _$BlogPostCreateStateCopyWithImpl<$Res, + _$BlogPostCreateStateLoadingImpl> implements _$$BlogPostCreateStateLoadingImplCopyWith<$Res> { __$$BlogPostCreateStateLoadingImplCopyWithImpl( - _$BlogPostCreateStateLoadingImpl _value, - $Res Function(_$BlogPostCreateStateLoadingImpl) _then, - ) : super(_value, _then); + _$BlogPostCreateStateLoadingImpl _value, + $Res Function(_$BlogPostCreateStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of BlogPostCreateState /// with the given fields replaced by the non-null parameter values. @@ -332,20 +331,20 @@ abstract class BlogPostCreateStateLoading implements BlogPostCreateState { /// @nodoc abstract class _$$BlogPostCreateStateLoadedImplCopyWith<$Res> { factory _$$BlogPostCreateStateLoadedImplCopyWith( - _$BlogPostCreateStateLoadedImpl value, - $Res Function(_$BlogPostCreateStateLoadedImpl) then, - ) = __$$BlogPostCreateStateLoadedImplCopyWithImpl<$Res>; + _$BlogPostCreateStateLoadedImpl value, + $Res Function(_$BlogPostCreateStateLoadedImpl) then) = + __$$BlogPostCreateStateLoadedImplCopyWithImpl<$Res>; } /// @nodoc class __$$BlogPostCreateStateLoadedImplCopyWithImpl<$Res> - extends - _$BlogPostCreateStateCopyWithImpl<$Res, _$BlogPostCreateStateLoadedImpl> + extends _$BlogPostCreateStateCopyWithImpl<$Res, + _$BlogPostCreateStateLoadedImpl> implements _$$BlogPostCreateStateLoadedImplCopyWith<$Res> { __$$BlogPostCreateStateLoadedImplCopyWithImpl( - _$BlogPostCreateStateLoadedImpl _value, - $Res Function(_$BlogPostCreateStateLoadedImpl) _then, - ) : super(_value, _then); + _$BlogPostCreateStateLoadedImpl _value, + $Res Function(_$BlogPostCreateStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of BlogPostCreateState /// with the given fields replaced by the non-null parameter values. @@ -453,37 +452,36 @@ abstract class BlogPostCreateStateLoaded implements BlogPostCreateState { /// @nodoc abstract class _$$BlogPostCreateStateErrorImplCopyWith<$Res> { factory _$$BlogPostCreateStateErrorImplCopyWith( - _$BlogPostCreateStateErrorImpl value, - $Res Function(_$BlogPostCreateStateErrorImpl) then, - ) = __$$BlogPostCreateStateErrorImplCopyWithImpl<$Res>; + _$BlogPostCreateStateErrorImpl value, + $Res Function(_$BlogPostCreateStateErrorImpl) then) = + __$$BlogPostCreateStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc class __$$BlogPostCreateStateErrorImplCopyWithImpl<$Res> - extends - _$BlogPostCreateStateCopyWithImpl<$Res, _$BlogPostCreateStateErrorImpl> + extends _$BlogPostCreateStateCopyWithImpl<$Res, + _$BlogPostCreateStateErrorImpl> implements _$$BlogPostCreateStateErrorImplCopyWith<$Res> { __$$BlogPostCreateStateErrorImplCopyWithImpl( - _$BlogPostCreateStateErrorImpl _value, - $Res Function(_$BlogPostCreateStateErrorImpl) _then, - ) : super(_value, _then); + _$BlogPostCreateStateErrorImpl _value, + $Res Function(_$BlogPostCreateStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of BlogPostCreateState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$BlogPostCreateStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$BlogPostCreateStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -518,9 +516,8 @@ class _$BlogPostCreateStateErrorImpl implements BlogPostCreateStateError { @override @pragma('vm:prefer-inline') _$$BlogPostCreateStateErrorImplCopyWith<_$BlogPostCreateStateErrorImpl> - get copyWith => __$$BlogPostCreateStateErrorImplCopyWithImpl< - _$BlogPostCreateStateErrorImpl - >(this, _$identity); + get copyWith => __$$BlogPostCreateStateErrorImplCopyWithImpl< + _$BlogPostCreateStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -607,5 +604,5 @@ abstract class BlogPostCreateStateError implements BlogPostCreateState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$BlogPostCreateStateErrorImplCopyWith<_$BlogPostCreateStateErrorImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart b/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart index 04102415..f7b57ddd 100644 --- a/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart +++ b/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart @@ -22,8 +22,9 @@ class BlogPostCreateScreen extends StatefulWidget { final FeedBlogPostModel? feedBlogPostModel; const BlogPostCreateScreen({ + super.key, this.feedBlogPostModel, - }) : super(); + }); @override State createState() => _BlogPostCreateScreenState(); @@ -61,6 +62,7 @@ class _BlogPostCreateScreenState extends State { super.dispose(); } + @override Widget build(BuildContext context) { return BlocProvider( create: (BuildContext context) => blogPostCubit, @@ -70,7 +72,7 @@ class _BlogPostCreateScreenState extends State { context.read().loadFeedBlogPostList(); } }, - child: _buildBlogPostCreate(), + child: _buildBlogPostCreate(context), ), ); } @@ -85,10 +87,11 @@ class _BlogPostCreateScreenState extends State { final picker = ImagePicker(); image = await picker.pickImage(source: ImageSource.camera); setState(() {}); + if (!context.mounted) return; Navigator.of(context).pop(); }, child: const Row( - children: const [ + children: [ Icon(Icons.photo_camera), SizedBox(width: 8), Text('Фото'), @@ -100,10 +103,11 @@ class _BlogPostCreateScreenState extends State { final picker = ImagePicker(); image = await picker.pickImage(source: ImageSource.gallery); setState(() {}); + if (!context.mounted) return; Navigator.of(context).pop(); }, child: const Row( - children: const [ + children: [ Icon(Icons.photo), SizedBox(width: 8), Text('Галерея'), @@ -120,7 +124,7 @@ class _BlogPostCreateScreenState extends State { ); } - _buildBlogPostCreate() { + _buildBlogPostCreate(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: true, appBar: AppBar(), @@ -137,8 +141,8 @@ class _BlogPostCreateScreenState extends State { ), backgroundColor: appTheme.blueA400, label: isLoading - ? CircularProgressIndicator() - : Text( + ? const CircularProgressIndicator() + : const Text( 'Создать', style: TextStyle( color: Colors.white, @@ -164,8 +168,10 @@ class _BlogPostCreateScreenState extends State { isLoading = false; }); if (!result) { + if (!context.mounted) return; showErrorDialog(context, title: S.current.could_not_update_blog_post); } else { + if (!context.mounted) return; context.pop(); } } else { @@ -179,8 +185,10 @@ class _BlogPostCreateScreenState extends State { isLoading = false; }); if (!result) { + if (!context.mounted) return; showErrorDialog(context, title: S.current.could_not_publish_blog_post); } else { + if (!context.mounted) return; context.pop(); } } @@ -188,36 +196,36 @@ class _BlogPostCreateScreenState extends State { ), ), body: SingleChildScrollView( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 16), - Text('Заголовок'), - SizedBox(height: 8), + const SizedBox(height: 16), + const Text('Заголовок'), + const SizedBox(height: 8), CustomTextFormField( controller: titleController, ), - SizedBox(height: 16), - Text('Описание'), - SizedBox(height: 8), + const SizedBox(height: 16), + const Text('Описание'), + const SizedBox(height: 8), CustomTextFormField( controller: descriptionController, maxLines: 6, minLines: 4, ), - SizedBox(height: 16), - if (videoUrlController.text.isEmpty) Text('Изображение поста'), - if (videoUrlController.text.isEmpty) SizedBox(height: 8), + const SizedBox(height: 16), + if (videoUrlController.text.isEmpty) const Text('Изображение поста'), + if (videoUrlController.text.isEmpty) const SizedBox(height: 8), if (videoUrlController.text.isEmpty) _buildAddPhoto(), - SizedBox(height: 16), - if (image == null && widget.feedBlogPostModel?.image == null) Text('Ссылка на видео'), - if (image == null && widget.feedBlogPostModel?.image == null) SizedBox(height: 8), + const SizedBox(height: 16), + if (image == null && widget.feedBlogPostModel?.image == null) const Text('Ссылка на видео'), + if (image == null && widget.feedBlogPostModel?.image == null) const SizedBox(height: 8), if (image == null && widget.feedBlogPostModel?.image == null) CustomTextFormField( controller: videoUrlController, ), - SizedBox(height: 80), + const SizedBox(height: 80), ], ), ), @@ -235,7 +243,7 @@ class _BlogPostCreateScreenState extends State { AnimatedContainer( height: shrinkImage ? 52 : 128, curve: Curves.easeIn, - duration: Duration(milliseconds: 150), + duration: const Duration(milliseconds: 150), decoration: AppDecoration.fillGray.copyWith( borderRadius: BorderRadius.circular(16), ), @@ -247,7 +255,7 @@ class _BlogPostCreateScreenState extends State { Icons.photo_library, color: appTheme.blueGray300, ), - SizedBox(width: 8), + const SizedBox(width: 8), Text( "Добавить фото", selectionColor: appTheme.blueA400, @@ -256,7 +264,7 @@ class _BlogPostCreateScreenState extends State { ), ), if (image != null) - Container( + SizedBox( width: shrinkImage ? 52 : MediaQuery.of(context).size.width - 32, child: ClipRRect( borderRadius: BorderRadius.circular(16), @@ -270,12 +278,12 @@ class _BlogPostCreateScreenState extends State { ), ), if (widget.feedBlogPostModel?.image != null && image == null) - Container( + SizedBox( width: shrinkImage ? 52 : MediaQuery.of(context).size.width - 32, child: ClipRRect( borderRadius: BorderRadius.circular(16), child: Image( - image: NetworkImage(baseUrl + '/storage/' + widget.feedBlogPostModel!.image), + image: NetworkImage('$baseUrl/storage/${widget.feedBlogPostModel!.image}'), ), ), ), diff --git a/lib/features/blog_post_create/repositories/blog_post_repository.dart b/lib/features/blog_post_create/repositories/blog_post_repository.dart index 0b9b0ecd..af796f14 100644 --- a/lib/features/blog_post_create/repositories/blog_post_repository.dart +++ b/lib/features/blog_post_create/repositories/blog_post_repository.dart @@ -1,3 +1,4 @@ +import 'dart:developer'; import 'dart:io'; import 'package:dio/dio.dart'; import 'package:eatvio_app/core/const.dart'; @@ -35,7 +36,7 @@ class BlogPostRepository { Future downloadImage(String imageUrl) async { try { // Загрузка изображения - final response = await http.get(Uri.parse(baseUrl + '/storage/' + imageUrl)); + final response = await http.get(Uri.parse('$baseUrl/storage/$imageUrl')); if (response.statusCode == 200) { // Получение временной директории @@ -49,11 +50,11 @@ class BlogPostRepository { // Возвращаем объект XFile return XFile(file.path); } else { - print('Ошибка загрузки изображения: ${response.statusCode}'); + log('Ошибка загрузки изображения: ${response.statusCode}'); return null; } } catch (e) { - print('Произошла ошибка: $e'); + log('Произошла ошибка: $e'); return null; } } diff --git a/lib/features/blog_post_create/services/blog_post_service.g.dart b/lib/features/blog_post_create/services/blog_post_service.g.dart index ba5e1482..11d14421 100644 --- a/lib/features/blog_post_create/services/blog_post_service.g.dart +++ b/lib/features/blog_post_create/services/blog_post_service.g.dart @@ -25,11 +25,11 @@ class _BlogPostService implements BlogPostService { final _data = formData; final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/blogPosts/create/published', @@ -52,11 +52,11 @@ class _BlogPostService implements BlogPostService { final _data = formData; final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/blogPosts/update/published/${id}', diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart index 621cd1bb..7c5d7ffd 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart @@ -12,8 +12,7 @@ part of 'new_messages_state.dart'; 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', -); + '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'); /// @nodoc mixin _$NewMessagesState { @@ -23,14 +22,16 @@ mixin _$NewMessagesState { required TResult Function() empty, required TResult Function(int messagesCount) loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? empty, TResult? Function(int messagesCount)? loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -38,21 +39,24 @@ mixin _$NewMessagesState { TResult Function(int messagesCount)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_NewMessagesState value) $default, { required TResult Function(NewMessagesStateEmpty value) empty, required TResult Function(NewMessagesStateLoaded value) loaded, required TResult Function(NewMessagesStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_NewMessagesState value)? $default, { TResult? Function(NewMessagesStateEmpty value)? empty, TResult? Function(NewMessagesStateLoaded value)? loaded, TResult? Function(NewMessagesStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_NewMessagesState value)? $default, { @@ -60,15 +64,15 @@ mixin _$NewMessagesState { TResult Function(NewMessagesStateLoaded value)? loaded, TResult Function(NewMessagesStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $NewMessagesStateCopyWith<$Res> { factory $NewMessagesStateCopyWith( - NewMessagesState value, - $Res Function(NewMessagesState) then, - ) = _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>; + NewMessagesState value, $Res Function(NewMessagesState) then) = + _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>; } /// @nodoc @@ -87,20 +91,18 @@ class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> /// @nodoc abstract class _$$NewMessagesStateImplCopyWith<$Res> { - factory _$$NewMessagesStateImplCopyWith( - _$NewMessagesStateImpl value, - $Res Function(_$NewMessagesStateImpl) then, - ) = __$$NewMessagesStateImplCopyWithImpl<$Res>; + factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value, + $Res Function(_$NewMessagesStateImpl) then) = + __$$NewMessagesStateImplCopyWithImpl<$Res>; } /// @nodoc class __$$NewMessagesStateImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl> implements _$$NewMessagesStateImplCopyWith<$Res> { - __$$NewMessagesStateImplCopyWithImpl( - _$NewMessagesStateImpl _value, - $Res Function(_$NewMessagesStateImpl) _then, - ) : super(_value, _then); + __$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value, + $Res Function(_$NewMessagesStateImpl) _then) + : super(_value, _then); /// Create a copy of NewMessagesState /// with the given fields replaced by the non-null parameter values. @@ -207,19 +209,18 @@ abstract class _NewMessagesState implements NewMessagesState { /// @nodoc abstract class _$$NewMessagesStateEmptyImplCopyWith<$Res> { factory _$$NewMessagesStateEmptyImplCopyWith( - _$NewMessagesStateEmptyImpl value, - $Res Function(_$NewMessagesStateEmptyImpl) then, - ) = __$$NewMessagesStateEmptyImplCopyWithImpl<$Res>; + _$NewMessagesStateEmptyImpl value, + $Res Function(_$NewMessagesStateEmptyImpl) then) = + __$$NewMessagesStateEmptyImplCopyWithImpl<$Res>; } /// @nodoc class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl> implements _$$NewMessagesStateEmptyImplCopyWith<$Res> { - __$$NewMessagesStateEmptyImplCopyWithImpl( - _$NewMessagesStateEmptyImpl _value, - $Res Function(_$NewMessagesStateEmptyImpl) _then, - ) : super(_value, _then); + __$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value, + $Res Function(_$NewMessagesStateEmptyImpl) _then) + : super(_value, _then); /// Create a copy of NewMessagesState /// with the given fields replaced by the non-null parameter values. @@ -327,9 +328,9 @@ abstract class NewMessagesStateEmpty implements NewMessagesState { /// @nodoc abstract class _$$NewMessagesStateLoadedImplCopyWith<$Res> { factory _$$NewMessagesStateLoadedImplCopyWith( - _$NewMessagesStateLoadedImpl value, - $Res Function(_$NewMessagesStateLoadedImpl) then, - ) = __$$NewMessagesStateLoadedImplCopyWithImpl<$Res>; + _$NewMessagesStateLoadedImpl value, + $Res Function(_$NewMessagesStateLoadedImpl) then) = + __$$NewMessagesStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({int messagesCount}); } @@ -339,24 +340,23 @@ class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl> implements _$$NewMessagesStateLoadedImplCopyWith<$Res> { __$$NewMessagesStateLoadedImplCopyWithImpl( - _$NewMessagesStateLoadedImpl _value, - $Res Function(_$NewMessagesStateLoadedImpl) _then, - ) : super(_value, _then); + _$NewMessagesStateLoadedImpl _value, + $Res Function(_$NewMessagesStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of NewMessagesState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? messagesCount = null}) { - return _then( - _$NewMessagesStateLoadedImpl( - messagesCount: - null == messagesCount - ? _value.messagesCount - : messagesCount // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + $Res call({ + Object? messagesCount = null, + }) { + return _then(_$NewMessagesStateLoadedImpl( + messagesCount: null == messagesCount + ? _value.messagesCount + : messagesCount // ignore: cast_nullable_to_non_nullable + as int, + )); } } @@ -391,11 +391,8 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { @override @pragma('vm:prefer-inline') _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> - get copyWith => - __$$NewMessagesStateLoadedImplCopyWithImpl<_$NewMessagesStateLoadedImpl>( - this, - _$identity, - ); + get copyWith => __$$NewMessagesStateLoadedImplCopyWithImpl< + _$NewMessagesStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -482,15 +479,15 @@ abstract class NewMessagesStateLoaded implements NewMessagesState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$NewMessagesStateErrorImplCopyWith<$Res> { factory _$$NewMessagesStateErrorImplCopyWith( - _$NewMessagesStateErrorImpl value, - $Res Function(_$NewMessagesStateErrorImpl) then, - ) = __$$NewMessagesStateErrorImplCopyWithImpl<$Res>; + _$NewMessagesStateErrorImpl value, + $Res Function(_$NewMessagesStateErrorImpl) then) = + __$$NewMessagesStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -499,25 +496,23 @@ abstract class _$$NewMessagesStateErrorImplCopyWith<$Res> { class __$$NewMessagesStateErrorImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl> implements _$$NewMessagesStateErrorImplCopyWith<$Res> { - __$$NewMessagesStateErrorImplCopyWithImpl( - _$NewMessagesStateErrorImpl _value, - $Res Function(_$NewMessagesStateErrorImpl) _then, - ) : super(_value, _then); + __$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value, + $Res Function(_$NewMessagesStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of NewMessagesState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$NewMessagesStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$NewMessagesStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -552,11 +547,8 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { @override @pragma('vm:prefer-inline') _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> - get copyWith => - __$$NewMessagesStateErrorImplCopyWithImpl<_$NewMessagesStateErrorImpl>( - this, - _$identity, - ); + get copyWith => __$$NewMessagesStateErrorImplCopyWithImpl< + _$NewMessagesStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -643,5 +635,5 @@ abstract class NewMessagesStateError implements NewMessagesState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart b/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart index 6a162c25..d634b318 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart @@ -12,8 +12,7 @@ part of 'notifications_state.dart'; 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', -); + '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'); /// @nodoc mixin _$NotificationsState { @@ -22,43 +21,46 @@ mixin _$NotificationsState { TResult Function() $default, { required TResult Function() empty, required TResult Function( - List notifications, - int notificationsCount, - ) - loaded, + List notifications, int notificationsCount) + loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? empty, TResult? Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { TResult Function()? empty, TResult Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_NotificationsState value) $default, { required TResult Function(NotificationsStateEmpty value) empty, required TResult Function(NotificationsStateLoaded value) loaded, required TResult Function(NotificationsStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_NotificationsState value)? $default, { TResult? Function(NotificationsStateEmpty value)? empty, TResult? Function(NotificationsStateLoaded value)? loaded, TResult? Function(NotificationsStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_NotificationsState value)? $default, { @@ -66,15 +68,15 @@ mixin _$NotificationsState { TResult Function(NotificationsStateLoaded value)? loaded, TResult Function(NotificationsStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $NotificationsStateCopyWith<$Res> { factory $NotificationsStateCopyWith( - NotificationsState value, - $Res Function(NotificationsState) then, - ) = _$NotificationsStateCopyWithImpl<$Res, NotificationsState>; + NotificationsState value, $Res Function(NotificationsState) then) = + _$NotificationsStateCopyWithImpl<$Res, NotificationsState>; } /// @nodoc @@ -93,20 +95,18 @@ class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> /// @nodoc abstract class _$$NotificationsStateImplCopyWith<$Res> { - factory _$$NotificationsStateImplCopyWith( - _$NotificationsStateImpl value, - $Res Function(_$NotificationsStateImpl) then, - ) = __$$NotificationsStateImplCopyWithImpl<$Res>; + factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value, + $Res Function(_$NotificationsStateImpl) then) = + __$$NotificationsStateImplCopyWithImpl<$Res>; } /// @nodoc class __$$NotificationsStateImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl> implements _$$NotificationsStateImplCopyWith<$Res> { - __$$NotificationsStateImplCopyWithImpl( - _$NotificationsStateImpl _value, - $Res Function(_$NotificationsStateImpl) _then, - ) : super(_value, _then); + __$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value, + $Res Function(_$NotificationsStateImpl) _then) + : super(_value, _then); /// Create a copy of NotificationsState /// with the given fields replaced by the non-null parameter values. @@ -137,10 +137,8 @@ class _$NotificationsStateImpl implements _NotificationsState { TResult Function() $default, { required TResult Function() empty, required TResult Function( - List notifications, - int notificationsCount, - ) - loaded, + List notifications, int notificationsCount) + loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -152,7 +150,7 @@ class _$NotificationsStateImpl implements _NotificationsState { TResult? Function()? $default, { TResult? Function()? empty, TResult? Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -164,7 +162,7 @@ class _$NotificationsStateImpl implements _NotificationsState { TResult Function()? $default, { TResult Function()? empty, TResult Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -219,20 +217,20 @@ abstract class _NotificationsState implements NotificationsState { /// @nodoc abstract class _$$NotificationsStateEmptyImplCopyWith<$Res> { factory _$$NotificationsStateEmptyImplCopyWith( - _$NotificationsStateEmptyImpl value, - $Res Function(_$NotificationsStateEmptyImpl) then, - ) = __$$NotificationsStateEmptyImplCopyWithImpl<$Res>; + _$NotificationsStateEmptyImpl value, + $Res Function(_$NotificationsStateEmptyImpl) then) = + __$$NotificationsStateEmptyImplCopyWithImpl<$Res>; } /// @nodoc class __$$NotificationsStateEmptyImplCopyWithImpl<$Res> - extends - _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateEmptyImpl> + extends _$NotificationsStateCopyWithImpl<$Res, + _$NotificationsStateEmptyImpl> implements _$$NotificationsStateEmptyImplCopyWith<$Res> { __$$NotificationsStateEmptyImplCopyWithImpl( - _$NotificationsStateEmptyImpl _value, - $Res Function(_$NotificationsStateEmptyImpl) _then, - ) : super(_value, _then); + _$NotificationsStateEmptyImpl _value, + $Res Function(_$NotificationsStateEmptyImpl) _then) + : super(_value, _then); /// Create a copy of NotificationsState /// with the given fields replaced by the non-null parameter values. @@ -264,10 +262,8 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty { TResult Function() $default, { required TResult Function() empty, required TResult Function( - List notifications, - int notificationsCount, - ) - loaded, + List notifications, int notificationsCount) + loaded, required TResult Function(String errorMessage) error, }) { return empty(); @@ -279,7 +275,7 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty { TResult? Function()? $default, { TResult? Function()? empty, TResult? Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult? Function(String errorMessage)? error, }) { return empty?.call(); @@ -291,7 +287,7 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty { TResult Function()? $default, { TResult Function()? empty, TResult Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -346,52 +342,51 @@ abstract class NotificationsStateEmpty implements NotificationsState { /// @nodoc abstract class _$$NotificationsStateLoadedImplCopyWith<$Res> { factory _$$NotificationsStateLoadedImplCopyWith( - _$NotificationsStateLoadedImpl value, - $Res Function(_$NotificationsStateLoadedImpl) then, - ) = __$$NotificationsStateLoadedImplCopyWithImpl<$Res>; + _$NotificationsStateLoadedImpl value, + $Res Function(_$NotificationsStateLoadedImpl) then) = + __$$NotificationsStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({List notifications, int notificationsCount}); } /// @nodoc class __$$NotificationsStateLoadedImplCopyWithImpl<$Res> - extends - _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateLoadedImpl> + extends _$NotificationsStateCopyWithImpl<$Res, + _$NotificationsStateLoadedImpl> implements _$$NotificationsStateLoadedImplCopyWith<$Res> { __$$NotificationsStateLoadedImplCopyWithImpl( - _$NotificationsStateLoadedImpl _value, - $Res Function(_$NotificationsStateLoadedImpl) _then, - ) : super(_value, _then); + _$NotificationsStateLoadedImpl _value, + $Res Function(_$NotificationsStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of NotificationsState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? notifications = null, Object? notificationsCount = null}) { - return _then( - _$NotificationsStateLoadedImpl( - notifications: - null == notifications - ? _value._notifications - : notifications // ignore: cast_nullable_to_non_nullable - as List, - notificationsCount: - null == notificationsCount - ? _value.notificationsCount - : notificationsCount // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + $Res call({ + Object? notifications = null, + Object? notificationsCount = null, + }) { + return _then(_$NotificationsStateLoadedImpl( + notifications: null == notifications + ? _value._notifications + : notifications // ignore: cast_nullable_to_non_nullable + as List, + notificationsCount: null == notificationsCount + ? _value.notificationsCount + : notificationsCount // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { - const _$NotificationsStateLoadedImpl({ - required final List notifications, - required this.notificationsCount, - }) : _notifications = notifications; + const _$NotificationsStateLoadedImpl( + {required final List notifications, + required this.notificationsCount}) + : _notifications = notifications; final List _notifications; @override @@ -414,20 +409,15 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateLoadedImpl && - const DeepCollectionEquality().equals( - other._notifications, - _notifications, - ) && + const DeepCollectionEquality() + .equals(other._notifications, _notifications) && (identical(other.notificationsCount, notificationsCount) || other.notificationsCount == notificationsCount)); } @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_notifications), - notificationsCount, - ); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_notifications), notificationsCount); /// Create a copy of NotificationsState /// with the given fields replaced by the non-null parameter values. @@ -435,9 +425,8 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { @override @pragma('vm:prefer-inline') _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> - get copyWith => __$$NotificationsStateLoadedImplCopyWithImpl< - _$NotificationsStateLoadedImpl - >(this, _$identity); + get copyWith => __$$NotificationsStateLoadedImplCopyWithImpl< + _$NotificationsStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -445,10 +434,8 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { TResult Function() $default, { required TResult Function() empty, required TResult Function( - List notifications, - int notificationsCount, - ) - loaded, + List notifications, int notificationsCount) + loaded, required TResult Function(String errorMessage) error, }) { return loaded(notifications, notificationsCount); @@ -460,7 +447,7 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { TResult? Function()? $default, { TResult? Function()? empty, TResult? Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult? Function(String errorMessage)? error, }) { return loaded?.call(notifications, notificationsCount); @@ -472,7 +459,7 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { TResult Function()? $default, { TResult Function()? empty, TResult Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -521,10 +508,9 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { } abstract class NotificationsStateLoaded implements NotificationsState { - const factory NotificationsStateLoaded({ - required final List notifications, - required final int notificationsCount, - }) = _$NotificationsStateLoadedImpl; + const factory NotificationsStateLoaded( + {required final List notifications, + required final int notificationsCount}) = _$NotificationsStateLoadedImpl; List get notifications; int get notificationsCount; @@ -533,43 +519,42 @@ abstract class NotificationsStateLoaded implements NotificationsState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$NotificationsStateErrorImplCopyWith<$Res> { factory _$$NotificationsStateErrorImplCopyWith( - _$NotificationsStateErrorImpl value, - $Res Function(_$NotificationsStateErrorImpl) then, - ) = __$$NotificationsStateErrorImplCopyWithImpl<$Res>; + _$NotificationsStateErrorImpl value, + $Res Function(_$NotificationsStateErrorImpl) then) = + __$$NotificationsStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc class __$$NotificationsStateErrorImplCopyWithImpl<$Res> - extends - _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateErrorImpl> + extends _$NotificationsStateCopyWithImpl<$Res, + _$NotificationsStateErrorImpl> implements _$$NotificationsStateErrorImplCopyWith<$Res> { __$$NotificationsStateErrorImplCopyWithImpl( - _$NotificationsStateErrorImpl _value, - $Res Function(_$NotificationsStateErrorImpl) _then, - ) : super(_value, _then); + _$NotificationsStateErrorImpl _value, + $Res Function(_$NotificationsStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of NotificationsState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$NotificationsStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$NotificationsStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -604,9 +589,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { @override @pragma('vm:prefer-inline') _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> - get copyWith => __$$NotificationsStateErrorImplCopyWithImpl< - _$NotificationsStateErrorImpl - >(this, _$identity); + get copyWith => __$$NotificationsStateErrorImplCopyWithImpl< + _$NotificationsStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -614,10 +598,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { TResult Function() $default, { required TResult Function() empty, required TResult Function( - List notifications, - int notificationsCount, - ) - loaded, + List notifications, int notificationsCount) + loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -629,7 +611,7 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { TResult? Function()? $default, { TResult? Function()? empty, TResult? Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -641,7 +623,7 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { TResult Function()? $default, { TResult Function()? empty, TResult Function(List notifications, int notificationsCount)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -699,5 +681,5 @@ abstract class NotificationsStateError implements NotificationsState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.freezed.dart b/lib/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.freezed.dart index 270c829f..b629d579 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.freezed.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.freezed.dart @@ -12,8 +12,7 @@ part of 'profile_avatar_state.dart'; 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', -); + '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'); /// @nodoc mixin _$ProfileAvatarState { @@ -23,14 +22,16 @@ mixin _$ProfileAvatarState { required TResult Function() loading, required TResult Function(ProfileModel profile) loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(ProfileModel profile)? loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -38,21 +39,24 @@ mixin _$ProfileAvatarState { TResult Function(ProfileModel profile)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_ProfileAvatarState value) $default, { required TResult Function(ProfileAvatarStateLoading value) loading, required TResult Function(ProfileAvatarStateLoaded value) loaded, required TResult Function(ProfileAvatarStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_ProfileAvatarState value)? $default, { TResult? Function(ProfileAvatarStateLoading value)? loading, TResult? Function(ProfileAvatarStateLoaded value)? loaded, TResult? Function(ProfileAvatarStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_ProfileAvatarState value)? $default, { @@ -60,15 +64,15 @@ mixin _$ProfileAvatarState { TResult Function(ProfileAvatarStateLoaded value)? loaded, TResult Function(ProfileAvatarStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ProfileAvatarStateCopyWith<$Res> { factory $ProfileAvatarStateCopyWith( - ProfileAvatarState value, - $Res Function(ProfileAvatarState) then, - ) = _$ProfileAvatarStateCopyWithImpl<$Res, ProfileAvatarState>; + ProfileAvatarState value, $Res Function(ProfileAvatarState) then) = + _$ProfileAvatarStateCopyWithImpl<$Res, ProfileAvatarState>; } /// @nodoc @@ -87,20 +91,18 @@ class _$ProfileAvatarStateCopyWithImpl<$Res, $Val extends ProfileAvatarState> /// @nodoc abstract class _$$ProfileAvatarStateImplCopyWith<$Res> { - factory _$$ProfileAvatarStateImplCopyWith( - _$ProfileAvatarStateImpl value, - $Res Function(_$ProfileAvatarStateImpl) then, - ) = __$$ProfileAvatarStateImplCopyWithImpl<$Res>; + factory _$$ProfileAvatarStateImplCopyWith(_$ProfileAvatarStateImpl value, + $Res Function(_$ProfileAvatarStateImpl) then) = + __$$ProfileAvatarStateImplCopyWithImpl<$Res>; } /// @nodoc class __$$ProfileAvatarStateImplCopyWithImpl<$Res> extends _$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateImpl> implements _$$ProfileAvatarStateImplCopyWith<$Res> { - __$$ProfileAvatarStateImplCopyWithImpl( - _$ProfileAvatarStateImpl _value, - $Res Function(_$ProfileAvatarStateImpl) _then, - ) : super(_value, _then); + __$$ProfileAvatarStateImplCopyWithImpl(_$ProfileAvatarStateImpl _value, + $Res Function(_$ProfileAvatarStateImpl) _then) + : super(_value, _then); /// Create a copy of ProfileAvatarState /// with the given fields replaced by the non-null parameter values. @@ -207,20 +209,20 @@ abstract class _ProfileAvatarState implements ProfileAvatarState { /// @nodoc abstract class _$$ProfileAvatarStateLoadingImplCopyWith<$Res> { factory _$$ProfileAvatarStateLoadingImplCopyWith( - _$ProfileAvatarStateLoadingImpl value, - $Res Function(_$ProfileAvatarStateLoadingImpl) then, - ) = __$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res>; + _$ProfileAvatarStateLoadingImpl value, + $Res Function(_$ProfileAvatarStateLoadingImpl) then) = + __$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res> - extends - _$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateLoadingImpl> + extends _$ProfileAvatarStateCopyWithImpl<$Res, + _$ProfileAvatarStateLoadingImpl> implements _$$ProfileAvatarStateLoadingImplCopyWith<$Res> { __$$ProfileAvatarStateLoadingImplCopyWithImpl( - _$ProfileAvatarStateLoadingImpl _value, - $Res Function(_$ProfileAvatarStateLoadingImpl) _then, - ) : super(_value, _then); + _$ProfileAvatarStateLoadingImpl _value, + $Res Function(_$ProfileAvatarStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of ProfileAvatarState /// with the given fields replaced by the non-null parameter values. @@ -328,9 +330,9 @@ abstract class ProfileAvatarStateLoading implements ProfileAvatarState { /// @nodoc abstract class _$$ProfileAvatarStateLoadedImplCopyWith<$Res> { factory _$$ProfileAvatarStateLoadedImplCopyWith( - _$ProfileAvatarStateLoadedImpl value, - $Res Function(_$ProfileAvatarStateLoadedImpl) then, - ) = __$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res>; + _$ProfileAvatarStateLoadedImpl value, + $Res Function(_$ProfileAvatarStateLoadedImpl) then) = + __$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({ProfileModel profile}); @@ -339,28 +341,27 @@ abstract class _$$ProfileAvatarStateLoadedImplCopyWith<$Res> { /// @nodoc class __$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res> - extends - _$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateLoadedImpl> + extends _$ProfileAvatarStateCopyWithImpl<$Res, + _$ProfileAvatarStateLoadedImpl> implements _$$ProfileAvatarStateLoadedImplCopyWith<$Res> { __$$ProfileAvatarStateLoadedImplCopyWithImpl( - _$ProfileAvatarStateLoadedImpl _value, - $Res Function(_$ProfileAvatarStateLoadedImpl) _then, - ) : super(_value, _then); + _$ProfileAvatarStateLoadedImpl _value, + $Res Function(_$ProfileAvatarStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of ProfileAvatarState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? profile = null}) { - return _then( - _$ProfileAvatarStateLoadedImpl( - profile: - null == profile - ? _value.profile - : profile // ignore: cast_nullable_to_non_nullable - as ProfileModel, - ), - ); + $Res call({ + Object? profile = null, + }) { + return _then(_$ProfileAvatarStateLoadedImpl( + profile: null == profile + ? _value.profile + : profile // ignore: cast_nullable_to_non_nullable + as ProfileModel, + )); } /// Create a copy of ProfileAvatarState @@ -404,9 +405,8 @@ class _$ProfileAvatarStateLoadedImpl implements ProfileAvatarStateLoaded { @override @pragma('vm:prefer-inline') _$$ProfileAvatarStateLoadedImplCopyWith<_$ProfileAvatarStateLoadedImpl> - get copyWith => __$$ProfileAvatarStateLoadedImplCopyWithImpl< - _$ProfileAvatarStateLoadedImpl - >(this, _$identity); + get copyWith => __$$ProfileAvatarStateLoadedImplCopyWithImpl< + _$ProfileAvatarStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -484,9 +484,8 @@ class _$ProfileAvatarStateLoadedImpl implements ProfileAvatarStateLoaded { } abstract class ProfileAvatarStateLoaded implements ProfileAvatarState { - const factory ProfileAvatarStateLoaded({ - required final ProfileModel profile, - }) = _$ProfileAvatarStateLoadedImpl; + const factory ProfileAvatarStateLoaded( + {required final ProfileModel profile}) = _$ProfileAvatarStateLoadedImpl; ProfileModel get profile; @@ -494,43 +493,42 @@ abstract class ProfileAvatarStateLoaded implements ProfileAvatarState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$ProfileAvatarStateLoadedImplCopyWith<_$ProfileAvatarStateLoadedImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$ProfileAvatarStateErrorImplCopyWith<$Res> { factory _$$ProfileAvatarStateErrorImplCopyWith( - _$ProfileAvatarStateErrorImpl value, - $Res Function(_$ProfileAvatarStateErrorImpl) then, - ) = __$$ProfileAvatarStateErrorImplCopyWithImpl<$Res>; + _$ProfileAvatarStateErrorImpl value, + $Res Function(_$ProfileAvatarStateErrorImpl) then) = + __$$ProfileAvatarStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc class __$$ProfileAvatarStateErrorImplCopyWithImpl<$Res> - extends - _$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateErrorImpl> + extends _$ProfileAvatarStateCopyWithImpl<$Res, + _$ProfileAvatarStateErrorImpl> implements _$$ProfileAvatarStateErrorImplCopyWith<$Res> { __$$ProfileAvatarStateErrorImplCopyWithImpl( - _$ProfileAvatarStateErrorImpl _value, - $Res Function(_$ProfileAvatarStateErrorImpl) _then, - ) : super(_value, _then); + _$ProfileAvatarStateErrorImpl _value, + $Res Function(_$ProfileAvatarStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of ProfileAvatarState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$ProfileAvatarStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$ProfileAvatarStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -565,9 +563,8 @@ class _$ProfileAvatarStateErrorImpl implements ProfileAvatarStateError { @override @pragma('vm:prefer-inline') _$$ProfileAvatarStateErrorImplCopyWith<_$ProfileAvatarStateErrorImpl> - get copyWith => __$$ProfileAvatarStateErrorImplCopyWithImpl< - _$ProfileAvatarStateErrorImpl - >(this, _$identity); + get copyWith => __$$ProfileAvatarStateErrorImplCopyWithImpl< + _$ProfileAvatarStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -654,5 +651,5 @@ abstract class ProfileAvatarStateError implements ProfileAvatarState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$ProfileAvatarStateErrorImplCopyWith<_$ProfileAvatarStateErrorImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart b/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart index 32da11b4..57a20923 100644 --- a/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart +++ b/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart @@ -90,7 +90,7 @@ class _BottomNavigationBarWidgetState extends State { icon: Padding( padding: const EdgeInsets.only(bottom: 2), child: SvgPicture.asset( - colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn), + colorFilter: const ColorFilter.mode(Colors.grey, BlendMode.srcIn), width: 20, height: 20, ImageConstant.icnFeed, @@ -114,7 +114,7 @@ class _BottomNavigationBarWidgetState extends State { icon: Padding( padding: const EdgeInsets.only(bottom: 2), child: SvgPicture.asset( - colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn), + colorFilter: const ColorFilter.mode(Colors.grey, BlendMode.srcIn), ImageConstant.icnDiary, width: 20, height: 20, @@ -139,7 +139,7 @@ class _BottomNavigationBarWidgetState extends State { icon: Padding( padding: const EdgeInsets.only(bottom: 2), child: SvgPicture.asset( - colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn), + colorFilter: const ColorFilter.mode(Colors.grey, BlendMode.srcIn), 'assets/icons/consultations.svg', width: 20, height: 20, @@ -165,7 +165,7 @@ class _BottomNavigationBarWidgetState extends State { final hasUnreadMessages = state.chatsWithUnreadMessagesCount > 0; return badges.Badge( position: badges.BadgePosition.topEnd(), - badgeAnimation: badges.BadgeAnimation.fade(), + badgeAnimation: const badges.BadgeAnimation.fade(), badgeStyle: badges.BadgeStyle( badgeColor: hasUnreadMessages ? Colors.red : Colors.transparent, ), @@ -187,7 +187,7 @@ class _BottomNavigationBarWidgetState extends State { appTheme.blueA400, BlendMode.srcIn, ) - : ColorFilter.mode(Colors.grey, BlendMode.srcIn), + : const ColorFilter.mode(Colors.grey, BlendMode.srcIn), ), ), ); @@ -200,10 +200,10 @@ class _BottomNavigationBarWidgetState extends State { builder: (BuildContext context, NotificationsState state) { return badges.Badge( position: badges.BadgePosition.topEnd(), - badgeAnimation: badges.BadgeAnimation.fade(), + badgeAnimation: const badges.BadgeAnimation.fade(), badgeContent: Text( (state is NotificationsStateLoaded) ? state.notificationsCount.toString() : '0', - style: TextStyle( + style: const TextStyle( color: Colors.white, fontSize: 8, ), @@ -217,7 +217,7 @@ class _BottomNavigationBarWidgetState extends State { appTheme.blueA400, BlendMode.srcIn, ) - : ColorFilter.mode(Colors.grey, BlendMode.srcIn), + : const ColorFilter.mode(Colors.grey, BlendMode.srcIn), width: 20, height: 20, ), diff --git a/lib/features/calendar/models/calendar_entry_model.dart b/lib/features/calendar/models/calendar_entry_model.dart deleted file mode 100644 index 32a6d1bd..00000000 --- a/lib/features/calendar/models/calendar_entry_model.dart +++ /dev/null @@ -1,21 +0,0 @@ -/// This class is used in the [userprofile_item_widget] screen. -// ignore_for_file: must_be_immutable - -class CalendarEntryModel { - String? date; - String? status; - String id; - bool is_current_day_included_in_the_chosen_diet_progression; - - CalendarEntryModel({ - this.date, - this.status, - required this.id, - required this.is_current_day_included_in_the_chosen_diet_progression, - }) { - date = date; - status = status; - id = id; - is_current_day_included_in_the_chosen_diet_progression = is_current_day_included_in_the_chosen_diet_progression; - } -} diff --git a/lib/features/calendar/models/calendar_model.dart b/lib/features/calendar/models/calendar_model.dart index 29e822e2..26eabe15 100644 --- a/lib/features/calendar/models/calendar_model.dart +++ b/lib/features/calendar/models/calendar_model.dart @@ -8,7 +8,7 @@ part 'calendar_model.g.dart'; class CalendarModel with _$CalendarModel { const factory CalendarModel({ required String date, - required bool is_current_day_included_in_the_chosen_diet_progression, + @JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') required bool isCurrentDayIncludedInTheChosenDietProgression, Object? diary, }) = _CalendarModel; diff --git a/lib/features/calendar/models/calendar_model.freezed.dart b/lib/features/calendar/models/calendar_model.freezed.dart index b7ca39ce..c1cdd84a 100644 --- a/lib/features/calendar/models/calendar_model.freezed.dart +++ b/lib/features/calendar/models/calendar_model.freezed.dart @@ -12,8 +12,7 @@ part of 'calendar_model.dart'; 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', -); + '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'); CalendarModel _$CalendarModelFromJson(Map json) { return _CalendarModel.fromJson(json); @@ -22,7 +21,8 @@ CalendarModel _$CalendarModelFromJson(Map json) { /// @nodoc mixin _$CalendarModel { String get date => throw _privateConstructorUsedError; - bool get is_current_day_included_in_the_chosen_diet_progression => + @JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') + bool get isCurrentDayIncludedInTheChosenDietProgression => throw _privateConstructorUsedError; Object? get diary => throw _privateConstructorUsedError; @@ -39,15 +39,14 @@ mixin _$CalendarModel { /// @nodoc abstract class $CalendarModelCopyWith<$Res> { factory $CalendarModelCopyWith( - CalendarModel value, - $Res Function(CalendarModel) then, - ) = _$CalendarModelCopyWithImpl<$Res, CalendarModel>; + CalendarModel value, $Res Function(CalendarModel) then) = + _$CalendarModelCopyWithImpl<$Res, CalendarModel>; @useResult - $Res call({ - String date, - bool is_current_day_included_in_the_chosen_diet_progression, - Object? diary, - }); + $Res call( + {String date, + @JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') + bool isCurrentDayIncludedInTheChosenDietProgression, + Object? diary}); } /// @nodoc @@ -66,26 +65,21 @@ class _$CalendarModelCopyWithImpl<$Res, $Val extends CalendarModel> @override $Res call({ Object? date = null, - Object? is_current_day_included_in_the_chosen_diet_progression = null, + Object? isCurrentDayIncludedInTheChosenDietProgression = null, Object? diary = freezed, }) { - return _then( - _value.copyWith( - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as String, - is_current_day_included_in_the_chosen_diet_progression: - null == is_current_day_included_in_the_chosen_diet_progression - ? _value - .is_current_day_included_in_the_chosen_diet_progression - : is_current_day_included_in_the_chosen_diet_progression // ignore: cast_nullable_to_non_nullable - as bool, - diary: freezed == diary ? _value.diary : diary, - ) - as $Val, - ); + return _then(_value.copyWith( + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as String, + isCurrentDayIncludedInTheChosenDietProgression: null == + isCurrentDayIncludedInTheChosenDietProgression + ? _value.isCurrentDayIncludedInTheChosenDietProgression + : isCurrentDayIncludedInTheChosenDietProgression // ignore: cast_nullable_to_non_nullable + as bool, + diary: freezed == diary ? _value.diary : diary, + ) as $Val); } } @@ -93,16 +87,15 @@ class _$CalendarModelCopyWithImpl<$Res, $Val extends CalendarModel> abstract class _$$CalendarModelImplCopyWith<$Res> implements $CalendarModelCopyWith<$Res> { factory _$$CalendarModelImplCopyWith( - _$CalendarModelImpl value, - $Res Function(_$CalendarModelImpl) then, - ) = __$$CalendarModelImplCopyWithImpl<$Res>; + _$CalendarModelImpl value, $Res Function(_$CalendarModelImpl) then) = + __$$CalendarModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String date, - bool is_current_day_included_in_the_chosen_diet_progression, - Object? diary, - }); + $Res call( + {String date, + @JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') + bool isCurrentDayIncludedInTheChosenDietProgression, + Object? diary}); } /// @nodoc @@ -110,9 +103,8 @@ class __$$CalendarModelImplCopyWithImpl<$Res> extends _$CalendarModelCopyWithImpl<$Res, _$CalendarModelImpl> implements _$$CalendarModelImplCopyWith<$Res> { __$$CalendarModelImplCopyWithImpl( - _$CalendarModelImpl _value, - $Res Function(_$CalendarModelImpl) _then, - ) : super(_value, _then); + _$CalendarModelImpl _value, $Res Function(_$CalendarModelImpl) _then) + : super(_value, _then); /// Create a copy of CalendarModel /// with the given fields replaced by the non-null parameter values. @@ -120,35 +112,32 @@ class __$$CalendarModelImplCopyWithImpl<$Res> @override $Res call({ Object? date = null, - Object? is_current_day_included_in_the_chosen_diet_progression = null, + Object? isCurrentDayIncludedInTheChosenDietProgression = null, Object? diary = freezed, }) { - return _then( - _$CalendarModelImpl( - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as String, - is_current_day_included_in_the_chosen_diet_progression: - null == is_current_day_included_in_the_chosen_diet_progression - ? _value.is_current_day_included_in_the_chosen_diet_progression - : is_current_day_included_in_the_chosen_diet_progression // ignore: cast_nullable_to_non_nullable - as bool, - diary: freezed == diary ? _value.diary : diary, - ), - ); + return _then(_$CalendarModelImpl( + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as String, + isCurrentDayIncludedInTheChosenDietProgression: null == + isCurrentDayIncludedInTheChosenDietProgression + ? _value.isCurrentDayIncludedInTheChosenDietProgression + : isCurrentDayIncludedInTheChosenDietProgression // ignore: cast_nullable_to_non_nullable + as bool, + diary: freezed == diary ? _value.diary : diary, + )); } } /// @nodoc @JsonSerializable() class _$CalendarModelImpl implements _CalendarModel { - const _$CalendarModelImpl({ - required this.date, - required this.is_current_day_included_in_the_chosen_diet_progression, - this.diary, - }); + const _$CalendarModelImpl( + {required this.date, + @JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') + required this.isCurrentDayIncludedInTheChosenDietProgression, + this.diary}); factory _$CalendarModelImpl.fromJson(Map json) => _$$CalendarModelImplFromJson(json); @@ -156,13 +145,14 @@ class _$CalendarModelImpl implements _CalendarModel { @override final String date; @override - final bool is_current_day_included_in_the_chosen_diet_progression; + @JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') + final bool isCurrentDayIncludedInTheChosenDietProgression; @override final Object? diary; @override String toString() { - return 'CalendarModel(date: $date, is_current_day_included_in_the_chosen_diet_progression: $is_current_day_included_in_the_chosen_diet_progression, diary: $diary)'; + return 'CalendarModel(date: $date, isCurrentDayIncludedInTheChosenDietProgression: $isCurrentDayIncludedInTheChosenDietProgression, diary: $diary)'; } @override @@ -171,23 +161,20 @@ class _$CalendarModelImpl implements _CalendarModel { (other.runtimeType == runtimeType && other is _$CalendarModelImpl && (identical(other.date, date) || other.date == date) && - (identical( - other.is_current_day_included_in_the_chosen_diet_progression, - is_current_day_included_in_the_chosen_diet_progression, - ) || - other.is_current_day_included_in_the_chosen_diet_progression == - is_current_day_included_in_the_chosen_diet_progression) && + (identical(other.isCurrentDayIncludedInTheChosenDietProgression, + isCurrentDayIncludedInTheChosenDietProgression) || + other.isCurrentDayIncludedInTheChosenDietProgression == + isCurrentDayIncludedInTheChosenDietProgression) && const DeepCollectionEquality().equals(other.diary, diary)); } @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - date, - is_current_day_included_in_the_chosen_diet_progression, - const DeepCollectionEquality().hash(diary), - ); + runtimeType, + date, + isCurrentDayIncludedInTheChosenDietProgression, + const DeepCollectionEquality().hash(diary)); /// Create a copy of CalendarModel /// with the given fields replaced by the non-null parameter values. @@ -199,16 +186,18 @@ class _$CalendarModelImpl implements _CalendarModel { @override Map toJson() { - return _$$CalendarModelImplToJson(this); + return _$$CalendarModelImplToJson( + this, + ); } } abstract class _CalendarModel implements CalendarModel { - const factory _CalendarModel({ - required final String date, - required final bool is_current_day_included_in_the_chosen_diet_progression, - final Object? diary, - }) = _$CalendarModelImpl; + const factory _CalendarModel( + {required final String date, + @JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') + required final bool isCurrentDayIncludedInTheChosenDietProgression, + final Object? diary}) = _$CalendarModelImpl; factory _CalendarModel.fromJson(Map json) = _$CalendarModelImpl.fromJson; @@ -216,7 +205,8 @@ abstract class _CalendarModel implements CalendarModel { @override String get date; @override - bool get is_current_day_included_in_the_chosen_diet_progression; + @JsonKey(name: 'is_current_day_included_in_the_chosen_diet_progression') + bool get isCurrentDayIncludedInTheChosenDietProgression; @override Object? get diary; diff --git a/lib/features/calendar/models/calendar_model.g.dart b/lib/features/calendar/models/calendar_model.g.dart index 65fd0063..5fc5711f 100644 --- a/lib/features/calendar/models/calendar_model.g.dart +++ b/lib/features/calendar/models/calendar_model.g.dart @@ -9,7 +9,7 @@ part of 'calendar_model.dart'; _$CalendarModelImpl _$$CalendarModelImplFromJson(Map json) => _$CalendarModelImpl( date: json['date'] as String, - is_current_day_included_in_the_chosen_diet_progression: + isCurrentDayIncludedInTheChosenDietProgression: json['is_current_day_included_in_the_chosen_diet_progression'] as bool, diary: json['diary'], @@ -19,6 +19,6 @@ Map _$$CalendarModelImplToJson(_$CalendarModelImpl instance) => { 'date': instance.date, 'is_current_day_included_in_the_chosen_diet_progression': - instance.is_current_day_included_in_the_chosen_diet_progression, + instance.isCurrentDayIncludedInTheChosenDietProgression, 'diary': instance.diary, }; diff --git a/lib/features/calendar/presentation/bloc/calendar_state.freezed.dart b/lib/features/calendar/presentation/bloc/calendar_state.freezed.dart index 442215e5..0e7bdbcd 100644 --- a/lib/features/calendar/presentation/bloc/calendar_state.freezed.dart +++ b/lib/features/calendar/presentation/bloc/calendar_state.freezed.dart @@ -12,8 +12,7 @@ part of 'calendar_state.dart'; 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', -); + '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'); /// @nodoc mixin _$CalendarState { @@ -23,14 +22,16 @@ mixin _$CalendarState { required TResult Function() loading, required TResult Function(List calendarList) loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(List calendarList)? loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -38,21 +39,24 @@ mixin _$CalendarState { TResult Function(List calendarList)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_CalendarState value) $default, { required TResult Function(CalendarStateLoading value) loading, required TResult Function(CalendarStateLoaded value) loaded, required TResult Function(CalendarStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_CalendarState value)? $default, { TResult? Function(CalendarStateLoading value)? loading, TResult? Function(CalendarStateLoaded value)? loaded, TResult? Function(CalendarStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_CalendarState value)? $default, { @@ -60,15 +64,15 @@ mixin _$CalendarState { TResult Function(CalendarStateLoaded value)? loaded, TResult Function(CalendarStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $CalendarStateCopyWith<$Res> { factory $CalendarStateCopyWith( - CalendarState value, - $Res Function(CalendarState) then, - ) = _$CalendarStateCopyWithImpl<$Res, CalendarState>; + CalendarState value, $Res Function(CalendarState) then) = + _$CalendarStateCopyWithImpl<$Res, CalendarState>; } /// @nodoc @@ -88,9 +92,8 @@ class _$CalendarStateCopyWithImpl<$Res, $Val extends CalendarState> /// @nodoc abstract class _$$CalendarStateImplCopyWith<$Res> { factory _$$CalendarStateImplCopyWith( - _$CalendarStateImpl value, - $Res Function(_$CalendarStateImpl) then, - ) = __$$CalendarStateImplCopyWithImpl<$Res>; + _$CalendarStateImpl value, $Res Function(_$CalendarStateImpl) then) = + __$$CalendarStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -98,9 +101,8 @@ class __$$CalendarStateImplCopyWithImpl<$Res> extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateImpl> implements _$$CalendarStateImplCopyWith<$Res> { __$$CalendarStateImplCopyWithImpl( - _$CalendarStateImpl _value, - $Res Function(_$CalendarStateImpl) _then, - ) : super(_value, _then); + _$CalendarStateImpl _value, $Res Function(_$CalendarStateImpl) _then) + : super(_value, _then); /// Create a copy of CalendarState /// with the given fields replaced by the non-null parameter values. @@ -206,20 +208,18 @@ abstract class _CalendarState implements CalendarState { /// @nodoc abstract class _$$CalendarStateLoadingImplCopyWith<$Res> { - factory _$$CalendarStateLoadingImplCopyWith( - _$CalendarStateLoadingImpl value, - $Res Function(_$CalendarStateLoadingImpl) then, - ) = __$$CalendarStateLoadingImplCopyWithImpl<$Res>; + factory _$$CalendarStateLoadingImplCopyWith(_$CalendarStateLoadingImpl value, + $Res Function(_$CalendarStateLoadingImpl) then) = + __$$CalendarStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$CalendarStateLoadingImplCopyWithImpl<$Res> extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateLoadingImpl> implements _$$CalendarStateLoadingImplCopyWith<$Res> { - __$$CalendarStateLoadingImplCopyWithImpl( - _$CalendarStateLoadingImpl _value, - $Res Function(_$CalendarStateLoadingImpl) _then, - ) : super(_value, _then); + __$$CalendarStateLoadingImplCopyWithImpl(_$CalendarStateLoadingImpl _value, + $Res Function(_$CalendarStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of CalendarState /// with the given fields replaced by the non-null parameter values. @@ -326,10 +326,9 @@ abstract class CalendarStateLoading implements CalendarState { /// @nodoc abstract class _$$CalendarStateLoadedImplCopyWith<$Res> { - factory _$$CalendarStateLoadedImplCopyWith( - _$CalendarStateLoadedImpl value, - $Res Function(_$CalendarStateLoadedImpl) then, - ) = __$$CalendarStateLoadedImplCopyWithImpl<$Res>; + factory _$$CalendarStateLoadedImplCopyWith(_$CalendarStateLoadedImpl value, + $Res Function(_$CalendarStateLoadedImpl) then) = + __$$CalendarStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({List calendarList}); } @@ -338,34 +337,32 @@ abstract class _$$CalendarStateLoadedImplCopyWith<$Res> { class __$$CalendarStateLoadedImplCopyWithImpl<$Res> extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateLoadedImpl> implements _$$CalendarStateLoadedImplCopyWith<$Res> { - __$$CalendarStateLoadedImplCopyWithImpl( - _$CalendarStateLoadedImpl _value, - $Res Function(_$CalendarStateLoadedImpl) _then, - ) : super(_value, _then); + __$$CalendarStateLoadedImplCopyWithImpl(_$CalendarStateLoadedImpl _value, + $Res Function(_$CalendarStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of CalendarState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? calendarList = null}) { - return _then( - _$CalendarStateLoadedImpl( - calendarList: - null == calendarList - ? _value._calendarList - : calendarList // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + $Res call({ + Object? calendarList = null, + }) { + return _then(_$CalendarStateLoadedImpl( + calendarList: null == calendarList + ? _value._calendarList + : calendarList // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc class _$CalendarStateLoadedImpl implements CalendarStateLoaded { - const _$CalendarStateLoadedImpl({ - required final List calendarList, - }) : _calendarList = calendarList; + const _$CalendarStateLoadedImpl( + {required final List calendarList}) + : _calendarList = calendarList; final List _calendarList; @override @@ -385,17 +382,13 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CalendarStateLoadedImpl && - const DeepCollectionEquality().equals( - other._calendarList, - _calendarList, - )); + const DeepCollectionEquality() + .equals(other._calendarList, _calendarList)); } @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_calendarList), - ); + runtimeType, const DeepCollectionEquality().hash(_calendarList)); /// Create a copy of CalendarState /// with the given fields replaced by the non-null parameter values. @@ -404,9 +397,7 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded { @pragma('vm:prefer-inline') _$$CalendarStateLoadedImplCopyWith<_$CalendarStateLoadedImpl> get copyWith => __$$CalendarStateLoadedImplCopyWithImpl<_$CalendarStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -484,9 +475,9 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded { } abstract class CalendarStateLoaded implements CalendarState { - const factory CalendarStateLoaded({ - required final List calendarList, - }) = _$CalendarStateLoadedImpl; + const factory CalendarStateLoaded( + {required final List calendarList}) = + _$CalendarStateLoadedImpl; List get calendarList; @@ -499,10 +490,9 @@ abstract class CalendarStateLoaded implements CalendarState { /// @nodoc abstract class _$$CalendarStateErrorImplCopyWith<$Res> { - factory _$$CalendarStateErrorImplCopyWith( - _$CalendarStateErrorImpl value, - $Res Function(_$CalendarStateErrorImpl) then, - ) = __$$CalendarStateErrorImplCopyWithImpl<$Res>; + factory _$$CalendarStateErrorImplCopyWith(_$CalendarStateErrorImpl value, + $Res Function(_$CalendarStateErrorImpl) then) = + __$$CalendarStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -511,25 +501,23 @@ abstract class _$$CalendarStateErrorImplCopyWith<$Res> { class __$$CalendarStateErrorImplCopyWithImpl<$Res> extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateErrorImpl> implements _$$CalendarStateErrorImplCopyWith<$Res> { - __$$CalendarStateErrorImplCopyWithImpl( - _$CalendarStateErrorImpl _value, - $Res Function(_$CalendarStateErrorImpl) _then, - ) : super(_value, _then); + __$$CalendarStateErrorImplCopyWithImpl(_$CalendarStateErrorImpl _value, + $Res Function(_$CalendarStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of CalendarState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$CalendarStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$CalendarStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -565,9 +553,7 @@ class _$CalendarStateErrorImpl implements CalendarStateError { @pragma('vm:prefer-inline') _$$CalendarStateErrorImplCopyWith<_$CalendarStateErrorImpl> get copyWith => __$$CalendarStateErrorImplCopyWithImpl<_$CalendarStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs diff --git a/lib/features/calendar/presentation/pages/calendar_screen.dart b/lib/features/calendar/presentation/pages/calendar_screen.dart index 393337f1..a409a1b0 100644 --- a/lib/features/calendar/presentation/pages/calendar_screen.dart +++ b/lib/features/calendar/presentation/pages/calendar_screen.dart @@ -12,8 +12,9 @@ import 'package:go_router/go_router.dart'; import 'package:intl/intl.dart'; class CalendarScreen extends StatelessWidget { - CalendarScreen({Key? key}) : super(key: key); + const CalendarScreen({super.key}); + @override Widget build(BuildContext context) { return BlocProvider( create: (context) => sl()..loadCalendarList(), @@ -22,8 +23,8 @@ class CalendarScreen extends StatelessWidget { if (state is CalendarStateLoaded) { return _buildCalendar(context, state); } else if (state is CalendarStateLoading) { - return Scaffold( - body: const Loader(), + return const Scaffold( + body: Loader(), ); } else if (state is CalendarStateError) { return Scaffold( @@ -34,15 +35,15 @@ class CalendarScreen extends StatelessWidget { ), ), ); - } else - return Scaffold( - body: Padding( - padding: const EdgeInsets.all(16), - child: Center( - child: Text("Неопределенная ошибка"), - ), + } + return const Scaffold( + body: Padding( + padding: EdgeInsets.all(16), + child: Center( + child: Text("Неопределенная ошибка"), ), - ); + ), + ); }, ), ); @@ -55,7 +56,7 @@ class CalendarScreen extends StatelessWidget { FormBuilder( child: Scaffold( appBar: AppBar( - title: Text( + title: const Text( 'Календарь', ), ), @@ -68,12 +69,12 @@ class CalendarScreen extends StatelessWidget { Expanded( child: SingleChildScrollView( child: Padding( - padding: EdgeInsets.only(bottom: 8), + padding: const EdgeInsets.only(bottom: 8), child: Column( children: [ - SizedBox(height: 24), + const SizedBox(height: 24), _buildCalendarBody(context, state), - SizedBox(height: 24), + const SizedBox(height: 24), ], ), ), @@ -90,11 +91,11 @@ class CalendarScreen extends StatelessWidget { _buildCalendarBody(BuildContext context, CalendarStateLoaded state) { return ListView.separated( - padding: EdgeInsets.all(8), + padding: const EdgeInsets.all(8), shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), separatorBuilder: (context, index) { - return SizedBox( + return const SizedBox( height: 4, ); }, @@ -106,12 +107,12 @@ class CalendarScreen extends StatelessWidget { return InkWell( borderRadius: BorderRadiusStyle.circleBorder8, child: Ink( - padding: EdgeInsets.all(8), + padding: const EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadiusStyle.circleBorder8, - color: state.calendarList[index].is_current_day_included_in_the_chosen_diet_progression - ? Color.fromRGBO(59, 130, 246, .2) - : Color.fromRGBO(126, 136, 151, .1), + color: state.calendarList[index].isCurrentDayIncludedInTheChosenDietProgression + ? const Color.fromRGBO(59, 130, 246, .2) + : const Color.fromRGBO(126, 136, 151, .1), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -125,12 +126,12 @@ class CalendarScreen extends StatelessWidget { formatDate(state.calendarList[index].date), style: theme.textTheme.titleMedium, ), - SizedBox(height: 4), - if (state.calendarList[index].is_current_day_included_in_the_chosen_diet_progression) + const SizedBox(height: 4), + if (state.calendarList[index].isCurrentDayIncludedInTheChosenDietProgression) Container( - padding: EdgeInsets.all(4.0), // Отступы внутри контейнера + padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера decoration: BoxDecoration( - color: Color.fromRGBO(13, 110, 253, 1), + color: const Color.fromRGBO(13, 110, 253, 1), borderRadius: BorderRadius.circular(24.0), // Закругленные углы ), child: Text( @@ -138,11 +139,11 @@ class CalendarScreen extends StatelessWidget { style: CustomTextStyles.titleSmallBold, // Предполагается, что текст белый ), ), - if (!state.calendarList[index].is_current_day_included_in_the_chosen_diet_progression) + if (!state.calendarList[index].isCurrentDayIncludedInTheChosenDietProgression) Container( - padding: EdgeInsets.all(4.0), // Отступы внутри контейнера + padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера decoration: BoxDecoration( - color: Color.fromRGBO(108, 117, 125, 1), + color: const Color.fromRGBO(108, 117, 125, 1), borderRadius: BorderRadius.circular(24.0), // Закругленные углы ), child: Text( @@ -166,7 +167,7 @@ class CalendarScreen extends StatelessWidget { extra: diary['id'].toString(), ), child: Ink( - padding: EdgeInsets.all(8), + padding: const EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadiusStyle.circleBorder8, color: getBackgroundColor(diary['state']), @@ -183,13 +184,13 @@ class CalendarScreen extends StatelessWidget { formatDate(state.calendarList[index].date), style: theme.textTheme.titleMedium, ), - SizedBox(height: 4), + const SizedBox(height: 4), Row( children: [ Container( - padding: EdgeInsets.all(4.0), // Отступы внутри контейнера + padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера decoration: BoxDecoration( - color: diary['state'] == 'finished' ? Color.fromRGBO(1, 154, 62, 1) : Color.fromRGBO(154, 74, 1, 1), + color: diary['state'] == 'finished' ? const Color.fromRGBO(1, 154, 62, 1) : const Color.fromRGBO(154, 74, 1, 1), borderRadius: BorderRadius.circular(24.0), // Закругленные углы ), child: Text( @@ -197,12 +198,12 @@ class CalendarScreen extends StatelessWidget { style: CustomTextStyles.titleSmallBold, // Предполагается, что текст белый ), ), - SizedBox(width: 4), + const SizedBox(width: 4), if (diary['state'] == 'started') Container( - padding: EdgeInsets.all(4.0), // Отступы внутри контейнера + padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера decoration: BoxDecoration( - color: Color.fromRGBO(13, 110, 253, 1), + color: const Color.fromRGBO(13, 110, 253, 1), borderRadius: BorderRadius.circular(24.0), // Закругленные углы ), child: Text( @@ -212,9 +213,9 @@ class CalendarScreen extends StatelessWidget { ), if (diary['state'] == 'finished') Container( - padding: EdgeInsets.all(4.0), // Отступы внутри контейнера + padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера decoration: BoxDecoration( - color: Color.fromRGBO(13, 110, 253, 1), + color: const Color.fromRGBO(13, 110, 253, 1), borderRadius: BorderRadius.circular(24.0), // Закругленные углы ), child: Text( @@ -256,16 +257,16 @@ String formatDate(String dateString) { String formattedDate = DateFormat('d MMMM', 'ru_RU').format(dateTime); // Возвращаем результат в нужном формате - return '$formattedDate'; + return formattedDate; } Color getBackgroundColor(String? status) { switch (status) { case 'finished': - return Color.fromRGBO(1, 154, 62, .1); + return const Color.fromRGBO(1, 154, 62, .1); case 'started': - return Color.fromRGBO(154, 74, 1, .1); + return const Color.fromRGBO(154, 74, 1, .1); default: - return Color.fromRGBO(126, 136, 151, .1); + return const Color.fromRGBO(126, 136, 151, .1); } } diff --git a/lib/features/calendar/services/calendar_service.g.dart b/lib/features/calendar/services/calendar_service.g.dart index 4c32230a..5055d002 100644 --- a/lib/features/calendar/services/calendar_service.g.dart +++ b/lib/features/calendar/services/calendar_service.g.dart @@ -36,13 +36,11 @@ class _CalendarService implements CalendarService { final _result = await _dio.fetch>(_options); late List _value; try { - _value = - _result.data! - .map( - (dynamic i) => - CalendarModel.fromJson(i as Map), - ) - .toList(); + _value = _result.data! + .map( + (dynamic i) => CalendarModel.fromJson(i as Map), + ) + .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; diff --git a/lib/features/chat/models/chat_message_model.freezed.dart b/lib/features/chat/models/chat_message_model.freezed.dart index 0d2f62c4..3cddc329 100644 --- a/lib/features/chat/models/chat_message_model.freezed.dart +++ b/lib/features/chat/models/chat_message_model.freezed.dart @@ -12,8 +12,7 @@ part of 'chat_message_model.dart'; 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', -); + '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'); ChatMessageModel _$ChatMessageModelFromJson(Map json) { return _ChatMessageModel.fromJson(json); @@ -49,20 +48,18 @@ mixin _$ChatMessageModel { /// @nodoc abstract class $ChatMessageModelCopyWith<$Res> { factory $ChatMessageModelCopyWith( - ChatMessageModel value, - $Res Function(ChatMessageModel) then, - ) = _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>; + ChatMessageModel value, $Res Function(ChatMessageModel) then) = + _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>; @useResult - $Res call({ - int id, - String data, - @JsonKey(name: 'media_data') List? mediaData, - @JsonKey(name: 'author_id') int authorId, - @JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt, - @JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead, - @JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor, - @JsonKey(name: 'room_id') String? roomId, - }); + $Res call( + {int id, + String data, + @JsonKey(name: 'media_data') List? mediaData, + @JsonKey(name: 'author_id') int authorId, + @JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt, + @JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead, + @JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor, + @JsonKey(name: 'room_id') String? roomId}); } /// @nodoc @@ -89,83 +86,69 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> Object? isCurrentUserAuthor = freezed, Object? roomId = freezed, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - data: - null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as String, - mediaData: - freezed == mediaData - ? _value.mediaData - : mediaData // ignore: cast_nullable_to_non_nullable - as List?, - authorId: - null == authorId - ? _value.authorId - : authorId // ignore: cast_nullable_to_non_nullable - as int, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - isRead: - null == isRead - ? _value.isRead - : isRead // ignore: cast_nullable_to_non_nullable - as bool, - isCurrentUserAuthor: - freezed == isCurrentUserAuthor - ? _value.isCurrentUserAuthor - : isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable - as bool?, - roomId: - freezed == roomId - ? _value.roomId - : roomId // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as String, + mediaData: freezed == mediaData + ? _value.mediaData + : mediaData // ignore: cast_nullable_to_non_nullable + as List?, + authorId: null == authorId + ? _value.authorId + : authorId // ignore: cast_nullable_to_non_nullable + as int, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + isRead: null == isRead + ? _value.isRead + : isRead // ignore: cast_nullable_to_non_nullable + as bool, + isCurrentUserAuthor: freezed == isCurrentUserAuthor + ? _value.isCurrentUserAuthor + : isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable + as bool?, + roomId: freezed == roomId + ? _value.roomId + : roomId // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } } /// @nodoc abstract class _$$ChatMessageModelImplCopyWith<$Res> implements $ChatMessageModelCopyWith<$Res> { - factory _$$ChatMessageModelImplCopyWith( - _$ChatMessageModelImpl value, - $Res Function(_$ChatMessageModelImpl) then, - ) = __$$ChatMessageModelImplCopyWithImpl<$Res>; + factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value, + $Res Function(_$ChatMessageModelImpl) then) = + __$$ChatMessageModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - int id, - String data, - @JsonKey(name: 'media_data') List? mediaData, - @JsonKey(name: 'author_id') int authorId, - @JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt, - @JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead, - @JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor, - @JsonKey(name: 'room_id') String? roomId, - }); + $Res call( + {int id, + String data, + @JsonKey(name: 'media_data') List? mediaData, + @JsonKey(name: 'author_id') int authorId, + @JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt, + @JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead, + @JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor, + @JsonKey(name: 'room_id') String? roomId}); } /// @nodoc class __$$ChatMessageModelImplCopyWithImpl<$Res> extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl> implements _$$ChatMessageModelImplCopyWith<$Res> { - __$$ChatMessageModelImplCopyWithImpl( - _$ChatMessageModelImpl _value, - $Res Function(_$ChatMessageModelImpl) _then, - ) : super(_value, _then); + __$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value, + $Res Function(_$ChatMessageModelImpl) _then) + : super(_value, _then); /// Create a copy of ChatMessageModel /// with the given fields replaced by the non-null parameter values. @@ -181,67 +164,58 @@ class __$$ChatMessageModelImplCopyWithImpl<$Res> Object? isCurrentUserAuthor = freezed, Object? roomId = freezed, }) { - return _then( - _$ChatMessageModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - data: - null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as String, - mediaData: - freezed == mediaData - ? _value._mediaData - : mediaData // ignore: cast_nullable_to_non_nullable - as List?, - authorId: - null == authorId - ? _value.authorId - : authorId // ignore: cast_nullable_to_non_nullable - as int, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - isRead: - null == isRead - ? _value.isRead - : isRead // ignore: cast_nullable_to_non_nullable - as bool, - isCurrentUserAuthor: - freezed == isCurrentUserAuthor - ? _value.isCurrentUserAuthor - : isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable - as bool?, - roomId: - freezed == roomId - ? _value.roomId - : roomId // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$ChatMessageModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as String, + mediaData: freezed == mediaData + ? _value._mediaData + : mediaData // ignore: cast_nullable_to_non_nullable + as List?, + authorId: null == authorId + ? _value.authorId + : authorId // ignore: cast_nullable_to_non_nullable + as int, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + isRead: null == isRead + ? _value.isRead + : isRead // ignore: cast_nullable_to_non_nullable + as bool, + isCurrentUserAuthor: freezed == isCurrentUserAuthor + ? _value.isCurrentUserAuthor + : isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable + as bool?, + roomId: freezed == roomId + ? _value.roomId + : roomId // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc @JsonSerializable() class _$ChatMessageModelImpl implements _ChatMessageModel { - const _$ChatMessageModelImpl({ - required this.id, - required this.data, - @JsonKey(name: 'media_data') required final List? mediaData, - @JsonKey(name: 'author_id') required this.authorId, - @JsonKey(name: 'updated_at', fromJson: parseDate) required this.updatedAt, - @JsonKey(name: 'read_by_to_user', defaultValue: false) required this.isRead, - @JsonKey(name: 'is_author_message_auth_user') - required this.isCurrentUserAuthor, - @JsonKey(name: 'room_id') required this.roomId, - }) : _mediaData = mediaData; + const _$ChatMessageModelImpl( + {required this.id, + required this.data, + @JsonKey(name: 'media_data') required final List? mediaData, + @JsonKey(name: 'author_id') required this.authorId, + @JsonKey(name: 'updated_at', fromJson: parseDate) required this.updatedAt, + @JsonKey(name: 'read_by_to_user', defaultValue: false) + required this.isRead, + @JsonKey(name: 'is_author_message_auth_user') + required this.isCurrentUserAuthor, + @JsonKey(name: 'room_id') required this.roomId}) + : _mediaData = mediaData; factory _$ChatMessageModelImpl.fromJson(Map json) => _$$ChatMessageModelImplFromJson(json); @@ -289,10 +263,8 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { other is _$ChatMessageModelImpl && (identical(other.id, id) || other.id == id) && (identical(other.data, data) || other.data == data) && - const DeepCollectionEquality().equals( - other._mediaData, - _mediaData, - ) && + const DeepCollectionEquality() + .equals(other._mediaData, _mediaData) && (identical(other.authorId, authorId) || other.authorId == authorId) && (identical(other.updatedAt, updatedAt) || @@ -306,16 +278,15 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - id, - data, - const DeepCollectionEquality().hash(_mediaData), - authorId, - updatedAt, - isRead, - isCurrentUserAuthor, - roomId, - ); + runtimeType, + id, + data, + const DeepCollectionEquality().hash(_mediaData), + authorId, + updatedAt, + isRead, + isCurrentUserAuthor, + roomId); /// Create a copy of ChatMessageModel /// with the given fields replaced by the non-null parameter values. @@ -324,30 +295,30 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { @pragma('vm:prefer-inline') _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => __$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$ChatMessageModelImplToJson(this); + return _$$ChatMessageModelImplToJson( + this, + ); } } abstract class _ChatMessageModel implements ChatMessageModel { - const factory _ChatMessageModel({ - required final int id, - required final String data, - @JsonKey(name: 'media_data') required final List? mediaData, - @JsonKey(name: 'author_id') required final int authorId, - @JsonKey(name: 'updated_at', fromJson: parseDate) - required final DateTime updatedAt, - @JsonKey(name: 'read_by_to_user', defaultValue: false) - required final bool isRead, - @JsonKey(name: 'is_author_message_auth_user') - required final bool? isCurrentUserAuthor, - @JsonKey(name: 'room_id') required final String? roomId, - }) = _$ChatMessageModelImpl; + const factory _ChatMessageModel( + {required final int id, + required final String data, + @JsonKey(name: 'media_data') required final List? mediaData, + @JsonKey(name: 'author_id') required final int authorId, + @JsonKey(name: 'updated_at', fromJson: parseDate) + required final DateTime updatedAt, + @JsonKey(name: 'read_by_to_user', defaultValue: false) + required final bool isRead, + @JsonKey(name: 'is_author_message_auth_user') + required final bool? isCurrentUserAuthor, + @JsonKey(name: 'room_id') required final String? roomId}) = + _$ChatMessageModelImpl; factory _ChatMessageModel.fromJson(Map json) = _$ChatMessageModelImpl.fromJson; diff --git a/lib/features/chat/models/chat_message_model.g.dart b/lib/features/chat/models/chat_message_model.g.dart index aedebde0..de7ea3c3 100644 --- a/lib/features/chat/models/chat_message_model.g.dart +++ b/lib/features/chat/models/chat_message_model.g.dart @@ -7,27 +7,27 @@ part of 'chat_message_model.dart'; // ************************************************************************** _$ChatMessageModelImpl _$$ChatMessageModelImplFromJson( - Map json, -) => _$ChatMessageModelImpl( - id: (json['id'] as num).toInt(), - data: json['data'] as String, - mediaData: json['media_data'] as List?, - authorId: (json['author_id'] as num).toInt(), - updatedAt: parseDate(json['updated_at'] as String), - isRead: json['read_by_to_user'] as bool? ?? false, - isCurrentUserAuthor: json['is_author_message_auth_user'] as bool?, - roomId: json['room_id'] as String?, -); + Map json) => + _$ChatMessageModelImpl( + id: (json['id'] as num).toInt(), + data: json['data'] as String, + mediaData: json['media_data'] as List?, + authorId: (json['author_id'] as num).toInt(), + updatedAt: parseDate(json['updated_at'] as String), + isRead: json['read_by_to_user'] as bool? ?? false, + isCurrentUserAuthor: json['is_author_message_auth_user'] as bool?, + roomId: json['room_id'] as String?, + ); Map _$$ChatMessageModelImplToJson( - _$ChatMessageModelImpl instance, -) => { - 'id': instance.id, - 'data': instance.data, - 'media_data': instance.mediaData, - 'author_id': instance.authorId, - 'updated_at': instance.updatedAt.toIso8601String(), - 'read_by_to_user': instance.isRead, - 'is_author_message_auth_user': instance.isCurrentUserAuthor, - 'room_id': instance.roomId, -}; + _$ChatMessageModelImpl instance) => + { + 'id': instance.id, + 'data': instance.data, + 'media_data': instance.mediaData, + 'author_id': instance.authorId, + 'updated_at': instance.updatedAt.toIso8601String(), + 'read_by_to_user': instance.isRead, + 'is_author_message_auth_user': instance.isCurrentUserAuthor, + 'room_id': instance.roomId, + }; diff --git a/lib/features/chat/models/chat_messages_model.freezed.dart b/lib/features/chat/models/chat_messages_model.freezed.dart index 1679286b..852b33e4 100644 --- a/lib/features/chat/models/chat_messages_model.freezed.dart +++ b/lib/features/chat/models/chat_messages_model.freezed.dart @@ -12,8 +12,7 @@ part of 'chat_messages_model.dart'; 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', -); + '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'); ChatMessagesModel _$ChatMessagesModelFromJson(Map json) { return _ChatMessagesModel.fromJson(json); @@ -38,14 +37,12 @@ mixin _$ChatMessagesModel { /// @nodoc abstract class $ChatMessagesModelCopyWith<$Res> { factory $ChatMessagesModelCopyWith( - ChatMessagesModel value, - $Res Function(ChatMessagesModel) then, - ) = _$ChatMessagesModelCopyWithImpl<$Res, ChatMessagesModel>; + ChatMessagesModel value, $Res Function(ChatMessagesModel) then) = + _$ChatMessagesModelCopyWithImpl<$Res, ChatMessagesModel>; @useResult - $Res call({ - @JsonKey(name: 'data') List messagesList, - ChatMetaModel meta, - }); + $Res call( + {@JsonKey(name: 'data') List messagesList, + ChatMetaModel meta}); $ChatMetaModelCopyWith<$Res> get meta; } @@ -64,22 +61,20 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? messagesList = null, Object? meta = null}) { - return _then( - _value.copyWith( - messagesList: - null == messagesList - ? _value.messagesList - : messagesList // ignore: cast_nullable_to_non_nullable - as List, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as ChatMetaModel, - ) - as $Val, - ); + $Res call({ + Object? messagesList = null, + Object? meta = null, + }) { + return _then(_value.copyWith( + messagesList: null == messagesList + ? _value.messagesList + : messagesList // ignore: cast_nullable_to_non_nullable + as List, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as ChatMetaModel, + ) as $Val); } /// Create a copy of ChatMessagesModel @@ -96,16 +91,14 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel> /// @nodoc abstract class _$$ChatMessagesModelImplCopyWith<$Res> implements $ChatMessagesModelCopyWith<$Res> { - factory _$$ChatMessagesModelImplCopyWith( - _$ChatMessagesModelImpl value, - $Res Function(_$ChatMessagesModelImpl) then, - ) = __$$ChatMessagesModelImplCopyWithImpl<$Res>; + factory _$$ChatMessagesModelImplCopyWith(_$ChatMessagesModelImpl value, + $Res Function(_$ChatMessagesModelImpl) then) = + __$$ChatMessagesModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'data') List messagesList, - ChatMetaModel meta, - }); + $Res call( + {@JsonKey(name: 'data') List messagesList, + ChatMetaModel meta}); @override $ChatMetaModelCopyWith<$Res> get meta; @@ -115,40 +108,39 @@ abstract class _$$ChatMessagesModelImplCopyWith<$Res> class __$$ChatMessagesModelImplCopyWithImpl<$Res> extends _$ChatMessagesModelCopyWithImpl<$Res, _$ChatMessagesModelImpl> implements _$$ChatMessagesModelImplCopyWith<$Res> { - __$$ChatMessagesModelImplCopyWithImpl( - _$ChatMessagesModelImpl _value, - $Res Function(_$ChatMessagesModelImpl) _then, - ) : super(_value, _then); + __$$ChatMessagesModelImplCopyWithImpl(_$ChatMessagesModelImpl _value, + $Res Function(_$ChatMessagesModelImpl) _then) + : super(_value, _then); /// Create a copy of ChatMessagesModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? messagesList = null, Object? meta = null}) { - return _then( - _$ChatMessagesModelImpl( - messagesList: - null == messagesList - ? _value._messagesList - : messagesList // ignore: cast_nullable_to_non_nullable - as List, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as ChatMetaModel, - ), - ); + $Res call({ + Object? messagesList = null, + Object? meta = null, + }) { + return _then(_$ChatMessagesModelImpl( + messagesList: null == messagesList + ? _value._messagesList + : messagesList // ignore: cast_nullable_to_non_nullable + as List, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as ChatMetaModel, + )); } } /// @nodoc @JsonSerializable() class _$ChatMessagesModelImpl implements _ChatMessagesModel { - const _$ChatMessagesModelImpl({ - @JsonKey(name: 'data') required final List messagesList, - required this.meta, - }) : _messagesList = messagesList; + const _$ChatMessagesModelImpl( + {@JsonKey(name: 'data') + required final List messagesList, + required this.meta}) + : _messagesList = messagesList; factory _$ChatMessagesModelImpl.fromJson(Map json) => _$$ChatMessagesModelImplFromJson(json); @@ -175,20 +167,15 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatMessagesModelImpl && - const DeepCollectionEquality().equals( - other._messagesList, - _messagesList, - ) && + const DeepCollectionEquality() + .equals(other._messagesList, _messagesList) && (identical(other.meta, meta) || other.meta == meta)); } @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_messagesList), - meta, - ); + runtimeType, const DeepCollectionEquality().hash(_messagesList), meta); /// Create a copy of ChatMessagesModel /// with the given fields replaced by the non-null parameter values. @@ -197,21 +184,21 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel { @pragma('vm:prefer-inline') _$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith => __$$ChatMessagesModelImplCopyWithImpl<_$ChatMessagesModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$ChatMessagesModelImplToJson(this); + return _$$ChatMessagesModelImplToJson( + this, + ); } } abstract class _ChatMessagesModel implements ChatMessagesModel { - const factory _ChatMessagesModel({ - @JsonKey(name: 'data') required final List messagesList, - required final ChatMetaModel meta, - }) = _$ChatMessagesModelImpl; + const factory _ChatMessagesModel( + {@JsonKey(name: 'data') + required final List messagesList, + required final ChatMetaModel meta}) = _$ChatMessagesModelImpl; factory _ChatMessagesModel.fromJson(Map json) = _$ChatMessagesModelImpl.fromJson; diff --git a/lib/features/chat/models/chat_messages_model.g.dart b/lib/features/chat/models/chat_messages_model.g.dart index a2722718..6216cd83 100644 --- a/lib/features/chat/models/chat_messages_model.g.dart +++ b/lib/features/chat/models/chat_messages_model.g.dart @@ -7,15 +7,17 @@ part of 'chat_messages_model.dart'; // ************************************************************************** _$ChatMessagesModelImpl _$$ChatMessagesModelImplFromJson( - Map json, -) => _$ChatMessagesModelImpl( - messagesList: - (json['data'] as List) + Map json) => + _$ChatMessagesModelImpl( + messagesList: (json['data'] as List) .map((e) => ChatMessageModel.fromJson(e as Map)) .toList(), - meta: ChatMetaModel.fromJson(json['meta'] as Map), -); + meta: ChatMetaModel.fromJson(json['meta'] as Map), + ); Map _$$ChatMessagesModelImplToJson( - _$ChatMessagesModelImpl instance, -) => {'data': instance.messagesList, 'meta': instance.meta}; + _$ChatMessagesModelImpl instance) => + { + 'data': instance.messagesList, + 'meta': instance.meta, + }; diff --git a/lib/features/chat/models/chat_meta_model.freezed.dart b/lib/features/chat/models/chat_meta_model.freezed.dart index 0ac5e1b1..e8e4e96b 100644 --- a/lib/features/chat/models/chat_meta_model.freezed.dart +++ b/lib/features/chat/models/chat_meta_model.freezed.dart @@ -12,8 +12,7 @@ part of 'chat_meta_model.dart'; 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', -); + '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'); ChatMetaModel _$ChatMetaModelFromJson(Map json) { return _ChatMetaModel.fromJson(json); @@ -37,9 +36,8 @@ mixin _$ChatMetaModel { /// @nodoc abstract class $ChatMetaModelCopyWith<$Res> { factory $ChatMetaModelCopyWith( - ChatMetaModel value, - $Res Function(ChatMetaModel) then, - ) = _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>; + ChatMetaModel value, $Res Function(ChatMetaModel) then) = + _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>; @useResult $Res call({@JsonKey(name: "last_page") int lastPage}); } @@ -58,17 +56,15 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? lastPage = null}) { - return _then( - _value.copyWith( - lastPage: - null == lastPage - ? _value.lastPage - : lastPage // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + $Res call({ + Object? lastPage = null, + }) { + return _then(_value.copyWith( + lastPage: null == lastPage + ? _value.lastPage + : lastPage // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } @@ -76,9 +72,8 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> abstract class _$$ChatMetaModelImplCopyWith<$Res> implements $ChatMetaModelCopyWith<$Res> { factory _$$ChatMetaModelImplCopyWith( - _$ChatMetaModelImpl value, - $Res Function(_$ChatMetaModelImpl) then, - ) = __$$ChatMetaModelImplCopyWithImpl<$Res>; + _$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) = + __$$ChatMetaModelImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: "last_page") int lastPage}); @@ -89,33 +84,30 @@ class __$$ChatMetaModelImplCopyWithImpl<$Res> extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl> implements _$$ChatMetaModelImplCopyWith<$Res> { __$$ChatMetaModelImplCopyWithImpl( - _$ChatMetaModelImpl _value, - $Res Function(_$ChatMetaModelImpl) _then, - ) : super(_value, _then); + _$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then) + : super(_value, _then); /// Create a copy of ChatMetaModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? lastPage = null}) { - return _then( - _$ChatMetaModelImpl( - lastPage: - null == lastPage - ? _value.lastPage - : lastPage // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + $Res call({ + Object? lastPage = null, + }) { + return _then(_$ChatMetaModelImpl( + lastPage: null == lastPage + ? _value.lastPage + : lastPage // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc @JsonSerializable() class _$ChatMetaModelImpl implements _ChatMetaModel { - const _$ChatMetaModelImpl({ - @JsonKey(name: "last_page") required this.lastPage, - }); + const _$ChatMetaModelImpl( + {@JsonKey(name: "last_page") required this.lastPage}); factory _$ChatMetaModelImpl.fromJson(Map json) => _$$ChatMetaModelImplFromJson(json); @@ -152,14 +144,16 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { @override Map toJson() { - return _$$ChatMetaModelImplToJson(this); + return _$$ChatMetaModelImplToJson( + this, + ); } } abstract class _ChatMetaModel implements ChatMetaModel { - const factory _ChatMetaModel({ - @JsonKey(name: "last_page") required final int lastPage, - }) = _$ChatMetaModelImpl; + const factory _ChatMetaModel( + {@JsonKey(name: "last_page") required final int lastPage}) = + _$ChatMetaModelImpl; factory _ChatMetaModel.fromJson(Map json) = _$ChatMetaModelImpl.fromJson; diff --git a/lib/features/chat/models/chat_meta_model.g.dart b/lib/features/chat/models/chat_meta_model.g.dart index fd0e0ea7..7126e2dd 100644 --- a/lib/features/chat/models/chat_meta_model.g.dart +++ b/lib/features/chat/models/chat_meta_model.g.dart @@ -7,7 +7,11 @@ part of 'chat_meta_model.dart'; // ************************************************************************** _$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map json) => - _$ChatMetaModelImpl(lastPage: (json['last_page'] as num).toInt()); + _$ChatMetaModelImpl( + lastPage: (json['last_page'] as num).toInt(), + ); Map _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) => - {'last_page': instance.lastPage}; + { + 'last_page': instance.lastPage, + }; diff --git a/lib/features/chat/models/chat_room_model.freezed.dart b/lib/features/chat/models/chat_room_model.freezed.dart index d624c9fe..829dd69f 100644 --- a/lib/features/chat/models/chat_room_model.freezed.dart +++ b/lib/features/chat/models/chat_room_model.freezed.dart @@ -12,8 +12,7 @@ part of 'chat_room_model.dart'; 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', -); + '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'); ChatRoomModel _$ChatRoomModelFromJson(Map json) { return _ChatRoomModel.fromJson(json); @@ -42,17 +41,16 @@ mixin _$ChatRoomModel { /// @nodoc abstract class $ChatRoomModelCopyWith<$Res> { factory $ChatRoomModelCopyWith( - ChatRoomModel value, - $Res Function(ChatRoomModel) then, - ) = _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>; + ChatRoomModel value, $Res Function(ChatRoomModel) then) = + _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>; @useResult - $Res call({ - String id, - @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, - Users users, - @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) - ChosenPlanModel? chosenPlan, - }); + $Res call( + {String id, + @JsonKey(name: 'chat_room_setting') + ChatRoomSettingsModel chatRoomSettings, + Users users, + @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) + ChosenPlanModel? chosenPlan}); $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; $UsersCopyWith<$Res> get users; @@ -79,31 +77,24 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> Object? users = null, Object? chosenPlan = freezed, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - chatRoomSettings: - null == chatRoomSettings - ? _value.chatRoomSettings - : chatRoomSettings // ignore: cast_nullable_to_non_nullable - as ChatRoomSettingsModel, - users: - null == users - ? _value.users - : users // ignore: cast_nullable_to_non_nullable - as Users, - chosenPlan: - freezed == chosenPlan - ? _value.chosenPlan - : chosenPlan // ignore: cast_nullable_to_non_nullable - as ChosenPlanModel?, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + chatRoomSettings: null == chatRoomSettings + ? _value.chatRoomSettings + : chatRoomSettings // ignore: cast_nullable_to_non_nullable + as ChatRoomSettingsModel, + users: null == users + ? _value.users + : users // ignore: cast_nullable_to_non_nullable + as Users, + chosenPlan: freezed == chosenPlan + ? _value.chosenPlan + : chosenPlan // ignore: cast_nullable_to_non_nullable + as ChosenPlanModel?, + ) as $Val); } /// Create a copy of ChatRoomModel @@ -111,9 +102,8 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> @override @pragma('vm:prefer-inline') $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings { - return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, ( - value, - ) { + return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, + (value) { return _then(_value.copyWith(chatRoomSettings: value) as $Val); }); } @@ -147,18 +137,17 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> abstract class _$$ChatRoomModelImplCopyWith<$Res> implements $ChatRoomModelCopyWith<$Res> { factory _$$ChatRoomModelImplCopyWith( - _$ChatRoomModelImpl value, - $Res Function(_$ChatRoomModelImpl) then, - ) = __$$ChatRoomModelImplCopyWithImpl<$Res>; + _$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) = + __$$ChatRoomModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String id, - @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, - Users users, - @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) - ChosenPlanModel? chosenPlan, - }); + $Res call( + {String id, + @JsonKey(name: 'chat_room_setting') + ChatRoomSettingsModel chatRoomSettings, + Users users, + @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) + ChosenPlanModel? chosenPlan}); @override $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; @@ -173,9 +162,8 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res> extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl> implements _$$ChatRoomModelImplCopyWith<$Res> { __$$ChatRoomModelImplCopyWithImpl( - _$ChatRoomModelImpl _value, - $Res Function(_$ChatRoomModelImpl) _then, - ) : super(_value, _then); + _$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then) + : super(_value, _then); /// Create a copy of ChatRoomModel /// with the given fields replaced by the non-null parameter values. @@ -187,43 +175,36 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res> Object? users = null, Object? chosenPlan = freezed, }) { - return _then( - _$ChatRoomModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - chatRoomSettings: - null == chatRoomSettings - ? _value.chatRoomSettings - : chatRoomSettings // ignore: cast_nullable_to_non_nullable - as ChatRoomSettingsModel, - users: - null == users - ? _value.users - : users // ignore: cast_nullable_to_non_nullable - as Users, - chosenPlan: - freezed == chosenPlan - ? _value.chosenPlan - : chosenPlan // ignore: cast_nullable_to_non_nullable - as ChosenPlanModel?, - ), - ); + return _then(_$ChatRoomModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + chatRoomSettings: null == chatRoomSettings + ? _value.chatRoomSettings + : chatRoomSettings // ignore: cast_nullable_to_non_nullable + as ChatRoomSettingsModel, + users: null == users + ? _value.users + : users // ignore: cast_nullable_to_non_nullable + as Users, + chosenPlan: freezed == chosenPlan + ? _value.chosenPlan + : chosenPlan // ignore: cast_nullable_to_non_nullable + as ChosenPlanModel?, + )); } } /// @nodoc @JsonSerializable() class _$ChatRoomModelImpl implements _ChatRoomModel { - const _$ChatRoomModelImpl({ - required this.id, - @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, - required this.users, - @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) - required this.chosenPlan, - }); + const _$ChatRoomModelImpl( + {required this.id, + @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, + required this.users, + @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) + required this.chosenPlan}); factory _$ChatRoomModelImpl.fromJson(Map json) => _$$ChatRoomModelImplFromJson(json); @@ -272,19 +253,20 @@ class _$ChatRoomModelImpl implements _ChatRoomModel { @override Map toJson() { - return _$$ChatRoomModelImplToJson(this); + return _$$ChatRoomModelImplToJson( + this, + ); } } abstract class _ChatRoomModel implements ChatRoomModel { - const factory _ChatRoomModel({ - required final String id, - @JsonKey(name: 'chat_room_setting') - required final ChatRoomSettingsModel chatRoomSettings, - required final Users users, - @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) - required final ChosenPlanModel? chosenPlan, - }) = _$ChatRoomModelImpl; + const factory _ChatRoomModel( + {required final String id, + @JsonKey(name: 'chat_room_setting') + required final ChatRoomSettingsModel chatRoomSettings, + required final Users users, + @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) + required final ChosenPlanModel? chosenPlan}) = _$ChatRoomModelImpl; factory _ChatRoomModel.fromJson(Map json) = _$ChatRoomModelImpl.fromJson; @@ -333,10 +315,9 @@ abstract class $UsersCopyWith<$Res> { factory $UsersCopyWith(Users value, $Res Function(Users) then) = _$UsersCopyWithImpl<$Res, Users>; @useResult - $Res call({ - @JsonKey(name: 'from_chat_user') ChatUserModel sender, - @JsonKey(name: 'to_chat_user') ChatUserModel receiver, - }); + $Res call( + {@JsonKey(name: 'from_chat_user') ChatUserModel sender, + @JsonKey(name: 'to_chat_user') ChatUserModel receiver}); $ChatUserModelCopyWith<$Res> get sender; $ChatUserModelCopyWith<$Res> get receiver; @@ -356,22 +337,20 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? sender = null, Object? receiver = null}) { - return _then( - _value.copyWith( - sender: - null == sender - ? _value.sender - : sender // ignore: cast_nullable_to_non_nullable - as ChatUserModel, - receiver: - null == receiver - ? _value.receiver - : receiver // ignore: cast_nullable_to_non_nullable - as ChatUserModel, - ) - as $Val, - ); + $Res call({ + Object? sender = null, + Object? receiver = null, + }) { + return _then(_value.copyWith( + sender: null == sender + ? _value.sender + : sender // ignore: cast_nullable_to_non_nullable + as ChatUserModel, + receiver: null == receiver + ? _value.receiver + : receiver // ignore: cast_nullable_to_non_nullable + as ChatUserModel, + ) as $Val); } /// Create a copy of Users @@ -398,15 +377,13 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users> /// @nodoc abstract class _$$UsersImplCopyWith<$Res> implements $UsersCopyWith<$Res> { factory _$$UsersImplCopyWith( - _$UsersImpl value, - $Res Function(_$UsersImpl) then, - ) = __$$UsersImplCopyWithImpl<$Res>; + _$UsersImpl value, $Res Function(_$UsersImpl) then) = + __$$UsersImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'from_chat_user') ChatUserModel sender, - @JsonKey(name: 'to_chat_user') ChatUserModel receiver, - }); + $Res call( + {@JsonKey(name: 'from_chat_user') ChatUserModel sender, + @JsonKey(name: 'to_chat_user') ChatUserModel receiver}); @override $ChatUserModelCopyWith<$Res> get sender; @@ -419,39 +396,36 @@ class __$$UsersImplCopyWithImpl<$Res> extends _$UsersCopyWithImpl<$Res, _$UsersImpl> implements _$$UsersImplCopyWith<$Res> { __$$UsersImplCopyWithImpl( - _$UsersImpl _value, - $Res Function(_$UsersImpl) _then, - ) : super(_value, _then); + _$UsersImpl _value, $Res Function(_$UsersImpl) _then) + : super(_value, _then); /// Create a copy of Users /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? sender = null, Object? receiver = null}) { - return _then( - _$UsersImpl( - sender: - null == sender - ? _value.sender - : sender // ignore: cast_nullable_to_non_nullable - as ChatUserModel, - receiver: - null == receiver - ? _value.receiver - : receiver // ignore: cast_nullable_to_non_nullable - as ChatUserModel, - ), - ); + $Res call({ + Object? sender = null, + Object? receiver = null, + }) { + return _then(_$UsersImpl( + sender: null == sender + ? _value.sender + : sender // ignore: cast_nullable_to_non_nullable + as ChatUserModel, + receiver: null == receiver + ? _value.receiver + : receiver // ignore: cast_nullable_to_non_nullable + as ChatUserModel, + )); } } /// @nodoc @JsonSerializable() class _$UsersImpl implements _Users { - const _$UsersImpl({ - @JsonKey(name: 'from_chat_user') required this.sender, - @JsonKey(name: 'to_chat_user') required this.receiver, - }); + const _$UsersImpl( + {@JsonKey(name: 'from_chat_user') required this.sender, + @JsonKey(name: 'to_chat_user') required this.receiver}); factory _$UsersImpl.fromJson(Map json) => _$$UsersImplFromJson(json); @@ -492,15 +466,17 @@ class _$UsersImpl implements _Users { @override Map toJson() { - return _$$UsersImplToJson(this); + return _$$UsersImplToJson( + this, + ); } } abstract class _Users implements Users { - const factory _Users({ - @JsonKey(name: 'from_chat_user') required final ChatUserModel sender, - @JsonKey(name: 'to_chat_user') required final ChatUserModel receiver, - }) = _$UsersImpl; + const factory _Users( + {@JsonKey(name: 'from_chat_user') required final ChatUserModel sender, + @JsonKey(name: 'to_chat_user') + required final ChatUserModel receiver}) = _$UsersImpl; factory _Users.fromJson(Map json) = _$UsersImpl.fromJson; diff --git a/lib/features/chat/models/chat_room_model.g.dart b/lib/features/chat/models/chat_room_model.g.dart index dd5279f0..fb9e6257 100644 --- a/lib/features/chat/models/chat_room_model.g.dart +++ b/lib/features/chat/models/chat_room_model.g.dart @@ -10,8 +10,7 @@ _$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map json) => _$ChatRoomModelImpl( id: json['id'] as String, chatRoomSettings: ChatRoomSettingsModel.fromJson( - json['chat_room_setting'] as Map, - ), + json['chat_room_setting'] as Map), users: Users.fromJson(json['users'] as Map), chosenPlan: parseChosenPlan(json['chosen_plan']), ); @@ -25,13 +24,11 @@ Map _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) => }; _$UsersImpl _$$UsersImplFromJson(Map json) => _$UsersImpl( - sender: ChatUserModel.fromJson( - json['from_chat_user'] as Map, - ), - receiver: ChatUserModel.fromJson( - json['to_chat_user'] as Map, - ), -); + sender: ChatUserModel.fromJson( + json['from_chat_user'] as Map), + receiver: + ChatUserModel.fromJson(json['to_chat_user'] as Map), + ); Map _$$UsersImplToJson(_$UsersImpl instance) => { diff --git a/lib/features/chat/models/chat_room_pagination_model.freezed.dart b/lib/features/chat/models/chat_room_pagination_model.freezed.dart index 0bab8fb2..54e56ee3 100644 --- a/lib/features/chat/models/chat_room_pagination_model.freezed.dart +++ b/lib/features/chat/models/chat_room_pagination_model.freezed.dart @@ -12,12 +12,10 @@ part of 'chat_room_pagination_model.dart'; 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', -); + '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'); ChatRoomPaginationModel _$ChatRoomPaginationModelFromJson( - Map json, -) { + Map json) { return _ChatRoomPreviewModel.fromJson(json); } @@ -40,24 +38,20 @@ mixin _$ChatRoomPaginationModel { /// @nodoc abstract class $ChatRoomPaginationModelCopyWith<$Res> { - factory $ChatRoomPaginationModelCopyWith( - ChatRoomPaginationModel value, - $Res Function(ChatRoomPaginationModel) then, - ) = _$ChatRoomPaginationModelCopyWithImpl<$Res, ChatRoomPaginationModel>; + factory $ChatRoomPaginationModelCopyWith(ChatRoomPaginationModel value, + $Res Function(ChatRoomPaginationModel) then) = + _$ChatRoomPaginationModelCopyWithImpl<$Res, ChatRoomPaginationModel>; @useResult - $Res call({ - @JsonKey(name: "chatRooms") ChatRooms chatRooms, - @JsonKey(name: "number_of_unread_chat_rooms") int unreadChatsCount, - }); + $Res call( + {@JsonKey(name: "chatRooms") ChatRooms chatRooms, + @JsonKey(name: "number_of_unread_chat_rooms") int unreadChatsCount}); $ChatRoomsCopyWith<$Res> get chatRooms; } /// @nodoc -class _$ChatRoomPaginationModelCopyWithImpl< - $Res, - $Val extends ChatRoomPaginationModel -> +class _$ChatRoomPaginationModelCopyWithImpl<$Res, + $Val extends ChatRoomPaginationModel> implements $ChatRoomPaginationModelCopyWith<$Res> { _$ChatRoomPaginationModelCopyWithImpl(this._value, this._then); @@ -70,22 +64,20 @@ class _$ChatRoomPaginationModelCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? chatRooms = null, Object? unreadChatsCount = null}) { - return _then( - _value.copyWith( - chatRooms: - null == chatRooms - ? _value.chatRooms - : chatRooms // ignore: cast_nullable_to_non_nullable - as ChatRooms, - unreadChatsCount: - null == unreadChatsCount - ? _value.unreadChatsCount - : unreadChatsCount // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + $Res call({ + Object? chatRooms = null, + Object? unreadChatsCount = null, + }) { + return _then(_value.copyWith( + chatRooms: null == chatRooms + ? _value.chatRooms + : chatRooms // ignore: cast_nullable_to_non_nullable + as ChatRooms, + unreadChatsCount: null == unreadChatsCount + ? _value.unreadChatsCount + : unreadChatsCount // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } /// Create a copy of ChatRoomPaginationModel @@ -102,16 +94,14 @@ class _$ChatRoomPaginationModelCopyWithImpl< /// @nodoc abstract class _$$ChatRoomPreviewModelImplCopyWith<$Res> implements $ChatRoomPaginationModelCopyWith<$Res> { - factory _$$ChatRoomPreviewModelImplCopyWith( - _$ChatRoomPreviewModelImpl value, - $Res Function(_$ChatRoomPreviewModelImpl) then, - ) = __$$ChatRoomPreviewModelImplCopyWithImpl<$Res>; + factory _$$ChatRoomPreviewModelImplCopyWith(_$ChatRoomPreviewModelImpl value, + $Res Function(_$ChatRoomPreviewModelImpl) then) = + __$$ChatRoomPreviewModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "chatRooms") ChatRooms chatRooms, - @JsonKey(name: "number_of_unread_chat_rooms") int unreadChatsCount, - }); + $Res call( + {@JsonKey(name: "chatRooms") ChatRooms chatRooms, + @JsonKey(name: "number_of_unread_chat_rooms") int unreadChatsCount}); @override $ChatRoomsCopyWith<$Res> get chatRooms; @@ -119,44 +109,41 @@ abstract class _$$ChatRoomPreviewModelImplCopyWith<$Res> /// @nodoc class __$$ChatRoomPreviewModelImplCopyWithImpl<$Res> - extends - _$ChatRoomPaginationModelCopyWithImpl<$Res, _$ChatRoomPreviewModelImpl> + extends _$ChatRoomPaginationModelCopyWithImpl<$Res, + _$ChatRoomPreviewModelImpl> implements _$$ChatRoomPreviewModelImplCopyWith<$Res> { - __$$ChatRoomPreviewModelImplCopyWithImpl( - _$ChatRoomPreviewModelImpl _value, - $Res Function(_$ChatRoomPreviewModelImpl) _then, - ) : super(_value, _then); + __$$ChatRoomPreviewModelImplCopyWithImpl(_$ChatRoomPreviewModelImpl _value, + $Res Function(_$ChatRoomPreviewModelImpl) _then) + : super(_value, _then); /// Create a copy of ChatRoomPaginationModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? chatRooms = null, Object? unreadChatsCount = null}) { - return _then( - _$ChatRoomPreviewModelImpl( - chatRooms: - null == chatRooms - ? _value.chatRooms - : chatRooms // ignore: cast_nullable_to_non_nullable - as ChatRooms, - unreadChatsCount: - null == unreadChatsCount - ? _value.unreadChatsCount - : unreadChatsCount // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + $Res call({ + Object? chatRooms = null, + Object? unreadChatsCount = null, + }) { + return _then(_$ChatRoomPreviewModelImpl( + chatRooms: null == chatRooms + ? _value.chatRooms + : chatRooms // ignore: cast_nullable_to_non_nullable + as ChatRooms, + unreadChatsCount: null == unreadChatsCount + ? _value.unreadChatsCount + : unreadChatsCount // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc @JsonSerializable() class _$ChatRoomPreviewModelImpl implements _ChatRoomPreviewModel { - const _$ChatRoomPreviewModelImpl({ - @JsonKey(name: "chatRooms") required this.chatRooms, - @JsonKey(name: "number_of_unread_chat_rooms") - required this.unreadChatsCount, - }); + const _$ChatRoomPreviewModelImpl( + {@JsonKey(name: "chatRooms") required this.chatRooms, + @JsonKey(name: "number_of_unread_chat_rooms") + required this.unreadChatsCount}); factory _$ChatRoomPreviewModelImpl.fromJson(Map json) => _$$ChatRoomPreviewModelImplFromJson(json); @@ -194,24 +181,23 @@ class _$ChatRoomPreviewModelImpl implements _ChatRoomPreviewModel { @override @pragma('vm:prefer-inline') _$$ChatRoomPreviewModelImplCopyWith<_$ChatRoomPreviewModelImpl> - get copyWith => - __$$ChatRoomPreviewModelImplCopyWithImpl<_$ChatRoomPreviewModelImpl>( - this, - _$identity, - ); + get copyWith => + __$$ChatRoomPreviewModelImplCopyWithImpl<_$ChatRoomPreviewModelImpl>( + this, _$identity); @override Map toJson() { - return _$$ChatRoomPreviewModelImplToJson(this); + return _$$ChatRoomPreviewModelImplToJson( + this, + ); } } abstract class _ChatRoomPreviewModel implements ChatRoomPaginationModel { - const factory _ChatRoomPreviewModel({ - @JsonKey(name: "chatRooms") required final ChatRooms chatRooms, - @JsonKey(name: "number_of_unread_chat_rooms") - required final int unreadChatsCount, - }) = _$ChatRoomPreviewModelImpl; + const factory _ChatRoomPreviewModel( + {@JsonKey(name: "chatRooms") required final ChatRooms chatRooms, + @JsonKey(name: "number_of_unread_chat_rooms") + required final int unreadChatsCount}) = _$ChatRoomPreviewModelImpl; factory _ChatRoomPreviewModel.fromJson(Map json) = _$ChatRoomPreviewModelImpl.fromJson; @@ -228,7 +214,7 @@ abstract class _ChatRoomPreviewModel implements ChatRoomPaginationModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$ChatRoomPreviewModelImplCopyWith<_$ChatRoomPreviewModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } ChatRooms _$ChatRoomsFromJson(Map json) { @@ -259,11 +245,10 @@ abstract class $ChatRoomsCopyWith<$Res> { factory $ChatRoomsCopyWith(ChatRooms value, $Res Function(ChatRooms) then) = _$ChatRoomsCopyWithImpl<$Res, ChatRooms>; @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "last_page") int lastPage, - @JsonKey(name: "current_page") int currentPage, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "last_page") int lastPage, + @JsonKey(name: "current_page") int currentPage}); } /// @nodoc @@ -285,26 +270,20 @@ class _$ChatRoomsCopyWithImpl<$Res, $Val extends ChatRooms> Object? lastPage = null, Object? currentPage = null, }) { - return _then( - _value.copyWith( - data: - null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as List, - lastPage: - null == lastPage - ? _value.lastPage - : lastPage // ignore: cast_nullable_to_non_nullable - as int, - currentPage: - null == currentPage - ? _value.currentPage - : currentPage // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + return _then(_value.copyWith( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as List, + lastPage: null == lastPage + ? _value.lastPage + : lastPage // ignore: cast_nullable_to_non_nullable + as int, + currentPage: null == currentPage + ? _value.currentPage + : currentPage // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } @@ -312,16 +291,14 @@ class _$ChatRoomsCopyWithImpl<$Res, $Val extends ChatRooms> abstract class _$$ChatRoomsImplCopyWith<$Res> implements $ChatRoomsCopyWith<$Res> { factory _$$ChatRoomsImplCopyWith( - _$ChatRoomsImpl value, - $Res Function(_$ChatRoomsImpl) then, - ) = __$$ChatRoomsImplCopyWithImpl<$Res>; + _$ChatRoomsImpl value, $Res Function(_$ChatRoomsImpl) then) = + __$$ChatRoomsImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "last_page") int lastPage, - @JsonKey(name: "current_page") int currentPage, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "last_page") int lastPage, + @JsonKey(name: "current_page") int currentPage}); } /// @nodoc @@ -329,9 +306,8 @@ class __$$ChatRoomsImplCopyWithImpl<$Res> extends _$ChatRoomsCopyWithImpl<$Res, _$ChatRoomsImpl> implements _$$ChatRoomsImplCopyWith<$Res> { __$$ChatRoomsImplCopyWithImpl( - _$ChatRoomsImpl _value, - $Res Function(_$ChatRoomsImpl) _then, - ) : super(_value, _then); + _$ChatRoomsImpl _value, $Res Function(_$ChatRoomsImpl) _then) + : super(_value, _then); /// Create a copy of ChatRooms /// with the given fields replaced by the non-null parameter values. @@ -342,36 +318,31 @@ class __$$ChatRoomsImplCopyWithImpl<$Res> Object? lastPage = null, Object? currentPage = null, }) { - return _then( - _$ChatRoomsImpl( - data: - null == data - ? _value._data - : data // ignore: cast_nullable_to_non_nullable - as List, - lastPage: - null == lastPage - ? _value.lastPage - : lastPage // ignore: cast_nullable_to_non_nullable - as int, - currentPage: - null == currentPage - ? _value.currentPage - : currentPage // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$ChatRoomsImpl( + data: null == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as List, + lastPage: null == lastPage + ? _value.lastPage + : lastPage // ignore: cast_nullable_to_non_nullable + as int, + currentPage: null == currentPage + ? _value.currentPage + : currentPage // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc @JsonSerializable() class _$ChatRoomsImpl implements _ChatRooms { - const _$ChatRoomsImpl({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "last_page") required this.lastPage, - @JsonKey(name: "current_page") required this.currentPage, - }) : _data = data; + const _$ChatRoomsImpl( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "last_page") required this.lastPage, + @JsonKey(name: "current_page") required this.currentPage}) + : _data = data; factory _$ChatRoomsImpl.fromJson(Map json) => _$$ChatRoomsImplFromJson(json); @@ -411,12 +382,8 @@ class _$ChatRoomsImpl implements _ChatRooms { @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_data), - lastPage, - currentPage, - ); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_data), lastPage, currentPage); /// Create a copy of ChatRooms /// with the given fields replaced by the non-null parameter values. @@ -428,16 +395,18 @@ class _$ChatRoomsImpl implements _ChatRooms { @override Map toJson() { - return _$$ChatRoomsImplToJson(this); + return _$$ChatRoomsImplToJson( + this, + ); } } abstract class _ChatRooms implements ChatRooms { - const factory _ChatRooms({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "last_page") required final int lastPage, - @JsonKey(name: "current_page") required final int currentPage, - }) = _$ChatRoomsImpl; + const factory _ChatRooms( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "last_page") required final int lastPage, + @JsonKey(name: "current_page") required final int currentPage}) = + _$ChatRoomsImpl; factory _ChatRooms.fromJson(Map json) = _$ChatRoomsImpl.fromJson; @@ -494,16 +463,15 @@ abstract class $ChatRoomCopyWith<$Res> { factory $ChatRoomCopyWith(ChatRoom value, $Res Function(ChatRoom) then) = _$ChatRoomCopyWithImpl<$Res, ChatRoom>; @useResult - $Res call({ - @JsonKey(name: "id") String id, - @JsonKey(name: "room_name") String roomName, - @JsonKey(name: "last_message", fromJson: parseLastMessage) - ChatMessageModel? lastMessage, - @JsonKey(name: "users") Users users, - @JsonKey(name: "unread_messages_count") int unreadMessagesCount, - @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) - ChosenPlanModel? chosenPlan, - }); + $Res call( + {@JsonKey(name: "id") String id, + @JsonKey(name: "room_name") String roomName, + @JsonKey(name: "last_message", fromJson: parseLastMessage) + ChatMessageModel? lastMessage, + @JsonKey(name: "users") Users users, + @JsonKey(name: "unread_messages_count") int unreadMessagesCount, + @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) + ChosenPlanModel? chosenPlan}); $ChatMessageModelCopyWith<$Res>? get lastMessage; $UsersCopyWith<$Res> get users; @@ -532,41 +500,32 @@ class _$ChatRoomCopyWithImpl<$Res, $Val extends ChatRoom> Object? unreadMessagesCount = null, Object? chosenPlan = freezed, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - roomName: - null == roomName - ? _value.roomName - : roomName // ignore: cast_nullable_to_non_nullable - as String, - lastMessage: - freezed == lastMessage - ? _value.lastMessage - : lastMessage // ignore: cast_nullable_to_non_nullable - as ChatMessageModel?, - users: - null == users - ? _value.users - : users // ignore: cast_nullable_to_non_nullable - as Users, - unreadMessagesCount: - null == unreadMessagesCount - ? _value.unreadMessagesCount - : unreadMessagesCount // ignore: cast_nullable_to_non_nullable - as int, - chosenPlan: - freezed == chosenPlan - ? _value.chosenPlan - : chosenPlan // ignore: cast_nullable_to_non_nullable - as ChosenPlanModel?, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + roomName: null == roomName + ? _value.roomName + : roomName // ignore: cast_nullable_to_non_nullable + as String, + lastMessage: freezed == lastMessage + ? _value.lastMessage + : lastMessage // ignore: cast_nullable_to_non_nullable + as ChatMessageModel?, + users: null == users + ? _value.users + : users // ignore: cast_nullable_to_non_nullable + as Users, + unreadMessagesCount: null == unreadMessagesCount + ? _value.unreadMessagesCount + : unreadMessagesCount // ignore: cast_nullable_to_non_nullable + as int, + chosenPlan: freezed == chosenPlan + ? _value.chosenPlan + : chosenPlan // ignore: cast_nullable_to_non_nullable + as ChosenPlanModel?, + ) as $Val); } /// Create a copy of ChatRoom @@ -612,21 +571,19 @@ class _$ChatRoomCopyWithImpl<$Res, $Val extends ChatRoom> abstract class _$$ChatRoomImplCopyWith<$Res> implements $ChatRoomCopyWith<$Res> { factory _$$ChatRoomImplCopyWith( - _$ChatRoomImpl value, - $Res Function(_$ChatRoomImpl) then, - ) = __$$ChatRoomImplCopyWithImpl<$Res>; + _$ChatRoomImpl value, $Res Function(_$ChatRoomImpl) then) = + __$$ChatRoomImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") String id, - @JsonKey(name: "room_name") String roomName, - @JsonKey(name: "last_message", fromJson: parseLastMessage) - ChatMessageModel? lastMessage, - @JsonKey(name: "users") Users users, - @JsonKey(name: "unread_messages_count") int unreadMessagesCount, - @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) - ChosenPlanModel? chosenPlan, - }); + $Res call( + {@JsonKey(name: "id") String id, + @JsonKey(name: "room_name") String roomName, + @JsonKey(name: "last_message", fromJson: parseLastMessage) + ChatMessageModel? lastMessage, + @JsonKey(name: "users") Users users, + @JsonKey(name: "unread_messages_count") int unreadMessagesCount, + @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) + ChosenPlanModel? chosenPlan}); @override $ChatMessageModelCopyWith<$Res>? get lastMessage; @@ -641,9 +598,8 @@ class __$$ChatRoomImplCopyWithImpl<$Res> extends _$ChatRoomCopyWithImpl<$Res, _$ChatRoomImpl> implements _$$ChatRoomImplCopyWith<$Res> { __$$ChatRoomImplCopyWithImpl( - _$ChatRoomImpl _value, - $Res Function(_$ChatRoomImpl) _then, - ) : super(_value, _then); + _$ChatRoomImpl _value, $Res Function(_$ChatRoomImpl) _then) + : super(_value, _then); /// Create a copy of ChatRoom /// with the given fields replaced by the non-null parameter values. @@ -657,56 +613,47 @@ class __$$ChatRoomImplCopyWithImpl<$Res> Object? unreadMessagesCount = null, Object? chosenPlan = freezed, }) { - return _then( - _$ChatRoomImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - roomName: - null == roomName - ? _value.roomName - : roomName // ignore: cast_nullable_to_non_nullable - as String, - lastMessage: - freezed == lastMessage - ? _value.lastMessage - : lastMessage // ignore: cast_nullable_to_non_nullable - as ChatMessageModel?, - users: - null == users - ? _value.users - : users // ignore: cast_nullable_to_non_nullable - as Users, - unreadMessagesCount: - null == unreadMessagesCount - ? _value.unreadMessagesCount - : unreadMessagesCount // ignore: cast_nullable_to_non_nullable - as int, - chosenPlan: - freezed == chosenPlan - ? _value.chosenPlan - : chosenPlan // ignore: cast_nullable_to_non_nullable - as ChosenPlanModel?, - ), - ); + return _then(_$ChatRoomImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + roomName: null == roomName + ? _value.roomName + : roomName // ignore: cast_nullable_to_non_nullable + as String, + lastMessage: freezed == lastMessage + ? _value.lastMessage + : lastMessage // ignore: cast_nullable_to_non_nullable + as ChatMessageModel?, + users: null == users + ? _value.users + : users // ignore: cast_nullable_to_non_nullable + as Users, + unreadMessagesCount: null == unreadMessagesCount + ? _value.unreadMessagesCount + : unreadMessagesCount // ignore: cast_nullable_to_non_nullable + as int, + chosenPlan: freezed == chosenPlan + ? _value.chosenPlan + : chosenPlan // ignore: cast_nullable_to_non_nullable + as ChosenPlanModel?, + )); } } /// @nodoc @JsonSerializable() class _$ChatRoomImpl implements _ChatRoom { - const _$ChatRoomImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "room_name") required this.roomName, - @JsonKey(name: "last_message", fromJson: parseLastMessage) - required this.lastMessage, - @JsonKey(name: "users") required this.users, - @JsonKey(name: "unread_messages_count") required this.unreadMessagesCount, - @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) - required this.chosenPlan, - }); + const _$ChatRoomImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "room_name") required this.roomName, + @JsonKey(name: "last_message", fromJson: parseLastMessage) + required this.lastMessage, + @JsonKey(name: "users") required this.users, + @JsonKey(name: "unread_messages_count") required this.unreadMessagesCount, + @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) + required this.chosenPlan}); factory _$ChatRoomImpl.fromJson(Map json) => _$$ChatRoomImplFromJson(json); @@ -754,15 +701,8 @@ class _$ChatRoomImpl implements _ChatRoom { @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - id, - roomName, - lastMessage, - users, - unreadMessagesCount, - chosenPlan, - ); + int get hashCode => Object.hash(runtimeType, id, roomName, lastMessage, users, + unreadMessagesCount, chosenPlan); /// Create a copy of ChatRoom /// with the given fields replaced by the non-null parameter values. @@ -774,22 +714,23 @@ class _$ChatRoomImpl implements _ChatRoom { @override Map toJson() { - return _$$ChatRoomImplToJson(this); + return _$$ChatRoomImplToJson( + this, + ); } } abstract class _ChatRoom implements ChatRoom { - const factory _ChatRoom({ - @JsonKey(name: "id") required final String id, - @JsonKey(name: "room_name") required final String roomName, - @JsonKey(name: "last_message", fromJson: parseLastMessage) - required final ChatMessageModel? lastMessage, - @JsonKey(name: "users") required final Users users, - @JsonKey(name: "unread_messages_count") - required final int unreadMessagesCount, - @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) - required final ChosenPlanModel? chosenPlan, - }) = _$ChatRoomImpl; + const factory _ChatRoom( + {@JsonKey(name: "id") required final String id, + @JsonKey(name: "room_name") required final String roomName, + @JsonKey(name: "last_message", fromJson: parseLastMessage) + required final ChatMessageModel? lastMessage, + @JsonKey(name: "users") required final Users users, + @JsonKey(name: "unread_messages_count") + required final int unreadMessagesCount, + @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) + required final ChosenPlanModel? chosenPlan}) = _$ChatRoomImpl; factory _ChatRoom.fromJson(Map json) = _$ChatRoomImpl.fromJson; @@ -846,10 +787,9 @@ abstract class $UsersCopyWith<$Res> { factory $UsersCopyWith(Users value, $Res Function(Users) then) = _$UsersCopyWithImpl<$Res, Users>; @useResult - $Res call({ - @JsonKey(name: "from_chat_user") ChatUser fromChatUser, - @JsonKey(name: "to_chat_user") ChatUser toChatUser, - }); + $Res call( + {@JsonKey(name: "from_chat_user") ChatUser fromChatUser, + @JsonKey(name: "to_chat_user") ChatUser toChatUser}); $ChatUserCopyWith<$Res> get fromChatUser; $ChatUserCopyWith<$Res> get toChatUser; @@ -869,22 +809,20 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? fromChatUser = null, Object? toChatUser = null}) { - return _then( - _value.copyWith( - fromChatUser: - null == fromChatUser - ? _value.fromChatUser - : fromChatUser // ignore: cast_nullable_to_non_nullable - as ChatUser, - toChatUser: - null == toChatUser - ? _value.toChatUser - : toChatUser // ignore: cast_nullable_to_non_nullable - as ChatUser, - ) - as $Val, - ); + $Res call({ + Object? fromChatUser = null, + Object? toChatUser = null, + }) { + return _then(_value.copyWith( + fromChatUser: null == fromChatUser + ? _value.fromChatUser + : fromChatUser // ignore: cast_nullable_to_non_nullable + as ChatUser, + toChatUser: null == toChatUser + ? _value.toChatUser + : toChatUser // ignore: cast_nullable_to_non_nullable + as ChatUser, + ) as $Val); } /// Create a copy of Users @@ -911,15 +849,13 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users> /// @nodoc abstract class _$$UsersImplCopyWith<$Res> implements $UsersCopyWith<$Res> { factory _$$UsersImplCopyWith( - _$UsersImpl value, - $Res Function(_$UsersImpl) then, - ) = __$$UsersImplCopyWithImpl<$Res>; + _$UsersImpl value, $Res Function(_$UsersImpl) then) = + __$$UsersImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "from_chat_user") ChatUser fromChatUser, - @JsonKey(name: "to_chat_user") ChatUser toChatUser, - }); + $Res call( + {@JsonKey(name: "from_chat_user") ChatUser fromChatUser, + @JsonKey(name: "to_chat_user") ChatUser toChatUser}); @override $ChatUserCopyWith<$Res> get fromChatUser; @@ -932,39 +868,36 @@ class __$$UsersImplCopyWithImpl<$Res> extends _$UsersCopyWithImpl<$Res, _$UsersImpl> implements _$$UsersImplCopyWith<$Res> { __$$UsersImplCopyWithImpl( - _$UsersImpl _value, - $Res Function(_$UsersImpl) _then, - ) : super(_value, _then); + _$UsersImpl _value, $Res Function(_$UsersImpl) _then) + : super(_value, _then); /// Create a copy of Users /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? fromChatUser = null, Object? toChatUser = null}) { - return _then( - _$UsersImpl( - fromChatUser: - null == fromChatUser - ? _value.fromChatUser - : fromChatUser // ignore: cast_nullable_to_non_nullable - as ChatUser, - toChatUser: - null == toChatUser - ? _value.toChatUser - : toChatUser // ignore: cast_nullable_to_non_nullable - as ChatUser, - ), - ); + $Res call({ + Object? fromChatUser = null, + Object? toChatUser = null, + }) { + return _then(_$UsersImpl( + fromChatUser: null == fromChatUser + ? _value.fromChatUser + : fromChatUser // ignore: cast_nullable_to_non_nullable + as ChatUser, + toChatUser: null == toChatUser + ? _value.toChatUser + : toChatUser // ignore: cast_nullable_to_non_nullable + as ChatUser, + )); } } /// @nodoc @JsonSerializable() class _$UsersImpl implements _Users { - const _$UsersImpl({ - @JsonKey(name: "from_chat_user") required this.fromChatUser, - @JsonKey(name: "to_chat_user") required this.toChatUser, - }); + const _$UsersImpl( + {@JsonKey(name: "from_chat_user") required this.fromChatUser, + @JsonKey(name: "to_chat_user") required this.toChatUser}); factory _$UsersImpl.fromJson(Map json) => _$$UsersImplFromJson(json); @@ -1006,15 +939,17 @@ class _$UsersImpl implements _Users { @override Map toJson() { - return _$$UsersImplToJson(this); + return _$$UsersImplToJson( + this, + ); } } abstract class _Users implements Users { - const factory _Users({ - @JsonKey(name: "from_chat_user") required final ChatUser fromChatUser, - @JsonKey(name: "to_chat_user") required final ChatUser toChatUser, - }) = _$UsersImpl; + const factory _Users( + {@JsonKey(name: "from_chat_user") required final ChatUser fromChatUser, + @JsonKey(name: "to_chat_user") + required final ChatUser toChatUser}) = _$UsersImpl; factory _Users.fromJson(Map json) = _$UsersImpl.fromJson; @@ -1063,12 +998,11 @@ abstract class $ChatUserCopyWith<$Res> { factory $ChatUserCopyWith(ChatUser value, $Res Function(ChatUser) then) = _$ChatUserCopyWithImpl<$Res, ChatUser>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "name") String name, - @JsonKey(name: "profile_photo_path") String? profilePhotoPath, - @JsonKey(name: "profile_photo_url") String profilePhotoUrl, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "name") String name, + @JsonKey(name: "profile_photo_path") String? profilePhotoPath, + @JsonKey(name: "profile_photo_url") String profilePhotoUrl}); } /// @nodoc @@ -1091,31 +1025,24 @@ class _$ChatUserCopyWithImpl<$Res, $Val extends ChatUser> Object? profilePhotoPath = freezed, Object? profilePhotoUrl = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - profilePhotoPath: - freezed == profilePhotoPath - ? _value.profilePhotoPath - : profilePhotoPath // ignore: cast_nullable_to_non_nullable - as String?, - profilePhotoUrl: - null == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + profilePhotoPath: freezed == profilePhotoPath + ? _value.profilePhotoPath + : profilePhotoPath // ignore: cast_nullable_to_non_nullable + as String?, + profilePhotoUrl: null == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -1123,17 +1050,15 @@ class _$ChatUserCopyWithImpl<$Res, $Val extends ChatUser> abstract class _$$ChatUserImplCopyWith<$Res> implements $ChatUserCopyWith<$Res> { factory _$$ChatUserImplCopyWith( - _$ChatUserImpl value, - $Res Function(_$ChatUserImpl) then, - ) = __$$ChatUserImplCopyWithImpl<$Res>; + _$ChatUserImpl value, $Res Function(_$ChatUserImpl) then) = + __$$ChatUserImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "name") String name, - @JsonKey(name: "profile_photo_path") String? profilePhotoPath, - @JsonKey(name: "profile_photo_url") String profilePhotoUrl, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "name") String name, + @JsonKey(name: "profile_photo_path") String? profilePhotoPath, + @JsonKey(name: "profile_photo_url") String profilePhotoUrl}); } /// @nodoc @@ -1141,9 +1066,8 @@ class __$$ChatUserImplCopyWithImpl<$Res> extends _$ChatUserCopyWithImpl<$Res, _$ChatUserImpl> implements _$$ChatUserImplCopyWith<$Res> { __$$ChatUserImplCopyWithImpl( - _$ChatUserImpl _value, - $Res Function(_$ChatUserImpl) _then, - ) : super(_value, _then); + _$ChatUserImpl _value, $Res Function(_$ChatUserImpl) _then) + : super(_value, _then); /// Create a copy of ChatUser /// with the given fields replaced by the non-null parameter values. @@ -1155,42 +1079,35 @@ class __$$ChatUserImplCopyWithImpl<$Res> Object? profilePhotoPath = freezed, Object? profilePhotoUrl = null, }) { - return _then( - _$ChatUserImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - profilePhotoPath: - freezed == profilePhotoPath - ? _value.profilePhotoPath - : profilePhotoPath // ignore: cast_nullable_to_non_nullable - as String?, - profilePhotoUrl: - null == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + return _then(_$ChatUserImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + profilePhotoPath: freezed == profilePhotoPath + ? _value.profilePhotoPath + : profilePhotoPath // ignore: cast_nullable_to_non_nullable + as String?, + profilePhotoUrl: null == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String, + )); } } /// @nodoc @JsonSerializable() class _$ChatUserImpl implements _ChatUser { - const _$ChatUserImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "name") required this.name, - @JsonKey(name: "profile_photo_path") required this.profilePhotoPath, - @JsonKey(name: "profile_photo_url") required this.profilePhotoUrl, - }); + const _$ChatUserImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "name") required this.name, + @JsonKey(name: "profile_photo_path") required this.profilePhotoPath, + @JsonKey(name: "profile_photo_url") required this.profilePhotoUrl}); factory _$ChatUserImpl.fromJson(Map json) => _$$ChatUserImplFromJson(json); @@ -1241,18 +1158,20 @@ class _$ChatUserImpl implements _ChatUser { @override Map toJson() { - return _$$ChatUserImplToJson(this); + return _$$ChatUserImplToJson( + this, + ); } } abstract class _ChatUser implements ChatUser { - const factory _ChatUser({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "name") required final String name, - @JsonKey(name: "profile_photo_path") - required final String? profilePhotoPath, - @JsonKey(name: "profile_photo_url") required final String profilePhotoUrl, - }) = _$ChatUserImpl; + const factory _ChatUser( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "name") required final String name, + @JsonKey(name: "profile_photo_path") + required final String? profilePhotoPath, + @JsonKey(name: "profile_photo_url") + required final String profilePhotoUrl}) = _$ChatUserImpl; factory _ChatUser.fromJson(Map json) = _$ChatUserImpl.fromJson; diff --git a/lib/features/chat/models/chat_room_pagination_model.g.dart b/lib/features/chat/models/chat_room_pagination_model.g.dart index 345b7e2d..d6f6e057 100644 --- a/lib/features/chat/models/chat_room_pagination_model.g.dart +++ b/lib/features/chat/models/chat_room_pagination_model.g.dart @@ -7,25 +7,24 @@ part of 'chat_room_pagination_model.dart'; // ************************************************************************** _$ChatRoomPreviewModelImpl _$$ChatRoomPreviewModelImplFromJson( - Map json, -) => _$ChatRoomPreviewModelImpl( - chatRooms: ChatRooms.fromJson(json['chatRooms'] as Map), - unreadChatsCount: (json['number_of_unread_chat_rooms'] as num).toInt(), -); + Map json) => + _$ChatRoomPreviewModelImpl( + chatRooms: ChatRooms.fromJson(json['chatRooms'] as Map), + unreadChatsCount: (json['number_of_unread_chat_rooms'] as num).toInt(), + ); Map _$$ChatRoomPreviewModelImplToJson( - _$ChatRoomPreviewModelImpl instance, -) => { - 'chatRooms': instance.chatRooms, - 'number_of_unread_chat_rooms': instance.unreadChatsCount, -}; + _$ChatRoomPreviewModelImpl instance) => + { + 'chatRooms': instance.chatRooms, + 'number_of_unread_chat_rooms': instance.unreadChatsCount, + }; _$ChatRoomsImpl _$$ChatRoomsImplFromJson(Map json) => _$ChatRoomsImpl( - data: - (json['data'] as List) - .map((e) => ChatRoom.fromJson(e as Map)) - .toList(), + data: (json['data'] as List) + .map((e) => ChatRoom.fromJson(e as Map)) + .toList(), lastPage: (json['last_page'] as num).toInt(), currentPage: (json['current_page'] as num).toInt(), ); @@ -58,11 +57,11 @@ Map _$$ChatRoomImplToJson(_$ChatRoomImpl instance) => }; _$UsersImpl _$$UsersImplFromJson(Map json) => _$UsersImpl( - fromChatUser: ChatUser.fromJson( - json['from_chat_user'] as Map, - ), - toChatUser: ChatUser.fromJson(json['to_chat_user'] as Map), -); + fromChatUser: + ChatUser.fromJson(json['from_chat_user'] as Map), + toChatUser: + ChatUser.fromJson(json['to_chat_user'] as Map), + ); Map _$$UsersImplToJson(_$UsersImpl instance) => { diff --git a/lib/features/chat/models/chat_room_settings_model.freezed.dart b/lib/features/chat/models/chat_room_settings_model.freezed.dart index 46cbf25e..9d12eefa 100644 --- a/lib/features/chat/models/chat_room_settings_model.freezed.dart +++ b/lib/features/chat/models/chat_room_settings_model.freezed.dart @@ -12,12 +12,10 @@ part of 'chat_room_settings_model.dart'; 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', -); + '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'); ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson( - Map json, -) { + Map json) { return _ChatRoomSettingsModel.fromJson(json); } @@ -44,25 +42,21 @@ mixin _$ChatRoomSettingsModel { /// @nodoc abstract class $ChatRoomSettingsModelCopyWith<$Res> { - factory $ChatRoomSettingsModelCopyWith( - ChatRoomSettingsModel value, - $Res Function(ChatRoomSettingsModel) then, - ) = _$ChatRoomSettingsModelCopyWithImpl<$Res, ChatRoomSettingsModel>; + factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value, + $Res Function(ChatRoomSettingsModel) then) = + _$ChatRoomSettingsModelCopyWithImpl<$Res, ChatRoomSettingsModel>; @useResult - $Res call({ - int id, - @JsonKey(name: 'room_name') String roomName, - String state, - @JsonKey(name: 'access_level') String accessLevel, - @JsonKey(name: 'updated_at') String updatedAt, - }); + $Res call( + {int id, + @JsonKey(name: 'room_name') String roomName, + String state, + @JsonKey(name: 'access_level') String accessLevel, + @JsonKey(name: 'updated_at') String updatedAt}); } /// @nodoc -class _$ChatRoomSettingsModelCopyWithImpl< - $Res, - $Val extends ChatRoomSettingsModel -> +class _$ChatRoomSettingsModelCopyWithImpl<$Res, + $Val extends ChatRoomSettingsModel> implements $ChatRoomSettingsModelCopyWith<$Res> { _$ChatRoomSettingsModelCopyWithImpl(this._value, this._then); @@ -82,36 +76,28 @@ class _$ChatRoomSettingsModelCopyWithImpl< Object? accessLevel = null, Object? updatedAt = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - roomName: - null == roomName - ? _value.roomName - : roomName // ignore: cast_nullable_to_non_nullable - as String, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - accessLevel: - null == accessLevel - ? _value.accessLevel - : accessLevel // ignore: cast_nullable_to_non_nullable - as String, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + roomName: null == roomName + ? _value.roomName + : roomName // ignore: cast_nullable_to_non_nullable + as String, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + accessLevel: null == accessLevel + ? _value.accessLevel + : accessLevel // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -119,29 +105,27 @@ class _$ChatRoomSettingsModelCopyWithImpl< abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> implements $ChatRoomSettingsModelCopyWith<$Res> { factory _$$ChatRoomSettingsModelImplCopyWith( - _$ChatRoomSettingsModelImpl value, - $Res Function(_$ChatRoomSettingsModelImpl) then, - ) = __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>; + _$ChatRoomSettingsModelImpl value, + $Res Function(_$ChatRoomSettingsModelImpl) then) = + __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - int id, - @JsonKey(name: 'room_name') String roomName, - String state, - @JsonKey(name: 'access_level') String accessLevel, - @JsonKey(name: 'updated_at') String updatedAt, - }); + $Res call( + {int id, + @JsonKey(name: 'room_name') String roomName, + String state, + @JsonKey(name: 'access_level') String accessLevel, + @JsonKey(name: 'updated_at') String updatedAt}); } /// @nodoc class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res> - extends - _$ChatRoomSettingsModelCopyWithImpl<$Res, _$ChatRoomSettingsModelImpl> + extends _$ChatRoomSettingsModelCopyWithImpl<$Res, + _$ChatRoomSettingsModelImpl> implements _$$ChatRoomSettingsModelImplCopyWith<$Res> { - __$$ChatRoomSettingsModelImplCopyWithImpl( - _$ChatRoomSettingsModelImpl _value, - $Res Function(_$ChatRoomSettingsModelImpl) _then, - ) : super(_value, _then); + __$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value, + $Res Function(_$ChatRoomSettingsModelImpl) _then) + : super(_value, _then); /// Create a copy of ChatRoomSettingsModel /// with the given fields replaced by the non-null parameter values. @@ -154,48 +138,40 @@ class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res> Object? accessLevel = null, Object? updatedAt = null, }) { - return _then( - _$ChatRoomSettingsModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - roomName: - null == roomName - ? _value.roomName - : roomName // ignore: cast_nullable_to_non_nullable - as String, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - accessLevel: - null == accessLevel - ? _value.accessLevel - : accessLevel // ignore: cast_nullable_to_non_nullable - as String, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + return _then(_$ChatRoomSettingsModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + roomName: null == roomName + ? _value.roomName + : roomName // ignore: cast_nullable_to_non_nullable + as String, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + accessLevel: null == accessLevel + ? _value.accessLevel + : accessLevel // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as String, + )); } } /// @nodoc @JsonSerializable() class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { - const _$ChatRoomSettingsModelImpl({ - required this.id, - @JsonKey(name: 'room_name') required this.roomName, - required this.state, - @JsonKey(name: 'access_level') required this.accessLevel, - @JsonKey(name: 'updated_at') required this.updatedAt, - }); + const _$ChatRoomSettingsModelImpl( + {required this.id, + @JsonKey(name: 'room_name') required this.roomName, + required this.state, + @JsonKey(name: 'access_level') required this.accessLevel, + @JsonKey(name: 'updated_at') required this.updatedAt}); factory _$ChatRoomSettingsModelImpl.fromJson(Map json) => _$$ChatRoomSettingsModelImplFromJson(json); @@ -245,26 +221,25 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { @override @pragma('vm:prefer-inline') _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> - get copyWith => - __$$ChatRoomSettingsModelImplCopyWithImpl<_$ChatRoomSettingsModelImpl>( - this, - _$identity, - ); + get copyWith => __$$ChatRoomSettingsModelImplCopyWithImpl< + _$ChatRoomSettingsModelImpl>(this, _$identity); @override Map toJson() { - return _$$ChatRoomSettingsModelImplToJson(this); + return _$$ChatRoomSettingsModelImplToJson( + this, + ); } } abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel { - const factory _ChatRoomSettingsModel({ - required final int id, - @JsonKey(name: 'room_name') required final String roomName, - required final String state, - @JsonKey(name: 'access_level') required final String accessLevel, - @JsonKey(name: 'updated_at') required final String updatedAt, - }) = _$ChatRoomSettingsModelImpl; + const factory _ChatRoomSettingsModel( + {required final int id, + @JsonKey(name: 'room_name') required final String roomName, + required final String state, + @JsonKey(name: 'access_level') required final String accessLevel, + @JsonKey(name: 'updated_at') required final String updatedAt}) = + _$ChatRoomSettingsModelImpl; factory _ChatRoomSettingsModel.fromJson(Map json) = _$ChatRoomSettingsModelImpl.fromJson; @@ -288,5 +263,5 @@ abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_room_settings_model.g.dart b/lib/features/chat/models/chat_room_settings_model.g.dart index 3a686cbd..7b824334 100644 --- a/lib/features/chat/models/chat_room_settings_model.g.dart +++ b/lib/features/chat/models/chat_room_settings_model.g.dart @@ -7,21 +7,21 @@ part of 'chat_room_settings_model.dart'; // ************************************************************************** _$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson( - Map json, -) => _$ChatRoomSettingsModelImpl( - id: (json['id'] as num).toInt(), - roomName: json['room_name'] as String, - state: json['state'] as String, - accessLevel: json['access_level'] as String, - updatedAt: json['updated_at'] as String, -); + Map json) => + _$ChatRoomSettingsModelImpl( + id: (json['id'] as num).toInt(), + roomName: json['room_name'] as String, + state: json['state'] as String, + accessLevel: json['access_level'] as String, + updatedAt: json['updated_at'] as String, + ); Map _$$ChatRoomSettingsModelImplToJson( - _$ChatRoomSettingsModelImpl instance, -) => { - 'id': instance.id, - 'room_name': instance.roomName, - 'state': instance.state, - 'access_level': instance.accessLevel, - 'updated_at': instance.updatedAt, -}; + _$ChatRoomSettingsModelImpl instance) => + { + 'id': instance.id, + 'room_name': instance.roomName, + 'state': instance.state, + 'access_level': instance.accessLevel, + 'updated_at': instance.updatedAt, + }; diff --git a/lib/features/chat/models/chat_user_model.freezed.dart b/lib/features/chat/models/chat_user_model.freezed.dart index 83bffe80..52f80c77 100644 --- a/lib/features/chat/models/chat_user_model.freezed.dart +++ b/lib/features/chat/models/chat_user_model.freezed.dart @@ -12,8 +12,7 @@ part of 'chat_user_model.dart'; 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', -); + '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'); ChatUserModel _$ChatUserModelFromJson(Map json) { return _ChatUserModel.fromJson(json); @@ -42,17 +41,15 @@ mixin _$ChatUserModel { /// @nodoc abstract class $ChatUserModelCopyWith<$Res> { factory $ChatUserModelCopyWith( - ChatUserModel value, - $Res Function(ChatUserModel) then, - ) = _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>; + ChatUserModel value, $Res Function(ChatUserModel) then) = + _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>; @useResult - $Res call({ - int id, - String name, - String slug, - @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, - @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl, - }); + $Res call( + {int id, + String name, + String slug, + @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); } /// @nodoc @@ -76,36 +73,28 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> Object? profilePhotoPath = freezed, Object? profilePhotoUrl = freezed, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - profilePhotoPath: - freezed == profilePhotoPath - ? _value.profilePhotoPath - : profilePhotoPath // ignore: cast_nullable_to_non_nullable - as String?, - profilePhotoUrl: - freezed == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + profilePhotoPath: freezed == profilePhotoPath + ? _value.profilePhotoPath + : profilePhotoPath // ignore: cast_nullable_to_non_nullable + as String?, + profilePhotoUrl: freezed == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } } @@ -113,18 +102,16 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> abstract class _$$ChatUserModelImplCopyWith<$Res> implements $ChatUserModelCopyWith<$Res> { factory _$$ChatUserModelImplCopyWith( - _$ChatUserModelImpl value, - $Res Function(_$ChatUserModelImpl) then, - ) = __$$ChatUserModelImplCopyWithImpl<$Res>; + _$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) = + __$$ChatUserModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - int id, - String name, - String slug, - @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, - @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl, - }); + $Res call( + {int id, + String name, + String slug, + @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); } /// @nodoc @@ -132,9 +119,8 @@ class __$$ChatUserModelImplCopyWithImpl<$Res> extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl> implements _$$ChatUserModelImplCopyWith<$Res> { __$$ChatUserModelImplCopyWithImpl( - _$ChatUserModelImpl _value, - $Res Function(_$ChatUserModelImpl) _then, - ) : super(_value, _then); + _$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then) + : super(_value, _then); /// Create a copy of ChatUserModel /// with the given fields replaced by the non-null parameter values. @@ -147,48 +133,40 @@ class __$$ChatUserModelImplCopyWithImpl<$Res> Object? profilePhotoPath = freezed, Object? profilePhotoUrl = freezed, }) { - return _then( - _$ChatUserModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - profilePhotoPath: - freezed == profilePhotoPath - ? _value.profilePhotoPath - : profilePhotoPath // ignore: cast_nullable_to_non_nullable - as String?, - profilePhotoUrl: - freezed == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$ChatUserModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + profilePhotoPath: freezed == profilePhotoPath + ? _value.profilePhotoPath + : profilePhotoPath // ignore: cast_nullable_to_non_nullable + as String?, + profilePhotoUrl: freezed == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc @JsonSerializable() class _$ChatUserModelImpl implements _ChatUserModel { - const _$ChatUserModelImpl({ - required this.id, - required this.name, - required this.slug, - @JsonKey(name: 'profile_photo_path') this.profilePhotoPath, - @JsonKey(name: 'profile_photo_url') this.profilePhotoUrl, - }); + const _$ChatUserModelImpl( + {required this.id, + required this.name, + required this.slug, + @JsonKey(name: 'profile_photo_path') this.profilePhotoPath, + @JsonKey(name: 'profile_photo_url') this.profilePhotoUrl}); factory _$ChatUserModelImpl.fromJson(Map json) => _$$ChatUserModelImplFromJson(json); @@ -228,13 +206,7 @@ class _$ChatUserModelImpl implements _ChatUserModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - id, - name, - slug, - profilePhotoPath, - profilePhotoUrl, - ); + runtimeType, id, name, slug, profilePhotoPath, profilePhotoUrl); /// Create a copy of ChatUserModel /// with the given fields replaced by the non-null parameter values. @@ -246,18 +218,20 @@ class _$ChatUserModelImpl implements _ChatUserModel { @override Map toJson() { - return _$$ChatUserModelImplToJson(this); + return _$$ChatUserModelImplToJson( + this, + ); } } abstract class _ChatUserModel implements ChatUserModel { - const factory _ChatUserModel({ - required final int id, - required final String name, - required final String slug, - @JsonKey(name: 'profile_photo_path') final String? profilePhotoPath, - @JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl, - }) = _$ChatUserModelImpl; + const factory _ChatUserModel( + {required final int id, + required final String name, + required final String slug, + @JsonKey(name: 'profile_photo_path') final String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) = + _$ChatUserModelImpl; factory _ChatUserModel.fromJson(Map json) = _$ChatUserModelImpl.fromJson; diff --git a/lib/features/chat/models/payment_model.dart b/lib/features/chat/models/payment_model.dart new file mode 100644 index 00000000..746c095a --- /dev/null +++ b/lib/features/chat/models/payment_model.dart @@ -0,0 +1,14 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'payment_model.freezed.dart'; +part 'payment_model.g.dart'; + +@freezed +class PaymentModel with _$PaymentModel { + + factory PaymentModel({ + @JsonKey(name: 'checkout_url') required String paymentUrl, + }) = _PaymentModel; + + factory PaymentModel.fromJson(Map json) => _$PaymentModelFromJson(json); +} \ No newline at end of file diff --git a/lib/features/chat/models/payment_model.freezed.dart b/lib/features/chat/models/payment_model.freezed.dart new file mode 100644 index 00000000..8c72d7f9 --- /dev/null +++ b/lib/features/chat/models/payment_model.freezed.dart @@ -0,0 +1,170 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'payment_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +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'); + +PaymentModel _$PaymentModelFromJson(Map json) { + return _PaymentModel.fromJson(json); +} + +/// @nodoc +mixin _$PaymentModel { + @JsonKey(name: 'checkout_url') + String get paymentUrl => throw _privateConstructorUsedError; + + /// Serializes this PaymentModel to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of PaymentModel + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $PaymentModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PaymentModelCopyWith<$Res> { + factory $PaymentModelCopyWith( + PaymentModel value, $Res Function(PaymentModel) then) = + _$PaymentModelCopyWithImpl<$Res, PaymentModel>; + @useResult + $Res call({@JsonKey(name: 'checkout_url') String paymentUrl}); +} + +/// @nodoc +class _$PaymentModelCopyWithImpl<$Res, $Val extends PaymentModel> + implements $PaymentModelCopyWith<$Res> { + _$PaymentModelCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of PaymentModel + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentUrl = null, + }) { + return _then(_value.copyWith( + paymentUrl: null == paymentUrl + ? _value.paymentUrl + : paymentUrl // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PaymentModelImplCopyWith<$Res> + implements $PaymentModelCopyWith<$Res> { + factory _$$PaymentModelImplCopyWith( + _$PaymentModelImpl value, $Res Function(_$PaymentModelImpl) then) = + __$$PaymentModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({@JsonKey(name: 'checkout_url') String paymentUrl}); +} + +/// @nodoc +class __$$PaymentModelImplCopyWithImpl<$Res> + extends _$PaymentModelCopyWithImpl<$Res, _$PaymentModelImpl> + implements _$$PaymentModelImplCopyWith<$Res> { + __$$PaymentModelImplCopyWithImpl( + _$PaymentModelImpl _value, $Res Function(_$PaymentModelImpl) _then) + : super(_value, _then); + + /// Create a copy of PaymentModel + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentUrl = null, + }) { + return _then(_$PaymentModelImpl( + paymentUrl: null == paymentUrl + ? _value.paymentUrl + : paymentUrl // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PaymentModelImpl implements _PaymentModel { + _$PaymentModelImpl({@JsonKey(name: 'checkout_url') required this.paymentUrl}); + + factory _$PaymentModelImpl.fromJson(Map json) => + _$$PaymentModelImplFromJson(json); + + @override + @JsonKey(name: 'checkout_url') + final String paymentUrl; + + @override + String toString() { + return 'PaymentModel(paymentUrl: $paymentUrl)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PaymentModelImpl && + (identical(other.paymentUrl, paymentUrl) || + other.paymentUrl == paymentUrl)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, paymentUrl); + + /// Create a copy of PaymentModel + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$PaymentModelImplCopyWith<_$PaymentModelImpl> get copyWith => + __$$PaymentModelImplCopyWithImpl<_$PaymentModelImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PaymentModelImplToJson( + this, + ); + } +} + +abstract class _PaymentModel implements PaymentModel { + factory _PaymentModel( + {@JsonKey(name: 'checkout_url') required final String paymentUrl}) = + _$PaymentModelImpl; + + factory _PaymentModel.fromJson(Map json) = + _$PaymentModelImpl.fromJson; + + @override + @JsonKey(name: 'checkout_url') + String get paymentUrl; + + /// Create a copy of PaymentModel + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$PaymentModelImplCopyWith<_$PaymentModelImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/features/chat/models/payment_model.g.dart b/lib/features/chat/models/payment_model.g.dart new file mode 100644 index 00000000..20eec7fd --- /dev/null +++ b/lib/features/chat/models/payment_model.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'payment_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$PaymentModelImpl _$$PaymentModelImplFromJson(Map json) => + _$PaymentModelImpl( + paymentUrl: json['checkout_url'] as String, + ); + +Map _$$PaymentModelImplToJson(_$PaymentModelImpl instance) => + { + 'checkout_url': instance.paymentUrl, + }; diff --git a/lib/features/chat/models/websocket_info_model.freezed.dart b/lib/features/chat/models/websocket_info_model.freezed.dart index 81030066..9cddabee 100644 --- a/lib/features/chat/models/websocket_info_model.freezed.dart +++ b/lib/features/chat/models/websocket_info_model.freezed.dart @@ -12,8 +12,7 @@ part of 'websocket_info_model.dart'; 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', -); + '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'); WebsocketInfoModel _$WebsocketInfoModelFromJson(Map json) { return _WebsocketInfoModel.fromJson(json); @@ -41,17 +40,15 @@ mixin _$WebsocketInfoModel { /// @nodoc abstract class $WebsocketInfoModelCopyWith<$Res> { factory $WebsocketInfoModelCopyWith( - WebsocketInfoModel value, - $Res Function(WebsocketInfoModel) then, - ) = _$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>; + WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) = + _$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>; @useResult - $Res call({ - String key, - String host, - String port, - String cluster, - @JsonKey(name: 'user_id') int userId, - }); + $Res call( + {String key, + String host, + String port, + String cluster, + @JsonKey(name: 'user_id') int userId}); } /// @nodoc @@ -75,65 +72,54 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> Object? cluster = null, Object? userId = null, }) { - return _then( - _value.copyWith( - key: - null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - host: - null == host - ? _value.host - : host // ignore: cast_nullable_to_non_nullable - as String, - port: - null == port - ? _value.port - : port // ignore: cast_nullable_to_non_nullable - as String, - cluster: - null == cluster - ? _value.cluster - : cluster // ignore: cast_nullable_to_non_nullable - as String, - userId: - null == userId - ? _value.userId - : userId // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + return _then(_value.copyWith( + key: null == key + ? _value.key + : key // ignore: cast_nullable_to_non_nullable + as String, + host: null == host + ? _value.host + : host // ignore: cast_nullable_to_non_nullable + as String, + port: null == port + ? _value.port + : port // ignore: cast_nullable_to_non_nullable + as String, + cluster: null == cluster + ? _value.cluster + : cluster // ignore: cast_nullable_to_non_nullable + as String, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } /// @nodoc abstract class _$$WebsocketInfoModelImplCopyWith<$Res> implements $WebsocketInfoModelCopyWith<$Res> { - factory _$$WebsocketInfoModelImplCopyWith( - _$WebsocketInfoModelImpl value, - $Res Function(_$WebsocketInfoModelImpl) then, - ) = __$$WebsocketInfoModelImplCopyWithImpl<$Res>; + factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value, + $Res Function(_$WebsocketInfoModelImpl) then) = + __$$WebsocketInfoModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String key, - String host, - String port, - String cluster, - @JsonKey(name: 'user_id') int userId, - }); + $Res call( + {String key, + String host, + String port, + String cluster, + @JsonKey(name: 'user_id') int userId}); } /// @nodoc class __$$WebsocketInfoModelImplCopyWithImpl<$Res> extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl> implements _$$WebsocketInfoModelImplCopyWith<$Res> { - __$$WebsocketInfoModelImplCopyWithImpl( - _$WebsocketInfoModelImpl _value, - $Res Function(_$WebsocketInfoModelImpl) _then, - ) : super(_value, _then); + __$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value, + $Res Function(_$WebsocketInfoModelImpl) _then) + : super(_value, _then); /// Create a copy of WebsocketInfoModel /// with the given fields replaced by the non-null parameter values. @@ -146,48 +132,40 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res> Object? cluster = null, Object? userId = null, }) { - return _then( - _$WebsocketInfoModelImpl( - key: - null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - host: - null == host - ? _value.host - : host // ignore: cast_nullable_to_non_nullable - as String, - port: - null == port - ? _value.port - : port // ignore: cast_nullable_to_non_nullable - as String, - cluster: - null == cluster - ? _value.cluster - : cluster // ignore: cast_nullable_to_non_nullable - as String, - userId: - null == userId - ? _value.userId - : userId // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$WebsocketInfoModelImpl( + key: null == key + ? _value.key + : key // ignore: cast_nullable_to_non_nullable + as String, + host: null == host + ? _value.host + : host // ignore: cast_nullable_to_non_nullable + as String, + port: null == port + ? _value.port + : port // ignore: cast_nullable_to_non_nullable + as String, + cluster: null == cluster + ? _value.cluster + : cluster // ignore: cast_nullable_to_non_nullable + as String, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc @JsonSerializable() class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { - const _$WebsocketInfoModelImpl({ - required this.key, - required this.host, - required this.port, - required this.cluster, - @JsonKey(name: 'user_id') required this.userId, - }); + const _$WebsocketInfoModelImpl( + {required this.key, + required this.host, + required this.port, + required this.cluster, + @JsonKey(name: 'user_id') required this.userId}); factory _$WebsocketInfoModelImpl.fromJson(Map json) => _$$WebsocketInfoModelImplFromJson(json); @@ -233,24 +211,24 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { @pragma('vm:prefer-inline') _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => __$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$WebsocketInfoModelImplToJson(this); + return _$$WebsocketInfoModelImplToJson( + this, + ); } } abstract class _WebsocketInfoModel implements WebsocketInfoModel { - const factory _WebsocketInfoModel({ - required final String key, - required final String host, - required final String port, - required final String cluster, - @JsonKey(name: 'user_id') required final int userId, - }) = _$WebsocketInfoModelImpl; + const factory _WebsocketInfoModel( + {required final String key, + required final String host, + required final String port, + required final String cluster, + @JsonKey(name: 'user_id') required final int userId}) = + _$WebsocketInfoModelImpl; factory _WebsocketInfoModel.fromJson(Map json) = _$WebsocketInfoModelImpl.fromJson; diff --git a/lib/features/chat/models/websocket_info_model.g.dart b/lib/features/chat/models/websocket_info_model.g.dart index eeb99cdd..b2bb1248 100644 --- a/lib/features/chat/models/websocket_info_model.g.dart +++ b/lib/features/chat/models/websocket_info_model.g.dart @@ -7,21 +7,21 @@ part of 'websocket_info_model.dart'; // ************************************************************************** _$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson( - Map json, -) => _$WebsocketInfoModelImpl( - key: json['key'] as String, - host: json['host'] as String, - port: json['port'] as String, - cluster: json['cluster'] as String, - userId: (json['user_id'] as num).toInt(), -); + Map json) => + _$WebsocketInfoModelImpl( + key: json['key'] as String, + host: json['host'] as String, + port: json['port'] as String, + cluster: json['cluster'] as String, + userId: (json['user_id'] as num).toInt(), + ); Map _$$WebsocketInfoModelImplToJson( - _$WebsocketInfoModelImpl instance, -) => { - 'key': instance.key, - 'host': instance.host, - 'port': instance.port, - 'cluster': instance.cluster, - 'user_id': instance.userId, -}; + _$WebsocketInfoModelImpl instance) => + { + 'key': instance.key, + 'host': instance.host, + 'port': instance.port, + 'cluster': instance.cluster, + 'user_id': instance.userId, + }; diff --git a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart index c6e44f76..e37fd767 100644 --- a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart +++ b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart @@ -7,12 +7,14 @@ import 'package:audioplayers/audioplayers.dart'; import 'package:dart_pusher_channels/dart_pusher_channels.dart'; import 'package:easy_debounce/easy_debounce.dart'; import 'package:eatvio_app/core/image_compressing/image_compress_utility.dart'; +import 'package:eatvio_app/core/utils/date_time_utils.dart'; import 'package:eatvio_app/core/websockets/ws_manager.dart'; import 'package:eatvio_app/features/chat/models/chat_message_model.dart'; import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart'; import 'package:eatvio_app/features/chat/repositories/chat_repository.dart'; import 'package:eatvio_app/features/my_finance/models/card_model.dart'; import 'package:eatvio_app/features/my_finance/repositories/cards_repository.dart'; +import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class ChatRoomCubit extends Cubit { @@ -23,10 +25,10 @@ class ChatRoomCubit extends Cubit { StreamSubscription? typingSubscription; StreamSubscription? messagesSubscription; int currentPage = 1; - late final int lastPage; + late int lastPage; bool isLoading = false; - ChatRoomCubit({required this.chatRepository, required this.wsManager, required this.cardsRepository}) : super(ChatRoomState.loading()); + ChatRoomCubit({required this.chatRepository, required this.wsManager, required this.cardsRepository}) : super(const ChatRoomState.loading()); loadNextPage(String chatId) async { if (currentPage < lastPage && !isLoading) { @@ -47,7 +49,7 @@ class ChatRoomCubit extends Cubit { currentPage++; } catch (e) { - emit(ChatRoomState.error(errorMessage: 'Ошибка получеия данных')); + emit(const ChatRoomState.error(errorMessage: 'Ошибка получеия данных')); } } } @@ -57,7 +59,7 @@ class ChatRoomCubit extends Cubit { final cards = await cardsRepository.getCards(); setCard(cards: cards); } catch (e) { - emit(ChatRoomState.error(errorMessage: 'Ошибка получеия данных')); + emit(const ChatRoomState.error(errorMessage: 'Ошибка получеия данных')); } } @@ -80,13 +82,29 @@ class ChatRoomCubit extends Cubit { await _subscribeToChatChannel(chatId: chatId); emit(ChatRoomState.loaded(chatRoom: chatRoom, chatMessages: chatMessages.messagesList, isTyping: false, isLoading: isLoading, hasCard: false)); - final cards = await cardsRepository.getCards(); - setCard(cards: cards); + // final cards = await cardsRepository.getCards(); + // setCard(cards: cards); } catch (e) { + log(e.toString()); typingSubscription?.cancel(); messagesSubscription?.cancel(); wsManager.unsubscribeDirectChatChannel(); - emit(ChatRoomState.error(errorMessage: 'Ошибка получеия данных')); + emit(const ChatRoomState.error(errorMessage: 'Ошибка получеия данных')); + } + } + + Future choseStartPlanDate(DateTime date) async { + try { + if (state is! ChatRoomStateLoaded) return false; + final planId = (state as ChatRoomStateLoaded).chatRoom.chosenPlan?.id; + if (planId == null) return false; + final stringDate = date.format('yyyy-MM-dd'); + await chatRepository.choseStartPlanDate(id: planId, date: {'start_date': stringDate}); + emit((state as ChatRoomStateLoaded).copyWith.chatRoom.chosenPlan?.call(chosenPlanState: ChosenPlanStateEnum.stateStartDateHasBeenSet) ?? state); + return true; + } catch (e, st) { + log(e.toString(), stackTrace: st); + return false; } } @@ -96,7 +114,7 @@ class ChatRoomCubit extends Cubit { final chatRoom = await chatRepository.getChatRoom(chatId); emit((state as ChatRoomStateLoaded).copyWith(chatRoom: chatRoom)); } catch (e) { - emit(ChatRoomState.error(errorMessage: 'Ошибка получеия данных')); + emit(const ChatRoomState.error(errorMessage: 'Ошибка получеия данных')); } } @@ -115,7 +133,7 @@ class ChatRoomCubit extends Cubit { typingSubscription = wsManager.clientTypingStream?.listen((event) { emit((state as ChatRoomStateLoaded).copyWith(isTyping: true, isLoading: isLoading)); - EasyDebounce.debounce('client-typing', Duration(seconds: 3), () => emit((state as ChatRoomStateLoaded).copyWith(isTyping: false, isLoading: isLoading))); + EasyDebounce.debounce('client-typing', const Duration(seconds: 3), () => emit((state as ChatRoomStateLoaded).copyWith(isTyping: false, isLoading: isLoading))); }); } @@ -136,9 +154,9 @@ class ChatRoomCubit extends Cubit { final ids = messagesIds.map((e) => e.id).toList(); await chatRepository.markMessagesAsRead(chatId, ids); final currentMessages = [...(state as ChatRoomStateLoaded).chatMessages]; - messagesIds.forEach((elem) { + for (var elem in messagesIds) { currentMessages[elem.index] = currentMessages[elem.index].copyWith(isRead: true); - }); + } if (!isClosed) { emit((state as ChatRoomStateLoaded).copyWith(chatMessages: currentMessages)); } @@ -151,6 +169,18 @@ class ChatRoomCubit extends Cubit { } } + Future getPaymentLink() async { + try { + final planId = (state as ChatRoomStateLoaded).chatRoom.chosenPlan?.id; + if (planId == null) return null; + final paymentModel = await chatRepository.getPaymentLink(id: planId); + return paymentModel.paymentUrl; + } catch (e, st) { + log(e.toString(), stackTrace: st); + return null; + } + } + @override Future close() async { wsManager.unsubscribeDirectChatChannel(); diff --git a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart index eb7ab711..7bc13889 100644 --- a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart +++ b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart @@ -12,8 +12,7 @@ part of 'chat_room_state.dart'; 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', -); + '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'); /// @nodoc mixin _$ChatRoomState { @@ -22,58 +21,60 @@ mixin _$ChatRoomState { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - ) - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading) + loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_ChatRoomState value) $default, { required TResult Function(ChatRoomStateLoading value) loading, required TResult Function(ChatRoomStateLoaded value) loaded, required TResult Function(ChatRoomStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_ChatRoomState value)? $default, { TResult? Function(ChatRoomStateLoading value)? loading, TResult? Function(ChatRoomStateLoaded value)? loaded, TResult? Function(ChatRoomStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_ChatRoomState value)? $default, { @@ -81,15 +82,15 @@ mixin _$ChatRoomState { TResult Function(ChatRoomStateLoaded value)? loaded, TResult Function(ChatRoomStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatRoomStateCopyWith<$Res> { factory $ChatRoomStateCopyWith( - ChatRoomState value, - $Res Function(ChatRoomState) then, - ) = _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>; + ChatRoomState value, $Res Function(ChatRoomState) then) = + _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>; } /// @nodoc @@ -109,9 +110,8 @@ class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> /// @nodoc abstract class _$$ChatRoomStateImplCopyWith<$Res> { factory _$$ChatRoomStateImplCopyWith( - _$ChatRoomStateImpl value, - $Res Function(_$ChatRoomStateImpl) then, - ) = __$$ChatRoomStateImplCopyWithImpl<$Res>; + _$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) = + __$$ChatRoomStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -119,9 +119,8 @@ class __$$ChatRoomStateImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl> implements _$$ChatRoomStateImplCopyWith<$Res> { __$$ChatRoomStateImplCopyWithImpl( - _$ChatRoomStateImpl _value, - $Res Function(_$ChatRoomStateImpl) _then, - ) : super(_value, _then); + _$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then) + : super(_value, _then); /// Create a copy of ChatRoomState /// with the given fields replaced by the non-null parameter values. @@ -152,13 +151,12 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - ) - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -170,13 +168,12 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -188,13 +185,12 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult Function()? $default, { TResult Function()? loading, TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -248,20 +244,18 @@ abstract class _ChatRoomState implements ChatRoomState { /// @nodoc abstract class _$$ChatRoomStateLoadingImplCopyWith<$Res> { - factory _$$ChatRoomStateLoadingImplCopyWith( - _$ChatRoomStateLoadingImpl value, - $Res Function(_$ChatRoomStateLoadingImpl) then, - ) = __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>; + factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value, + $Res Function(_$ChatRoomStateLoadingImpl) then) = + __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl> implements _$$ChatRoomStateLoadingImplCopyWith<$Res> { - __$$ChatRoomStateLoadingImplCopyWithImpl( - _$ChatRoomStateLoadingImpl _value, - $Res Function(_$ChatRoomStateLoadingImpl) _then, - ) : super(_value, _then); + __$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value, + $Res Function(_$ChatRoomStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of ChatRoomState /// with the given fields replaced by the non-null parameter values. @@ -293,13 +287,12 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - ) - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loading(); @@ -311,13 +304,12 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return loading?.call(); @@ -329,13 +321,12 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult Function()? $default, { TResult Function()? loading, TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -389,18 +380,16 @@ abstract class ChatRoomStateLoading implements ChatRoomState { /// @nodoc abstract class _$$ChatRoomStateLoadedImplCopyWith<$Res> { - factory _$$ChatRoomStateLoadedImplCopyWith( - _$ChatRoomStateLoadedImpl value, - $Res Function(_$ChatRoomStateLoadedImpl) then, - ) = __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>; + factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value, + $Res Function(_$ChatRoomStateLoadedImpl) then) = + __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>; @useResult - $Res call({ - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - }); + $Res call( + {ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading}); $ChatRoomModelCopyWith<$Res> get chatRoom; } @@ -409,10 +398,9 @@ abstract class _$$ChatRoomStateLoadedImplCopyWith<$Res> { class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl> implements _$$ChatRoomStateLoadedImplCopyWith<$Res> { - __$$ChatRoomStateLoadedImplCopyWithImpl( - _$ChatRoomStateLoadedImpl _value, - $Res Function(_$ChatRoomStateLoadedImpl) _then, - ) : super(_value, _then); + __$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value, + $Res Function(_$ChatRoomStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of ChatRoomState /// with the given fields replaced by the non-null parameter values. @@ -425,35 +413,28 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> Object? isTyping = null, Object? isLoading = null, }) { - return _then( - _$ChatRoomStateLoadedImpl( - chatRoom: - null == chatRoom - ? _value.chatRoom - : chatRoom // ignore: cast_nullable_to_non_nullable - as ChatRoomModel, - chatMessages: - null == chatMessages - ? _value._chatMessages - : chatMessages // ignore: cast_nullable_to_non_nullable - as List, - hasCard: - null == hasCard - ? _value.hasCard - : hasCard // ignore: cast_nullable_to_non_nullable - as bool, - isTyping: - null == isTyping - ? _value.isTyping - : isTyping // ignore: cast_nullable_to_non_nullable - as bool, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + return _then(_$ChatRoomStateLoadedImpl( + chatRoom: null == chatRoom + ? _value.chatRoom + : chatRoom // ignore: cast_nullable_to_non_nullable + as ChatRoomModel, + chatMessages: null == chatMessages + ? _value._chatMessages + : chatMessages // ignore: cast_nullable_to_non_nullable + as List, + hasCard: null == hasCard + ? _value.hasCard + : hasCard // ignore: cast_nullable_to_non_nullable + as bool, + isTyping: null == isTyping + ? _value.isTyping + : isTyping // ignore: cast_nullable_to_non_nullable + as bool, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + )); } /// Create a copy of ChatRoomState @@ -470,13 +451,13 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> /// @nodoc class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { - const _$ChatRoomStateLoadedImpl({ - required this.chatRoom, - required final List chatMessages, - required this.hasCard, - required this.isTyping, - required this.isLoading, - }) : _chatMessages = chatMessages; + const _$ChatRoomStateLoadedImpl( + {required this.chatRoom, + required final List chatMessages, + required this.hasCard, + required this.isTyping, + required this.isLoading}) + : _chatMessages = chatMessages; @override final ChatRoomModel chatRoom; @@ -507,10 +488,8 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { other is _$ChatRoomStateLoadedImpl && (identical(other.chatRoom, chatRoom) || other.chatRoom == chatRoom) && - const DeepCollectionEquality().equals( - other._chatMessages, - _chatMessages, - ) && + const DeepCollectionEquality() + .equals(other._chatMessages, _chatMessages) && (identical(other.hasCard, hasCard) || other.hasCard == hasCard) && (identical(other.isTyping, isTyping) || other.isTyping == isTyping) && @@ -520,13 +499,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { @override int get hashCode => Object.hash( - runtimeType, - chatRoom, - const DeepCollectionEquality().hash(_chatMessages), - hasCard, - isTyping, - isLoading, - ); + runtimeType, + chatRoom, + const DeepCollectionEquality().hash(_chatMessages), + hasCard, + isTyping, + isLoading); /// Create a copy of ChatRoomState /// with the given fields replaced by the non-null parameter values. @@ -535,9 +513,7 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { @pragma('vm:prefer-inline') _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => __$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -545,13 +521,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - ) - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loaded(chatRoom, chatMessages, hasCard, isTyping, isLoading); @@ -563,13 +538,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return loaded?.call(chatRoom, chatMessages, hasCard, isTyping, isLoading); @@ -581,13 +555,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { TResult Function()? $default, { TResult Function()? loading, TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -636,13 +609,12 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { } abstract class ChatRoomStateLoaded implements ChatRoomState { - const factory ChatRoomStateLoaded({ - required final ChatRoomModel chatRoom, - required final List chatMessages, - required final bool hasCard, - required final bool isTyping, - required final bool isLoading, - }) = _$ChatRoomStateLoadedImpl; + const factory ChatRoomStateLoaded( + {required final ChatRoomModel chatRoom, + required final List chatMessages, + required final bool hasCard, + required final bool isTyping, + required final bool isLoading}) = _$ChatRoomStateLoadedImpl; ChatRoomModel get chatRoom; List get chatMessages; @@ -659,10 +631,9 @@ abstract class ChatRoomStateLoaded implements ChatRoomState { /// @nodoc abstract class _$$ChatRoomStateErrorImplCopyWith<$Res> { - factory _$$ChatRoomStateErrorImplCopyWith( - _$ChatRoomStateErrorImpl value, - $Res Function(_$ChatRoomStateErrorImpl) then, - ) = __$$ChatRoomStateErrorImplCopyWithImpl<$Res>; + factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value, + $Res Function(_$ChatRoomStateErrorImpl) then) = + __$$ChatRoomStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -671,25 +642,23 @@ abstract class _$$ChatRoomStateErrorImplCopyWith<$Res> { class __$$ChatRoomStateErrorImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl> implements _$$ChatRoomStateErrorImplCopyWith<$Res> { - __$$ChatRoomStateErrorImplCopyWithImpl( - _$ChatRoomStateErrorImpl _value, - $Res Function(_$ChatRoomStateErrorImpl) _then, - ) : super(_value, _then); + __$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value, + $Res Function(_$ChatRoomStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of ChatRoomState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$ChatRoomStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$ChatRoomStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -725,9 +694,7 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { @pragma('vm:prefer-inline') _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => __$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -735,13 +702,12 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - ) - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -753,13 +719,12 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -771,13 +736,12 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { TResult Function()? $default, { TResult Function()? loading, TResult Function( - ChatRoomModel chatRoom, - List chatMessages, - bool hasCard, - bool isTyping, - bool isLoading, - )? - loaded, + ChatRoomModel chatRoom, + List chatMessages, + bool hasCard, + bool isTyping, + bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { diff --git a/lib/features/chat/presentation/bloc/chats_cubit/chats_state.freezed.dart b/lib/features/chat/presentation/bloc/chats_cubit/chats_state.freezed.dart index ebdaf5d8..a2271568 100644 --- a/lib/features/chat/presentation/bloc/chats_cubit/chats_state.freezed.dart +++ b/lib/features/chat/presentation/bloc/chats_cubit/chats_state.freezed.dart @@ -12,8 +12,7 @@ part of 'chats_state.dart'; 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', -); + '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'); /// @nodoc mixin _$ChatsState { @@ -33,17 +32,15 @@ mixin _$ChatsState { /// @nodoc abstract class $ChatsStateCopyWith<$Res> { factory $ChatsStateCopyWith( - ChatsState value, - $Res Function(ChatsState) then, - ) = _$ChatsStateCopyWithImpl<$Res, ChatsState>; + ChatsState value, $Res Function(ChatsState) then) = + _$ChatsStateCopyWithImpl<$Res, ChatsState>; @useResult - $Res call({ - BaseState state, - int chatsWithUnreadMessagesCount, - List chatRooms, - bool isLoadingMoreChats, - String? errorMessage, - }); + $Res call( + {BaseState state, + int chatsWithUnreadMessagesCount, + List chatRooms, + bool isLoadingMoreChats, + String? errorMessage}); } /// @nodoc @@ -67,36 +64,28 @@ class _$ChatsStateCopyWithImpl<$Res, $Val extends ChatsState> Object? isLoadingMoreChats = null, Object? errorMessage = freezed, }) { - return _then( - _value.copyWith( - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as BaseState, - chatsWithUnreadMessagesCount: - null == chatsWithUnreadMessagesCount - ? _value.chatsWithUnreadMessagesCount - : chatsWithUnreadMessagesCount // ignore: cast_nullable_to_non_nullable - as int, - chatRooms: - null == chatRooms - ? _value.chatRooms - : chatRooms // ignore: cast_nullable_to_non_nullable - as List, - isLoadingMoreChats: - null == isLoadingMoreChats - ? _value.isLoadingMoreChats - : isLoadingMoreChats // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as BaseState, + chatsWithUnreadMessagesCount: null == chatsWithUnreadMessagesCount + ? _value.chatsWithUnreadMessagesCount + : chatsWithUnreadMessagesCount // ignore: cast_nullable_to_non_nullable + as int, + chatRooms: null == chatRooms + ? _value.chatRooms + : chatRooms // ignore: cast_nullable_to_non_nullable + as List, + isLoadingMoreChats: null == isLoadingMoreChats + ? _value.isLoadingMoreChats + : isLoadingMoreChats // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } } @@ -104,18 +93,16 @@ class _$ChatsStateCopyWithImpl<$Res, $Val extends ChatsState> abstract class _$$ChatsStateImplCopyWith<$Res> implements $ChatsStateCopyWith<$Res> { factory _$$ChatsStateImplCopyWith( - _$ChatsStateImpl value, - $Res Function(_$ChatsStateImpl) then, - ) = __$$ChatsStateImplCopyWithImpl<$Res>; + _$ChatsStateImpl value, $Res Function(_$ChatsStateImpl) then) = + __$$ChatsStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - BaseState state, - int chatsWithUnreadMessagesCount, - List chatRooms, - bool isLoadingMoreChats, - String? errorMessage, - }); + $Res call( + {BaseState state, + int chatsWithUnreadMessagesCount, + List chatRooms, + bool isLoadingMoreChats, + String? errorMessage}); } /// @nodoc @@ -123,9 +110,8 @@ class __$$ChatsStateImplCopyWithImpl<$Res> extends _$ChatsStateCopyWithImpl<$Res, _$ChatsStateImpl> implements _$$ChatsStateImplCopyWith<$Res> { __$$ChatsStateImplCopyWithImpl( - _$ChatsStateImpl _value, - $Res Function(_$ChatsStateImpl) _then, - ) : super(_value, _then); + _$ChatsStateImpl _value, $Res Function(_$ChatsStateImpl) _then) + : super(_value, _then); /// Create a copy of ChatsState /// with the given fields replaced by the non-null parameter values. @@ -138,48 +124,41 @@ class __$$ChatsStateImplCopyWithImpl<$Res> Object? isLoadingMoreChats = null, Object? errorMessage = freezed, }) { - return _then( - _$ChatsStateImpl( - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as BaseState, - chatsWithUnreadMessagesCount: - null == chatsWithUnreadMessagesCount - ? _value.chatsWithUnreadMessagesCount - : chatsWithUnreadMessagesCount // ignore: cast_nullable_to_non_nullable - as int, - chatRooms: - null == chatRooms - ? _value._chatRooms - : chatRooms // ignore: cast_nullable_to_non_nullable - as List, - isLoadingMoreChats: - null == isLoadingMoreChats - ? _value.isLoadingMoreChats - : isLoadingMoreChats // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$ChatsStateImpl( + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as BaseState, + chatsWithUnreadMessagesCount: null == chatsWithUnreadMessagesCount + ? _value.chatsWithUnreadMessagesCount + : chatsWithUnreadMessagesCount // ignore: cast_nullable_to_non_nullable + as int, + chatRooms: null == chatRooms + ? _value._chatRooms + : chatRooms // ignore: cast_nullable_to_non_nullable + as List, + isLoadingMoreChats: null == isLoadingMoreChats + ? _value.isLoadingMoreChats + : isLoadingMoreChats // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc class _$ChatsStateImpl implements _ChatsState { - _$ChatsStateImpl({ - this.state = BaseState.initial, - this.chatsWithUnreadMessagesCount = 0, - final List chatRooms = const [], - this.isLoadingMoreChats = false, - this.errorMessage = null, - }) : _chatRooms = chatRooms; + _$ChatsStateImpl( + {this.state = BaseState.initial, + this.chatsWithUnreadMessagesCount = 0, + final List chatRooms = const [], + this.isLoadingMoreChats = false, + this.errorMessage = null}) + : _chatRooms = chatRooms; @override @JsonKey() @@ -214,16 +193,12 @@ class _$ChatsStateImpl implements _ChatsState { (other.runtimeType == runtimeType && other is _$ChatsStateImpl && (identical(other.state, state) || other.state == state) && - (identical( - other.chatsWithUnreadMessagesCount, - chatsWithUnreadMessagesCount, - ) || + (identical(other.chatsWithUnreadMessagesCount, + chatsWithUnreadMessagesCount) || other.chatsWithUnreadMessagesCount == chatsWithUnreadMessagesCount) && - const DeepCollectionEquality().equals( - other._chatRooms, - _chatRooms, - ) && + const DeepCollectionEquality() + .equals(other._chatRooms, _chatRooms) && (identical(other.isLoadingMoreChats, isLoadingMoreChats) || other.isLoadingMoreChats == isLoadingMoreChats) && (identical(other.errorMessage, errorMessage) || @@ -232,13 +207,12 @@ class _$ChatsStateImpl implements _ChatsState { @override int get hashCode => Object.hash( - runtimeType, - state, - chatsWithUnreadMessagesCount, - const DeepCollectionEquality().hash(_chatRooms), - isLoadingMoreChats, - errorMessage, - ); + runtimeType, + state, + chatsWithUnreadMessagesCount, + const DeepCollectionEquality().hash(_chatRooms), + isLoadingMoreChats, + errorMessage); /// Create a copy of ChatsState /// with the given fields replaced by the non-null parameter values. @@ -250,13 +224,12 @@ class _$ChatsStateImpl implements _ChatsState { } abstract class _ChatsState implements ChatsState { - factory _ChatsState({ - final BaseState state, - final int chatsWithUnreadMessagesCount, - final List chatRooms, - final bool isLoadingMoreChats, - final String? errorMessage, - }) = _$ChatsStateImpl; + factory _ChatsState( + {final BaseState state, + final int chatsWithUnreadMessagesCount, + final List chatRooms, + final bool isLoadingMoreChats, + final String? errorMessage}) = _$ChatsStateImpl; @override BaseState get state; diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index 5fafe2c8..2243829c 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -16,6 +16,7 @@ import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/features/chat/presentation/widgets/notification_banner.dart'; import 'package:eatvio_app/features/chat/presentation/widgets/order_card.dart'; import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; +import 'package:eatvio_app/features/order_info/presentation/info_by_order_screen.dart'; import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart'; import 'package:eatvio_app/features/user_details/presentation/user_details_screen.dart'; import 'package:eatvio_app/generated/l10n.dart'; @@ -62,6 +63,7 @@ class _ChatScreenState extends State { super.dispose(); } + @override Widget build(BuildContext context) { return BlocProvider( create: (BuildContext context) => chatRoomCubit, @@ -73,7 +75,7 @@ class _ChatScreenState extends State { } else if (state is ChatRoomStateError) { return Scaffold(appBar: AppBar(), body: DataErrorWidget(onReload: () => chatRoomCubit.initChat(widget.chatId))); } else { - return Scaffold(body: const Loader()); + return const Scaffold(body: Loader()); } }, ), @@ -85,11 +87,13 @@ class _ChatScreenState extends State { final amIConsultant = chosenPlan?.consultantId == state.chatRoom.users.sender.id; final showAboutOrderButton = showableChatBadgeStates.contains(chosenPlan?.chosenPlanState); BannerType? bannerType; - if (amIConsultant && !state.hasCard) { + if (amIConsultant && state.hasCard) { bannerType = BannerType.card; } else if (amIConsultant && chosenPlan?.chosenPlanState == ChosenPlanStateEnum.stateInCoordination) { bannerType = BannerType.date; - } else if (!amIConsultant && chosenPlan?.chosenPlanState == ChosenPlanStateEnum.stateStartDateHasBeenSet) { + } else if (!amIConsultant && + (chosenPlan?.chosenPlanState == ChosenPlanStateEnum.stateStartDateHasBeenSet || + chosenPlan?.chosenPlanState == ChosenPlanStateEnum.statePendingPayment)) { bannerType = BannerType.payment; } return Scaffold( @@ -122,20 +126,20 @@ class _ChatScreenState extends State { width: 40, height: 40, alignment: Alignment.center, - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Color(0xFFEBF4FF), shape: BoxShape.circle, ), child: Text( state.chatRoom.users.receiver.name.split(' ').first[0] + state.chatRoom.users.receiver.name.split(' ')[1][0], - style: TextStyle( + style: const TextStyle( color: Color(0xFF7F9CF5), fontWeight: FontWeight.w400, fontSize: 20, ), ), ), - SizedBox(width: 16), + const SizedBox(width: 16), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -154,7 +158,7 @@ class _ChatScreenState extends State { secondCurve: Curves.easeOut, secondChild: const SizedBox.shrink(), crossFadeState: state.isTyping ? CrossFadeState.showFirst : CrossFadeState.showSecond, - duration: Duration(milliseconds: 150), + duration: const Duration(milliseconds: 150), ), ], ), @@ -173,19 +177,19 @@ class _ChatScreenState extends State { color: appTheme.whiteA700, width: double.maxFinite, child: SingleChildScrollView( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), controller: scrollController, reverse: true, child: Column( children: [ - SizedBox(height: 16), + const SizedBox(height: 16), ListView.builder( - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), reverse: true, shrinkWrap: true, itemBuilder: (context, index) { if (index == state.chatMessages.length) { - return Padding(padding: const EdgeInsets.all(8), child: const Loader()); + return const Padding(padding: EdgeInsets.all(8), child: Loader()); } if ((index + 1 != state.chatMessages.length && @@ -200,13 +204,14 @@ class _ChatScreenState extends State { onVisibilityChanged: (VisibilityInfo info) { if (!state.chatMessages[index].isRead && !isCurrentUserAuthor && info.visibleFraction > 0) { unreadMessagesIdsCopy.add((id: state.chatMessages[index].id, index: index)); - EasyDebounce.debounce('mark_as_read', Duration(milliseconds: 500), () async { + EasyDebounce.debounce('mark_as_read', const Duration(milliseconds: 500), () async { final result = await context.read().markMessagesAsRead(state.chatRoom.id, unreadMessagesIdsCopy); if (!result) return; + if (!context.mounted) return; context.read().reduceUnreadMessagesCount( - chatId: state.chatRoom.id, - count: unreadMessagesIdsCopy.length, - ); + chatId: state.chatRoom.id, + count: unreadMessagesIdsCopy.length, + ); unreadMessagesIdsCopy.clear(); }); } @@ -228,9 +233,10 @@ class _ChatScreenState extends State { onVisibilityChanged: (VisibilityInfo info) { if (!state.chatMessages[index].isRead && !isCurrentUserAuthor && info.visibleFraction > 0) { unreadMessagesIds.add((id: state.chatMessages[index].id, index: index)); - EasyDebounce.debounce('mark_as_read', Duration(milliseconds: 500), () async { + EasyDebounce.debounce('mark_as_read', const Duration(milliseconds: 500), () async { final result = await context.read().markMessagesAsRead(state.chatRoom.id, unreadMessagesIds); if (!result) return; + if (!context.mounted) return; context.read().reduceUnreadMessagesCount(chatId: state.chatRoom.id, count: unreadMessagesIds.length); unreadMessagesIds.clear(); }); @@ -247,7 +253,7 @@ class _ChatScreenState extends State { }, itemCount: state.chatMessages.length + (state.isLoading ? 1 : 0), ), - SizedBox(height: 16), + const SizedBox(height: 16), if (chosenPlan != null) ...[ OrderCard( plan: chosenPlan.plan, @@ -257,15 +263,15 @@ class _ChatScreenState extends State { await context.read().cancelChosenPlan(chatId: state.chatRoom.id, planId: chosenPlan.id); }, ), - if (amIConsultant) ...[ + if (amIConsultant) Padding( - padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16), + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), child: CustomOutlinedButton( text: S.current.user_info, height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), onPressed: () async { @@ -273,9 +279,8 @@ class _ChatScreenState extends State { }, ), ), - if (bannerType != null) - Padding(padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16), child: NotificationBanner(bannerType: bannerType)), - ], + if (bannerType != null) + Padding(padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), child: NotificationBanner(bannerType: bannerType)), ], ], ), @@ -283,11 +288,11 @@ class _ChatScreenState extends State { ), ), Container( - padding: EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric(vertical: 8), child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ - SizedBox(width: 8), + const SizedBox(width: 8), InkWell( onTap: () async { FilePickerResult? result = await FilePicker.platform.pickFiles( @@ -320,14 +325,14 @@ class _ChatScreenState extends State { await chatRoomCubit.sendMessage(chatId: widget.chatId, files: files); } }, - customBorder: CircleBorder(), + customBorder: const CircleBorder(), child: Ink( height: 40, width: 40, - child: Transform.rotate(angle: pi / 4, child: Icon(Icons.attach_file_rounded, size: 30, color: Color(0xFF858E99))), + child: Transform.rotate(angle: pi / 4, child: const Icon(Icons.attach_file_rounded, size: 30, color: Color(0xFF858E99))), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: SizedBox( height: 40, @@ -338,29 +343,29 @@ class _ChatScreenState extends State { maxLines: null, minLines: null, keyboardType: TextInputType.multiline, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1), + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1), decoration: InputDecoration( isDense: true, - contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 10), + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), hintText: 'Сообщение', - hintStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, height: 1, color: Color(0xFFAEAEB2)), + hintStyle: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, height: 1, color: Color(0xFFAEAEB2)), filled: true, - border: OutlineInputBorder(borderRadius: BorderRadius.circular(100), borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1)), + border: OutlineInputBorder(borderRadius: BorderRadius.circular(100), borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(100), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(100), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), ), ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), InkWell( - customBorder: CircleBorder(), + customBorder: const CircleBorder(), onTap: () { if (textEditingController.text.isNotEmpty) { chatRoomCubit.sendMessage(chatId: widget.chatId, data: textEditingController.text.trim()); @@ -373,16 +378,25 @@ class _ChatScreenState extends State { decoration: BoxDecoration(color: appTheme.blueA400, shape: BoxShape.circle), height: 40, width: 40, - child: Icon(Icons.arrow_upward_rounded, size: 24, color: Colors.white), + child: const Icon(Icons.arrow_upward_rounded, size: 24, color: Colors.white), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), ], ), ), ], ), - if (showAboutOrderButton) Positioned(top: 8, right: 15, left: 16, child: AboutOrderButton()), + if (showAboutOrderButton) + Positioned( + top: 8, + right: 15, + left: 16, + child: AboutOrderButton( + onTap: () { + GoRouter.of(context).push(InfoByOrderScreen.path, extra: state.chatRoom.chosenPlan); + }, + )), ], ), ), diff --git a/lib/features/chat/presentation/pages/chats_screen.dart b/lib/features/chat/presentation/pages/chats_screen.dart index 75882083..03c3870a 100644 --- a/lib/features/chat/presentation/pages/chats_screen.dart +++ b/lib/features/chat/presentation/pages/chats_screen.dart @@ -11,7 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class ChatsScreen extends StatefulWidget { - const ChatsScreen({Key? key}) : super(key: key); + const ChatsScreen({super.key}); @override State createState() => _ChatsScreenState(); @@ -20,6 +20,7 @@ class ChatsScreen extends StatefulWidget { class _ChatsScreenState extends State { final searchController = TextEditingController(); + @override Widget build(BuildContext context) { return BlocBuilder( builder: (context, state) { @@ -47,7 +48,7 @@ class _ChatsScreenState extends State { if (query.length > 2) { EasyDebounce.debounce( 'searchChatRoom', - Duration(milliseconds: 300), + const Duration(milliseconds: 300), () => context.read().getChatRooms(query: query), ); } else { @@ -55,9 +56,9 @@ class _ChatsScreenState extends State { } }, controller: searchController, - fillColor: Color(0xFFF0F2F5), + fillColor: const Color(0xFFF0F2F5), hintText: "Поиск", - hintStyle: TextStyle( + hintStyle: const TextStyle( color: Color(0xFF7B8794), ), ), @@ -84,18 +85,18 @@ class _ChatsScreenState extends State { return false; }, child: ListView.separated( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), separatorBuilder: (context, index) { - return SizedBox( + return const SizedBox( height: 8, ); }, itemCount: state.isLoadingMoreChats ? state.chatRooms.length + 1 : state.chatRooms.length, itemBuilder: (context, index) { if (index == state.chatRooms.length) { - return Center(child: Loader()); + return const Center(child: Loader()); } return ChatEntryWidget(chatRoom: state.chatRooms[index]); }, diff --git a/lib/features/chat/presentation/pages/payment_screen.dart b/lib/features/chat/presentation/pages/payment_screen.dart new file mode 100644 index 00000000..bdd496ea --- /dev/null +++ b/lib/features/chat/presentation/pages/payment_screen.dart @@ -0,0 +1,49 @@ +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:webview_flutter/webview_flutter.dart'; + +class PaymentScreen extends StatefulWidget { + static const name = 'paymentScreen'; + static const path = '/payment-screen'; + final String url; + const PaymentScreen({super.key, required this.url}); + + @override + State createState() => _PaymentScreenState(); +} + +class _PaymentScreenState extends State { + late final WebViewController _controller; + + @override + void initState() { + super.initState(); + _controller = WebViewController() + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..setNavigationDelegate( + NavigationDelegate( + onProgress: (int progress) {}, + onPageStarted: (String url) {}, + onPageFinished: (String url) {}, + onHttpError: (HttpResponseError error) {}, + onWebResourceError: (WebResourceError error) {}, + onNavigationRequest: (NavigationRequest request) { + log(request.url); + return NavigationDecision.navigate; + }, + ), + ) + ..loadRequest(Uri.parse(widget.url)); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(), + body: WebViewWidget( + controller: _controller, + ), + ); + } +} diff --git a/lib/features/chat/presentation/pages/photo_view_screen.dart b/lib/features/chat/presentation/pages/photo_view_screen.dart index 383a538b..260c051d 100644 --- a/lib/features/chat/presentation/pages/photo_view_screen.dart +++ b/lib/features/chat/presentation/pages/photo_view_screen.dart @@ -27,7 +27,7 @@ class PhotoViewScreen extends StatefulWidget { } class _PhotoViewScreenState extends State { - late final pageController; + late final PageController pageController; int imageIndex = 0; @override @@ -45,7 +45,7 @@ class _PhotoViewScreenState extends State { direction: DismissiblePageDismissDirection.vertical, isFullScreen: true, child: PhotoViewGallery.builder( - backgroundDecoration: BoxDecoration( + backgroundDecoration: const BoxDecoration( color: Colors.transparent, ), scrollPhysics: const BouncingScrollPhysics(), @@ -71,29 +71,29 @@ class _PhotoViewScreenState extends State { child: Column( children: [ const SizedBox(height: 32), - Text('Файл'), + const Text('Файл'), const SizedBox(height: 8), ListTile( shape: RoundedRectangleBorder( borderRadius: BorderRadiusStyle.circleBorder17, ), - contentPadding: EdgeInsets.all(16), + contentPadding: const EdgeInsets.all(16), onTap: () async { if (!await launchUrl(Uri.parse(widget.imageUrls[index]))) { throw Exception('Could not launch ${widget.imageUrls[index]}'); } }, - leading: Icon( + leading: const Icon( Icons.file_copy_outlined, color: Colors.white, ), - trailing: Icon( + trailing: const Icon( Icons.download_outlined, color: Colors.white, ), title: Text( - widget.imageUrls[index].replaceAll(baseUrl + '/storage/' + 'chat_files/', ''), - style: TextStyle( + widget.imageUrls[index].replaceAll('$baseUrl/storage/chat_files/', ''), + style: const TextStyle( color: Colors.white, fontSize: 12, ), @@ -108,7 +108,7 @@ class _PhotoViewScreenState extends State { }, itemCount: widget.imageUrls.length, loadingBuilder: (context, event) => Center( - child: Container( + child: SizedBox( width: 20.0, height: 20.0, child: CircularProgressIndicator( diff --git a/lib/features/chat/presentation/widgets/about_order_button.dart b/lib/features/chat/presentation/widgets/about_order_button.dart index 7496d431..f32ac3f3 100644 --- a/lib/features/chat/presentation/widgets/about_order_button.dart +++ b/lib/features/chat/presentation/widgets/about_order_button.dart @@ -5,12 +5,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; class AboutOrderButton extends StatelessWidget { - const AboutOrderButton({super.key}); - + const AboutOrderButton({super.key, required this.onTap}); + final void Function() onTap; @override Widget build(BuildContext context) { return GestureDetector( - onTap: () {}, + onTap: onTap, child: Container( height: 44, decoration: BoxDecoration( @@ -20,13 +20,13 @@ class AboutOrderButton extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - SizedBox.shrink(), + const SizedBox.shrink(), Text( S.current.more_about_order, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), Container( - margin: EdgeInsets.only(right: 4), + margin: const EdgeInsets.only(right: 4), width: 36, height: 36, decoration: BoxDecoration( diff --git a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart index 195f19de..c0857612 100644 --- a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart @@ -27,7 +27,7 @@ class ChatBubbleWidget extends StatelessWidget { @override Widget build(BuildContext context) { final size = MediaQuery.sizeOf(context); - return Container( + return SizedBox( width: size.width, child: Padding( padding: EdgeInsets.fromLTRB(isCurrentUser ? 64 : 16, 10, isCurrentUser ? 16 : 64, 4), @@ -41,7 +41,7 @@ class ChatBubbleWidget extends StatelessWidget { padding: const EdgeInsets.only(right: 4, bottom: 4), child: Text( sendTime.format('hh:mm'), - style: TextStyle( + style: const TextStyle( color: Color(0xFF7B8794), height: 1, fontSize: 10, @@ -52,16 +52,16 @@ class ChatBubbleWidget extends StatelessWidget { constraints: BoxConstraints(maxWidth: size.width * 0.7), decoration: BoxDecoration( color: isCurrentUser ? appTheme.gray50 : appTheme.gray60004, - borderRadius: mediaData.length > 0 + borderRadius: mediaData.isNotEmpty ? BorderRadius.circular(24) : BorderRadius.horizontal( - left: isCurrentUser ? Radius.circular(32) : Radius.circular(16), - right: isCurrentUser ? Radius.circular(16) : Radius.circular(24), + left: isCurrentUser ? const Radius.circular(32) : const Radius.circular(16), + right: isCurrentUser ? const Radius.circular(16) : const Radius.circular(24), ), ), child: Padding( padding: - mediaData.isNotEmpty ? EdgeInsets.all(8) : EdgeInsets.only(top: 8, bottom: 8, left: isCurrentUser ? 16 : 8, right: isCurrentUser ? 8 : 16), + mediaData.isNotEmpty ? const EdgeInsets.all(8) : EdgeInsets.only(top: 8, bottom: 8, left: isCurrentUser ? 16 : 8, right: isCurrentUser ? 8 : 16), child: Column( crossAxisAlignment: isCurrentUser ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [ @@ -70,7 +70,7 @@ class ChatBubbleWidget extends StatelessWidget { width: size.width * 0.7, child: CustomScrollView( shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), slivers: [ SliverList.separated( itemBuilder: (BuildContext context, int index) { @@ -78,25 +78,25 @@ class ChatBubbleWidget extends StatelessWidget { !mediaData[index].toString().contains('.jpg') && !mediaData[index].toString().contains('.jpeg')) { return ListTile( - contentPadding: EdgeInsets.all(4), + contentPadding: const EdgeInsets.all(4), horizontalTitleGap: 8, onTap: () async { - if (!await launchUrl(Uri.parse(baseUrl + '/storage/' + mediaData[index].toString()))) { + if (!await launchUrl(Uri.parse('$baseUrl/storage/${mediaData[index]}'))) { throw Exception('Could not launch ${mediaData[index].toString()}'); } }, - leading: Icon( + leading: const Icon( Icons.file_copy_outlined, color: Colors.white, ), - trailing: Icon( + trailing: const Icon( Icons.download_outlined, color: Colors.white, ), title: Text( mediaData[index].toString().replaceAll('chat_files/', ''), maxLines: 2, - style: TextStyle( + style: const TextStyle( color: Colors.white, fontSize: 12, overflow: TextOverflow.ellipsis, @@ -108,18 +108,18 @@ class ChatBubbleWidget extends StatelessWidget { onTap: () { context.pushTransparentRoute( PhotoViewScreen( - imageUrls: mediaData.map((e) => baseUrl + '/storage/' + e.toString()).toList(), + imageUrls: mediaData.map((e) => '$baseUrl/storage/$e').toList(), index: index, ), ); }, child: Hero( - tag: baseUrl + '/storage/' + '${mediaData[index]}', + tag: '$baseUrl/storage/${mediaData[index]}', transitionOnUserGestures: true, child: ClipRRect( borderRadius: BorderRadius.circular(16), child: CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + '${mediaData[index]}', + imageUrl: '$baseUrl/storage/${mediaData[index]}', ), ), ), @@ -131,7 +131,7 @@ class ChatBubbleWidget extends StatelessWidget { ], ), ), - if (mediaData.isNotEmpty && text.isNotEmpty) SizedBox(height: 8), + if (mediaData.isNotEmpty && text.isNotEmpty) const SizedBox(height: 8), if (text.isNotEmpty) Text( text, @@ -146,7 +146,7 @@ class ChatBubbleWidget extends StatelessWidget { padding: const EdgeInsets.only(left: 4, bottom: 4), child: Text( sendTime.format('hh:mm'), - style: TextStyle( + style: const TextStyle( color: Color(0xFF7B8794), height: 1, fontSize: 10, diff --git a/lib/features/chat/presentation/widgets/chat_entry_widget.dart b/lib/features/chat/presentation/widgets/chat_entry_widget.dart index 4e1eea67..bde4f8fd 100644 --- a/lib/features/chat/presentation/widgets/chat_entry_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_entry_widget.dart @@ -8,7 +8,7 @@ import 'package:go_router/go_router.dart'; class ChatEntryWidget extends StatefulWidget { final ChatRoom chatRoom; - ChatEntryWidget({ + const ChatEntryWidget({ required this.chatRoom, super.key, }); @@ -29,10 +29,10 @@ class _ChatEntryWidgetState extends State { }, ), child: Ink( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), - color: Color(0xFFF6FAFF), + color: const Color(0xFFF6FAFF), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -52,10 +52,10 @@ class _ChatEntryWidgetState extends State { Text( widget.chatRoom.users.toChatUser.name.length <= 20 ? widget.chatRoom.users.toChatUser.name - : widget.chatRoom.users.toChatUser.name.substring(0, 20) + '...', + : '${widget.chatRoom.users.toChatUser.name.substring(0, 20)}...', style: theme.textTheme.titleMedium, ), - SizedBox(height: 8), + const SizedBox(height: 8), if (widget.chatRoom.lastMessage != null) SizedBox( width: MediaQuery.sizeOf(context).width * 0.5, @@ -68,22 +68,22 @@ class _ChatEntryWidgetState extends State { ), ], ), - Spacer(), + const Spacer(), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ if (widget.chatRoom.lastMessage != null) Padding( - padding: EdgeInsets.only(left: 8), + padding: const EdgeInsets.only(left: 8), child: Text( widget.chatRoom.lastMessage!.updatedAt.format('dd MMM', 'ru'), style: theme.textTheme.bodyMedium, ), ), - SizedBox(height: 4), + const SizedBox(height: 4), if (widget.chatRoom.unreadMessagesCount > 0) Container( - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 6), + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6), decoration: BoxDecoration( shape: BoxShape.circle, color: appTheme.blueA400, diff --git a/lib/features/chat/presentation/widgets/chat_search_bar_widget.dart b/lib/features/chat/presentation/widgets/chat_search_bar_widget.dart index 2750d2c5..80e0c42c 100644 --- a/lib/features/chat/presentation/widgets/chat_search_bar_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_search_bar_widget.dart @@ -3,8 +3,8 @@ import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:flutter/material.dart'; class ChatSearchBarWidget extends StatelessWidget { - ChatSearchBarWidget({ - Key? key, + const ChatSearchBarWidget({ + super.key, this.alignment, this.width, this.scrollPadding, @@ -27,7 +27,7 @@ class ChatSearchBarWidget extends StatelessWidget { this.validator, this.onChanged, required this.onSuffixIconTap, - }) : super(key: key); + }); final Alignment? alignment; @@ -107,7 +107,7 @@ class ChatSearchBarWidget extends StatelessWidget { hintText: hintText ?? "", hintStyle: hintStyle ?? CustomTextStyles.bodySmallMulishBluegray800, prefixIcon: prefix ?? - Padding( + const Padding( padding: EdgeInsets.only(left: 12), child: Icon( Icons.search, @@ -126,7 +126,7 @@ class ChatSearchBarWidget extends StatelessWidget { ), ), isDense: true, - contentPadding: EdgeInsets.all(16), + contentPadding: const EdgeInsets.all(16), fillColor: fillColor ?? appTheme.gray100, filled: filled, border: borderDecoration ?? diff --git a/lib/features/chat/presentation/widgets/chose_plan_date_widget.dart b/lib/features/chat/presentation/widgets/chose_plan_date_widget.dart new file mode 100644 index 00000000..5ec4e370 --- /dev/null +++ b/lib/features/chat/presentation/widgets/chose_plan_date_widget.dart @@ -0,0 +1,90 @@ +import 'package:eatvio_app/core/utils/toasts.dart'; +import 'package:eatvio_app/core/widgets/bottom_sheet_handler_bar.dart'; +import 'package:eatvio_app/core/widgets/custom_divider.dart'; +import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart'; +import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart'; +import 'package:eatvio_app/features/diets/presentation/widgets/calendar_widget.dart'; +import 'package:eatvio_app/generated/l10n.dart'; +import 'package:eatvio_app/core/theme/custom_text_style.dart'; +import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/core/widgets/custom_outlined_button.dart'; +import 'package:flutter/material.dart'; + +class ChosePlanDateWidget extends StatefulWidget { + const ChosePlanDateWidget({super.key, required this.chatCubit}); + final ChatRoomCubit chatCubit; + + @override + State createState() => _ChosePlanDateWidget(); +} + +class _ChosePlanDateWidget extends State { + final startDate = [DateTime.now()]; + @override + Widget build(BuildContext context) { + final s = S.of(context); + String? planName; + if (widget.chatCubit.state is ChatRoomStateLoaded) { + planName = (widget.chatCubit.state as ChatRoomStateLoaded).chatRoom.chosenPlan?.plan.name; + } + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox(height: 4), + const BottomSheetHandlerBar(), + const SizedBox(height: 12), + Text( + planName ?? '', + style: TextStyles.headingXLSemibold.copyWith( + color: appTheme.black, + ), + ), + const SizedBox(height: 12), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 25.0), + child: Text( + s.chose_plan_start_date_2, + textAlign: TextAlign.center, + style: TextStyles.textMMedium.copyWith( + color: appTheme.black, + ), + ), + ), + const SizedBox(height: 12), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0), + child: CustomDivider(), + ), + CalendarWidget( + startDate: startDate, + ), + Padding( + padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28), + child: CustomOutlinedButton( + onPressed: () async { + final result = await widget.chatCubit.choseStartPlanDate(startDate[0]); + if (result) { + showSuccessToast('Дата установлена'); + if (!context.mounted) return; + Navigator.pop(context); + } else { + showErrorToast('Не удалось установить дату'); + if (!context.mounted) return; + Navigator.pop(context); + } + }, + height: 60, + text: s.confirm, + buttonTextStyle: TextStyles.textLSemibold.copyWith( + color: appTheme.whiteA700, + ), + buttonStyle: ButtonStyle( + backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), + side: const WidgetStatePropertyAll(BorderSide.none), + ), + ), + ), + ], + ); + } +} diff --git a/lib/features/chat/presentation/widgets/notification_banner.dart b/lib/features/chat/presentation/widgets/notification_banner.dart index 5d3c8097..5b7bfefa 100644 --- a/lib/features/chat/presentation/widgets/notification_banner.dart +++ b/lib/features/chat/presentation/widgets/notification_banner.dart @@ -1,8 +1,13 @@ import 'package:eatvio_app/core/theme/custom_text_style.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart'; +import 'package:eatvio_app/features/chat/presentation/pages/payment_screen.dart'; +import 'package:eatvio_app/features/chat/presentation/widgets/chose_plan_date_widget.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:go_router/go_router.dart'; class NotificationBanner extends StatelessWidget { const NotificationBanner({super.key, required this.bannerType}); @@ -32,38 +37,52 @@ class NotificationBanner extends StatelessWidget { BannerType.date => [ SizedBox( width: size.width * 0.6, - child: Text(s.can_not_choose_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)), + child: Text(s.choose_plan_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)), ), - SizedBox(height: 12), + const SizedBox(height: 12), GestureDetector( - onTap: () {}, - child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)), + onTap: () { + final cubit = context.read(); + showModalBottomSheet( + context: context, + builder: (context) => ChosePlanDateWidget( + chatCubit: cubit, + ), + ); + }, + child: Text(s.choose_date, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], BannerType.card => [ SizedBox( width: size.width * 0.6, child: Text(s.can_not_choose_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)), ), - SizedBox(height: 12), + const SizedBox(height: 12), GestureDetector( onTap: () {}, child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], BannerType.payment => [ SizedBox( width: size.width * 0.6, - child: Text(s.can_not_choose_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)), + child: Text(s.tap_on_link_to_pay, style: TextStyles.textMMedium.copyWith(color: appTheme.black)), ), - SizedBox(height: 12), + const SizedBox(height: 12), GestureDetector( - onTap: () {}, - child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)), + onTap: () async { + final paymentLink = await context.read().getPaymentLink(); + if (paymentLink != null) { + if (!context.mounted) return; + GoRouter.of(context).push(PaymentScreen.path, extra: paymentLink); + } + }, + child: Text(s.pay, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], }, ), diff --git a/lib/features/chat/presentation/widgets/order_card.dart b/lib/features/chat/presentation/widgets/order_card.dart index c3041757..31d99aad 100644 --- a/lib/features/chat/presentation/widgets/order_card.dart +++ b/lib/features/chat/presentation/widgets/order_card.dart @@ -33,8 +33,8 @@ class _OrderCardState extends State { }; final s = S.of(context); return Container( - margin: EdgeInsets.symmetric(horizontal: 16), - padding: EdgeInsets.only(top: 8, bottom: 12, left: 8, right: 8), + margin: const EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.only(top: 8, bottom: 12, left: 8, right: 8), decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: appTheme.gray60004), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -47,7 +47,7 @@ class _OrderCardState extends State { ClipRRect( borderRadius: BorderRadius.circular(12), child: Image.network( - baseUrl + '/storage/' + widget.plan.image, + '$baseUrl/storage/${widget.plan.image}', width: double.infinity, fit: BoxFit.cover, ), @@ -59,7 +59,7 @@ class _OrderCardState extends State { padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), decoration: BoxDecoration( color: appTheme.blueA400, - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topRight: Radius.circular(12), bottomRight: Radius.circular(12), ), @@ -77,7 +77,7 @@ class _OrderCardState extends State { padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), decoration: BoxDecoration( color: appTheme.greenA700, - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topRight: Radius.circular(12), bottomRight: Radius.circular(12), ), @@ -91,17 +91,17 @@ class _OrderCardState extends State { ], ), ), - SizedBox(height: 12), + const SizedBox(height: 12), Text( - '${widget.plan.name}', + widget.plan.name, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 12), + const SizedBox(height: 12), Text( '${s.option}: ${option?.short ?? ''}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 8), + const SizedBox(height: 8), if (option != null) ...option.items .map( @@ -114,11 +114,11 @@ class _OrderCardState extends State { ), ), ) - .toList(), + , if (widget.isCustomerView) ...[ - SizedBox(height: 8), + const SizedBox(height: 8), isLoading - ? Loader() + ? const Loader() : GestureDetector( onTap: () async { setState(() => isLoading = true); @@ -126,7 +126,7 @@ class _OrderCardState extends State { setState(() => isLoading = false); }, child: Text( - '${s.cancel_order}', + s.cancel_order, style: TextStyles.textSMedium.copyWith(color: appTheme.strongRed), ), ), diff --git a/lib/features/chat/repositories/chat_repository.dart b/lib/features/chat/repositories/chat_repository.dart index c6b1bf8d..5027aeed 100644 --- a/lib/features/chat/repositories/chat_repository.dart +++ b/lib/features/chat/repositories/chat_repository.dart @@ -1,11 +1,11 @@ import 'dart:async'; import 'dart:io'; - import 'package:dio/dio.dart'; import 'package:eatvio_app/features/chat/models/chat_message_model.dart'; import 'package:eatvio_app/features/chat/models/chat_messages_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_pagination_model.dart'; +import 'package:eatvio_app/features/chat/models/payment_model.dart'; import 'package:eatvio_app/features/chat/services/chat_service.dart'; import 'package:http_parser/http_parser.dart'; @@ -47,7 +47,7 @@ class ChatRepository { await chatService.sendMessage( id: chatId, data: data, - media_data: multipartFiles.isEmpty ? null : multipartFiles, + mediaData: multipartFiles.isEmpty ? null : multipartFiles, ); } catch (e) { rethrow; @@ -103,4 +103,22 @@ class ChatRepository { rethrow; } } + + Future choseStartPlanDate({required int id, required Map date}) async { + try { + await chatService.choseStartPlanDate(id: id, date: date); + } catch (e) { + rethrow; + } + } + + Future getPaymentLink({ + required int id, + }) async { + try { + return await chatService.getPaymentLink(id: id); + } catch (e) { + rethrow; + } + } } diff --git a/lib/features/chat/services/chat_service.dart b/lib/features/chat/services/chat_service.dart index 3eae96fd..e8e47e2b 100644 --- a/lib/features/chat/services/chat_service.dart +++ b/lib/features/chat/services/chat_service.dart @@ -2,6 +2,7 @@ import 'package:dio/dio.dart'; import 'package:eatvio_app/features/chat/models/chat_messages_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_pagination_model.dart'; +import 'package:eatvio_app/features/chat/models/payment_model.dart'; import 'package:retrofit/retrofit.dart'; part 'chat_service.g.dart'; @@ -26,7 +27,7 @@ abstract class ChatService { Future sendMessage({ @Path() required String id, @Part() String? data, - @Part(name: 'media_data[]', contentType: 'multipart/form-data') List? media_data, + @Part(name: 'media_data[]', contentType: 'multipart/form-data') List? mediaData, }); @GET('/api/chat/show/{id}/messages?page={page}') @@ -50,4 +51,15 @@ abstract class ChatService { Future cancelChosenPlan({ @Path() required int id, }); + + @POST('/api/chosen_plans/{id}/negotiate_contract_start') + Future choseStartPlanDate({ + @Path() required int id, + @Body() required Map date, + }); + + @POST('/api/chosen_plans/{id}/start_payment_process') + Future getPaymentLink({ + @Path() required int id, + }); } diff --git a/lib/features/chat/services/chat_service.g.dart b/lib/features/chat/services/chat_service.g.dart index dd3188c1..d25bec4d 100644 --- a/lib/features/chat/services/chat_service.g.dart +++ b/lib/features/chat/services/chat_service.g.dart @@ -82,7 +82,7 @@ class _ChatService implements ChatService { Future sendMessage({ required String id, String? data, - List? media_data, + List? mediaData, }) async { final _extra = {}; final queryParameters = {}; @@ -92,16 +92,16 @@ class _ChatService implements ChatService { if (data != null) { _data.fields.add(MapEntry('data', data)); } - if (media_data != null) { - _data.files.addAll(media_data.map((i) => MapEntry('media_data[]', i))); + if (mediaData != null) { + _data.files.addAll(mediaData.map((i) => MapEntry('media_data[]', i))); } final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/chat/${id}/message/send', @@ -212,6 +212,56 @@ class _ChatService implements ChatService { await _dio.fetch(_options); } + @override + Future choseStartPlanDate({ + required int id, + required Map date, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(date); + final _options = _setStreamType( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/chosen_plans/${id}/negotiate_contract_start', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + await _dio.fetch(_options); + } + + @override + Future getPaymentLink({required int id}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/chosen_plans/${id}/start_payment_process', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PaymentModel _value; + try { + _value = PaymentModel.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + return _value; + } + RequestOptions _setStreamType(RequestOptions requestOptions) { if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || diff --git a/lib/features/complaining/models/complain_model.freezed.dart b/lib/features/complaining/models/complain_model.freezed.dart index aa196f5f..464a38e4 100644 --- a/lib/features/complaining/models/complain_model.freezed.dart +++ b/lib/features/complaining/models/complain_model.freezed.dart @@ -12,8 +12,7 @@ part of 'complain_model.dart'; 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', -); + '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'); ComplainModel _$ComplainModelFromJson(Map json) { return _ComplainModel.fromJson(json); @@ -37,9 +36,8 @@ mixin _$ComplainModel { /// @nodoc abstract class $ComplainModelCopyWith<$Res> { factory $ComplainModelCopyWith( - ComplainModel value, - $Res Function(ComplainModel) then, - ) = _$ComplainModelCopyWithImpl<$Res, ComplainModel>; + ComplainModel value, $Res Function(ComplainModel) then) = + _$ComplainModelCopyWithImpl<$Res, ComplainModel>; @useResult $Res call({String? description, List tags}); } @@ -58,22 +56,20 @@ class _$ComplainModelCopyWithImpl<$Res, $Val extends ComplainModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? description = freezed, Object? tags = null}) { - return _then( - _value.copyWith( - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - tags: - null == tags - ? _value.tags - : tags // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + $Res call({ + Object? description = freezed, + Object? tags = null, + }) { + return _then(_value.copyWith( + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + tags: null == tags + ? _value.tags + : tags // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } } @@ -81,9 +77,8 @@ class _$ComplainModelCopyWithImpl<$Res, $Val extends ComplainModel> abstract class _$$ComplainModelImplCopyWith<$Res> implements $ComplainModelCopyWith<$Res> { factory _$$ComplainModelImplCopyWith( - _$ComplainModelImpl value, - $Res Function(_$ComplainModelImpl) then, - ) = __$$ComplainModelImplCopyWithImpl<$Res>; + _$ComplainModelImpl value, $Res Function(_$ComplainModelImpl) then) = + __$$ComplainModelImplCopyWithImpl<$Res>; @override @useResult $Res call({String? description, List tags}); @@ -94,39 +89,36 @@ class __$$ComplainModelImplCopyWithImpl<$Res> extends _$ComplainModelCopyWithImpl<$Res, _$ComplainModelImpl> implements _$$ComplainModelImplCopyWith<$Res> { __$$ComplainModelImplCopyWithImpl( - _$ComplainModelImpl _value, - $Res Function(_$ComplainModelImpl) _then, - ) : super(_value, _then); + _$ComplainModelImpl _value, $Res Function(_$ComplainModelImpl) _then) + : super(_value, _then); /// Create a copy of ComplainModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? description = freezed, Object? tags = null}) { - return _then( - _$ComplainModelImpl( - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - tags: - null == tags - ? _value._tags - : tags // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + $Res call({ + Object? description = freezed, + Object? tags = null, + }) { + return _then(_$ComplainModelImpl( + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + tags: null == tags + ? _value._tags + : tags // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc @JsonSerializable() class _$ComplainModelImpl implements _ComplainModel { - const _$ComplainModelImpl({ - this.description = null, - final List tags = const [], - }) : _tags = tags; + const _$ComplainModelImpl( + {this.description = null, final List tags = const []}) + : _tags = tags; factory _$ComplainModelImpl.fromJson(Map json) => _$$ComplainModelImplFromJson(json); @@ -161,10 +153,7 @@ class _$ComplainModelImpl implements _ComplainModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - description, - const DeepCollectionEquality().hash(_tags), - ); + runtimeType, description, const DeepCollectionEquality().hash(_tags)); /// Create a copy of ComplainModel /// with the given fields replaced by the non-null parameter values. @@ -176,15 +165,16 @@ class _$ComplainModelImpl implements _ComplainModel { @override Map toJson() { - return _$$ComplainModelImplToJson(this); + return _$$ComplainModelImplToJson( + this, + ); } } abstract class _ComplainModel implements ComplainModel { - const factory _ComplainModel({ - final String? description, - final List tags, - }) = _$ComplainModelImpl; + const factory _ComplainModel( + {final String? description, + final List tags}) = _$ComplainModelImpl; factory _ComplainModel.fromJson(Map json) = _$ComplainModelImpl.fromJson; diff --git a/lib/features/complaining/models/complain_model.g.dart b/lib/features/complaining/models/complain_model.g.dart index 86bdd2fb..d9d3226f 100644 --- a/lib/features/complaining/models/complain_model.g.dart +++ b/lib/features/complaining/models/complain_model.g.dart @@ -11,7 +11,7 @@ _$ComplainModelImpl _$$ComplainModelImplFromJson(Map json) => description: json['description'] as String? ?? null, tags: (json['tags'] as List?)?.map((e) => e as String).toList() ?? - const [], + const [], ); Map _$$ComplainModelImplToJson(_$ComplainModelImpl instance) => diff --git a/lib/features/complaining/presentation/complaining_bottom_sheet.dart b/lib/features/complaining/presentation/complaining_bottom_sheet.dart index eff3b154..e3f42616 100644 --- a/lib/features/complaining/presentation/complaining_bottom_sheet.dart +++ b/lib/features/complaining/presentation/complaining_bottom_sheet.dart @@ -31,28 +31,28 @@ class _ComplainingBottomSheetState extends State { return BlocProvider( create: (context) => sl()..setContentTypeAndIdentifier(contentType: widget.complainedContentType, slug: widget.slug, id: widget.id), child: Container( - padding: EdgeInsets.only(top: 8, bottom: 24, left: 16, right: 16), - decoration: BoxDecoration( + padding: const EdgeInsets.only(top: 8, bottom: 24, left: 16, right: 16), + decoration: const BoxDecoration( borderRadius: BorderRadius.vertical(top: Radius.circular(12)), ), child: BlocBuilder( builder: (context, state) { final category = state.category; if (state.wasSentSuccessfully == true) { - return _ComplaintSentWidget(); + return const _ComplaintSentWidget(); } else if (state.wasSentSuccessfully == false) { - return _ComplaintFailedWidget(); + return const _ComplaintFailedWidget(); } if (category != null) { return switch (category) { - ComplainType.spam => _SpamWidget(), - ComplainType.lawViolation => _LawViolationWidget(), - ComplainType.deception => _DeceptionWidget(), - ComplainType.violenceDndHostility => _ViolenceAndHostility(), - ComplainType.explicitImage => _ExplicitImageWidget(), + ComplainType.spam => const _SpamWidget(), + ComplainType.lawViolation => const _LawViolationWidget(), + ComplainType.deception => const _DeceptionWidget(), + ComplainType.violenceDndHostility => const _ViolenceAndHostility(), + ComplainType.explicitImage => const _ExplicitImageWidget(), }; } - return _CategoryWidget(); + return const _CategoryWidget(); }, ), ), @@ -69,19 +69,19 @@ class _CategoryWidget extends StatelessWidget { return Column( mainAxisSize: MainAxisSize.min, children: [ - BottomSheetHandlerBar(), - SizedBox(height: 20), + const BottomSheetHandlerBar(), + const SizedBox(height: 20), Text( s.complaint, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 8), + const SizedBox(height: 8), Text( s.complaint_question, textAlign: TextAlign.center, style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 24), + const SizedBox(height: 24), ...List.generate( categories.length, (index) => Column( @@ -92,11 +92,11 @@ class _CategoryWidget extends StatelessWidget { context.read().setCategory(categories[index]); }, ), - if (index != categories.length - 1) SizedBox(height: 20), + if (index != categories.length - 1) const SizedBox(height: 20), ], ), ), - SizedBox(height: 24), + const SizedBox(height: 24), ], ); } @@ -111,13 +111,13 @@ class _SpamWidget extends StatelessWidget { return Column( mainAxisSize: MainAxisSize.min, children: [ - BottomSheetHandlerBar(), - SizedBox(height: 20), + const BottomSheetHandlerBar(), + const SizedBox(height: 20), Text( s.spam, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 8), + const SizedBox(height: 8), SizedBox( width: MediaQuery.sizeOf(context).width * 0.7, child: Text( @@ -126,8 +126,8 @@ class _SpamWidget extends StatelessWidget { style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), ), - SizedBox(height: 24), - _ComplainButton(), + const SizedBox(height: 24), + const _ComplainButton(), ], ); } @@ -142,13 +142,13 @@ class _ExplicitImageWidget extends StatelessWidget { return Column( mainAxisSize: MainAxisSize.min, children: [ - BottomSheetHandlerBar(), - SizedBox(height: 20), + const BottomSheetHandlerBar(), + const SizedBox(height: 20), Text( s.explicitImages, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 8), + const SizedBox(height: 8), SizedBox( width: MediaQuery.sizeOf(context).width * 0.7, child: Text( @@ -157,8 +157,8 @@ class _ExplicitImageWidget extends StatelessWidget { style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), ), - SizedBox(height: 24), - _ComplainButton(), + const SizedBox(height: 24), + const _ComplainButton(), ], ); } @@ -197,13 +197,13 @@ class _LawViolationWidgetState extends State<_LawViolationWidget> { return Column( mainAxisSize: MainAxisSize.min, children: [ - BottomSheetHandlerBar(), - SizedBox(height: 20), + const BottomSheetHandlerBar(), + const SizedBox(height: 20), Text( s.lawViolation, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 8), + const SizedBox(height: 8), SizedBox( width: MediaQuery.sizeOf(context).width * 0.7, child: Text( @@ -212,7 +212,7 @@ class _LawViolationWidgetState extends State<_LawViolationWidget> { style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), ), - SizedBox(height: 24), + const SizedBox(height: 24), ...tags.mapIndexed((index, element) { return Row( children: [ @@ -238,9 +238,9 @@ class _LawViolationWidgetState extends State<_LawViolationWidget> { ), ], ); - }).toList(), + }), if (tags.last.$1) ...[ - SizedBox(height: 12), + const SizedBox(height: 12), CustomTextFormField( hintText: s.type_here_your_complaint, onChanged: (value) { @@ -248,8 +248,8 @@ class _LawViolationWidgetState extends State<_LawViolationWidget> { }, ), ], - SizedBox(height: 20), - _ComplainButton(), + const SizedBox(height: 20), + const _ComplainButton(), ], ); } @@ -287,13 +287,13 @@ class _ViolenceAndHostilityState extends State<_ViolenceAndHostility> { return Column( mainAxisSize: MainAxisSize.min, children: [ - BottomSheetHandlerBar(), - SizedBox(height: 20), + const BottomSheetHandlerBar(), + const SizedBox(height: 20), Text( s.lawViolation, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 8), + const SizedBox(height: 8), SizedBox( width: MediaQuery.sizeOf(context).width * 0.7, child: Text( @@ -302,7 +302,7 @@ class _ViolenceAndHostilityState extends State<_ViolenceAndHostility> { style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), ), - SizedBox(height: 24), + const SizedBox(height: 24), ...tags.mapIndexed((index, element) { return Row( children: [ @@ -327,9 +327,9 @@ class _ViolenceAndHostilityState extends State<_ViolenceAndHostility> { ), ], ); - }).toList(), - SizedBox(height: 20), - _ComplainButton(), + }), + const SizedBox(height: 20), + const _ComplainButton(), ], ); } @@ -369,13 +369,13 @@ class _DeceptionWidgetState extends State<_DeceptionWidget> { return Column( mainAxisSize: MainAxisSize.min, children: [ - BottomSheetHandlerBar(), - SizedBox(height: 20), + const BottomSheetHandlerBar(), + const SizedBox(height: 20), Text( s.lawViolation, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 8), + const SizedBox(height: 8), SizedBox( width: MediaQuery.sizeOf(context).width * 0.7, child: Text( @@ -384,7 +384,7 @@ class _DeceptionWidgetState extends State<_DeceptionWidget> { style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), ), - SizedBox(height: 24), + const SizedBox(height: 24), ...tags.mapIndexed((index, element) { return Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -406,7 +406,7 @@ class _DeceptionWidgetState extends State<_DeceptionWidget> { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 8), + const SizedBox(height: 8), Text( element.$2, style: TextStyles.textLSemibold.copyWith(color: appTheme.black), @@ -422,9 +422,9 @@ class _DeceptionWidgetState extends State<_DeceptionWidget> { ), ], ); - }).toList(), - SizedBox(height: 20), - _ComplainButton(), + }), + const SizedBox(height: 20), + const _ComplainButton(), ], ); } @@ -439,13 +439,13 @@ class _ComplaintSentWidget extends StatelessWidget { return Column( mainAxisSize: MainAxisSize.min, children: [ - BottomSheetHandlerBar(), - SizedBox(height: 20), + const BottomSheetHandlerBar(), + const SizedBox(height: 20), Text( s.complaint_sent, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 8), + const SizedBox(height: 8), SizedBox( width: MediaQuery.sizeOf(context).width * 0.7, child: Text( @@ -454,13 +454,13 @@ class _ComplaintSentWidget extends StatelessWidget { style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), ), - SizedBox(height: 24), + const SizedBox(height: 24), CustomOutlinedButton( text: s.ok, height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), onPressed: () { @@ -481,13 +481,13 @@ class _ComplaintFailedWidget extends StatelessWidget { return Column( mainAxisSize: MainAxisSize.min, children: [ - BottomSheetHandlerBar(), - SizedBox(height: 20), + const BottomSheetHandlerBar(), + const SizedBox(height: 20), Text( s.could_not_send_complain, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 8), + const SizedBox(height: 8), SizedBox( width: MediaQuery.sizeOf(context).width * 0.7, child: Text( @@ -496,13 +496,13 @@ class _ComplaintFailedWidget extends StatelessWidget { style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), ), - SizedBox(height: 24), + const SizedBox(height: 24), CustomOutlinedButton( text: s.ok, height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), onPressed: () { @@ -523,14 +523,14 @@ class _ComplainButton extends StatelessWidget { return BlocBuilder( builder: (context, state) { if (state.isLoading) { - return Loader(); + return const Loader(); } return CustomOutlinedButton( text: s.send_complain, height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), onPressed: () async { @@ -558,7 +558,7 @@ class _CategoryButton extends StatelessWidget { category.getTranslatedText(), style: TextStyles.textLSemibold.copyWith(color: appTheme.black), ), - Spacer(), + const Spacer(), SvgPicture.asset('assets/icons/right_arrow.svg'), ], ), diff --git a/lib/features/complaining/presentation/cubit/complaining_state.freezed.dart b/lib/features/complaining/presentation/cubit/complaining_state.freezed.dart index 41902047..d2719d8e 100644 --- a/lib/features/complaining/presentation/cubit/complaining_state.freezed.dart +++ b/lib/features/complaining/presentation/cubit/complaining_state.freezed.dart @@ -12,8 +12,7 @@ part of 'complaining_state.dart'; 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', -); + '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'); /// @nodoc mixin _$ComplainingState { @@ -35,19 +34,17 @@ mixin _$ComplainingState { /// @nodoc abstract class $ComplainingStateCopyWith<$Res> { factory $ComplainingStateCopyWith( - ComplainingState value, - $Res Function(ComplainingState) then, - ) = _$ComplainingStateCopyWithImpl<$Res, ComplainingState>; + ComplainingState value, $Res Function(ComplainingState) then) = + _$ComplainingStateCopyWithImpl<$Res, ComplainingState>; @useResult - $Res call({ - bool isLoading, - bool? wasSentSuccessfully, - ComplainType? category, - ComplainedContent? contentType, - int? contentId, - String? contentSlug, - ComplainModel complainInfo, - }); + $Res call( + {bool isLoading, + bool? wasSentSuccessfully, + ComplainType? category, + ComplainedContent? contentType, + int? contentId, + String? contentSlug, + ComplainModel complainInfo}); $ComplainModelCopyWith<$Res> get complainInfo; } @@ -75,46 +72,36 @@ class _$ComplainingStateCopyWithImpl<$Res, $Val extends ComplainingState> Object? contentSlug = freezed, Object? complainInfo = null, }) { - return _then( - _value.copyWith( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - wasSentSuccessfully: - freezed == wasSentSuccessfully - ? _value.wasSentSuccessfully - : wasSentSuccessfully // ignore: cast_nullable_to_non_nullable - as bool?, - category: - freezed == category - ? _value.category - : category // ignore: cast_nullable_to_non_nullable - as ComplainType?, - contentType: - freezed == contentType - ? _value.contentType - : contentType // ignore: cast_nullable_to_non_nullable - as ComplainedContent?, - contentId: - freezed == contentId - ? _value.contentId - : contentId // ignore: cast_nullable_to_non_nullable - as int?, - contentSlug: - freezed == contentSlug - ? _value.contentSlug - : contentSlug // ignore: cast_nullable_to_non_nullable - as String?, - complainInfo: - null == complainInfo - ? _value.complainInfo - : complainInfo // ignore: cast_nullable_to_non_nullable - as ComplainModel, - ) - as $Val, - ); + return _then(_value.copyWith( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + wasSentSuccessfully: freezed == wasSentSuccessfully + ? _value.wasSentSuccessfully + : wasSentSuccessfully // ignore: cast_nullable_to_non_nullable + as bool?, + category: freezed == category + ? _value.category + : category // ignore: cast_nullable_to_non_nullable + as ComplainType?, + contentType: freezed == contentType + ? _value.contentType + : contentType // ignore: cast_nullable_to_non_nullable + as ComplainedContent?, + contentId: freezed == contentId + ? _value.contentId + : contentId // ignore: cast_nullable_to_non_nullable + as int?, + contentSlug: freezed == contentSlug + ? _value.contentSlug + : contentSlug // ignore: cast_nullable_to_non_nullable + as String?, + complainInfo: null == complainInfo + ? _value.complainInfo + : complainInfo // ignore: cast_nullable_to_non_nullable + as ComplainModel, + ) as $Val); } /// Create a copy of ComplainingState @@ -131,21 +118,19 @@ class _$ComplainingStateCopyWithImpl<$Res, $Val extends ComplainingState> /// @nodoc abstract class _$$ComplainingStateImplCopyWith<$Res> implements $ComplainingStateCopyWith<$Res> { - factory _$$ComplainingStateImplCopyWith( - _$ComplainingStateImpl value, - $Res Function(_$ComplainingStateImpl) then, - ) = __$$ComplainingStateImplCopyWithImpl<$Res>; + factory _$$ComplainingStateImplCopyWith(_$ComplainingStateImpl value, + $Res Function(_$ComplainingStateImpl) then) = + __$$ComplainingStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - bool isLoading, - bool? wasSentSuccessfully, - ComplainType? category, - ComplainedContent? contentType, - int? contentId, - String? contentSlug, - ComplainModel complainInfo, - }); + $Res call( + {bool isLoading, + bool? wasSentSuccessfully, + ComplainType? category, + ComplainedContent? contentType, + int? contentId, + String? contentSlug, + ComplainModel complainInfo}); @override $ComplainModelCopyWith<$Res> get complainInfo; @@ -155,10 +140,9 @@ abstract class _$$ComplainingStateImplCopyWith<$Res> class __$$ComplainingStateImplCopyWithImpl<$Res> extends _$ComplainingStateCopyWithImpl<$Res, _$ComplainingStateImpl> implements _$$ComplainingStateImplCopyWith<$Res> { - __$$ComplainingStateImplCopyWithImpl( - _$ComplainingStateImpl _value, - $Res Function(_$ComplainingStateImpl) _then, - ) : super(_value, _then); + __$$ComplainingStateImplCopyWithImpl(_$ComplainingStateImpl _value, + $Res Function(_$ComplainingStateImpl) _then) + : super(_value, _then); /// Create a copy of ComplainingState /// with the given fields replaced by the non-null parameter values. @@ -173,60 +157,50 @@ class __$$ComplainingStateImplCopyWithImpl<$Res> Object? contentSlug = freezed, Object? complainInfo = null, }) { - return _then( - _$ComplainingStateImpl( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - wasSentSuccessfully: - freezed == wasSentSuccessfully - ? _value.wasSentSuccessfully - : wasSentSuccessfully // ignore: cast_nullable_to_non_nullable - as bool?, - category: - freezed == category - ? _value.category - : category // ignore: cast_nullable_to_non_nullable - as ComplainType?, - contentType: - freezed == contentType - ? _value.contentType - : contentType // ignore: cast_nullable_to_non_nullable - as ComplainedContent?, - contentId: - freezed == contentId - ? _value.contentId - : contentId // ignore: cast_nullable_to_non_nullable - as int?, - contentSlug: - freezed == contentSlug - ? _value.contentSlug - : contentSlug // ignore: cast_nullable_to_non_nullable - as String?, - complainInfo: - null == complainInfo - ? _value.complainInfo - : complainInfo // ignore: cast_nullable_to_non_nullable - as ComplainModel, - ), - ); + return _then(_$ComplainingStateImpl( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + wasSentSuccessfully: freezed == wasSentSuccessfully + ? _value.wasSentSuccessfully + : wasSentSuccessfully // ignore: cast_nullable_to_non_nullable + as bool?, + category: freezed == category + ? _value.category + : category // ignore: cast_nullable_to_non_nullable + as ComplainType?, + contentType: freezed == contentType + ? _value.contentType + : contentType // ignore: cast_nullable_to_non_nullable + as ComplainedContent?, + contentId: freezed == contentId + ? _value.contentId + : contentId // ignore: cast_nullable_to_non_nullable + as int?, + contentSlug: freezed == contentSlug + ? _value.contentSlug + : contentSlug // ignore: cast_nullable_to_non_nullable + as String?, + complainInfo: null == complainInfo + ? _value.complainInfo + : complainInfo // ignore: cast_nullable_to_non_nullable + as ComplainModel, + )); } } /// @nodoc class _$ComplainingStateImpl implements _ComplainingState { - _$ComplainingStateImpl({ - this.isLoading = false, - this.wasSentSuccessfully = null, - this.category = null, - this.contentType = null, - this.contentId = null, - this.contentSlug = null, - this.complainInfo = const ComplainModel(), - }); + _$ComplainingStateImpl( + {this.isLoading = false, + this.wasSentSuccessfully = null, + this.category = null, + this.contentType = null, + this.contentId = null, + this.contentSlug = null, + this.complainInfo = const ComplainModel()}); @override @JsonKey() @@ -277,16 +251,8 @@ class _$ComplainingStateImpl implements _ComplainingState { } @override - int get hashCode => Object.hash( - runtimeType, - isLoading, - wasSentSuccessfully, - category, - contentType, - contentId, - contentSlug, - complainInfo, - ); + int get hashCode => Object.hash(runtimeType, isLoading, wasSentSuccessfully, + category, contentType, contentId, contentSlug, complainInfo); /// Create a copy of ComplainingState /// with the given fields replaced by the non-null parameter values. @@ -295,21 +261,18 @@ class _$ComplainingStateImpl implements _ComplainingState { @pragma('vm:prefer-inline') _$$ComplainingStateImplCopyWith<_$ComplainingStateImpl> get copyWith => __$$ComplainingStateImplCopyWithImpl<_$ComplainingStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _ComplainingState implements ComplainingState { - factory _ComplainingState({ - final bool isLoading, - final bool? wasSentSuccessfully, - final ComplainType? category, - final ComplainedContent? contentType, - final int? contentId, - final String? contentSlug, - final ComplainModel complainInfo, - }) = _$ComplainingStateImpl; + factory _ComplainingState( + {final bool isLoading, + final bool? wasSentSuccessfully, + final ComplainType? category, + final ComplainedContent? contentType, + final int? contentId, + final String? contentSlug, + final ComplainModel complainInfo}) = _$ComplainingStateImpl; @override bool get isLoading; diff --git a/lib/features/consultant/become_consultant/models/consultant_profile_model.freezed.dart b/lib/features/consultant/become_consultant/models/consultant_profile_model.freezed.dart index 381e21ee..d320c937 100644 --- a/lib/features/consultant/become_consultant/models/consultant_profile_model.freezed.dart +++ b/lib/features/consultant/become_consultant/models/consultant_profile_model.freezed.dart @@ -12,12 +12,10 @@ part of 'consultant_profile_model.dart'; 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', -); + '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'); ConsultantProfileModel _$ConsultantProfileModelFromJson( - Map json, -) { + Map json) { return _ConsultantProfileModel.fromJson(json); } @@ -45,29 +43,25 @@ mixin _$ConsultantProfileModel { /// @nodoc abstract class $ConsultantProfileModelCopyWith<$Res> { - factory $ConsultantProfileModelCopyWith( - ConsultantProfileModel value, - $Res Function(ConsultantProfileModel) then, - ) = _$ConsultantProfileModelCopyWithImpl<$Res, ConsultantProfileModel>; + factory $ConsultantProfileModelCopyWith(ConsultantProfileModel value, + $Res Function(ConsultantProfileModel) then) = + _$ConsultantProfileModelCopyWithImpl<$Res, ConsultantProfileModel>; @useResult - $Res call({ - @JsonKey(name: 'has_medical_education', includeIfNull: false) - bool? hasMedicalEducation, - @JsonKey(name: 'social_links', includeIfNull: false) - SocialLinksModel? socialLinks, - @JsonKey(name: 'cert_photos', includeIfNull: false) List? photos, - @JsonKey(name: 'completed_courses', includeIfNull: false) - List? certificates, - }); + $Res call( + {@JsonKey(name: 'has_medical_education', includeIfNull: false) + bool? hasMedicalEducation, + @JsonKey(name: 'social_links', includeIfNull: false) + SocialLinksModel? socialLinks, + @JsonKey(name: 'cert_photos', includeIfNull: false) List? photos, + @JsonKey(name: 'completed_courses', includeIfNull: false) + List? certificates}); $SocialLinksModelCopyWith<$Res>? get socialLinks; } /// @nodoc -class _$ConsultantProfileModelCopyWithImpl< - $Res, - $Val extends ConsultantProfileModel -> +class _$ConsultantProfileModelCopyWithImpl<$Res, + $Val extends ConsultantProfileModel> implements $ConsultantProfileModelCopyWith<$Res> { _$ConsultantProfileModelCopyWithImpl(this._value, this._then); @@ -86,31 +80,24 @@ class _$ConsultantProfileModelCopyWithImpl< Object? photos = freezed, Object? certificates = freezed, }) { - return _then( - _value.copyWith( - hasMedicalEducation: - freezed == hasMedicalEducation - ? _value.hasMedicalEducation - : hasMedicalEducation // ignore: cast_nullable_to_non_nullable - as bool?, - socialLinks: - freezed == socialLinks - ? _value.socialLinks - : socialLinks // ignore: cast_nullable_to_non_nullable - as SocialLinksModel?, - photos: - freezed == photos - ? _value.photos - : photos // ignore: cast_nullable_to_non_nullable - as List?, - certificates: - freezed == certificates - ? _value.certificates - : certificates // ignore: cast_nullable_to_non_nullable - as List?, - ) - as $Val, - ); + return _then(_value.copyWith( + hasMedicalEducation: freezed == hasMedicalEducation + ? _value.hasMedicalEducation + : hasMedicalEducation // ignore: cast_nullable_to_non_nullable + as bool?, + socialLinks: freezed == socialLinks + ? _value.socialLinks + : socialLinks // ignore: cast_nullable_to_non_nullable + as SocialLinksModel?, + photos: freezed == photos + ? _value.photos + : photos // ignore: cast_nullable_to_non_nullable + as List?, + certificates: freezed == certificates + ? _value.certificates + : certificates // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); } /// Create a copy of ConsultantProfileModel @@ -132,20 +119,19 @@ class _$ConsultantProfileModelCopyWithImpl< abstract class _$$ConsultantProfileModelImplCopyWith<$Res> implements $ConsultantProfileModelCopyWith<$Res> { factory _$$ConsultantProfileModelImplCopyWith( - _$ConsultantProfileModelImpl value, - $Res Function(_$ConsultantProfileModelImpl) then, - ) = __$$ConsultantProfileModelImplCopyWithImpl<$Res>; + _$ConsultantProfileModelImpl value, + $Res Function(_$ConsultantProfileModelImpl) then) = + __$$ConsultantProfileModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'has_medical_education', includeIfNull: false) - bool? hasMedicalEducation, - @JsonKey(name: 'social_links', includeIfNull: false) - SocialLinksModel? socialLinks, - @JsonKey(name: 'cert_photos', includeIfNull: false) List? photos, - @JsonKey(name: 'completed_courses', includeIfNull: false) - List? certificates, - }); + $Res call( + {@JsonKey(name: 'has_medical_education', includeIfNull: false) + bool? hasMedicalEducation, + @JsonKey(name: 'social_links', includeIfNull: false) + SocialLinksModel? socialLinks, + @JsonKey(name: 'cert_photos', includeIfNull: false) List? photos, + @JsonKey(name: 'completed_courses', includeIfNull: false) + List? certificates}); @override $SocialLinksModelCopyWith<$Res>? get socialLinks; @@ -153,13 +139,13 @@ abstract class _$$ConsultantProfileModelImplCopyWith<$Res> /// @nodoc class __$$ConsultantProfileModelImplCopyWithImpl<$Res> - extends - _$ConsultantProfileModelCopyWithImpl<$Res, _$ConsultantProfileModelImpl> + extends _$ConsultantProfileModelCopyWithImpl<$Res, + _$ConsultantProfileModelImpl> implements _$$ConsultantProfileModelImplCopyWith<$Res> { __$$ConsultantProfileModelImplCopyWithImpl( - _$ConsultantProfileModelImpl _value, - $Res Function(_$ConsultantProfileModelImpl) _then, - ) : super(_value, _then); + _$ConsultantProfileModelImpl _value, + $Res Function(_$ConsultantProfileModelImpl) _then) + : super(_value, _then); /// Create a copy of ConsultantProfileModel /// with the given fields replaced by the non-null parameter values. @@ -171,46 +157,40 @@ class __$$ConsultantProfileModelImplCopyWithImpl<$Res> Object? photos = freezed, Object? certificates = freezed, }) { - return _then( - _$ConsultantProfileModelImpl( - hasMedicalEducation: - freezed == hasMedicalEducation - ? _value.hasMedicalEducation - : hasMedicalEducation // ignore: cast_nullable_to_non_nullable - as bool?, - socialLinks: - freezed == socialLinks - ? _value.socialLinks - : socialLinks // ignore: cast_nullable_to_non_nullable - as SocialLinksModel?, - photos: - freezed == photos - ? _value._photos - : photos // ignore: cast_nullable_to_non_nullable - as List?, - certificates: - freezed == certificates - ? _value._certificates - : certificates // ignore: cast_nullable_to_non_nullable - as List?, - ), - ); + return _then(_$ConsultantProfileModelImpl( + hasMedicalEducation: freezed == hasMedicalEducation + ? _value.hasMedicalEducation + : hasMedicalEducation // ignore: cast_nullable_to_non_nullable + as bool?, + socialLinks: freezed == socialLinks + ? _value.socialLinks + : socialLinks // ignore: cast_nullable_to_non_nullable + as SocialLinksModel?, + photos: freezed == photos + ? _value._photos + : photos // ignore: cast_nullable_to_non_nullable + as List?, + certificates: freezed == certificates + ? _value._certificates + : certificates // ignore: cast_nullable_to_non_nullable + as List?, + )); } } /// @nodoc @JsonSerializable() class _$ConsultantProfileModelImpl implements _ConsultantProfileModel { - const _$ConsultantProfileModelImpl({ - @JsonKey(name: 'has_medical_education', includeIfNull: false) - this.hasMedicalEducation, - @JsonKey(name: 'social_links', includeIfNull: false) this.socialLinks, - @JsonKey(name: 'cert_photos', includeIfNull: false) - final List? photos, - @JsonKey(name: 'completed_courses', includeIfNull: false) - final List? certificates, - }) : _photos = photos, - _certificates = certificates; + const _$ConsultantProfileModelImpl( + {@JsonKey(name: 'has_medical_education', includeIfNull: false) + this.hasMedicalEducation, + @JsonKey(name: 'social_links', includeIfNull: false) this.socialLinks, + @JsonKey(name: 'cert_photos', includeIfNull: false) + final List? photos, + @JsonKey(name: 'completed_courses', includeIfNull: false) + final List? certificates}) + : _photos = photos, + _certificates = certificates; factory _$ConsultantProfileModelImpl.fromJson(Map json) => _$$ConsultantProfileModelImplFromJson(json); @@ -258,21 +238,18 @@ class _$ConsultantProfileModelImpl implements _ConsultantProfileModel { (identical(other.socialLinks, socialLinks) || other.socialLinks == socialLinks) && const DeepCollectionEquality().equals(other._photos, _photos) && - const DeepCollectionEquality().equals( - other._certificates, - _certificates, - )); + const DeepCollectionEquality() + .equals(other._certificates, _certificates)); } @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - hasMedicalEducation, - socialLinks, - const DeepCollectionEquality().hash(_photos), - const DeepCollectionEquality().hash(_certificates), - ); + runtimeType, + hasMedicalEducation, + socialLinks, + const DeepCollectionEquality().hash(_photos), + const DeepCollectionEquality().hash(_certificates)); /// Create a copy of ConsultantProfileModel /// with the given fields replaced by the non-null parameter values. @@ -280,29 +257,28 @@ class _$ConsultantProfileModelImpl implements _ConsultantProfileModel { @override @pragma('vm:prefer-inline') _$$ConsultantProfileModelImplCopyWith<_$ConsultantProfileModelImpl> - get copyWith => - __$$ConsultantProfileModelImplCopyWithImpl<_$ConsultantProfileModelImpl>( - this, - _$identity, - ); + get copyWith => __$$ConsultantProfileModelImplCopyWithImpl< + _$ConsultantProfileModelImpl>(this, _$identity); @override Map toJson() { - return _$$ConsultantProfileModelImplToJson(this); + return _$$ConsultantProfileModelImplToJson( + this, + ); } } abstract class _ConsultantProfileModel implements ConsultantProfileModel { - const factory _ConsultantProfileModel({ - @JsonKey(name: 'has_medical_education', includeIfNull: false) - final bool? hasMedicalEducation, - @JsonKey(name: 'social_links', includeIfNull: false) - final SocialLinksModel? socialLinks, - @JsonKey(name: 'cert_photos', includeIfNull: false) - final List? photos, - @JsonKey(name: 'completed_courses', includeIfNull: false) - final List? certificates, - }) = _$ConsultantProfileModelImpl; + const factory _ConsultantProfileModel( + {@JsonKey(name: 'has_medical_education', includeIfNull: false) + final bool? hasMedicalEducation, + @JsonKey(name: 'social_links', includeIfNull: false) + final SocialLinksModel? socialLinks, + @JsonKey(name: 'cert_photos', includeIfNull: false) + final List? photos, + @JsonKey(name: 'completed_courses', includeIfNull: false) + final List? certificates}) = + _$ConsultantProfileModelImpl; factory _ConsultantProfileModel.fromJson(Map json) = _$ConsultantProfileModelImpl.fromJson; @@ -325,7 +301,7 @@ abstract class _ConsultantProfileModel implements ConsultantProfileModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$ConsultantProfileModelImplCopyWith<_$ConsultantProfileModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } SocialLinksModel _$SocialLinksModelFromJson(Map json) { @@ -358,18 +334,16 @@ mixin _$SocialLinksModel { /// @nodoc abstract class $SocialLinksModelCopyWith<$Res> { factory $SocialLinksModelCopyWith( - SocialLinksModel value, - $Res Function(SocialLinksModel) then, - ) = _$SocialLinksModelCopyWithImpl<$Res, SocialLinksModel>; + SocialLinksModel value, $Res Function(SocialLinksModel) then) = + _$SocialLinksModelCopyWithImpl<$Res, SocialLinksModel>; @useResult - $Res call({ - @JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink, - @JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink, - @JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink, - @JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink, - @JsonKey(name: 'personal_site_link', includeIfNull: false) - String? personalSiteLink, - }); + $Res call( + {@JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink, + @JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink, + @JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink, + @JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink, + @JsonKey(name: 'personal_site_link', includeIfNull: false) + String? personalSiteLink}); } /// @nodoc @@ -393,66 +367,55 @@ class _$SocialLinksModelCopyWithImpl<$Res, $Val extends SocialLinksModel> Object? instaLink = freezed, Object? personalSiteLink = freezed, }) { - return _then( - _value.copyWith( - vkLink: - freezed == vkLink - ? _value.vkLink - : vkLink // ignore: cast_nullable_to_non_nullable - as String?, - tgLink: - freezed == tgLink - ? _value.tgLink - : tgLink // ignore: cast_nullable_to_non_nullable - as String?, - fbLink: - freezed == fbLink - ? _value.fbLink - : fbLink // ignore: cast_nullable_to_non_nullable - as String?, - instaLink: - freezed == instaLink - ? _value.instaLink - : instaLink // ignore: cast_nullable_to_non_nullable - as String?, - personalSiteLink: - freezed == personalSiteLink - ? _value.personalSiteLink - : personalSiteLink // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + vkLink: freezed == vkLink + ? _value.vkLink + : vkLink // ignore: cast_nullable_to_non_nullable + as String?, + tgLink: freezed == tgLink + ? _value.tgLink + : tgLink // ignore: cast_nullable_to_non_nullable + as String?, + fbLink: freezed == fbLink + ? _value.fbLink + : fbLink // ignore: cast_nullable_to_non_nullable + as String?, + instaLink: freezed == instaLink + ? _value.instaLink + : instaLink // ignore: cast_nullable_to_non_nullable + as String?, + personalSiteLink: freezed == personalSiteLink + ? _value.personalSiteLink + : personalSiteLink // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } } /// @nodoc abstract class _$$SocialLinksModelImplCopyWith<$Res> implements $SocialLinksModelCopyWith<$Res> { - factory _$$SocialLinksModelImplCopyWith( - _$SocialLinksModelImpl value, - $Res Function(_$SocialLinksModelImpl) then, - ) = __$$SocialLinksModelImplCopyWithImpl<$Res>; + factory _$$SocialLinksModelImplCopyWith(_$SocialLinksModelImpl value, + $Res Function(_$SocialLinksModelImpl) then) = + __$$SocialLinksModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink, - @JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink, - @JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink, - @JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink, - @JsonKey(name: 'personal_site_link', includeIfNull: false) - String? personalSiteLink, - }); + $Res call( + {@JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink, + @JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink, + @JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink, + @JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink, + @JsonKey(name: 'personal_site_link', includeIfNull: false) + String? personalSiteLink}); } /// @nodoc class __$$SocialLinksModelImplCopyWithImpl<$Res> extends _$SocialLinksModelCopyWithImpl<$Res, _$SocialLinksModelImpl> implements _$$SocialLinksModelImplCopyWith<$Res> { - __$$SocialLinksModelImplCopyWithImpl( - _$SocialLinksModelImpl _value, - $Res Function(_$SocialLinksModelImpl) _then, - ) : super(_value, _then); + __$$SocialLinksModelImplCopyWithImpl(_$SocialLinksModelImpl _value, + $Res Function(_$SocialLinksModelImpl) _then) + : super(_value, _then); /// Create a copy of SocialLinksModel /// with the given fields replaced by the non-null parameter values. @@ -465,49 +428,41 @@ class __$$SocialLinksModelImplCopyWithImpl<$Res> Object? instaLink = freezed, Object? personalSiteLink = freezed, }) { - return _then( - _$SocialLinksModelImpl( - vkLink: - freezed == vkLink - ? _value.vkLink - : vkLink // ignore: cast_nullable_to_non_nullable - as String?, - tgLink: - freezed == tgLink - ? _value.tgLink - : tgLink // ignore: cast_nullable_to_non_nullable - as String?, - fbLink: - freezed == fbLink - ? _value.fbLink - : fbLink // ignore: cast_nullable_to_non_nullable - as String?, - instaLink: - freezed == instaLink - ? _value.instaLink - : instaLink // ignore: cast_nullable_to_non_nullable - as String?, - personalSiteLink: - freezed == personalSiteLink - ? _value.personalSiteLink - : personalSiteLink // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$SocialLinksModelImpl( + vkLink: freezed == vkLink + ? _value.vkLink + : vkLink // ignore: cast_nullable_to_non_nullable + as String?, + tgLink: freezed == tgLink + ? _value.tgLink + : tgLink // ignore: cast_nullable_to_non_nullable + as String?, + fbLink: freezed == fbLink + ? _value.fbLink + : fbLink // ignore: cast_nullable_to_non_nullable + as String?, + instaLink: freezed == instaLink + ? _value.instaLink + : instaLink // ignore: cast_nullable_to_non_nullable + as String?, + personalSiteLink: freezed == personalSiteLink + ? _value.personalSiteLink + : personalSiteLink // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc @JsonSerializable() class _$SocialLinksModelImpl implements _SocialLinksModel { - const _$SocialLinksModelImpl({ - @JsonKey(name: 'vk_link', includeIfNull: false) this.vkLink, - @JsonKey(name: 'tg_link', includeIfNull: false) this.tgLink, - @JsonKey(name: 'fb_link', includeIfNull: false) this.fbLink, - @JsonKey(name: 'insta_link', includeIfNull: false) this.instaLink, - @JsonKey(name: 'personal_site_link', includeIfNull: false) - this.personalSiteLink, - }); + const _$SocialLinksModelImpl( + {@JsonKey(name: 'vk_link', includeIfNull: false) this.vkLink, + @JsonKey(name: 'tg_link', includeIfNull: false) this.tgLink, + @JsonKey(name: 'fb_link', includeIfNull: false) this.fbLink, + @JsonKey(name: 'insta_link', includeIfNull: false) this.instaLink, + @JsonKey(name: 'personal_site_link', includeIfNull: false) + this.personalSiteLink}); factory _$SocialLinksModelImpl.fromJson(Map json) => _$$SocialLinksModelImplFromJson(json); @@ -550,13 +505,7 @@ class _$SocialLinksModelImpl implements _SocialLinksModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - vkLink, - tgLink, - fbLink, - instaLink, - personalSiteLink, - ); + runtimeType, vkLink, tgLink, fbLink, instaLink, personalSiteLink); /// Create a copy of SocialLinksModel /// with the given fields replaced by the non-null parameter values. @@ -565,25 +514,25 @@ class _$SocialLinksModelImpl implements _SocialLinksModel { @pragma('vm:prefer-inline') _$$SocialLinksModelImplCopyWith<_$SocialLinksModelImpl> get copyWith => __$$SocialLinksModelImplCopyWithImpl<_$SocialLinksModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$SocialLinksModelImplToJson(this); + return _$$SocialLinksModelImplToJson( + this, + ); } } abstract class _SocialLinksModel implements SocialLinksModel { - const factory _SocialLinksModel({ - @JsonKey(name: 'vk_link', includeIfNull: false) final String? vkLink, - @JsonKey(name: 'tg_link', includeIfNull: false) final String? tgLink, - @JsonKey(name: 'fb_link', includeIfNull: false) final String? fbLink, - @JsonKey(name: 'insta_link', includeIfNull: false) final String? instaLink, - @JsonKey(name: 'personal_site_link', includeIfNull: false) - final String? personalSiteLink, - }) = _$SocialLinksModelImpl; + const factory _SocialLinksModel( + {@JsonKey(name: 'vk_link', includeIfNull: false) final String? vkLink, + @JsonKey(name: 'tg_link', includeIfNull: false) final String? tgLink, + @JsonKey(name: 'fb_link', includeIfNull: false) final String? fbLink, + @JsonKey(name: 'insta_link', includeIfNull: false) + final String? instaLink, + @JsonKey(name: 'personal_site_link', includeIfNull: false) + final String? personalSiteLink}) = _$SocialLinksModelImpl; factory _SocialLinksModel.fromJson(Map json) = _$SocialLinksModelImpl.fromJson; @@ -634,9 +583,8 @@ mixin _$CertificatesModel { /// @nodoc abstract class $CertificatesModelCopyWith<$Res> { factory $CertificatesModelCopyWith( - CertificatesModel value, - $Res Function(CertificatesModel) then, - ) = _$CertificatesModelCopyWithImpl<$Res, CertificatesModel>; + CertificatesModel value, $Res Function(CertificatesModel) then) = + _$CertificatesModelCopyWithImpl<$Res, CertificatesModel>; @useResult $Res call({String title, String date}); } @@ -655,32 +603,29 @@ class _$CertificatesModelCopyWithImpl<$Res, $Val extends CertificatesModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? title = null, Object? date = null}) { - return _then( - _value.copyWith( - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? title = null, + Object? date = null, + }) { + return _then(_value.copyWith( + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } /// @nodoc abstract class _$$CertificatesModelImplCopyWith<$Res> implements $CertificatesModelCopyWith<$Res> { - factory _$$CertificatesModelImplCopyWith( - _$CertificatesModelImpl value, - $Res Function(_$CertificatesModelImpl) then, - ) = __$$CertificatesModelImplCopyWithImpl<$Res>; + factory _$$CertificatesModelImplCopyWith(_$CertificatesModelImpl value, + $Res Function(_$CertificatesModelImpl) then) = + __$$CertificatesModelImplCopyWithImpl<$Res>; @override @useResult $Res call({String title, String date}); @@ -690,30 +635,28 @@ abstract class _$$CertificatesModelImplCopyWith<$Res> class __$$CertificatesModelImplCopyWithImpl<$Res> extends _$CertificatesModelCopyWithImpl<$Res, _$CertificatesModelImpl> implements _$$CertificatesModelImplCopyWith<$Res> { - __$$CertificatesModelImplCopyWithImpl( - _$CertificatesModelImpl _value, - $Res Function(_$CertificatesModelImpl) _then, - ) : super(_value, _then); + __$$CertificatesModelImplCopyWithImpl(_$CertificatesModelImpl _value, + $Res Function(_$CertificatesModelImpl) _then) + : super(_value, _then); /// Create a copy of CertificatesModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? title = null, Object? date = null}) { - return _then( - _$CertificatesModelImpl( - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? title = null, + Object? date = null, + }) { + return _then(_$CertificatesModelImpl( + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -755,21 +698,20 @@ class _$CertificatesModelImpl implements _CertificatesModel { @pragma('vm:prefer-inline') _$$CertificatesModelImplCopyWith<_$CertificatesModelImpl> get copyWith => __$$CertificatesModelImplCopyWithImpl<_$CertificatesModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$CertificatesModelImplToJson(this); + return _$$CertificatesModelImplToJson( + this, + ); } } abstract class _CertificatesModel implements CertificatesModel { - const factory _CertificatesModel({ - required final String title, - required final String date, - }) = _$CertificatesModelImpl; + const factory _CertificatesModel( + {required final String title, + required final String date}) = _$CertificatesModelImpl; factory _CertificatesModel.fromJson(Map json) = _$CertificatesModelImpl.fromJson; diff --git a/lib/features/consultant/become_consultant/models/consultant_profile_model.g.dart b/lib/features/consultant/become_consultant/models/consultant_profile_model.g.dart index deaca4ff..e66c2cee 100644 --- a/lib/features/consultant/become_consultant/models/consultant_profile_model.g.dart +++ b/lib/features/consultant/become_consultant/models/consultant_profile_model.g.dart @@ -7,60 +7,62 @@ part of 'consultant_profile_model.dart'; // ************************************************************************** _$ConsultantProfileModelImpl _$$ConsultantProfileModelImplFromJson( - Map json, -) => _$ConsultantProfileModelImpl( - hasMedicalEducation: json['has_medical_education'] as bool?, - socialLinks: - json['social_links'] == null + Map json) => + _$ConsultantProfileModelImpl( + hasMedicalEducation: json['has_medical_education'] as bool?, + socialLinks: json['social_links'] == null ? null : SocialLinksModel.fromJson( - json['social_links'] as Map, - ), - photos: - (json['cert_photos'] as List?)?.map((e) => e as String).toList(), - certificates: - (json['completed_courses'] as List?) + json['social_links'] as Map), + photos: (json['cert_photos'] as List?) + ?.map((e) => e as String) + .toList(), + certificates: (json['completed_courses'] as List?) ?.map((e) => CertificatesModel.fromJson(e as Map)) .toList(), -); + ); Map _$$ConsultantProfileModelImplToJson( - _$ConsultantProfileModelImpl instance, -) => { - if (instance.hasMedicalEducation case final value?) - 'has_medical_education': value, - if (instance.socialLinks case final value?) 'social_links': value, - if (instance.photos case final value?) 'cert_photos': value, - if (instance.certificates case final value?) 'completed_courses': value, -}; + _$ConsultantProfileModelImpl instance) => + { + if (instance.hasMedicalEducation case final value?) + 'has_medical_education': value, + if (instance.socialLinks case final value?) 'social_links': value, + if (instance.photos case final value?) 'cert_photos': value, + if (instance.certificates case final value?) 'completed_courses': value, + }; _$SocialLinksModelImpl _$$SocialLinksModelImplFromJson( - Map json, -) => _$SocialLinksModelImpl( - vkLink: json['vk_link'] as String?, - tgLink: json['tg_link'] as String?, - fbLink: json['fb_link'] as String?, - instaLink: json['insta_link'] as String?, - personalSiteLink: json['personal_site_link'] as String?, -); + Map json) => + _$SocialLinksModelImpl( + vkLink: json['vk_link'] as String?, + tgLink: json['tg_link'] as String?, + fbLink: json['fb_link'] as String?, + instaLink: json['insta_link'] as String?, + personalSiteLink: json['personal_site_link'] as String?, + ); Map _$$SocialLinksModelImplToJson( - _$SocialLinksModelImpl instance, -) => { - if (instance.vkLink case final value?) 'vk_link': value, - if (instance.tgLink case final value?) 'tg_link': value, - if (instance.fbLink case final value?) 'fb_link': value, - if (instance.instaLink case final value?) 'insta_link': value, - if (instance.personalSiteLink case final value?) 'personal_site_link': value, -}; + _$SocialLinksModelImpl instance) => + { + if (instance.vkLink case final value?) 'vk_link': value, + if (instance.tgLink case final value?) 'tg_link': value, + if (instance.fbLink case final value?) 'fb_link': value, + if (instance.instaLink case final value?) 'insta_link': value, + if (instance.personalSiteLink case final value?) + 'personal_site_link': value, + }; _$CertificatesModelImpl _$$CertificatesModelImplFromJson( - Map json, -) => _$CertificatesModelImpl( - title: json['title'] as String, - date: json['date'] as String, -); + Map json) => + _$CertificatesModelImpl( + title: json['title'] as String, + date: json['date'] as String, + ); Map _$$CertificatesModelImplToJson( - _$CertificatesModelImpl instance, -) => {'title': instance.title, 'date': instance.date}; + _$CertificatesModelImpl instance) => + { + 'title': instance.title, + 'date': instance.date, + }; diff --git a/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart b/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart index b0d9d28d..a7171f89 100644 --- a/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart +++ b/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart @@ -12,7 +12,7 @@ class RegisterConsultantCubit extends Cubit { RegisterConsultantCubit({ required this.consultantRepository, }) : super( - RegisterConsultantState( + const RegisterConsultantState( consultant: ConsultantProfileModel( socialLinks: SocialLinksModel(), hasMedicalEducation: true, diff --git a/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_state.freezed.dart b/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_state.freezed.dart index 9fda3f44..1bd087fe 100644 --- a/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_state.freezed.dart +++ b/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_state.freezed.dart @@ -12,8 +12,7 @@ part of 'register_consultant_state.dart'; 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', -); + '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'); /// @nodoc mixin _$RegisterConsultantState { @@ -29,10 +28,9 @@ mixin _$RegisterConsultantState { /// @nodoc abstract class $RegisterConsultantStateCopyWith<$Res> { - factory $RegisterConsultantStateCopyWith( - RegisterConsultantState value, - $Res Function(RegisterConsultantState) then, - ) = _$RegisterConsultantStateCopyWithImpl<$Res, RegisterConsultantState>; + factory $RegisterConsultantStateCopyWith(RegisterConsultantState value, + $Res Function(RegisterConsultantState) then) = + _$RegisterConsultantStateCopyWithImpl<$Res, RegisterConsultantState>; @useResult $Res call({ConsultantProfileModel consultant, bool acceptOffer}); @@ -40,10 +38,8 @@ abstract class $RegisterConsultantStateCopyWith<$Res> { } /// @nodoc -class _$RegisterConsultantStateCopyWithImpl< - $Res, - $Val extends RegisterConsultantState -> +class _$RegisterConsultantStateCopyWithImpl<$Res, + $Val extends RegisterConsultantState> implements $RegisterConsultantStateCopyWith<$Res> { _$RegisterConsultantStateCopyWithImpl(this._value, this._then); @@ -56,22 +52,20 @@ class _$RegisterConsultantStateCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? consultant = null, Object? acceptOffer = null}) { - return _then( - _value.copyWith( - consultant: - null == consultant - ? _value.consultant - : consultant // ignore: cast_nullable_to_non_nullable - as ConsultantProfileModel, - acceptOffer: - null == acceptOffer - ? _value.acceptOffer - : acceptOffer // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + $Res call({ + Object? consultant = null, + Object? acceptOffer = null, + }) { + return _then(_value.copyWith( + consultant: null == consultant + ? _value.consultant + : consultant // ignore: cast_nullable_to_non_nullable + as ConsultantProfileModel, + acceptOffer: null == acceptOffer + ? _value.acceptOffer + : acceptOffer // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } /// Create a copy of RegisterConsultantState @@ -89,9 +83,9 @@ class _$RegisterConsultantStateCopyWithImpl< abstract class _$$RegisterConsultantStateImplCopyWith<$Res> implements $RegisterConsultantStateCopyWith<$Res> { factory _$$RegisterConsultantStateImplCopyWith( - _$RegisterConsultantStateImpl value, - $Res Function(_$RegisterConsultantStateImpl) then, - ) = __$$RegisterConsultantStateImplCopyWithImpl<$Res>; + _$RegisterConsultantStateImpl value, + $Res Function(_$RegisterConsultantStateImpl) then) = + __$$RegisterConsultantStateImplCopyWithImpl<$Res>; @override @useResult $Res call({ConsultantProfileModel consultant, bool acceptOffer}); @@ -102,46 +96,40 @@ abstract class _$$RegisterConsultantStateImplCopyWith<$Res> /// @nodoc class __$$RegisterConsultantStateImplCopyWithImpl<$Res> - extends - _$RegisterConsultantStateCopyWithImpl< - $Res, - _$RegisterConsultantStateImpl - > + extends _$RegisterConsultantStateCopyWithImpl<$Res, + _$RegisterConsultantStateImpl> implements _$$RegisterConsultantStateImplCopyWith<$Res> { __$$RegisterConsultantStateImplCopyWithImpl( - _$RegisterConsultantStateImpl _value, - $Res Function(_$RegisterConsultantStateImpl) _then, - ) : super(_value, _then); + _$RegisterConsultantStateImpl _value, + $Res Function(_$RegisterConsultantStateImpl) _then) + : super(_value, _then); /// Create a copy of RegisterConsultantState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? consultant = null, Object? acceptOffer = null}) { - return _then( - _$RegisterConsultantStateImpl( - consultant: - null == consultant - ? _value.consultant - : consultant // ignore: cast_nullable_to_non_nullable - as ConsultantProfileModel, - acceptOffer: - null == acceptOffer - ? _value.acceptOffer - : acceptOffer // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + $Res call({ + Object? consultant = null, + Object? acceptOffer = null, + }) { + return _then(_$RegisterConsultantStateImpl( + consultant: null == consultant + ? _value.consultant + : consultant // ignore: cast_nullable_to_non_nullable + as ConsultantProfileModel, + acceptOffer: null == acceptOffer + ? _value.acceptOffer + : acceptOffer // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc class _$RegisterConsultantStateImpl implements _RegisterConsultantState { - const _$RegisterConsultantStateImpl({ - required this.consultant, - required this.acceptOffer, - }); + const _$RegisterConsultantStateImpl( + {required this.consultant, required this.acceptOffer}); @override final ConsultantProfileModel consultant; @@ -173,16 +161,14 @@ class _$RegisterConsultantStateImpl implements _RegisterConsultantState { @override @pragma('vm:prefer-inline') _$$RegisterConsultantStateImplCopyWith<_$RegisterConsultantStateImpl> - get copyWith => __$$RegisterConsultantStateImplCopyWithImpl< - _$RegisterConsultantStateImpl - >(this, _$identity); + get copyWith => __$$RegisterConsultantStateImplCopyWithImpl< + _$RegisterConsultantStateImpl>(this, _$identity); } abstract class _RegisterConsultantState implements RegisterConsultantState { - const factory _RegisterConsultantState({ - required final ConsultantProfileModel consultant, - required final bool acceptOffer, - }) = _$RegisterConsultantStateImpl; + const factory _RegisterConsultantState( + {required final ConsultantProfileModel consultant, + required final bool acceptOffer}) = _$RegisterConsultantStateImpl; @override ConsultantProfileModel get consultant; @@ -194,5 +180,5 @@ abstract class _RegisterConsultantState implements RegisterConsultantState { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$RegisterConsultantStateImplCopyWith<_$RegisterConsultantStateImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart index c7049bff..c559654c 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart @@ -30,13 +30,13 @@ class _AdditionalSettingsScreenState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, top: 16), + padding: const EdgeInsets.only(bottom: 80, top: 16), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), child: Text( 'Дополнительные настройки', style: TextStyle( @@ -82,11 +82,11 @@ class _AdditionalSettingsScreenState extends State { required bool value, }) { return ListTile( - contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 4), + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), onTap: onTap, title: Text( title, - style: TextStyle( + style: const TextStyle( fontSize: 18, fontWeight: FontWeight.w400, height: 1, diff --git a/lib/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart index 8b4f969b..bcffc6e4 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart @@ -14,16 +14,16 @@ class _BecomeConsultantScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Стать консультантом'), + title: const Text('Стать консультантом'), automaticallyImplyLeading: false, centerTitle: false, leading: IconButton( onPressed: () => GoRouter.of(context).pop(), - icon: Icon(Icons.close), + icon: const Icon(Icons.close), ), ), - body: Padding( - padding: const EdgeInsets.all(16), + body: const Padding( + padding: EdgeInsets.all(16), child: Text( 'Чтобы стать консультантом необходимо пройти короткую регистрацию. Подготовьте свои дипломы и/или сертификаты в формате jpg, они Вам пригодятся для проверки и подтверждения. Также необходимо будет указать ссылки на Ваши соц. сети и указать тип лица (физ. лицо или юр. лицо). На данный момент доступна регистрация в качестве физ. лица.\n\nВнутри Итвио разница между обычным пользователем и консультантом заключается в дополнительных возможностях последнего создавать публичные диеты, рецепты и планы питания; участвовать в ежемесячных рейтингах.', style: TextStyle( @@ -46,7 +46,7 @@ class _BecomeConsultantScreenState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Начать регистрацию', style: TextStyle( diff --git a/lib/features/consultant/become_consultant/presentation/pages/certificates_and_diplomas_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/certificates_and_diplomas_screen.dart index cef02ded..6e49d3b3 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/certificates_and_diplomas_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/certificates_and_diplomas_screen.dart @@ -52,12 +52,12 @@ class _CertificatesAndDiplomasScreenState extends State _diplomaInfo(diploma: diplomasList[index]), separatorBuilder: (context, index) => Padding( padding: const EdgeInsets.symmetric(vertical: 16), @@ -117,14 +117,14 @@ class _CertificatesAndDiplomasScreenState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, top: 16), + padding: const EdgeInsets.only(bottom: 80, top: 16), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), child: Text( 'Последний шаг', style: TextStyle( @@ -37,7 +37,7 @@ class _LastStepScreenState extends State { const SizedBox(height: 16), CheckboxListTile( value: checkboxState, - title: Text( + title: const Text( 'Я ознакомлен и принимаю договор публичной офёрты', style: TextStyle( fontSize: 18, @@ -63,8 +63,8 @@ class _LastStepScreenState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 4), child: TextButton( - onPressed: () async => await launchUrl(Uri.parse(baseUrl + '/oferta_bs.pdf')), - child: Text( + onPressed: () async => await launchUrl(Uri.parse('$baseUrl/oferta_bs.pdf')), + child: const Text( 'Договор офёрты', style: TextStyle( height: 1, diff --git a/lib/features/consultant/become_consultant/presentation/pages/photo_or_scans_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/photo_or_scans_screen.dart index 5a547050..672499b2 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/photo_or_scans_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/photo_or_scans_screen.dart @@ -29,12 +29,12 @@ class _PhotoOrScansScreenState extends State { Widget build(BuildContext context) { return SingleChildScrollView( physics: const BouncingScrollPhysics(), - padding: EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Загрузите фото или сканы дипломов и сертификатов', style: TextStyle( fontSize: 24, @@ -46,7 +46,7 @@ class _PhotoOrScansScreenState extends State { GridView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, childAspectRatio: 3 / 4, crossAxisSpacing: 8, @@ -67,7 +67,7 @@ class _PhotoOrScansScreenState extends State { }, child: Ink( decoration: BoxDecoration( - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), borderRadius: BorderRadius.circular(20), ), child: Icon( @@ -98,7 +98,7 @@ class _PhotoOrScansScreenState extends State { children: [ Ink( decoration: BoxDecoration( - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(20), ), image: DecorationImage( @@ -119,14 +119,14 @@ class _PhotoOrScansScreenState extends State { }); _saveState(); }, - customBorder: CircleBorder(), + customBorder: const CircleBorder(), child: Ink( - padding: EdgeInsets.all(4), - decoration: BoxDecoration( + padding: const EdgeInsets.all(4), + decoration: const BoxDecoration( color: Color(0xFFF1F2F6), shape: BoxShape.circle, ), - child: Icon( + child: const Icon( size: 20, Icons.close, color: Colors.black, diff --git a/lib/features/consultant/become_consultant/presentation/pages/registration_as_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/registration_as_screen.dart index 8320381d..5d69d36a 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/registration_as_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/registration_as_screen.dart @@ -8,21 +8,21 @@ class RegistrationAsScreen extends StatefulWidget { State createState() => _RegistrationAsScreenState(); } -enum RegistrationAsType { Physical, SelfBusy, IP, OOO } +enum RegistrationAsType { physical, selfBusy, iP, ooo } class _RegistrationAsScreenState extends State { - RegistrationAsType registrationAsType = RegistrationAsType.Physical; + RegistrationAsType registrationAsType = RegistrationAsType.physical; @override Widget build(BuildContext context) { return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, top: 16), + padding: const EdgeInsets.only(bottom: 80, top: 16), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), child: Text( 'Регистрация в качестве', style: TextStyle( @@ -34,9 +34,9 @@ class _RegistrationAsScreenState extends State { ), const SizedBox(height: 16), RadioListTile( - value: RegistrationAsType.Physical, + value: RegistrationAsType.physical, groupValue: registrationAsType, - title: Text( + title: const Text( 'Физического лица', style: TextStyle( fontSize: 18, @@ -45,12 +45,12 @@ class _RegistrationAsScreenState extends State { ), activeColor: appTheme.blueA400, onChanged: (value) {}, - contentPadding: EdgeInsets.symmetric(horizontal: 8), + contentPadding: const EdgeInsets.symmetric(horizontal: 8), ), RadioListTile( - value: RegistrationAsType.SelfBusy, + value: RegistrationAsType.selfBusy, groupValue: registrationAsType, - title: Text( + title: const Text( 'Самозанятого', style: TextStyle( fontSize: 18, @@ -58,12 +58,12 @@ class _RegistrationAsScreenState extends State { ), ), onChanged: null, - contentPadding: EdgeInsets.symmetric(horizontal: 8), + contentPadding: const EdgeInsets.symmetric(horizontal: 8), ), RadioListTile( - value: RegistrationAsType.IP, + value: RegistrationAsType.iP, groupValue: registrationAsType, - title: Text( + title: const Text( 'Индивидуального предпринимателя', style: TextStyle( fontSize: 18, @@ -71,12 +71,12 @@ class _RegistrationAsScreenState extends State { ), ), onChanged: null, - contentPadding: EdgeInsets.symmetric(horizontal: 8), + contentPadding: const EdgeInsets.symmetric(horizontal: 8), ), RadioListTile( - value: RegistrationAsType.OOO, + value: RegistrationAsType.ooo, groupValue: registrationAsType, - title: Text( + title: const Text( 'Общества с ограниченной ответственностью', style: TextStyle( fontSize: 18, @@ -84,16 +84,16 @@ class _RegistrationAsScreenState extends State { ), ), onChanged: null, - contentPadding: EdgeInsets.symmetric(horizontal: 8), + contentPadding: const EdgeInsets.symmetric(horizontal: 8), ), Padding( - padding: EdgeInsets.symmetric( + padding: const EdgeInsets.symmetric( horizontal: 16, vertical: 16, ), child: _divider(context), ), - Padding( + const Padding( padding: EdgeInsets.symmetric(horizontal: 16), child: Text( '* На данный момент регистрация доступна только в качестве физического лица. Остальные варианты скоро появятся', diff --git a/lib/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart index ed754c67..5c0076c3 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart @@ -17,21 +17,21 @@ class _SocialNetworksScreenState extends State { final telegramController = TextEditingController(); final webSiteController = TextEditingController(); - var maskFormatter = new MaskTextInputFormatter( + var maskFormatter = MaskTextInputFormatter( mask: 'https://########################################', filter: { '#': RegExp(r"[a-zA-Z. ]+"), }, type: MaskAutoCompletionType.lazy, ); - var maskTgFormatter = new MaskTextInputFormatter( + var maskTgFormatter = MaskTextInputFormatter( mask: 'https://tg.me/########################################', filter: { '#': RegExp(r"[a-zA-Z. ]+"), }, type: MaskAutoCompletionType.lazy, ); - var maskVkFormatter = new MaskTextInputFormatter( + var maskVkFormatter = MaskTextInputFormatter( mask: 'https://vk.com/########################################', filter: { '#': RegExp(r"[a-zA-Z. ]+"), @@ -50,12 +50,12 @@ class _SocialNetworksScreenState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Социальные сети', style: TextStyle( fontSize: 24, @@ -70,9 +70,9 @@ class _SocialNetworksScreenState extends State { Container( height: 52, width: 52, - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), decoration: BoxDecoration( - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), borderRadius: BorderRadius.circular(20), ), child: SvgPicture.asset( @@ -100,9 +100,9 @@ class _SocialNetworksScreenState extends State { Container( height: 52, width: 52, - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), decoration: BoxDecoration( - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), borderRadius: BorderRadius.circular(20), ), child: SvgPicture.asset( @@ -130,9 +130,9 @@ class _SocialNetworksScreenState extends State { Container( height: 52, width: 52, - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), decoration: BoxDecoration( - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), borderRadius: BorderRadius.circular(20), ), child: SvgPicture.asset( diff --git a/lib/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart index e9aa8985..28692a4c 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart @@ -39,7 +39,7 @@ class _StepperBecomeConsultantScreenState extends State Container( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), width: MediaQuery.of(context).size.width, child: Column( mainAxisSize: MainAxisSize.min, children: [ - Text( + const Text( 'Спасибо!\nВаши данные отправлены на модерацию', textAlign: TextAlign.center, style: TextStyle( @@ -112,7 +113,7 @@ class _StepperBecomeConsultantScreenState extends State AlertDialog( @@ -176,7 +178,7 @@ class _StepperBecomeConsultantScreenState extends State AlertDialog( actionsPadding: const EdgeInsets.symmetric(horizontal: 4), - content: Text('Примите договор публичной офёрты'), + content: const Text('Примите договор публичной офёрты'), actions: [ TextButton( child: const Text('Ок'), @@ -198,7 +200,7 @@ class _StepperBecomeConsultantScreenState extends State IconButton( - icon: Icon(Icons.close_rounded), + icon: const Icon(Icons.close_rounded), onPressed: () => GoRouter.of(context).pop(), ), ), @@ -249,7 +251,7 @@ class _StepperBecomeConsultantScreenState extends State>( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/consultant_request/photos/upload', diff --git a/lib/features/consultant_rating/models/rating_model.freezed.dart b/lib/features/consultant_rating/models/rating_model.freezed.dart index 1b17936c..74e1f0c7 100644 --- a/lib/features/consultant_rating/models/rating_model.freezed.dart +++ b/lib/features/consultant_rating/models/rating_model.freezed.dart @@ -12,8 +12,7 @@ part of 'rating_model.dart'; 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', -); + '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'); RatingModel _$RatingModelFromJson(Map json) { return _RatingModel.fromJson(json); @@ -38,9 +37,8 @@ mixin _$RatingModel { /// @nodoc abstract class $RatingModelCopyWith<$Res> { factory $RatingModelCopyWith( - RatingModel value, - $Res Function(RatingModel) then, - ) = _$RatingModelCopyWithImpl<$Res, RatingModel>; + RatingModel value, $Res Function(RatingModel) then) = + _$RatingModelCopyWithImpl<$Res, RatingModel>; @useResult $Res call({DateTime date, String title, int amount}); } @@ -64,26 +62,20 @@ class _$RatingModelCopyWithImpl<$Res, $Val extends RatingModel> Object? title = null, Object? amount = null, }) { - return _then( - _value.copyWith( - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as DateTime, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - amount: - null == amount - ? _value.amount - : amount // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + return _then(_value.copyWith( + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as DateTime, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } @@ -91,9 +83,8 @@ class _$RatingModelCopyWithImpl<$Res, $Val extends RatingModel> abstract class _$$RatingModelImplCopyWith<$Res> implements $RatingModelCopyWith<$Res> { factory _$$RatingModelImplCopyWith( - _$RatingModelImpl value, - $Res Function(_$RatingModelImpl) then, - ) = __$$RatingModelImplCopyWithImpl<$Res>; + _$RatingModelImpl value, $Res Function(_$RatingModelImpl) then) = + __$$RatingModelImplCopyWithImpl<$Res>; @override @useResult $Res call({DateTime date, String title, int amount}); @@ -104,9 +95,8 @@ class __$$RatingModelImplCopyWithImpl<$Res> extends _$RatingModelCopyWithImpl<$Res, _$RatingModelImpl> implements _$$RatingModelImplCopyWith<$Res> { __$$RatingModelImplCopyWithImpl( - _$RatingModelImpl _value, - $Res Function(_$RatingModelImpl) _then, - ) : super(_value, _then); + _$RatingModelImpl _value, $Res Function(_$RatingModelImpl) _then) + : super(_value, _then); /// Create a copy of RatingModel /// with the given fields replaced by the non-null parameter values. @@ -117,36 +107,28 @@ class __$$RatingModelImplCopyWithImpl<$Res> Object? title = null, Object? amount = null, }) { - return _then( - _$RatingModelImpl( - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as DateTime, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - amount: - null == amount - ? _value.amount - : amount // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$RatingModelImpl( + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as DateTime, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc @JsonSerializable() class _$RatingModelImpl implements _RatingModel { - _$RatingModelImpl({ - required this.date, - required this.title, - required this.amount, - }); + _$RatingModelImpl( + {required this.date, required this.title, required this.amount}); factory _$RatingModelImpl.fromJson(Map json) => _$$RatingModelImplFromJson(json); @@ -187,16 +169,17 @@ class _$RatingModelImpl implements _RatingModel { @override Map toJson() { - return _$$RatingModelImplToJson(this); + return _$$RatingModelImplToJson( + this, + ); } } abstract class _RatingModel implements RatingModel { - factory _RatingModel({ - required final DateTime date, - required final String title, - required final int amount, - }) = _$RatingModelImpl; + factory _RatingModel( + {required final DateTime date, + required final String title, + required final int amount}) = _$RatingModelImpl; factory _RatingModel.fromJson(Map json) = _$RatingModelImpl.fromJson; diff --git a/lib/features/consultant_rating/presentation/consultant_rating_screen.dart b/lib/features/consultant_rating/presentation/consultant_rating_screen.dart index 75434b3e..285e5d63 100644 --- a/lib/features/consultant_rating/presentation/consultant_rating_screen.dart +++ b/lib/features/consultant_rating/presentation/consultant_rating_screen.dart @@ -37,11 +37,11 @@ class ConsultantRatingPageContent extends StatelessWidget { body: SingleChildScrollView( child: Column( children: [ - SizedBox(height: 16), - RatingWidget( + const SizedBox(height: 16), + const RatingWidget( rating: 1058, ), - SizedBox(height: 16), + const SizedBox(height: 16), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: CustomOutlinedButton( @@ -49,15 +49,15 @@ class ConsultantRatingPageContent extends StatelessWidget { height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), onPressed: () {}, ), ), - SizedBox(height: 16), - StatisticWidget(), - SizedBox(height: 16), + const SizedBox(height: 16), + const StatisticWidget(), + const SizedBox(height: 16), RatingHistoryWidget( ratingHistory: [ RatingModel(date: DateTime.now(), title: ' djkasjdasjkdkjasjkdjkaskjdjklasjkld', amount: 201300), diff --git a/lib/features/consultant_rating/presentation/widgets/period_filter_widget.dart b/lib/features/consultant_rating/presentation/widgets/period_filter_widget.dart index e78c7b26..7ad0fa7e 100644 --- a/lib/features/consultant_rating/presentation/widgets/period_filter_widget.dart +++ b/lib/features/consultant_rating/presentation/widgets/period_filter_widget.dart @@ -51,11 +51,11 @@ class _PeriodFilterWidgetState extends State { items: periodDropDownTitles .mapIndexed( (index, value) => DropdownMenuItem( + value: periodDropDownTitles[index], child: Text( periodDropDownTitles[index], style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), - value: periodDropDownTitles[index], ), ) .toList(), diff --git a/lib/features/consultant_rating/presentation/widgets/rating_history_item.dart b/lib/features/consultant_rating/presentation/widgets/rating_history_item.dart index 0a4c052c..3a3cff6e 100644 --- a/lib/features/consultant_rating/presentation/widgets/rating_history_item.dart +++ b/lib/features/consultant_rating/presentation/widgets/rating_history_item.dart @@ -12,7 +12,7 @@ class RatingHistoryItem extends StatelessWidget { Widget build(BuildContext context) { return Container( height: 80, - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), decoration: BoxDecoration( color: appTheme.gray100, borderRadius: BorderRadius.circular(20), @@ -29,7 +29,7 @@ class RatingHistoryItem extends StatelessWidget { date.format('dd.MM.yyyy'), style: TextStyles.textXSSemibold.copyWith(color: appTheme.gray), ), - Spacer(), + const Spacer(), Text( title, style: TextStyles.textMMedium.copyWith(color: appTheme.black), diff --git a/lib/features/consultant_rating/presentation/widgets/rating_history_widget.dart b/lib/features/consultant_rating/presentation/widgets/rating_history_widget.dart index 835cc216..0413dda5 100644 --- a/lib/features/consultant_rating/presentation/widgets/rating_history_widget.dart +++ b/lib/features/consultant_rating/presentation/widgets/rating_history_widget.dart @@ -15,7 +15,7 @@ class RatingHistoryWidget extends StatelessWidget { Widget build(BuildContext context) { final s = S.of(context); return MainBackgroundBouble( - padding: EdgeInsets.only( + padding: const EdgeInsets.only( left: 16, right: 16, top: 16, @@ -28,7 +28,7 @@ class RatingHistoryWidget extends StatelessWidget { s.rating_history, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - Spacer(), + const Spacer(), SvgPicture.asset( 'assets/icons/question_mark.svg', height: 22, @@ -40,15 +40,15 @@ class RatingHistoryWidget extends StatelessWidget { ), ], ), - SizedBox( + const SizedBox( height: 16, ), - PeriodFilterWidget(), - SizedBox( + const PeriodFilterWidget(), + const SizedBox( height: 12, ), ListView.builder( - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) { return Padding( padding: index == ratingHistory.length - 1 ? EdgeInsets.zero : const EdgeInsets.only(bottom: 12), diff --git a/lib/features/consultant_rating/presentation/widgets/rating_widget.dart b/lib/features/consultant_rating/presentation/widgets/rating_widget.dart index bffdb6ff..4f7c8206 100644 --- a/lib/features/consultant_rating/presentation/widgets/rating_widget.dart +++ b/lib/features/consultant_rating/presentation/widgets/rating_widget.dart @@ -40,7 +40,7 @@ class RatingWidget extends StatelessWidget { rating.toString(), style: TextStyles.headingFS40FW600.copyWith(color: appTheme.blueA400), ), - SizedBox(height: 4), + const SizedBox(height: 4), Text( s.your_rating, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), diff --git a/lib/features/consultant_rating/presentation/widgets/statistic_bouble.dart b/lib/features/consultant_rating/presentation/widgets/statistic_bouble.dart index d306eb51..2f28ee23 100644 --- a/lib/features/consultant_rating/presentation/widgets/statistic_bouble.dart +++ b/lib/features/consultant_rating/presentation/widgets/statistic_bouble.dart @@ -10,7 +10,7 @@ class StatisticBouble extends StatelessWidget { Widget build(BuildContext context) { return Container( height: 80, - padding: EdgeInsets.symmetric(horizontal: 12), + padding: const EdgeInsets.symmetric(horizontal: 12), decoration: BoxDecoration( color: appTheme.gray100, borderRadius: BorderRadius.circular(20), @@ -22,7 +22,7 @@ class StatisticBouble extends StatelessWidget { number.toString(), style: TextStyles.headingXLSemibold.copyWith(color: appTheme.blueA400), ), - SizedBox( + const SizedBox( height: 4, ), Text( diff --git a/lib/features/consultant_rating/presentation/widgets/statistic_widget.dart b/lib/features/consultant_rating/presentation/widgets/statistic_widget.dart index 911007c1..b7f97e2b 100644 --- a/lib/features/consultant_rating/presentation/widgets/statistic_widget.dart +++ b/lib/features/consultant_rating/presentation/widgets/statistic_widget.dart @@ -14,7 +14,7 @@ class StatisticWidget extends StatelessWidget { Widget build(BuildContext context) { final s = S.of(context); return MainBackgroundBouble( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: Column( children: [ Row( @@ -23,7 +23,7 @@ class StatisticWidget extends StatelessWidget { s.statistic, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - Spacer(), + const Spacer(), SvgPicture.asset( 'assets/icons/question_mark.svg', height: 22, @@ -35,41 +35,41 @@ class StatisticWidget extends StatelessWidget { ), ], ), - SizedBox( + const SizedBox( height: 16, ), - PeriodFilterWidget(), - SizedBox( + const PeriodFilterWidget(), + const SizedBox( height: 12, ), Row( children: [ Expanded(child: StatisticBouble(number: 12, title: s.invited_people_count)), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded(child: StatisticBouble(number: 12, title: s.published_posts_count)), ], ), - SizedBox( + const SizedBox( height: 8, ), Row( children: [ Expanded(child: StatisticBouble(number: 12, title: s.published_recipes_count)), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded(child: StatisticBouble(number: 12, title: s.published_diets_count)), ], ), - SizedBox( + const SizedBox( height: 8, ), Row( children: [ Expanded(child: StatisticBouble(number: 12, title: s.consultations_count)), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded(child: StatisticBouble(number: 12, title: s.active_consultations_count)), ], ), - SizedBox( + const SizedBox( height: 8, ), ], diff --git a/lib/features/consultations/entities/consultations_entity.dart b/lib/features/consultations/entities/consultations_entity.dart index 5e3dd9e1..8b7ed8dd 100644 --- a/lib/features/consultations/entities/consultations_entity.dart +++ b/lib/features/consultations/entities/consultations_entity.dart @@ -29,11 +29,11 @@ class ConsultationsEntity { } enum LegendOfPlanDay { - Empty, // Дневник не заполнялся и никаких движений в тот день не было. - NotCompleted, // Начат дневник питания, но не закончен. - EndBuyUserDontCheck, // Дневник закончен и прокомментирован консультантом но не просмотрен пользователем. - CompletedButConsultantCommentEmpty, // Дневник заполнен, но не прокомментирован консультантом. - FullCompleted, // Дневник заполнен, прокомментирован консультантом и после этого клиент просмотрел комментарии. + empty, // Дневник не заполнялся и никаких движений в тот день не было. + notCompleted, // Начат дневник питания, но не закончен. + endBuyUserDontCheck, // Дневник закончен и прокомментирован консультантом но не просмотрен пользователем. + completedButConsultantCommentEmpty, // Дневник заполнен, но не прокомментирован консультантом. + fullCompleted, // Дневник заполнен, прокомментирован консультантом и после этого клиент просмотрел комментарии. } class DayOfPlanEntity { @@ -53,7 +53,7 @@ List generateTestData() { List testConsultations = List.generate(20, (index) { DateTime startDate = DateTime.now().subtract(Duration(days: random.nextInt(30))); - DateTime endDate = startDate.add(Duration(days: 30)); + DateTime endDate = startDate.add(const Duration(days: 30)); List days = List.generate(30, (i) { DateTime dayDate = startDate.add(Duration(days: i)); diff --git a/lib/features/consultations/presentation/pages/consultations_screen.dart b/lib/features/consultations/presentation/pages/consultations_screen.dart index b64bf260..d5b7bc18 100644 --- a/lib/features/consultations/presentation/pages/consultations_screen.dart +++ b/lib/features/consultations/presentation/pages/consultations_screen.dart @@ -8,18 +8,18 @@ class ConsultationsScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Color(0xFFF0F2F5), + backgroundColor: const Color(0xFFF0F2F5), appBar: AppBar( - title: Text('Консультации'), + title: const Text('Консультации'), centerTitle: true, - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.vertical( bottom: Radius.circular(12), ), ), ), body: ListView.separated( - padding: EdgeInsets.symmetric(vertical: 12), + padding: const EdgeInsets.symmetric(vertical: 12), itemBuilder: (context, index) => ConsultationCardWidget( consultationsEntity: testData[index], ), diff --git a/lib/features/consultations/presentation/pages/info_by_order_screen.dart b/lib/features/consultations/presentation/pages/info_by_order_screen.dart deleted file mode 100644 index a64879c8..00000000 --- a/lib/features/consultations/presentation/pages/info_by_order_screen.dart +++ /dev/null @@ -1,155 +0,0 @@ -import 'package:flutter/material.dart'; - -class InfoByOrderScreen extends StatefulWidget { - static const name = 'infoByOrderScreen'; - static const path = '/info-by-order-screen'; - - const InfoByOrderScreen({super.key}); - - @override - State createState() => _InfoByOrderScreenState(); -} - -class _InfoByOrderScreenState extends State { - bool _isHelpExpanded = false; - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(title: Text("Информация о заказе"), leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: () {})), - body: ListView( - padding: EdgeInsets.all(16.0), - children: [ - _buildProfileSection(), - SizedBox(height: 10), - _buildOrderStatus(), - SizedBox(height: 20), - _buildPlanDetails(), - SizedBox(height: 20), - _buildOptionDetails(), - SizedBox(height: 20), - _buildOrderProgress(), - SizedBox(height: 20), - _buildHelpSection(), - SizedBox(height: 20), - _buildCancelButton(), - ], - ), - ); - } - - Widget _buildProfileSection() { - return Row( - children: [ - CircleAvatar( - radius: 30, - backgroundImage: AssetImage('assets/profile.jpg'), // Замените на реальный путь - ), - SizedBox(width: 10), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("Дмитрий Коваль", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)), - Text("Консультант 128-й в рейтинге", style: TextStyle(color: Colors.grey)), - ], - ), - ], - ); - } - - Widget _buildOrderStatus() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text("Статус заказа", style: TextStyle(fontWeight: FontWeight.bold)), - Chip(label: Text("Заказ оплачен", style: TextStyle(color: Colors.white)), backgroundColor: Colors.green), - ], - ), - Text("Сумма заказа: 2500₽"), - Text("Время выполнения плана: 7 дней"), - ], - ); - } - - Widget _buildPlanDetails() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("Название плана", style: TextStyle(fontWeight: FontWeight.bold)), - Text("В мире, где технологии становятся все более..."), - SizedBox(height: 10), - Image.asset('assets/plan_image.jpg', height: 150, fit: BoxFit.cover), - ], - ); - } - - Widget _buildOptionDetails() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("Название опции", style: TextStyle(fontWeight: FontWeight.bold)), - Text("Поддержка 24/7"), - Text("Составление индивидуальной диеты"), - Text("Длинное название опции..."), - ], - ); - } - - Widget _buildOrderProgress() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("Этапы заказа", style: TextStyle(fontWeight: FontWeight.bold)), - ListTile(leading: Icon(Icons.check_circle, color: Colors.green), title: Text("Заказ создан")), - ListTile(leading: Icon(Icons.check_circle, color: Colors.green), title: Text("Выбрана дата старта")), - ListTile(leading: Icon(Icons.check_circle, color: Colors.green), title: Text("Заказ оплачен")), - ListTile(leading: Icon(Icons.radio_button_unchecked, color: Colors.grey), title: Text("В процессе")), - ListTile(leading: Icon(Icons.radio_button_unchecked, color: Colors.grey), title: Text("Завершен")), - ], - ); - } - - Widget _buildHelpSection() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListTile( - leading: Icon(Icons.help_outline), - title: Text("Помощь", style: TextStyle(fontWeight: FontWeight.bold)), - trailing: Icon(_isHelpExpanded ? Icons.expand_less : Icons.expand_more), - onTap: () { - setState(() { - _isHelpExpanded = !_isHelpExpanded; - }); - }, - ), - if (_isHelpExpanded) ...[ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("Продавец не отвечает на мои сообщения", style: TextStyle(fontWeight: FontWeight.bold)), - Text("Ответ некоторых продавцов может занять больше времени, чем вы ожидали..."), - SizedBox(height: 10), - Text("Работа, которую сдал продавец, отличалась от описания", style: TextStyle(fontWeight: FontWeight.bold)), - Text("У вас есть три дня, чтобы проверить сданную на проверку работу..."), - ], - ), - ), - ], - ], - ); - } - - Widget _buildCancelButton() { - return ElevatedButton( - style: ElevatedButton.styleFrom(backgroundColor: Colors.red, padding: EdgeInsets.symmetric(vertical: 15)), - onPressed: () {}, - child: Text("Отменить заказ", style: TextStyle(color: Colors.white)), - ); - } -} diff --git a/lib/features/consultations/presentation/widgets/consultation_card_widget.dart b/lib/features/consultations/presentation/widgets/consultation_card_widget.dart index 84bc8e68..9239e225 100644 --- a/lib/features/consultations/presentation/widgets/consultation_card_widget.dart +++ b/lib/features/consultations/presentation/widgets/consultation_card_widget.dart @@ -42,7 +42,7 @@ class ConsultationCardWidget extends StatelessWidget { children: [ Row( children: [ - CircleAvatar( + const CircleAvatar( radius: 30, ), const SizedBox(width: 12), @@ -51,7 +51,7 @@ class ConsultationCardWidget extends StatelessWidget { children: [ Text( consultationsEntity.name, - style: TextStyle( + style: const TextStyle( height: 1, color: Color(0xFF323F4B), fontSize: 16, @@ -61,7 +61,7 @@ class ConsultationCardWidget extends StatelessWidget { const SizedBox(height: 4), Text( consultationsEntity.planName, - style: TextStyle( + style: const TextStyle( height: 1, color: Color(0xFF88949F), fontSize: 14, @@ -89,14 +89,14 @@ class ConsultationCardWidget extends StatelessWidget { ), ), const SizedBox(height: 12), - CustomDivider(), + const CustomDivider(), const SizedBox(height: 12), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'День ${consultationsEntity.currentDayOfPlan} из ${consultationsEntity.totalDaysOfPlan}', - style: TextStyle( + style: const TextStyle( height: 1, color: Color(0xFF323F4B), fontSize: 16, @@ -116,7 +116,7 @@ class ConsultationCardWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text( + const Text( 'Легенда', style: TextStyle( height: 1, @@ -130,7 +130,7 @@ class ConsultationCardWidget extends StatelessWidget { shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) => _legendTitle(titles[index], legendColors[index]), - separatorBuilder: (context, index) => SizedBox(height: 16), + separatorBuilder: (context, index) => const SizedBox(height: 16), itemCount: titles.length, ), const SizedBox(height: 16), @@ -139,7 +139,7 @@ class ConsultationCardWidget extends StatelessWidget { ), ); }, - child: Icon( + child: const Icon( Icons.help_outline_rounded, color: Color(0xFF323F4B), size: 20, @@ -157,11 +157,11 @@ class ConsultationCardWidget extends StatelessWidget { headerVisible: false, calendarFormat: CalendarFormat.week, calendarStyle: CalendarStyle( - weekendDecoration: BoxDecoration( + weekendDecoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), - defaultDecoration: BoxDecoration( + defaultDecoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), @@ -169,7 +169,7 @@ class ConsultationCardWidget extends StatelessWidget { color: appTheme.blueA400, shape: BoxShape.circle, ), - todayTextStyle: TextStyle( + todayTextStyle: const TextStyle( color: Colors.black, ), todayDecoration: BoxDecoration( @@ -183,11 +183,11 @@ class ConsultationCardWidget extends StatelessWidget { ), ), const SizedBox(height: 16), - CustomDivider(), + const CustomDivider(), const SizedBox(height: 12), Text( '${consultationsEntity.paymentAmount} ₽', - style: TextStyle( + style: const TextStyle( color: Color(0xFF019A3E), fontSize: 20, fontWeight: FontWeight.w600, @@ -201,12 +201,12 @@ class ConsultationCardWidget extends StatelessWidget { onTap: () {}, child: Ink( width: MediaQuery.of(context).size.width - 32 - 52 - 8, - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Комментировать отчёт', style: TextStyle( @@ -227,9 +227,9 @@ class ConsultationCardWidget extends StatelessWidget { width: 52, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), ), - child: Center( + child: const Center( child: Icon( Icons.chat_outlined, size: 24, @@ -261,7 +261,7 @@ class ConsultationCardWidget extends StatelessWidget { Flexible( child: Text( text, - style: TextStyle( + style: const TextStyle( height: 1, fontSize: 16, fontWeight: FontWeight.w500, diff --git a/lib/features/create_diet/models/create_diet_model.freezed.dart b/lib/features/create_diet/models/create_diet_model.freezed.dart index c9e626ae..1effb5c0 100644 --- a/lib/features/create_diet/models/create_diet_model.freezed.dart +++ b/lib/features/create_diet/models/create_diet_model.freezed.dart @@ -12,8 +12,7 @@ part of 'create_diet_model.dart'; 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', -); + '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'); /// @nodoc mixin _$CreateDietModel { @@ -37,20 +36,18 @@ mixin _$CreateDietModel { /// @nodoc abstract class $CreateDietModelCopyWith<$Res> { factory $CreateDietModelCopyWith( - CreateDietModel value, - $Res Function(CreateDietModel) then, - ) = _$CreateDietModelCopyWithImpl<$Res, CreateDietModel>; + CreateDietModel value, $Res Function(CreateDietModel) then) = + _$CreateDietModelCopyWithImpl<$Res, CreateDietModel>; @useResult - $Res call({ - String? imageUrl, - String? name, - String? details, - DietState? state, - int? duration, - Map type, - XFile? image, - List>>? dailySchedule, - }); + $Res call( + {String? imageUrl, + String? name, + String? details, + DietState? state, + int? duration, + Map type, + XFile? image, + List>>? dailySchedule}); } /// @nodoc @@ -77,73 +74,60 @@ class _$CreateDietModelCopyWithImpl<$Res, $Val extends CreateDietModel> Object? image = freezed, Object? dailySchedule = freezed, }) { - return _then( - _value.copyWith( - imageUrl: - freezed == imageUrl - ? _value.imageUrl - : imageUrl // ignore: cast_nullable_to_non_nullable - as String?, - name: - freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - details: - freezed == details - ? _value.details - : details // ignore: cast_nullable_to_non_nullable - as String?, - state: - freezed == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as DietState?, - duration: - freezed == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int?, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as Map, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as XFile?, - dailySchedule: - freezed == dailySchedule - ? _value.dailySchedule - : dailySchedule // ignore: cast_nullable_to_non_nullable - as List>>?, - ) - as $Val, - ); + return _then(_value.copyWith( + imageUrl: freezed == imageUrl + ? _value.imageUrl + : imageUrl // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + details: freezed == details + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as DietState?, + duration: freezed == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as Map, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as XFile?, + dailySchedule: freezed == dailySchedule + ? _value.dailySchedule + : dailySchedule // ignore: cast_nullable_to_non_nullable + as List>>?, + ) as $Val); } } /// @nodoc abstract class _$$CreateDietModelImplCopyWith<$Res> implements $CreateDietModelCopyWith<$Res> { - factory _$$CreateDietModelImplCopyWith( - _$CreateDietModelImpl value, - $Res Function(_$CreateDietModelImpl) then, - ) = __$$CreateDietModelImplCopyWithImpl<$Res>; + factory _$$CreateDietModelImplCopyWith(_$CreateDietModelImpl value, + $Res Function(_$CreateDietModelImpl) then) = + __$$CreateDietModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String? imageUrl, - String? name, - String? details, - DietState? state, - int? duration, - Map type, - XFile? image, - List>>? dailySchedule, - }); + $Res call( + {String? imageUrl, + String? name, + String? details, + DietState? state, + int? duration, + Map type, + XFile? image, + List>>? dailySchedule}); } /// @nodoc @@ -151,9 +135,8 @@ class __$$CreateDietModelImplCopyWithImpl<$Res> extends _$CreateDietModelCopyWithImpl<$Res, _$CreateDietModelImpl> implements _$$CreateDietModelImplCopyWith<$Res> { __$$CreateDietModelImplCopyWithImpl( - _$CreateDietModelImpl _value, - $Res Function(_$CreateDietModelImpl) _then, - ) : super(_value, _then); + _$CreateDietModelImpl _value, $Res Function(_$CreateDietModelImpl) _then) + : super(_value, _then); /// Create a copy of CreateDietModel /// with the given fields replaced by the non-null parameter values. @@ -169,68 +152,58 @@ class __$$CreateDietModelImplCopyWithImpl<$Res> Object? image = freezed, Object? dailySchedule = freezed, }) { - return _then( - _$CreateDietModelImpl( - imageUrl: - freezed == imageUrl - ? _value.imageUrl - : imageUrl // ignore: cast_nullable_to_non_nullable - as String?, - name: - freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - details: - freezed == details - ? _value.details - : details // ignore: cast_nullable_to_non_nullable - as String?, - state: - freezed == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as DietState?, - duration: - freezed == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int?, - type: - null == type - ? _value._type - : type // ignore: cast_nullable_to_non_nullable - as Map, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as XFile?, - dailySchedule: - freezed == dailySchedule - ? _value._dailySchedule - : dailySchedule // ignore: cast_nullable_to_non_nullable - as List>>?, - ), - ); + return _then(_$CreateDietModelImpl( + imageUrl: freezed == imageUrl + ? _value.imageUrl + : imageUrl // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + details: freezed == details + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as DietState?, + duration: freezed == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _value._type + : type // ignore: cast_nullable_to_non_nullable + as Map, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as XFile?, + dailySchedule: freezed == dailySchedule + ? _value._dailySchedule + : dailySchedule // ignore: cast_nullable_to_non_nullable + as List>>?, + )); } } /// @nodoc class _$CreateDietModelImpl extends _CreateDietModel { - const _$CreateDietModelImpl({ - this.imageUrl, - this.name, - this.details, - this.state, - this.duration, - required final Map type, - this.image, - final List>>? dailySchedule, - }) : _type = type, - _dailySchedule = dailySchedule, - super._(); + const _$CreateDietModelImpl( + {this.imageUrl, + this.name, + this.details, + this.state, + this.duration, + required final Map type, + this.image, + final List>>? dailySchedule}) + : _type = type, + _dailySchedule = dailySchedule, + super._(); @override final String? imageUrl; @@ -281,24 +254,21 @@ class _$CreateDietModelImpl extends _CreateDietModel { other.duration == duration) && const DeepCollectionEquality().equals(other._type, _type) && (identical(other.image, image) || other.image == image) && - const DeepCollectionEquality().equals( - other._dailySchedule, - _dailySchedule, - )); + const DeepCollectionEquality() + .equals(other._dailySchedule, _dailySchedule)); } @override int get hashCode => Object.hash( - runtimeType, - imageUrl, - name, - details, - state, - duration, - const DeepCollectionEquality().hash(_type), - image, - const DeepCollectionEquality().hash(_dailySchedule), - ); + runtimeType, + imageUrl, + name, + details, + state, + duration, + const DeepCollectionEquality().hash(_type), + image, + const DeepCollectionEquality().hash(_dailySchedule)); /// Create a copy of CreateDietModel /// with the given fields replaced by the non-null parameter values. @@ -307,22 +277,20 @@ class _$CreateDietModelImpl extends _CreateDietModel { @pragma('vm:prefer-inline') _$$CreateDietModelImplCopyWith<_$CreateDietModelImpl> get copyWith => __$$CreateDietModelImplCopyWithImpl<_$CreateDietModelImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _CreateDietModel extends CreateDietModel { - const factory _CreateDietModel({ - final String? imageUrl, - final String? name, - final String? details, - final DietState? state, - final int? duration, - required final Map type, - final XFile? image, - final List>>? dailySchedule, - }) = _$CreateDietModelImpl; + const factory _CreateDietModel( + {final String? imageUrl, + final String? name, + final String? details, + final DietState? state, + final int? duration, + required final Map type, + final XFile? image, + final List>>? dailySchedule}) = + _$CreateDietModelImpl; const _CreateDietModel._() : super._(); @override diff --git a/lib/features/create_diet/presentation/create_diet_screen.dart b/lib/features/create_diet/presentation/create_diet_screen.dart index 632fb5f4..a6732979 100644 --- a/lib/features/create_diet/presentation/create_diet_screen.dart +++ b/lib/features/create_diet/presentation/create_diet_screen.dart @@ -39,7 +39,7 @@ class CreateDietScreen extends StatelessWidget { } class CreateDietScreenContent extends StatefulWidget { - CreateDietScreenContent({super.key, this.diet}); + const CreateDietScreenContent({super.key, this.diet}); final Diet? diet; @override @@ -66,18 +66,20 @@ class _CreateDietScreenContentState extends State { return BlocBuilder( builder: (context, state) { if (state.published) { - Future.delayed(Duration(milliseconds: 500), () { + Future.delayed(const Duration(milliseconds: 500), () { + if (!context.mounted) return; context.pop(); showBottomSheetWithBlur( userRootNavigator: true, context: context, child: SuccessPublishedDietBottomSheet( - title: '${state.dietData.name ?? 'Диета'}', + title: state.dietData.name ?? 'Диета', ), ); }); } else if (state.drafted) { - Future.delayed(Duration(milliseconds: 500), () { + Future.delayed(const Duration(milliseconds: 500), () { + if (!context.mounted) return; context.pop(); showBottomSheetWithBlur( context: context, @@ -103,13 +105,13 @@ class _CreateDietScreenContentState extends State { body: SingleChildScrollView( child: Column( children: [ - SizedBox(height: 8), + const SizedBox(height: 8), MainBackgroundBouble( padding: const EdgeInsets.symmetric(horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 16), + const SizedBox(height: 16), CustomTextFormField( hintText: s.enter_diet_name, controller: nameController, @@ -119,12 +121,12 @@ class _CreateDietScreenContentState extends State { }, ), if (state.dietNameError != null) ...[ - SizedBox( + const SizedBox( height: 4, ), CustomErrorWidget(error: state.dietNameError ?? ''), ], - SizedBox(height: 12), + const SizedBox(height: 12), SizedBox( height: 132, child: CustomTextFormField( @@ -141,30 +143,30 @@ class _CreateDietScreenContentState extends State { ), ), if (state.dietDescriptionError != null) ...[ - SizedBox( + const SizedBox( height: 4, ), CustomErrorWidget(error: state.dietDescriptionError ?? ''), ], - SizedBox(height: 12), - DietDurationDropDownWidget(), - SizedBox(height: 12), - StatusDropDownWidget(), - SizedBox(height: 16), - DietTypeChoiceWidget(), - SizedBox(height: 16), - DietImagePickerWidget(), - SizedBox(height: 16), + const SizedBox(height: 12), + const DietDurationDropDownWidget(), + const SizedBox(height: 12), + const StatusDropDownWidget(), + const SizedBox(height: 16), + const DietTypeChoiceWidget(), + const SizedBox(height: 16), + const DietImagePickerWidget(), + const SizedBox(height: 16), ], ), ), - SizedBox(height: 16), + const SizedBox(height: 16), MainBackgroundBouble( child: Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: Center( child: Text( - s.diet_plan + ' (${state.dietData.duration ?? 0} ' + getDayForm(state.dietData.duration ?? 0, s) + ')', + '${s.diet_plan} (${state.dietData.duration ?? 0} ${getDayForm(state.dietData.duration ?? 0, s)})', style: TextStyles.headingXLSemibold.copyWith( color: appTheme.black, ), @@ -172,16 +174,16 @@ class _CreateDietScreenContentState extends State { ), ), ), - SizedBox(height: 8), + const SizedBox(height: 8), ListView.separated( padding: const EdgeInsets.all(0), itemBuilder: (context, index) => DayWidget(index: index), itemCount: state.dietData.dailySchedule?.length ?? 0, shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - separatorBuilder: (context, index) => SizedBox(height: 8), + physics: const NeverScrollableScrollPhysics(), + separatorBuilder: (context, index) => const SizedBox(height: 8), ), - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Column( @@ -192,19 +194,20 @@ class _CreateDietScreenContentState extends State { : () async { final diet = await context.read().getDietForPreview(); if (diet == null) return; + if (!context.mounted) return; GoRouter.of(context).pushNamed(DietPreviewScreen.name, extra: diet); }, text: s.preview, height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.gray), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.dottedBorder), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), if (state.isDietPublishing) - Loader() + const Loader() else CustomOutlinedButton( onPressed: () async { @@ -213,11 +216,13 @@ class _CreateDietScreenContentState extends State { 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}'); } } @@ -226,14 +231,14 @@ class _CreateDietScreenContentState extends State { height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), ), ], ), ), - SizedBox(height: 20), + const SizedBox(height: 20), ], ), ), 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 80f1850a..8b4b646e 100644 --- a/lib/features/create_diet/presentation/cubit/create_diet_cubit.dart +++ b/lib/features/create_diet/presentation/cubit/create_diet_cubit.dart @@ -53,7 +53,7 @@ class CreateDietCubit extends Cubit { name: diet.name, duration: diet.duration, type: type, - imageUrl: baseUrl + '/storage/' + diet.image, + imageUrl: '$baseUrl/storage/${diet.image}', ), ); emit(state.copyWith(dietStateIndex: dietStateIndex, durationIndex: durationValues.indexOf(diet.duration))); diff --git a/lib/features/create_diet/presentation/cubit/create_diet_state.freezed.dart b/lib/features/create_diet/presentation/cubit/create_diet_state.freezed.dart index 63ed6466..cc266342 100644 --- a/lib/features/create_diet/presentation/cubit/create_diet_state.freezed.dart +++ b/lib/features/create_diet/presentation/cubit/create_diet_state.freezed.dart @@ -12,8 +12,7 @@ part of 'create_diet_state.dart'; 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', -); + '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'); /// @nodoc mixin _$CreateDietState { @@ -45,28 +44,26 @@ mixin _$CreateDietState { /// @nodoc abstract class $CreateDietStateCopyWith<$Res> { factory $CreateDietStateCopyWith( - CreateDietState value, - $Res Function(CreateDietState) then, - ) = _$CreateDietStateCopyWithImpl<$Res, CreateDietState>; + CreateDietState value, $Res Function(CreateDietState) then) = + _$CreateDietStateCopyWithImpl<$Res, CreateDietState>; @useResult - $Res call({ - bool isLoading, - bool isDietPublishing, - String? errorMessage, - CreateDietModel dietData, - List>? copiedDay, - String? dietNameError, - String? dietDescriptionError, - String? dietDurationError, - String? dietStateError, - String? dietImageError, - List dailyScheduleErrors, - int? durationIndex, - int? dietStateIndex, - bool published, - bool drafted, - bool isDietBeingEdited, - }); + $Res call( + {bool isLoading, + bool isDietPublishing, + String? errorMessage, + CreateDietModel dietData, + List>? copiedDay, + String? dietNameError, + String? dietDescriptionError, + String? dietDurationError, + String? dietStateError, + String? dietImageError, + List dailyScheduleErrors, + int? durationIndex, + int? dietStateIndex, + bool published, + bool drafted, + bool isDietBeingEdited}); $CreateDietModelCopyWith<$Res> get dietData; } @@ -103,91 +100,72 @@ class _$CreateDietStateCopyWithImpl<$Res, $Val extends CreateDietState> Object? drafted = null, Object? isDietBeingEdited = null, }) { - return _then( - _value.copyWith( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - isDietPublishing: - null == isDietPublishing - ? _value.isDietPublishing - : isDietPublishing // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - dietData: - null == dietData - ? _value.dietData - : dietData // ignore: cast_nullable_to_non_nullable - as CreateDietModel, - copiedDay: - freezed == copiedDay - ? _value.copiedDay - : copiedDay // ignore: cast_nullable_to_non_nullable - as List>?, - dietNameError: - freezed == dietNameError - ? _value.dietNameError - : dietNameError // ignore: cast_nullable_to_non_nullable - as String?, - dietDescriptionError: - freezed == dietDescriptionError - ? _value.dietDescriptionError - : dietDescriptionError // ignore: cast_nullable_to_non_nullable - as String?, - dietDurationError: - freezed == dietDurationError - ? _value.dietDurationError - : dietDurationError // ignore: cast_nullable_to_non_nullable - as String?, - dietStateError: - freezed == dietStateError - ? _value.dietStateError - : dietStateError // ignore: cast_nullable_to_non_nullable - as String?, - dietImageError: - freezed == dietImageError - ? _value.dietImageError - : dietImageError // ignore: cast_nullable_to_non_nullable - as String?, - dailyScheduleErrors: - null == dailyScheduleErrors - ? _value.dailyScheduleErrors - : dailyScheduleErrors // ignore: cast_nullable_to_non_nullable - as List, - durationIndex: - freezed == durationIndex - ? _value.durationIndex - : durationIndex // ignore: cast_nullable_to_non_nullable - as int?, - dietStateIndex: - freezed == dietStateIndex - ? _value.dietStateIndex - : dietStateIndex // ignore: cast_nullable_to_non_nullable - as int?, - published: - null == published - ? _value.published - : published // ignore: cast_nullable_to_non_nullable - as bool, - drafted: - null == drafted - ? _value.drafted - : drafted // ignore: cast_nullable_to_non_nullable - as bool, - isDietBeingEdited: - null == isDietBeingEdited - ? _value.isDietBeingEdited - : isDietBeingEdited // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + return _then(_value.copyWith( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + isDietPublishing: null == isDietPublishing + ? _value.isDietPublishing + : isDietPublishing // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + dietData: null == dietData + ? _value.dietData + : dietData // ignore: cast_nullable_to_non_nullable + as CreateDietModel, + copiedDay: freezed == copiedDay + ? _value.copiedDay + : copiedDay // ignore: cast_nullable_to_non_nullable + as List>?, + dietNameError: freezed == dietNameError + ? _value.dietNameError + : dietNameError // ignore: cast_nullable_to_non_nullable + as String?, + dietDescriptionError: freezed == dietDescriptionError + ? _value.dietDescriptionError + : dietDescriptionError // ignore: cast_nullable_to_non_nullable + as String?, + dietDurationError: freezed == dietDurationError + ? _value.dietDurationError + : dietDurationError // ignore: cast_nullable_to_non_nullable + as String?, + dietStateError: freezed == dietStateError + ? _value.dietStateError + : dietStateError // ignore: cast_nullable_to_non_nullable + as String?, + dietImageError: freezed == dietImageError + ? _value.dietImageError + : dietImageError // ignore: cast_nullable_to_non_nullable + as String?, + dailyScheduleErrors: null == dailyScheduleErrors + ? _value.dailyScheduleErrors + : dailyScheduleErrors // ignore: cast_nullable_to_non_nullable + as List, + durationIndex: freezed == durationIndex + ? _value.durationIndex + : durationIndex // ignore: cast_nullable_to_non_nullable + as int?, + dietStateIndex: freezed == dietStateIndex + ? _value.dietStateIndex + : dietStateIndex // ignore: cast_nullable_to_non_nullable + as int?, + published: null == published + ? _value.published + : published // ignore: cast_nullable_to_non_nullable + as bool, + drafted: null == drafted + ? _value.drafted + : drafted // ignore: cast_nullable_to_non_nullable + as bool, + isDietBeingEdited: null == isDietBeingEdited + ? _value.isDietBeingEdited + : isDietBeingEdited // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } /// Create a copy of CreateDietState @@ -204,30 +182,28 @@ class _$CreateDietStateCopyWithImpl<$Res, $Val extends CreateDietState> /// @nodoc abstract class _$$CreateDietStateImplCopyWith<$Res> implements $CreateDietStateCopyWith<$Res> { - factory _$$CreateDietStateImplCopyWith( - _$CreateDietStateImpl value, - $Res Function(_$CreateDietStateImpl) then, - ) = __$$CreateDietStateImplCopyWithImpl<$Res>; + factory _$$CreateDietStateImplCopyWith(_$CreateDietStateImpl value, + $Res Function(_$CreateDietStateImpl) then) = + __$$CreateDietStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - bool isLoading, - bool isDietPublishing, - String? errorMessage, - CreateDietModel dietData, - List>? copiedDay, - String? dietNameError, - String? dietDescriptionError, - String? dietDurationError, - String? dietStateError, - String? dietImageError, - List dailyScheduleErrors, - int? durationIndex, - int? dietStateIndex, - bool published, - bool drafted, - bool isDietBeingEdited, - }); + $Res call( + {bool isLoading, + bool isDietPublishing, + String? errorMessage, + CreateDietModel dietData, + List>? copiedDay, + String? dietNameError, + String? dietDescriptionError, + String? dietDurationError, + String? dietStateError, + String? dietImageError, + List dailyScheduleErrors, + int? durationIndex, + int? dietStateIndex, + bool published, + bool drafted, + bool isDietBeingEdited}); @override $CreateDietModelCopyWith<$Res> get dietData; @@ -238,9 +214,8 @@ class __$$CreateDietStateImplCopyWithImpl<$Res> extends _$CreateDietStateCopyWithImpl<$Res, _$CreateDietStateImpl> implements _$$CreateDietStateImplCopyWith<$Res> { __$$CreateDietStateImplCopyWithImpl( - _$CreateDietStateImpl _value, - $Res Function(_$CreateDietStateImpl) _then, - ) : super(_value, _then); + _$CreateDietStateImpl _value, $Res Function(_$CreateDietStateImpl) _then) + : super(_value, _then); /// Create a copy of CreateDietState /// with the given fields replaced by the non-null parameter values. @@ -264,115 +239,97 @@ class __$$CreateDietStateImplCopyWithImpl<$Res> Object? drafted = null, Object? isDietBeingEdited = null, }) { - return _then( - _$CreateDietStateImpl( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - isDietPublishing: - null == isDietPublishing - ? _value.isDietPublishing - : isDietPublishing // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - dietData: - null == dietData - ? _value.dietData - : dietData // ignore: cast_nullable_to_non_nullable - as CreateDietModel, - copiedDay: - freezed == copiedDay - ? _value._copiedDay - : copiedDay // ignore: cast_nullable_to_non_nullable - as List>?, - dietNameError: - freezed == dietNameError - ? _value.dietNameError - : dietNameError // ignore: cast_nullable_to_non_nullable - as String?, - dietDescriptionError: - freezed == dietDescriptionError - ? _value.dietDescriptionError - : dietDescriptionError // ignore: cast_nullable_to_non_nullable - as String?, - dietDurationError: - freezed == dietDurationError - ? _value.dietDurationError - : dietDurationError // ignore: cast_nullable_to_non_nullable - as String?, - dietStateError: - freezed == dietStateError - ? _value.dietStateError - : dietStateError // ignore: cast_nullable_to_non_nullable - as String?, - dietImageError: - freezed == dietImageError - ? _value.dietImageError - : dietImageError // ignore: cast_nullable_to_non_nullable - as String?, - dailyScheduleErrors: - null == dailyScheduleErrors - ? _value._dailyScheduleErrors - : dailyScheduleErrors // ignore: cast_nullable_to_non_nullable - as List, - durationIndex: - freezed == durationIndex - ? _value.durationIndex - : durationIndex // ignore: cast_nullable_to_non_nullable - as int?, - dietStateIndex: - freezed == dietStateIndex - ? _value.dietStateIndex - : dietStateIndex // ignore: cast_nullable_to_non_nullable - as int?, - published: - null == published - ? _value.published - : published // ignore: cast_nullable_to_non_nullable - as bool, - drafted: - null == drafted - ? _value.drafted - : drafted // ignore: cast_nullable_to_non_nullable - as bool, - isDietBeingEdited: - null == isDietBeingEdited - ? _value.isDietBeingEdited - : isDietBeingEdited // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + return _then(_$CreateDietStateImpl( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + isDietPublishing: null == isDietPublishing + ? _value.isDietPublishing + : isDietPublishing // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + dietData: null == dietData + ? _value.dietData + : dietData // ignore: cast_nullable_to_non_nullable + as CreateDietModel, + copiedDay: freezed == copiedDay + ? _value._copiedDay + : copiedDay // ignore: cast_nullable_to_non_nullable + as List>?, + dietNameError: freezed == dietNameError + ? _value.dietNameError + : dietNameError // ignore: cast_nullable_to_non_nullable + as String?, + dietDescriptionError: freezed == dietDescriptionError + ? _value.dietDescriptionError + : dietDescriptionError // ignore: cast_nullable_to_non_nullable + as String?, + dietDurationError: freezed == dietDurationError + ? _value.dietDurationError + : dietDurationError // ignore: cast_nullable_to_non_nullable + as String?, + dietStateError: freezed == dietStateError + ? _value.dietStateError + : dietStateError // ignore: cast_nullable_to_non_nullable + as String?, + dietImageError: freezed == dietImageError + ? _value.dietImageError + : dietImageError // ignore: cast_nullable_to_non_nullable + as String?, + dailyScheduleErrors: null == dailyScheduleErrors + ? _value._dailyScheduleErrors + : dailyScheduleErrors // ignore: cast_nullable_to_non_nullable + as List, + durationIndex: freezed == durationIndex + ? _value.durationIndex + : durationIndex // ignore: cast_nullable_to_non_nullable + as int?, + dietStateIndex: freezed == dietStateIndex + ? _value.dietStateIndex + : dietStateIndex // ignore: cast_nullable_to_non_nullable + as int?, + published: null == published + ? _value.published + : published // ignore: cast_nullable_to_non_nullable + as bool, + drafted: null == drafted + ? _value.drafted + : drafted // ignore: cast_nullable_to_non_nullable + as bool, + isDietBeingEdited: null == isDietBeingEdited + ? _value.isDietBeingEdited + : isDietBeingEdited // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc class _$CreateDietStateImpl implements _CreateDietState { - const _$CreateDietStateImpl({ - required this.isLoading, - required this.isDietPublishing, - required this.errorMessage, - required this.dietData, - final List>? copiedDay, - this.dietNameError, - this.dietDescriptionError, - this.dietDurationError, - this.dietStateError, - this.dietImageError, - required final List dailyScheduleErrors, - this.durationIndex, - this.dietStateIndex, - this.published = false, - this.drafted = false, - this.isDietBeingEdited = false, - }) : _copiedDay = copiedDay, - _dailyScheduleErrors = dailyScheduleErrors; + const _$CreateDietStateImpl( + {required this.isLoading, + required this.isDietPublishing, + required this.errorMessage, + required this.dietData, + final List>? copiedDay, + this.dietNameError, + this.dietDescriptionError, + this.dietDurationError, + this.dietStateError, + this.dietImageError, + required final List dailyScheduleErrors, + this.durationIndex, + this.dietStateIndex, + this.published = false, + this.drafted = false, + this.isDietBeingEdited = false}) + : _copiedDay = copiedDay, + _dailyScheduleErrors = dailyScheduleErrors; @override final bool isLoading; @@ -443,10 +400,8 @@ class _$CreateDietStateImpl implements _CreateDietState { other.errorMessage == errorMessage) && (identical(other.dietData, dietData) || other.dietData == dietData) && - const DeepCollectionEquality().equals( - other._copiedDay, - _copiedDay, - ) && + const DeepCollectionEquality() + .equals(other._copiedDay, _copiedDay) && (identical(other.dietNameError, dietNameError) || other.dietNameError == dietNameError) && (identical(other.dietDescriptionError, dietDescriptionError) || @@ -457,10 +412,8 @@ class _$CreateDietStateImpl implements _CreateDietState { other.dietStateError == dietStateError) && (identical(other.dietImageError, dietImageError) || other.dietImageError == dietImageError) && - const DeepCollectionEquality().equals( - other._dailyScheduleErrors, - _dailyScheduleErrors, - ) && + const DeepCollectionEquality() + .equals(other._dailyScheduleErrors, _dailyScheduleErrors) && (identical(other.durationIndex, durationIndex) || other.durationIndex == durationIndex) && (identical(other.dietStateIndex, dietStateIndex) || @@ -474,24 +427,23 @@ class _$CreateDietStateImpl implements _CreateDietState { @override int get hashCode => Object.hash( - runtimeType, - isLoading, - isDietPublishing, - errorMessage, - dietData, - const DeepCollectionEquality().hash(_copiedDay), - dietNameError, - dietDescriptionError, - dietDurationError, - dietStateError, - dietImageError, - const DeepCollectionEquality().hash(_dailyScheduleErrors), - durationIndex, - dietStateIndex, - published, - drafted, - isDietBeingEdited, - ); + runtimeType, + isLoading, + isDietPublishing, + errorMessage, + dietData, + const DeepCollectionEquality().hash(_copiedDay), + dietNameError, + dietDescriptionError, + dietDurationError, + dietStateError, + dietImageError, + const DeepCollectionEquality().hash(_dailyScheduleErrors), + durationIndex, + dietStateIndex, + published, + drafted, + isDietBeingEdited); /// Create a copy of CreateDietState /// with the given fields replaced by the non-null parameter values. @@ -500,30 +452,27 @@ class _$CreateDietStateImpl implements _CreateDietState { @pragma('vm:prefer-inline') _$$CreateDietStateImplCopyWith<_$CreateDietStateImpl> get copyWith => __$$CreateDietStateImplCopyWithImpl<_$CreateDietStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _CreateDietState implements CreateDietState { - const factory _CreateDietState({ - required final bool isLoading, - required final bool isDietPublishing, - required final String? errorMessage, - required final CreateDietModel dietData, - final List>? copiedDay, - final String? dietNameError, - final String? dietDescriptionError, - final String? dietDurationError, - final String? dietStateError, - final String? dietImageError, - required final List dailyScheduleErrors, - final int? durationIndex, - final int? dietStateIndex, - final bool published, - final bool drafted, - final bool isDietBeingEdited, - }) = _$CreateDietStateImpl; + const factory _CreateDietState( + {required final bool isLoading, + required final bool isDietPublishing, + required final String? errorMessage, + required final CreateDietModel dietData, + final List>? copiedDay, + final String? dietNameError, + final String? dietDescriptionError, + final String? dietDurationError, + final String? dietStateError, + final String? dietImageError, + required final List dailyScheduleErrors, + final int? durationIndex, + final int? dietStateIndex, + final bool published, + final bool drafted, + final bool isDietBeingEdited}) = _$CreateDietStateImpl; @override bool get isLoading; diff --git a/lib/features/create_diet/presentation/diet_preview_screen.dart b/lib/features/create_diet/presentation/diet_preview_screen.dart index 8ed2cbf1..759a9ad3 100644 --- a/lib/features/create_diet/presentation/diet_preview_screen.dart +++ b/lib/features/create_diet/presentation/diet_preview_screen.dart @@ -62,7 +62,7 @@ class _DietPreviewScreenState extends State { backgroundColor: appTheme.gray100, resizeToAvoidBottomInset: true, bottomSheet: Container( - padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), + padding: const EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), decoration: BoxDecoration( color: Colors.white, border: Border( @@ -97,7 +97,7 @@ class _DietPreviewScreenState extends State { ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), BookmarkButton( isFavorite: widget.diet.isFavorite, onTap: () {}, @@ -109,7 +109,7 @@ class _DietPreviewScreenState extends State { ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -127,27 +127,27 @@ class _DietPreviewScreenState extends State { style: TextStyles.textMMedium.copyWith(color: appTheme.black), decoration: InputDecoration( isDense: true, - contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), hintText: s.comment.capitalize(), hintStyle: TextStyles.textMMedium.copyWith(color: appTheme.lightGray600), filled: true, border: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide( + borderSide: const BorderSide( color: Color(0xFFD1D1D6), width: 1, ), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide( + borderSide: const BorderSide( color: Color(0xFFD1D1D6), width: 1, ), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide( + borderSide: const BorderSide( color: Color(0xFFD1D1D6), width: 1, ), @@ -156,7 +156,7 @@ class _DietPreviewScreenState extends State { ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), GestureDetector( onTap: () {}, child: Container( @@ -196,7 +196,7 @@ class _DietPreviewScreenState extends State { disableActions: true, path: 'diet/${widget.diet.id}', ), - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight, @@ -218,11 +218,11 @@ class _DietPreviewScreenState extends State { ), body: SingleChildScrollView( controller: scrollController, - padding: EdgeInsets.only(bottom: 160), + padding: const EdgeInsets.only(bottom: 160), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 8), + const SizedBox(height: 8), MainBackgroundBouble( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -246,20 +246,21 @@ class _DietPreviewScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset('assets/icons/eye.svg', width: 18, height: 12), - SizedBox(width: 8), + const SizedBox(width: 8), Text( widget.diet.totalViews.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), - SizedBox(width: 12), + const SizedBox(width: 12), GestureDetector( onTap: () {}, child: InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset( 'assets/icons/heart.svg', @@ -267,33 +268,32 @@ class _DietPreviewScreenState extends State { height: 12, colorFilter: widget.diet.wasLikedByMe ? ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn) : null, ), - SizedBox(width: 8), + const SizedBox(width: 8), Text( widget.diet.totalLikes.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), ), - SizedBox(width: 12), + const SizedBox(width: 12), InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset('assets/icons/comment2.svg', width: 13, height: 12), - SizedBox(width: 8), + const SizedBox(width: 8), Text( widget.diet.totalComments.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), ], ), ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( @@ -301,12 +301,12 @@ class _DietPreviewScreenState extends State { style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), InfoRow(diet: widget.diet, type: ProductType.diet,), ExpandableText( text: widget.diet.details, ), - SizedBox(height: 20), + const SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: AuthorCard( @@ -314,17 +314,17 @@ class _DietPreviewScreenState extends State { title: s.diet_author, ), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ), - SizedBox(height: 16), + const SizedBox(height: 16), MainBackgroundBouble( child: Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: Center( child: Text( - s.diet_plan + '(${widget.diet.duration.toString()} ' + getDayForm(widget.diet.duration, s) + ')', + '${s.diet_plan}(${widget.diet.duration.toString()} ${getDayForm(widget.diet.duration, s)})', style: TextStyles.headingXLSemibold.copyWith( color: appTheme.black, ), @@ -332,9 +332,9 @@ class _DietPreviewScreenState extends State { ), ), ), - SizedBox(height: 8), + const SizedBox(height: 8), ListView.builder( - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { return _dayOfPlan(widget.diet.dailySchedule[index] ?? {}, index, s); @@ -342,20 +342,20 @@ class _DietPreviewScreenState extends State { itemCount: widget.diet.dailySchedule.length, ), MainBackgroundBouble( - padding: EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 16), child: Column( children: [ Container( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), alignment: Alignment.centerLeft, child: Text( - '0' + ' ' + getCommentForm(widget.diet.totalComments, s), + '0 ${getCommentForm(widget.diet.totalComments, s)}', style: TextStyles.textMMedium.copyWith( color: appTheme.gray500, ), ), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ), @@ -366,7 +366,7 @@ class _DietPreviewScreenState extends State { } _dayOfPlan(Map> day, int dayNumber, S s) { - _choiceChipWidget(int index) { + choiceChipWidget(int index) { return ChoiceChip( selectedColor: appTheme.blueA400, pressElevation: 0, @@ -393,7 +393,7 @@ class _DietPreviewScreenState extends State { return Padding( padding: const EdgeInsets.only(bottom: 8), child: MainBackgroundBouble( - padding: EdgeInsets.only( + padding: const EdgeInsets.only( top: 16, ), child: Column( @@ -404,13 +404,13 @@ class _DietPreviewScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - s.day + ' ' + (dayNumber + 1).toString(), + '${s.day} ${dayNumber + 1}', style: TextStyles.headingXLSemibold.copyWith( color: appTheme.black, ), ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 12), + const Padding( + padding: EdgeInsets.symmetric(vertical: 12), child: CustomDivider(), ), Text( @@ -422,21 +422,21 @@ class _DietPreviewScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - _choiceChipWidget(0), - _choiceChipWidget(1), - _choiceChipWidget(2), - _choiceChipWidget(3), - _choiceChipWidget(4), + choiceChipWidget(0), + choiceChipWidget(1), + choiceChipWidget(2), + choiceChipWidget(3), + choiceChipWidget(4), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), ListView.builder( shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) => _daily(day[widget.selectedIndexes[dayNumber] + 1]?[index + 1], s), itemCount: day[widget.selectedIndexes[dayNumber] + 1]?.length ?? 0, ), - SizedBox(height: 8), + const SizedBox(height: 8), ], ), ), @@ -453,7 +453,7 @@ class _DietPreviewScreenState extends State { } _daily(DailySchedule? daily, S s) { - if (daily == null) return SizedBox.shrink(); + if (daily == null) return const SizedBox.shrink(); return Padding( padding: const EdgeInsets.only(bottom: 12), child: Row( @@ -467,9 +467,9 @@ class _DietPreviewScreenState extends State { ), ), ), - Spacer(), + const Spacer(), Text( - daily.quantity.toString() + ' ' + getLocalizedMeasurementUnits(s, daily.portion), + '${daily.quantity} ${getLocalizedMeasurementUnits(s, daily.portion)}', style: TextStyles.textMSemibold.copyWith( color: appTheme.black, ), diff --git a/lib/features/create_diet/presentation/widgets/add_meal_widget.dart b/lib/features/create_diet/presentation/widgets/add_meal_widget.dart index c5d377f7..8f125abd 100644 --- a/lib/features/create_diet/presentation/widgets/add_meal_widget.dart +++ b/lib/features/create_diet/presentation/widgets/add_meal_widget.dart @@ -54,7 +54,7 @@ class _AddMealWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text( + const Text( 'Добавление блюда', style: TextStyle( fontSize: 20, @@ -75,7 +75,7 @@ class _AddMealWidgetState extends State { onChanged: (query) { EasyDebounce.debounce( 'glossary-search', - Duration(milliseconds: 250), + const Duration(milliseconds: 250), () async { selectedGlossary = null; if (query.isEmpty) { @@ -113,7 +113,7 @@ class _AddMealWidgetState extends State { ), glossariesList.isEmpty ? const SizedBox(height: 16) : const SizedBox.shrink(), Container( - constraints: BoxConstraints( + constraints: const BoxConstraints( maxHeight: 256, ), child: ListView.separated( @@ -135,7 +135,7 @@ class _AddMealWidgetState extends State { ), title: Text( glossariesList[i].name, - style: TextStyle( + style: const TextStyle( height: 1, ), ), @@ -152,12 +152,12 @@ class _AddMealWidgetState extends State { Icons.add_rounded, color: Colors.grey.shade400, ), - contentPadding: EdgeInsets.only(left: 12), + contentPadding: const EdgeInsets.only(left: 12), ); }, itemCount: glossariesList.length, separatorBuilder: (BuildContext context, int index) { - return CustomDivider(); + return const CustomDivider(); }, ), ), @@ -179,9 +179,9 @@ class _AddMealWidgetState extends State { height: 52, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), ), - child: Icon( + child: const Icon( Icons.delete_outline_rounded, color: Colors.red, ), @@ -201,7 +201,7 @@ class _AddMealWidgetState extends State { child: Center( child: Text( widget.portionIndex == null ? 'Добавить' : 'Сохранить', - style: TextStyle( + style: const TextStyle( fontSize: 18, fontWeight: FontWeight.w600, color: Colors.white, @@ -220,10 +220,10 @@ class _AddMealWidgetState extends State { Future addPortion() async { final portionIndex = widget.portionIndex; var measurementUnits = selectedGlossary?.grInPortion == null - ? Portion.PCS + ? Portion.pcs : selectedGlossary?.grInPortion == 0 - ? Portion.GRAMS - : Portion.PCS; + ? Portion.grams + : Portion.pcs; final glossary = selectedGlossary; if (glossary != null) { final [calories, carbohydrates, proteins, fats] = _getCPFC(glossary, measurementUnits); @@ -265,7 +265,7 @@ class _AddMealWidgetState extends State { ), ); if (newGlossary != null) { - measurementUnits = Portion.GRAMS; + measurementUnits = Portion.grams; final [calories, carbohydrates, proteins, fats] = _getCPFC(newGlossary, measurementUnits); final portion = DailySchedule( dailyNutrition: DailyNutrition(energy: calories, proteins: proteins, fats: fats, carbohydrates: carbohydrates), @@ -297,7 +297,7 @@ class _AddMealWidgetState extends State { final double carbohydrates; final double proteins; final double fats; - if (measurementUnits == Portion.GRAMS) { + if (measurementUnits == Portion.grams) { calories = (glossary.energyOn100Gr * int.parse(quantityController.text) / 100); carbohydrates = (glossary.carbohydratesOn100Gr * int.parse(quantityController.text) / 100); proteins = (glossary.proteinsOn100Gr * int.parse(quantityController.text) / 100); @@ -310,5 +310,4 @@ class _AddMealWidgetState extends State { } return [calories, carbohydrates, proteins, fats]; } - } diff --git a/lib/features/create_diet/presentation/widgets/day_widget.dart b/lib/features/create_diet/presentation/widgets/day_widget.dart index 8ca5cc11..2bb1f93c 100644 --- a/lib/features/create_diet/presentation/widgets/day_widget.dart +++ b/lib/features/create_diet/presentation/widgets/day_widget.dart @@ -17,7 +17,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; class DayWidget extends StatefulWidget { - DayWidget({ + const DayWidget({ super.key, required this.index, }); @@ -47,10 +47,10 @@ class _DayWidgetState extends State { Row( children: [ Text( - s.day + ' ${widget.index + 1}', + '${s.day} ${widget.index + 1}', style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - Spacer(), + const Spacer(), GestureDetector( onTap: () { context.read().copyDay(widget.index); @@ -65,23 +65,23 @@ class _DayWidgetState extends State { ), ], ), - SizedBox( + const SizedBox( height: 12, ), - CustomDivider(), - SizedBox( + const CustomDivider(), + const SizedBox( height: 12, ), Text( s.meal, style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 16), + const SizedBox(height: 16), Row( children: [ ChoiceChipWidget( chipsLabelList: chipsLabelList, - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), fontSize: TextStyles.textMMedium.fontSize, fontWeight: TextStyles.textMMedium.fontWeight, index: 0, @@ -92,10 +92,10 @@ class _DayWidgetState extends State { }); }, ), - Spacer(), + const Spacer(), ChoiceChipWidget( chipsLabelList: chipsLabelList, - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), fontSize: TextStyles.textMMedium.fontSize, fontWeight: TextStyles.textMMedium.fontWeight, index: 1, @@ -106,10 +106,10 @@ class _DayWidgetState extends State { }); }, ), - Spacer(), + const Spacer(), ChoiceChipWidget( chipsLabelList: chipsLabelList, - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), fontSize: TextStyles.textMMedium.fontSize, fontWeight: TextStyles.textMMedium.fontWeight, index: 2, @@ -120,10 +120,10 @@ class _DayWidgetState extends State { }); }, ), - Spacer(), + const Spacer(), ChoiceChipWidget( chipsLabelList: chipsLabelList, - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), fontSize: TextStyles.textMMedium.fontSize, fontWeight: TextStyles.textMMedium.fontWeight, index: 3, @@ -134,10 +134,10 @@ class _DayWidgetState extends State { }); }, ), - Spacer(), + const Spacer(), ChoiceChipWidget( chipsLabelList: chipsLabelList, - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), fontSize: TextStyles.textMMedium.fontSize, fontWeight: TextStyles.textMMedium.fontWeight, index: 4, @@ -151,10 +151,10 @@ class _DayWidgetState extends State { ], ), ListView.separated( - separatorBuilder: (context, index) => SizedBox( + separatorBuilder: (context, index) => const SizedBox( height: 8, ), - padding: EdgeInsets.all(0), + padding: const EdgeInsets.all(0), itemBuilder: (context, index) { final product = state.dietData.dailySchedule?[widget.index][_selectedMealIndex][index]; if (product != null) { @@ -174,9 +174,9 @@ class _DayWidgetState extends State { }, itemCount: state.dietData.dailySchedule?[widget.index][_selectedMealIndex].length ?? 0, shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), ), - SizedBox(height: 16), + const SizedBox(height: 16), Row( children: [ GestureDetector( @@ -184,8 +184,8 @@ class _DayWidgetState extends State { context.read().pasteCopiedDay(widget.index); }, child: Container( - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 14), - decoration: BoxDecoration(color: appTheme.gray50, borderRadius: BorderRadius.all(Radius.circular(12))), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), + decoration: BoxDecoration(color: appTheme.gray50, borderRadius: const BorderRadius.all(Radius.circular(12))), child: SvgPicture.asset( 'assets/icons/paste2.svg', width: 28, @@ -193,7 +193,7 @@ class _DayWidgetState extends State { ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: CustomOutlinedButton( onPressed: () { @@ -209,7 +209,7 @@ class _DayWidgetState extends State { color: appTheme.whiteA700, ), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), ), @@ -217,10 +217,10 @@ class _DayWidgetState extends State { ], ), if (state.dailyScheduleErrors[widget.index].isNotEmpty) ...[ - SizedBox(height: 12), + const SizedBox(height: 12), CustomErrorWidget(error: state.dailyScheduleErrors[widget.index]), ], - SizedBox(height: 20), + const SizedBox(height: 20), ], ), ), @@ -274,7 +274,7 @@ class _DayWidgetState extends State { carbohydrates: carbohydrates, ); } - return CpfcContainer( + return const CpfcContainer( calories: 0, proteins: 0, fats: 0, @@ -302,7 +302,7 @@ class _DayWidgetState extends State { quantityControllerText: quantity.toString(), ); }, - trailing: Icon(Icons.more_vert_rounded), + trailing: const Icon(Icons.more_vert_rounded), title: Text(product), subtitle: Text('$quantity $portion'), shape: RoundedRectangleBorder( @@ -324,7 +324,7 @@ class _DayWidgetState extends State { return showModalBottomSheet( useRootNavigator: true, context: context, - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(top: Radius.circular(12)), ), isScrollControlled: true, diff --git a/lib/features/create_diet/presentation/widgets/diet_duration_drop_down_widget.dart b/lib/features/create_diet/presentation/widgets/diet_duration_drop_down_widget.dart index 97987b30..8ab35278 100644 --- a/lib/features/create_diet/presentation/widgets/diet_duration_drop_down_widget.dart +++ b/lib/features/create_diet/presentation/widgets/diet_duration_drop_down_widget.dart @@ -26,9 +26,9 @@ class _DietDurationDropDownWidgetState extends State super.didChangeDependencies(); final s = S.of(context); if (durationDropDownTitles.isEmpty) { - durationValues.forEach((element) { + for (var element in durationValues) { durationDropDownTitles.add('$element ${getDayForm(element, s)}'); - }); + } } } @@ -54,18 +54,18 @@ class _DietDurationDropDownWidgetState extends State items: durationDropDownTitles .mapIndexed( (index, value) => DropdownMenuItem( + value: durationDropDownTitles[index], child: Text( durationDropDownTitles[index], style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), - value: durationDropDownTitles[index], ), ) .toList(), value: state.durationIndex == null ? null : durationDropDownTitles[state.durationIndex ?? 0], ), if (state.dietDurationError != null) ...[ - SizedBox( + const SizedBox( height: 4, ), CustomErrorWidget(error: state.dietDurationError ?? ''), 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 c15c70b6..b32a01b5 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 @@ -31,12 +31,13 @@ class _DietImagePickerWidgetState extends State { final picker = ImagePicker(); final image = await picker.pickImage(source: ImageSource.camera); cubit.setImage(image); + if (!context.mounted) return; Navigator.of(context).pop(); }, child: Row( children: [ - Icon(Icons.photo_camera), - SizedBox(width: 8), + const Icon(Icons.photo_camera), + const SizedBox(width: 8), Text(s.photo), ], ), @@ -46,12 +47,13 @@ class _DietImagePickerWidgetState extends State { final picker = ImagePicker(); final image = await picker.pickImage(source: ImageSource.gallery); cubit.setImage(image); + if (!context.mounted) return; Navigator.of(context).pop(); }, child: Row( children: [ - Icon(Icons.photo), - SizedBox(width: 8), + const Icon(Icons.photo), + const SizedBox(width: 8), Text(s.gallery), ], ), @@ -96,7 +98,7 @@ class _DietImagePickerWidgetState extends State { color: appTheme.gray50, ), width: MediaQuery.sizeOf(context).width, - padding: hasImage ? null : EdgeInsets.all(8), + padding: hasImage ? null : const EdgeInsets.all(8), child: hasImage ? Padding( padding: const EdgeInsets.only(top: 6, right: 6), @@ -113,7 +115,7 @@ class _DietImagePickerWidgetState extends State { color: appTheme.dividerColor, shape: BoxShape.circle, ), - child: Icon( + child: const Icon( Icons.close_rounded, color: Colors.grey, size: 16, @@ -126,20 +128,20 @@ class _DietImagePickerWidgetState extends State { children: [ DottedBorder( stackFit: StackFit.expand, - dashPattern: [14, 14], + dashPattern: const [14, 14], color: state.dietImageError != null ? appTheme.red : appTheme.dottedBorder, borderType: BorderType.RRect, - radius: Radius.circular(12), - child: SizedBox.expand(), + radius: const Radius.circular(12), + child: const SizedBox.expand(), ), Center( child: Column( children: [ - SizedBox( + const SizedBox( height: 48, ), SvgPicture.asset('assets/icons/eatvio_logo.svg'), - SizedBox( + const SizedBox( height: 24, ), Text( @@ -153,7 +155,7 @@ class _DietImagePickerWidgetState extends State { ), ), ), - if (state.dietImageError != null) ...[SizedBox(height: 8), CustomErrorWidget(error: state.dietImageError ?? '')], + if (state.dietImageError != null) ...[const SizedBox(height: 8), CustomErrorWidget(error: state.dietImageError ?? '')], ], ); }, diff --git a/lib/features/create_diet/presentation/widgets/diet_type_choice_widget.dart b/lib/features/create_diet/presentation/widgets/diet_type_choice_widget.dart index 112ddbad..b8db4b7a 100644 --- a/lib/features/create_diet/presentation/widgets/diet_type_choice_widget.dart +++ b/lib/features/create_diet/presentation/widgets/diet_type_choice_widget.dart @@ -9,7 +9,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; class DietTypeChoiceWidget extends StatefulWidget { - DietTypeChoiceWidget({super.key}); + const DietTypeChoiceWidget({super.key}); @override State createState() => _DietTypeChoiceWidgetState(); @@ -76,12 +76,12 @@ class _DietTypeChoiceWidgetState extends State { height: 80, child: Column( children: [ - SizedBox(height: 16), + const SizedBox(height: 16), SvgPicture.asset( choiceContent[index].$1, height: 30, ), - SizedBox(height: 8), + const SizedBox(height: 8), Text( choiceContent[index].$2, overflow: TextOverflow.clip, diff --git a/lib/features/create_diet/presentation/widgets/error_widget.dart b/lib/features/create_diet/presentation/widgets/error_widget.dart index bd9eaf9d..84ba0577 100644 --- a/lib/features/create_diet/presentation/widgets/error_widget.dart +++ b/lib/features/create_diet/presentation/widgets/error_widget.dart @@ -11,7 +11,7 @@ class CustomErrorWidget extends StatelessWidget { return Row( children: [ SvgPicture.asset('assets/icons/error_icon.svg', width: 14, height: 14), - SizedBox( + const SizedBox( width: 2, ), Expanded( 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 b178eccd..456133e9 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 @@ -26,7 +26,7 @@ class _StatusDropDownWidgetState extends State { super.didChangeDependencies(); final s = S.of(context); if (dietStateTitles.isEmpty) { - dietStates.forEach((elem) { + for (var elem in dietStates) { switch (elem) { case DietState.active: dietStateTitles.add(s.active_diet_state); @@ -35,7 +35,7 @@ class _StatusDropDownWidgetState extends State { case DietState.personal: dietStateTitles.add(s.personal_diet_state); } - }); + } } } @@ -62,18 +62,18 @@ class _StatusDropDownWidgetState extends State { items: dietStateTitles .mapIndexed( (index, value) => DropdownMenuItem( + value: dietStates[index], child: Text( dietStateTitles[index], style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), - value: dietStates[index], ), ) .toList(), value: state.dietStateIndex == null ? null : dietStates[state.dietStateIndex ?? 0], ), if (state.dietStateError != null) ...[ - SizedBox( + const SizedBox( height: 4, ), CustomErrorWidget(error: state.dietStateError ?? ''), diff --git a/lib/features/create_diet/repositories/create_diet_repository.dart b/lib/features/create_diet/repositories/create_diet_repository.dart index e72f159b..84c17072 100644 --- a/lib/features/create_diet/repositories/create_diet_repository.dart +++ b/lib/features/create_diet/repositories/create_diet_repository.dart @@ -25,10 +25,10 @@ class CreateDietRepository { for (final (productIndex, product) in meal.indexed) { final jsonProduct = product.toJson(); dietMap.addAll({ - 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][${productIndex}][name]': jsonProduct['name'], - 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][${productIndex}][portion]': jsonProduct['portion'], - 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][${productIndex}][quantity]': jsonProduct['quantity'], - 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][${productIndex}][product_nutritional_value_id]': jsonProduct['product_nutritional_value_id'], + 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][$productIndex][name]': jsonProduct['name'], + 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][$productIndex][portion]': jsonProduct['portion'], + 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][$productIndex][quantity]': jsonProduct['quantity'], + 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][$productIndex][product_nutritional_value_id]': jsonProduct['product_nutritional_value_id'], }); } } @@ -102,10 +102,10 @@ class CreateDietRepository { for (final (productIndex, product) in meal.indexed) { final jsonProduct = product.toJson(); dietMap.addAll({ - 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][${productIndex}][name]': jsonProduct['name'], - 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][${productIndex}][portion]': jsonProduct['portion'], - 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][${productIndex}][quantity]': jsonProduct['quantity'], - 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][${productIndex}][product_nutritional_value_id]': jsonProduct['product_nutritional_value_id'], + 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][$productIndex][name]': jsonProduct['name'], + 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][$productIndex][portion]': jsonProduct['portion'], + 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][$productIndex][quantity]': jsonProduct['quantity'], + 'daily_schedule[${dayIndex + 1}][${mealIndex + 1}][$productIndex][product_nutritional_value_id]': jsonProduct['product_nutritional_value_id'], }); } } diff --git a/lib/features/create_diet/services/create_diet_service.g.dart b/lib/features/create_diet/services/create_diet_service.g.dart index f913ebab..61af7e06 100644 --- a/lib/features/create_diet/services/create_diet_service.g.dart +++ b/lib/features/create_diet/services/create_diet_service.g.dart @@ -25,11 +25,11 @@ class _CreateDietService implements CreateDietService { final _data = formData; final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/diets/create/published', @@ -57,11 +57,11 @@ class _CreateDietService implements CreateDietService { final _data = formData; final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/diets/create/drafted', @@ -89,11 +89,11 @@ class _CreateDietService implements CreateDietService { final _data = formData; final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/diets/create/personalized', @@ -124,11 +124,11 @@ class _CreateDietService implements CreateDietService { final _data = formData; final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/diets/update/published/${diet}', @@ -151,11 +151,11 @@ class _CreateDietService implements CreateDietService { final _data = formData; final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/diets/update/drafted/${diet}', @@ -178,11 +178,11 @@ class _CreateDietService implements CreateDietService { final _data = formData; final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/diets/update/personalized/${diet}', diff --git a/lib/features/create_plan/models/create_plan_model.freezed.dart b/lib/features/create_plan/models/create_plan_model.freezed.dart index 27f8f60e..226b3072 100644 --- a/lib/features/create_plan/models/create_plan_model.freezed.dart +++ b/lib/features/create_plan/models/create_plan_model.freezed.dart @@ -12,8 +12,7 @@ part of 'create_plan_model.dart'; 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', -); + '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'); /// @nodoc mixin _$CreatePlanModel { @@ -35,19 +34,17 @@ mixin _$CreatePlanModel { /// @nodoc abstract class $CreatePlanModelCopyWith<$Res> { factory $CreatePlanModelCopyWith( - CreatePlanModel value, - $Res Function(CreatePlanModel) then, - ) = _$CreatePlanModelCopyWithImpl<$Res, CreatePlanModel>; + CreatePlanModel value, $Res Function(CreatePlanModel) then) = + _$CreatePlanModelCopyWithImpl<$Res, CreatePlanModel>; @useResult - $Res call({ - String? name, - String? details, - String? state, - int? duration, - List type, - XFile? image, - List options, - }); + $Res call( + {String? name, + String? details, + String? state, + int? duration, + List type, + XFile? image, + List options}); } /// @nodoc @@ -73,67 +70,55 @@ class _$CreatePlanModelCopyWithImpl<$Res, $Val extends CreatePlanModel> Object? image = freezed, Object? options = null, }) { - return _then( - _value.copyWith( - name: - freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - details: - freezed == details - ? _value.details - : details // ignore: cast_nullable_to_non_nullable - as String?, - state: - freezed == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String?, - duration: - freezed == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int?, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as List, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as XFile?, - options: - null == options - ? _value.options - : options // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + return _then(_value.copyWith( + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + details: freezed == details + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + duration: freezed == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as List, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as XFile?, + options: null == options + ? _value.options + : options // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } } /// @nodoc abstract class _$$CreatePlanModelImplCopyWith<$Res> implements $CreatePlanModelCopyWith<$Res> { - factory _$$CreatePlanModelImplCopyWith( - _$CreatePlanModelImpl value, - $Res Function(_$CreatePlanModelImpl) then, - ) = __$$CreatePlanModelImplCopyWithImpl<$Res>; + factory _$$CreatePlanModelImplCopyWith(_$CreatePlanModelImpl value, + $Res Function(_$CreatePlanModelImpl) then) = + __$$CreatePlanModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String? name, - String? details, - String? state, - int? duration, - List type, - XFile? image, - List options, - }); + $Res call( + {String? name, + String? details, + String? state, + int? duration, + List type, + XFile? image, + List options}); } /// @nodoc @@ -141,9 +126,8 @@ class __$$CreatePlanModelImplCopyWithImpl<$Res> extends _$CreatePlanModelCopyWithImpl<$Res, _$CreatePlanModelImpl> implements _$$CreatePlanModelImplCopyWith<$Res> { __$$CreatePlanModelImplCopyWithImpl( - _$CreatePlanModelImpl _value, - $Res Function(_$CreatePlanModelImpl) _then, - ) : super(_value, _then); + _$CreatePlanModelImpl _value, $Res Function(_$CreatePlanModelImpl) _then) + : super(_value, _then); /// Create a copy of CreatePlanModel /// with the given fields replaced by the non-null parameter values. @@ -158,62 +142,53 @@ class __$$CreatePlanModelImplCopyWithImpl<$Res> Object? image = freezed, Object? options = null, }) { - return _then( - _$CreatePlanModelImpl( - name: - freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - details: - freezed == details - ? _value.details - : details // ignore: cast_nullable_to_non_nullable - as String?, - state: - freezed == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String?, - duration: - freezed == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int?, - type: - null == type - ? _value._type - : type // ignore: cast_nullable_to_non_nullable - as List, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as XFile?, - options: - null == options - ? _value._options - : options // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + return _then(_$CreatePlanModelImpl( + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + details: freezed == details + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + duration: freezed == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _value._type + : type // ignore: cast_nullable_to_non_nullable + as List, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as XFile?, + options: null == options + ? _value._options + : options // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc class _$CreatePlanModelImpl extends _CreatePlanModel { - const _$CreatePlanModelImpl({ - this.name, - this.details, - this.state, - this.duration, - required final List type, - this.image, - required final List options, - }) : _type = type, - _options = options, - super._(); + const _$CreatePlanModelImpl( + {this.name, + this.details, + this.state, + this.duration, + required final List type, + this.image, + required final List options}) + : _type = type, + _options = options, + super._(); @override final String? name; @@ -263,15 +238,14 @@ class _$CreatePlanModelImpl extends _CreatePlanModel { @override int get hashCode => Object.hash( - runtimeType, - name, - details, - state, - duration, - const DeepCollectionEquality().hash(_type), - image, - const DeepCollectionEquality().hash(_options), - ); + runtimeType, + name, + details, + state, + duration, + const DeepCollectionEquality().hash(_type), + image, + const DeepCollectionEquality().hash(_options)); /// Create a copy of CreatePlanModel /// with the given fields replaced by the non-null parameter values. @@ -280,21 +254,18 @@ class _$CreatePlanModelImpl extends _CreatePlanModel { @pragma('vm:prefer-inline') _$$CreatePlanModelImplCopyWith<_$CreatePlanModelImpl> get copyWith => __$$CreatePlanModelImplCopyWithImpl<_$CreatePlanModelImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _CreatePlanModel extends CreatePlanModel { - const factory _CreatePlanModel({ - final String? name, - final String? details, - final String? state, - final int? duration, - required final List type, - final XFile? image, - required final List options, - }) = _$CreatePlanModelImpl; + const factory _CreatePlanModel( + {final String? name, + final String? details, + final String? state, + final int? duration, + required final List type, + final XFile? image, + required final List options}) = _$CreatePlanModelImpl; const _CreatePlanModel._() : super._(); @override diff --git a/lib/features/create_plan/presentation/create_plan_screen.dart b/lib/features/create_plan/presentation/create_plan_screen.dart index a530add4..ab921880 100644 --- a/lib/features/create_plan/presentation/create_plan_screen.dart +++ b/lib/features/create_plan/presentation/create_plan_screen.dart @@ -54,13 +54,13 @@ class CreatePlanScreenContent extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 8), + const SizedBox(height: 8), MainBackgroundBouble( padding: const EdgeInsets.symmetric(horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 16), + const SizedBox(height: 16), Text( s.label, textAlign: TextAlign.center, @@ -68,7 +68,7 @@ class CreatePlanScreenContent extends StatelessWidget { softWrap: true, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( hintText: s.plan_label_desc, onChanged: (value) { @@ -76,7 +76,7 @@ class CreatePlanScreenContent extends StatelessWidget { }, maxLength: 150, ), - SizedBox(height: 12), + const SizedBox(height: 12), Text( s.plan_duration, textAlign: TextAlign.center, @@ -84,13 +84,13 @@ class CreatePlanScreenContent extends StatelessWidget { softWrap: true, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), - PlanDurationDropDownWidget(), - SizedBox(height: 20), - PlanImagePickerWidget(), - SizedBox(height: 16), - PlanTypeChoiceWidget(), - SizedBox(height: 16), + const SizedBox(height: 4), + const PlanDurationDropDownWidget(), + const SizedBox(height: 20), + const PlanImagePickerWidget(), + const SizedBox(height: 16), + const PlanTypeChoiceWidget(), + const SizedBox(height: 16), Text( s.plan_desc, textAlign: TextAlign.center, @@ -98,7 +98,7 @@ class CreatePlanScreenContent extends StatelessWidget { softWrap: true, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), SizedBox( height: 132, child: CustomTextFormField( @@ -113,11 +113,11 @@ class CreatePlanScreenContent extends StatelessWidget { }, ), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ), - SizedBox(height: 20), + const SizedBox(height: 20), Padding( padding: const EdgeInsets.only(left: 16), child: Text( @@ -128,14 +128,14 @@ class CreatePlanScreenContent extends StatelessWidget { style: TextStyles.headingXLSemibold.copyWith(color: appTheme.blueGray400), ), ), - SizedBox(height: 8), - OptionsCountButton(), - SizedBox(height: 20), + const SizedBox(height: 8), + const OptionsCountButton(), + const SizedBox(height: 20), BlocBuilder( buildWhen: (previous, current) => previous.selectedOptionIndex != current.selectedOptionIndex, builder: (context, state) { if (state.selectedOptionIndex == null) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } return Padding( padding: const EdgeInsets.only(left: 16), @@ -146,9 +146,9 @@ class CreatePlanScreenContent extends StatelessWidget { ); }, ), - SizedBox(height: 8), - OptionWidget(), - SizedBox(height: 20), + const SizedBox(height: 8), + const OptionWidget(), + const SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Column( @@ -159,29 +159,29 @@ class CreatePlanScreenContent extends StatelessWidget { height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.gray), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.dottedBorder), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), CustomOutlinedButton( onPressed: () async {}, text: s.preview, height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.gray), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.dottedBorder), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), CustomOutlinedButton( onPressed: () {}, text: s.publish, height: 52, buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), ), @@ -194,10 +194,10 @@ class CreatePlanScreenContent extends StatelessWidget { BlocBuilder( builder: (context, state) { if (state.selectedOptionIndex == null) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } - return Padding( - padding: const EdgeInsets.only(bottom: 24.0), + return const Padding( + padding: EdgeInsets.only(bottom: 24.0), child: Align( alignment: Alignment.bottomCenter, child: SelectExactOptionWidget(), diff --git a/lib/features/create_plan/presentation/cubit/create_plan_state.freezed.dart b/lib/features/create_plan/presentation/cubit/create_plan_state.freezed.dart index c27467b7..bb7eba17 100644 --- a/lib/features/create_plan/presentation/cubit/create_plan_state.freezed.dart +++ b/lib/features/create_plan/presentation/cubit/create_plan_state.freezed.dart @@ -12,8 +12,7 @@ part of 'create_plan_state.dart'; 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', -); + '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'); /// @nodoc mixin _$CreatePlanState { @@ -33,17 +32,15 @@ mixin _$CreatePlanState { /// @nodoc abstract class $CreatePlanStateCopyWith<$Res> { factory $CreatePlanStateCopyWith( - CreatePlanState value, - $Res Function(CreatePlanState) then, - ) = _$CreatePlanStateCopyWithImpl<$Res, CreatePlanState>; + CreatePlanState value, $Res Function(CreatePlanState) then) = + _$CreatePlanStateCopyWithImpl<$Res, CreatePlanState>; @useResult - $Res call({ - bool isLoading, - String? errorMessage, - CreatePlanModel planData, - int? durationIndex, - int? selectedOptionIndex, - }); + $Res call( + {bool isLoading, + String? errorMessage, + CreatePlanModel planData, + int? durationIndex, + int? selectedOptionIndex}); $CreatePlanModelCopyWith<$Res> get planData; } @@ -69,36 +66,28 @@ class _$CreatePlanStateCopyWithImpl<$Res, $Val extends CreatePlanState> Object? durationIndex = freezed, Object? selectedOptionIndex = freezed, }) { - return _then( - _value.copyWith( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - planData: - null == planData - ? _value.planData - : planData // ignore: cast_nullable_to_non_nullable - as CreatePlanModel, - durationIndex: - freezed == durationIndex - ? _value.durationIndex - : durationIndex // ignore: cast_nullable_to_non_nullable - as int?, - selectedOptionIndex: - freezed == selectedOptionIndex - ? _value.selectedOptionIndex - : selectedOptionIndex // ignore: cast_nullable_to_non_nullable - as int?, - ) - as $Val, - ); + return _then(_value.copyWith( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + planData: null == planData + ? _value.planData + : planData // ignore: cast_nullable_to_non_nullable + as CreatePlanModel, + durationIndex: freezed == durationIndex + ? _value.durationIndex + : durationIndex // ignore: cast_nullable_to_non_nullable + as int?, + selectedOptionIndex: freezed == selectedOptionIndex + ? _value.selectedOptionIndex + : selectedOptionIndex // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); } /// Create a copy of CreatePlanState @@ -115,19 +104,17 @@ class _$CreatePlanStateCopyWithImpl<$Res, $Val extends CreatePlanState> /// @nodoc abstract class _$$CreatePlanStateImplCopyWith<$Res> implements $CreatePlanStateCopyWith<$Res> { - factory _$$CreatePlanStateImplCopyWith( - _$CreatePlanStateImpl value, - $Res Function(_$CreatePlanStateImpl) then, - ) = __$$CreatePlanStateImplCopyWithImpl<$Res>; + factory _$$CreatePlanStateImplCopyWith(_$CreatePlanStateImpl value, + $Res Function(_$CreatePlanStateImpl) then) = + __$$CreatePlanStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - bool isLoading, - String? errorMessage, - CreatePlanModel planData, - int? durationIndex, - int? selectedOptionIndex, - }); + $Res call( + {bool isLoading, + String? errorMessage, + CreatePlanModel planData, + int? durationIndex, + int? selectedOptionIndex}); @override $CreatePlanModelCopyWith<$Res> get planData; @@ -138,9 +125,8 @@ class __$$CreatePlanStateImplCopyWithImpl<$Res> extends _$CreatePlanStateCopyWithImpl<$Res, _$CreatePlanStateImpl> implements _$$CreatePlanStateImplCopyWith<$Res> { __$$CreatePlanStateImplCopyWithImpl( - _$CreatePlanStateImpl _value, - $Res Function(_$CreatePlanStateImpl) _then, - ) : super(_value, _then); + _$CreatePlanStateImpl _value, $Res Function(_$CreatePlanStateImpl) _then) + : super(_value, _then); /// Create a copy of CreatePlanState /// with the given fields replaced by the non-null parameter values. @@ -153,48 +139,40 @@ class __$$CreatePlanStateImplCopyWithImpl<$Res> Object? durationIndex = freezed, Object? selectedOptionIndex = freezed, }) { - return _then( - _$CreatePlanStateImpl( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - planData: - null == planData - ? _value.planData - : planData // ignore: cast_nullable_to_non_nullable - as CreatePlanModel, - durationIndex: - freezed == durationIndex - ? _value.durationIndex - : durationIndex // ignore: cast_nullable_to_non_nullable - as int?, - selectedOptionIndex: - freezed == selectedOptionIndex - ? _value.selectedOptionIndex - : selectedOptionIndex // ignore: cast_nullable_to_non_nullable - as int?, - ), - ); + return _then(_$CreatePlanStateImpl( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + planData: null == planData + ? _value.planData + : planData // ignore: cast_nullable_to_non_nullable + as CreatePlanModel, + durationIndex: freezed == durationIndex + ? _value.durationIndex + : durationIndex // ignore: cast_nullable_to_non_nullable + as int?, + selectedOptionIndex: freezed == selectedOptionIndex + ? _value.selectedOptionIndex + : selectedOptionIndex // ignore: cast_nullable_to_non_nullable + as int?, + )); } } /// @nodoc class _$CreatePlanStateImpl implements _CreatePlanState { - const _$CreatePlanStateImpl({ - required this.isLoading, - required this.errorMessage, - required this.planData, - this.durationIndex, - this.selectedOptionIndex, - }); + const _$CreatePlanStateImpl( + {required this.isLoading, + required this.errorMessage, + required this.planData, + this.durationIndex, + this.selectedOptionIndex}); @override final bool isLoading; @@ -230,14 +208,8 @@ class _$CreatePlanStateImpl implements _CreatePlanState { } @override - int get hashCode => Object.hash( - runtimeType, - isLoading, - errorMessage, - planData, - durationIndex, - selectedOptionIndex, - ); + int get hashCode => Object.hash(runtimeType, isLoading, errorMessage, + planData, durationIndex, selectedOptionIndex); /// Create a copy of CreatePlanState /// with the given fields replaced by the non-null parameter values. @@ -246,19 +218,16 @@ class _$CreatePlanStateImpl implements _CreatePlanState { @pragma('vm:prefer-inline') _$$CreatePlanStateImplCopyWith<_$CreatePlanStateImpl> get copyWith => __$$CreatePlanStateImplCopyWithImpl<_$CreatePlanStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _CreatePlanState implements CreatePlanState { - const factory _CreatePlanState({ - required final bool isLoading, - required final String? errorMessage, - required final CreatePlanModel planData, - final int? durationIndex, - final int? selectedOptionIndex, - }) = _$CreatePlanStateImpl; + const factory _CreatePlanState( + {required final bool isLoading, + required final String? errorMessage, + required final CreatePlanModel planData, + final int? durationIndex, + final int? selectedOptionIndex}) = _$CreatePlanStateImpl; @override bool get isLoading; diff --git a/lib/features/create_plan/presentation/widgets/add_item_widget.dart b/lib/features/create_plan/presentation/widgets/add_item_widget.dart index e57c916e..16a79d26 100644 --- a/lib/features/create_plan/presentation/widgets/add_item_widget.dart +++ b/lib/features/create_plan/presentation/widgets/add_item_widget.dart @@ -7,7 +7,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; class AddItemWidget extends StatefulWidget { - AddItemWidget({ + const AddItemWidget({ super.key, required this.canBeDeleted, required this.enableHint, @@ -51,13 +51,13 @@ class _AddItemWidgetState extends State { ), ), if (widget.canBeDeleted) ...[ - SizedBox(width: 8), + const SizedBox(width: 8), GestureDetector( onTap: () { context.read().removeOptionContentItem(widget.index); }, child: Container( - padding: EdgeInsets.all(14), + padding: const EdgeInsets.all(14), decoration: BoxDecoration( color: appTheme.lightGray0, borderRadius: BorderRadius.circular(20), diff --git a/lib/features/create_plan/presentation/widgets/option_widget.dart b/lib/features/create_plan/presentation/widgets/option_widget.dart index bda55262..42d52977 100644 --- a/lib/features/create_plan/presentation/widgets/option_widget.dart +++ b/lib/features/create_plan/presentation/widgets/option_widget.dart @@ -13,7 +13,7 @@ import 'package:flutter_portal/flutter_portal.dart'; import 'package:flutter_svg/flutter_svg.dart'; class OptionWidget extends StatefulWidget { - OptionWidget({super.key}); + const OptionWidget({super.key}); @override State createState() => _OptionWidgetState(); @@ -40,7 +40,7 @@ class _OptionWidgetState extends State { } final price = double.tryParse(customerPriceController.text.replaceAll('₽', '')); if (price != null && price < 1200) { - customerPriceController.value = TextEditingValue( + customerPriceController.value = const TextEditingValue( text: "1200₽", selection: TextSelection.collapsed(offset: 4), ); @@ -57,7 +57,7 @@ class _OptionWidgetState extends State { } final price = double.tryParse(creatorPriceController.text.replaceAll('₽', '')); if (price != null && price < 1000) { - creatorPriceController.value = TextEditingValue( + creatorPriceController.value = const TextEditingValue( text: "1000₽", selection: TextSelection.collapsed(offset: 4), ); @@ -80,7 +80,7 @@ class _OptionWidgetState extends State { optionTitleController.text = state.planData.options[selectedOptionIndex].short; optionDescriptionController.text = state.planData.options[selectedOptionIndex].description; return MainBackgroundBouble( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -91,7 +91,7 @@ class _OptionWidgetState extends State { softWrap: true, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( hintText: optionNameHintText, controller: optionTitleController, @@ -100,7 +100,7 @@ class _OptionWidgetState extends State { }, maxLength: 150, ), - SizedBox(height: 12), + const SizedBox(height: 12), Text( s.option_desc, textAlign: TextAlign.center, @@ -108,7 +108,7 @@ class _OptionWidgetState extends State { softWrap: true, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), SizedBox( height: 120, child: CustomTextFormField( @@ -124,7 +124,7 @@ class _OptionWidgetState extends State { }, ), ), - SizedBox(height: 12), + const SizedBox(height: 12), Row( children: [ Text( @@ -134,11 +134,11 @@ class _OptionWidgetState extends State { softWrap: true, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(width: 4), - _PriceExplanationWidget(), + const SizedBox(width: 4), + const _PriceExplanationWidget(), ], ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: creatorPriceController, onChanged: (value) { @@ -151,7 +151,7 @@ class _OptionWidgetState extends State { }, maxLength: 20, ), - SizedBox(height: 12), + const SizedBox(height: 12), Row( children: [ Text( @@ -161,14 +161,14 @@ class _OptionWidgetState extends State { softWrap: true, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(width: 4), - _PriceExplanationWidget(), + const SizedBox(width: 4), + const _PriceExplanationWidget(), ], ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: customerPriceController, - textInputType: TextInputType.numberWithOptions(decimal: true), + textInputType: const TextInputType.numberWithOptions(decimal: true), onChanged: (value) { final price = double.tryParse(value.replaceAll('₽', '')); if (price != null) { @@ -178,7 +178,7 @@ class _OptionWidgetState extends State { }, maxLength: 20, ), - SizedBox(height: 10), + const SizedBox(height: 10), Text( s.minimal_customer_price, textAlign: TextAlign.center, @@ -186,9 +186,9 @@ class _OptionWidgetState extends State { softWrap: true, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 16), - CustomDivider(), - SizedBox(height: 16), + const SizedBox(height: 16), + const CustomDivider(), + const SizedBox(height: 16), Text( s.option_content, textAlign: TextAlign.center, @@ -196,10 +196,10 @@ class _OptionWidgetState extends State { softWrap: true, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), ListView.separated( padding: EdgeInsets.zero, - separatorBuilder: (context, index) => SizedBox(height: 8), + separatorBuilder: (context, index) => const SizedBox(height: 8), reverse: false, itemBuilder: (context, index) { final items = state.planData.options[selectedOptionIndex].items; @@ -231,18 +231,18 @@ class _OptionWidgetState extends State { }, itemCount: state.planData.options[selectedOptionIndex].items.length + 1, shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), ), - SizedBox(height: 16), - CustomDivider(), - SizedBox(height: 16), + const SizedBox(height: 16), + const CustomDivider(), + const SizedBox(height: 16), Row( children: [ Checkbox( value: isChecked, activeColor: appTheme.gray, checkColor: appTheme.gray, - fillColor: WidgetStatePropertyAll(Colors.transparent), + fillColor: const WidgetStatePropertyAll(Colors.transparent), side: WidgetStateBorderSide.resolveWith( (Set states) { return BorderSide(width: 1, color: appTheme.gray); @@ -283,9 +283,9 @@ class _PriceExplanationWidgetState extends State<_PriceExplanationWidget> { Widget build(BuildContext context) { final s = S.of(context); return PortalTarget( - closeDuration: Duration(milliseconds: 300), + closeDuration: const Duration(milliseconds: 300), portalFollower: AnimatedContainer( - padding: EdgeInsets.all(10), + padding: const EdgeInsets.all(10), duration: const Duration(milliseconds: 300), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), @@ -302,7 +302,7 @@ class _PriceExplanationWidgetState extends State<_PriceExplanationWidget> { ), ), visible: visible, - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.bottomLeft, target: Alignment.topRight, diff --git a/lib/features/create_plan/presentation/widgets/options_count_button.dart b/lib/features/create_plan/presentation/widgets/options_count_button.dart index fddba602..09833c70 100644 --- a/lib/features/create_plan/presentation/widgets/options_count_button.dart +++ b/lib/features/create_plan/presentation/widgets/options_count_button.dart @@ -16,7 +16,7 @@ class OptionsCountButton extends StatelessWidget { builder: (context, state) { final selectedOption = state.selectedOptionIndex; return Container( - margin: EdgeInsets.symmetric(horizontal: 16), + margin: const EdgeInsets.symmetric(horizontal: 16), decoration: BoxDecoration( color: appTheme.whiteA700, borderRadius: BorderRadius.circular(100), diff --git a/lib/features/create_plan/presentation/widgets/plan_duration_drop_down_widget.dart b/lib/features/create_plan/presentation/widgets/plan_duration_drop_down_widget.dart index 132c2ffd..9e06a8e7 100644 --- a/lib/features/create_plan/presentation/widgets/plan_duration_drop_down_widget.dart +++ b/lib/features/create_plan/presentation/widgets/plan_duration_drop_down_widget.dart @@ -25,9 +25,9 @@ class _PlanDurationDropDownWidgetState extends State super.didChangeDependencies(); final s = S.of(context); if (durationDropDownTitles.isEmpty) { - durationValues.forEach((element) { + for (var element in durationValues) { durationDropDownTitles.add('$element ${getDayForm(element, s)}'); - }); + } } } @@ -49,11 +49,11 @@ class _PlanDurationDropDownWidgetState extends State items: durationDropDownTitles .mapIndexed( (index, value) => DropdownMenuItem( + value: durationDropDownTitles[index], child: Text( durationDropDownTitles[index], style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), - value: durationDropDownTitles[index], ), ) .toList(), 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 37b9e9a6..c834d5a7 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 @@ -30,12 +30,13 @@ class _PlanImagePickerWidgetState extends State { final picker = ImagePicker(); final image = await picker.pickImage(source: ImageSource.camera); cubit.setImage(image); + if (!context.mounted) return; Navigator.of(context).pop(); }, child: Row( children: [ - Icon(Icons.photo_camera), - SizedBox(width: 8), + const Icon(Icons.photo_camera), + const SizedBox(width: 8), Text(s.photo), ], ), @@ -45,12 +46,13 @@ class _PlanImagePickerWidgetState extends State { final picker = ImagePicker(); final image = await picker.pickImage(source: ImageSource.gallery); cubit.setImage(image); + if (!context.mounted) return; Navigator.of(context).pop(); }, child: Row( children: [ - Icon(Icons.photo), - SizedBox(width: 8), + const Icon(Icons.photo), + const SizedBox(width: 8), Text(s.gallery), ], ), @@ -82,7 +84,7 @@ class _PlanImagePickerWidgetState extends State { color: appTheme.gray50, ), width: MediaQuery.sizeOf(context).width, - padding: state.planData.image != null ? null : EdgeInsets.all(8), + padding: state.planData.image != null ? null : const EdgeInsets.all(8), child: state.planData.image != null ? Padding( padding: const EdgeInsets.only(top: 6, right: 6), @@ -99,7 +101,7 @@ class _PlanImagePickerWidgetState extends State { color: appTheme.dividerColor, shape: BoxShape.circle, ), - child: Icon( + child: const Icon( Icons.close_rounded, color: Colors.grey, size: 16, @@ -112,20 +114,20 @@ class _PlanImagePickerWidgetState extends State { children: [ DottedBorder( stackFit: StackFit.expand, - dashPattern: [14, 14], + dashPattern: const [14, 14], color: appTheme.dottedBorder, borderType: BorderType.RRect, - radius: Radius.circular(12), - child: SizedBox.expand(), + radius: const Radius.circular(12), + child: const SizedBox.expand(), ), Center( child: Column( children: [ - SizedBox( + const SizedBox( height: 48, ), SvgPicture.asset('assets/icons/eatvio_logo.svg'), - SizedBox( + const SizedBox( height: 24, ), Text( diff --git a/lib/features/create_plan/presentation/widgets/plan_type_choice_widget.dart b/lib/features/create_plan/presentation/widgets/plan_type_choice_widget.dart index 44811953..cff69d5e 100644 --- a/lib/features/create_plan/presentation/widgets/plan_type_choice_widget.dart +++ b/lib/features/create_plan/presentation/widgets/plan_type_choice_widget.dart @@ -7,7 +7,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class PlanTypeChoiceWidget extends StatefulWidget { - PlanTypeChoiceWidget({super.key}); + const PlanTypeChoiceWidget({super.key}); @override State createState() => _PlanTypeChoiceWidgetState(); @@ -75,12 +75,12 @@ class _PlanTypeChoiceWidgetState extends State { height: 104, child: Column( children: [ - SizedBox(height: 16), + const SizedBox(height: 16), Image.asset( choiceContent[index].$1, height: 30, ), - SizedBox(height: 8), + const SizedBox(height: 8), Text( choiceContent[index].$2, overflow: TextOverflow.clip, diff --git a/lib/features/create_plan/presentation/widgets/select_exact_option_widget.dart b/lib/features/create_plan/presentation/widgets/select_exact_option_widget.dart index 6660bc46..ba428c3e 100644 --- a/lib/features/create_plan/presentation/widgets/select_exact_option_widget.dart +++ b/lib/features/create_plan/presentation/widgets/select_exact_option_widget.dart @@ -18,7 +18,7 @@ class _SelectExactOptionWidgetState extends State { builder: (context, state) { final selectedIndex = state.selectedOptionIndex; return Container( - padding: EdgeInsets.all(4), + padding: const EdgeInsets.all(4), width: 140, height: 48, decoration: BoxDecoration( diff --git a/lib/features/create_plan/repositories/create_plan_repository.dart b/lib/features/create_plan/repositories/create_plan_repository.dart index 447f1d3a..0f01edbc 100644 --- a/lib/features/create_plan/repositories/create_plan_repository.dart +++ b/lib/features/create_plan/repositories/create_plan_repository.dart @@ -8,7 +8,7 @@ class CreatePlanRepository { Future createPlan({ required Map model, }) async { - await createPlanService..createPlan(model: model); + createPlanService.createPlan(model: model); } Future createPacketOption({ diff --git a/lib/features/create_plan/services/create_plan_service.g.dart b/lib/features/create_plan/services/create_plan_service.g.dart index 054aabe1..c93251e7 100644 --- a/lib/features/create_plan/services/create_plan_service.g.dart +++ b/lib/features/create_plan/services/create_plan_service.g.dart @@ -26,11 +26,11 @@ class _CreatePlanService implements CreatePlanService { _data.addAll(model); final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/plans/create', diff --git a/lib/features/create_recipe/entities/recipe_create_entity.dart b/lib/features/create_recipe/entities/recipe_create_entity.dart index 9792ea63..91fec435 100644 --- a/lib/features/create_recipe/entities/recipe_create_entity.dart +++ b/lib/features/create_recipe/entities/recipe_create_entity.dart @@ -8,19 +8,20 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'recipe_create_entity.freezed.dart'; enum TypeOfRecipe { - first_meals, - second_meals, + firstMeals, + secondMeals, salads, snacks, sweets, drinks, other; + @override String toString() { switch (this) { - case TypeOfRecipe.first_meals: + case TypeOfRecipe.firstMeals: return 'Первые блюда'; - case TypeOfRecipe.second_meals: + case TypeOfRecipe.secondMeals: return 'Вторые блюда'; case TypeOfRecipe.salads: return 'Салаты'; @@ -37,9 +38,9 @@ enum TypeOfRecipe { String toApiType() { switch (this) { - case TypeOfRecipe.first_meals: + case TypeOfRecipe.firstMeals: return 'first_meals'; - case TypeOfRecipe.second_meals: + case TypeOfRecipe.secondMeals: return 'second_meals'; case TypeOfRecipe.salads: return 'salads'; @@ -57,9 +58,9 @@ enum TypeOfRecipe { static TypeOfRecipe? fromString(String value) { switch (value) { case 'Первые блюда': - return TypeOfRecipe.first_meals; + return TypeOfRecipe.firstMeals; case 'Вторые блюда': - return TypeOfRecipe.second_meals; + return TypeOfRecipe.secondMeals; case 'Салаты': return TypeOfRecipe.salads; case 'Закуски': @@ -84,10 +85,10 @@ class RecipeCreateEntity with _$RecipeCreateEntity { TypeOfRecipe? typeOfRecipe, int? countOfPortions, double? energyInOnePortion, - int? totalCookHours, - int? totalCookMinutes, - int? activeCookHours, - int? activeCookMinutes, + int? totalCookHours, + int? totalCookMinutes, + int? activeCookHours, + int? activeCookMinutes, String? description, File? image, String? videoUrl, @@ -105,7 +106,7 @@ class RecipeCreateEntity with _$RecipeCreateEntity { activeCookTime: ((activeCookHours ?? 0) * 60) + (activeCookMinutes ?? 0), description: description, image: image?.path, - video_url: videoUrl, + videoUrl: videoUrl, ingredients: ingredients, steps: steps.map((step) { if (step.hasProps()) return Step(image: step.image?.path ?? '', description: step.description ?? ''); diff --git a/lib/features/create_recipe/entities/recipe_create_entity.freezed.dart b/lib/features/create_recipe/entities/recipe_create_entity.freezed.dart index f8cc176b..c5f4178d 100644 --- a/lib/features/create_recipe/entities/recipe_create_entity.freezed.dart +++ b/lib/features/create_recipe/entities/recipe_create_entity.freezed.dart @@ -12,8 +12,7 @@ part of 'recipe_create_entity.dart'; 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', -); + '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'); /// @nodoc mixin _$RecipeCreateEntity { @@ -42,26 +41,24 @@ mixin _$RecipeCreateEntity { /// @nodoc abstract class $RecipeCreateEntityCopyWith<$Res> { factory $RecipeCreateEntityCopyWith( - RecipeCreateEntity value, - $Res Function(RecipeCreateEntity) then, - ) = _$RecipeCreateEntityCopyWithImpl<$Res, RecipeCreateEntity>; + RecipeCreateEntity value, $Res Function(RecipeCreateEntity) then) = + _$RecipeCreateEntityCopyWithImpl<$Res, RecipeCreateEntity>; @useResult - $Res call({ - String? title, - TypeOfRecipe? typeOfRecipe, - int? countOfPortions, - double? energyInOnePortion, - int? totalCookHours, - int? totalCookMinutes, - int? activeCookHours, - int? activeCookMinutes, - String? description, - File? image, - String? videoUrl, - List ingredients, - List steps, - List tags, - }); + $Res call( + {String? title, + TypeOfRecipe? typeOfRecipe, + int? countOfPortions, + double? energyInOnePortion, + int? totalCookHours, + int? totalCookMinutes, + int? activeCookHours, + int? activeCookMinutes, + String? description, + File? image, + String? videoUrl, + List ingredients, + List steps, + List tags}); } /// @nodoc @@ -94,119 +91,99 @@ class _$RecipeCreateEntityCopyWithImpl<$Res, $Val extends RecipeCreateEntity> Object? steps = null, Object? tags = null, }) { - return _then( - _value.copyWith( - title: - freezed == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String?, - typeOfRecipe: - freezed == typeOfRecipe - ? _value.typeOfRecipe - : typeOfRecipe // ignore: cast_nullable_to_non_nullable - as TypeOfRecipe?, - countOfPortions: - freezed == countOfPortions - ? _value.countOfPortions - : countOfPortions // ignore: cast_nullable_to_non_nullable - as int?, - energyInOnePortion: - freezed == energyInOnePortion - ? _value.energyInOnePortion - : energyInOnePortion // ignore: cast_nullable_to_non_nullable - as double?, - totalCookHours: - freezed == totalCookHours - ? _value.totalCookHours - : totalCookHours // ignore: cast_nullable_to_non_nullable - as int?, - totalCookMinutes: - freezed == totalCookMinutes - ? _value.totalCookMinutes - : totalCookMinutes // ignore: cast_nullable_to_non_nullable - as int?, - activeCookHours: - freezed == activeCookHours - ? _value.activeCookHours - : activeCookHours // ignore: cast_nullable_to_non_nullable - as int?, - activeCookMinutes: - freezed == activeCookMinutes - ? _value.activeCookMinutes - : activeCookMinutes // ignore: cast_nullable_to_non_nullable - as int?, - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as File?, - videoUrl: - freezed == videoUrl - ? _value.videoUrl - : videoUrl // ignore: cast_nullable_to_non_nullable - as String?, - ingredients: - null == ingredients - ? _value.ingredients - : ingredients // ignore: cast_nullable_to_non_nullable - as List, - steps: - null == steps - ? _value.steps - : steps // ignore: cast_nullable_to_non_nullable - as List, - tags: - null == tags - ? _value.tags - : tags // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + return _then(_value.copyWith( + title: freezed == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + typeOfRecipe: freezed == typeOfRecipe + ? _value.typeOfRecipe + : typeOfRecipe // ignore: cast_nullable_to_non_nullable + as TypeOfRecipe?, + countOfPortions: freezed == countOfPortions + ? _value.countOfPortions + : countOfPortions // ignore: cast_nullable_to_non_nullable + as int?, + energyInOnePortion: freezed == energyInOnePortion + ? _value.energyInOnePortion + : energyInOnePortion // ignore: cast_nullable_to_non_nullable + as double?, + totalCookHours: freezed == totalCookHours + ? _value.totalCookHours + : totalCookHours // ignore: cast_nullable_to_non_nullable + as int?, + totalCookMinutes: freezed == totalCookMinutes + ? _value.totalCookMinutes + : totalCookMinutes // ignore: cast_nullable_to_non_nullable + as int?, + activeCookHours: freezed == activeCookHours + ? _value.activeCookHours + : activeCookHours // ignore: cast_nullable_to_non_nullable + as int?, + activeCookMinutes: freezed == activeCookMinutes + ? _value.activeCookMinutes + : activeCookMinutes // ignore: cast_nullable_to_non_nullable + as int?, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as File?, + videoUrl: freezed == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String?, + ingredients: null == ingredients + ? _value.ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List, + steps: null == steps + ? _value.steps + : steps // ignore: cast_nullable_to_non_nullable + as List, + tags: null == tags + ? _value.tags + : tags // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } } /// @nodoc abstract class _$$RecipeCreateEntityImplCopyWith<$Res> implements $RecipeCreateEntityCopyWith<$Res> { - factory _$$RecipeCreateEntityImplCopyWith( - _$RecipeCreateEntityImpl value, - $Res Function(_$RecipeCreateEntityImpl) then, - ) = __$$RecipeCreateEntityImplCopyWithImpl<$Res>; + factory _$$RecipeCreateEntityImplCopyWith(_$RecipeCreateEntityImpl value, + $Res Function(_$RecipeCreateEntityImpl) then) = + __$$RecipeCreateEntityImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String? title, - TypeOfRecipe? typeOfRecipe, - int? countOfPortions, - double? energyInOnePortion, - int? totalCookHours, - int? totalCookMinutes, - int? activeCookHours, - int? activeCookMinutes, - String? description, - File? image, - String? videoUrl, - List ingredients, - List steps, - List tags, - }); + $Res call( + {String? title, + TypeOfRecipe? typeOfRecipe, + int? countOfPortions, + double? energyInOnePortion, + int? totalCookHours, + int? totalCookMinutes, + int? activeCookHours, + int? activeCookMinutes, + String? description, + File? image, + String? videoUrl, + List ingredients, + List steps, + List tags}); } /// @nodoc class __$$RecipeCreateEntityImplCopyWithImpl<$Res> extends _$RecipeCreateEntityCopyWithImpl<$Res, _$RecipeCreateEntityImpl> implements _$$RecipeCreateEntityImplCopyWith<$Res> { - __$$RecipeCreateEntityImplCopyWithImpl( - _$RecipeCreateEntityImpl _value, - $Res Function(_$RecipeCreateEntityImpl) _then, - ) : super(_value, _then); + __$$RecipeCreateEntityImplCopyWithImpl(_$RecipeCreateEntityImpl _value, + $Res Function(_$RecipeCreateEntityImpl) _then) + : super(_value, _then); /// Create a copy of RecipeCreateEntity /// with the given fields replaced by the non-null parameter values. @@ -228,105 +205,89 @@ class __$$RecipeCreateEntityImplCopyWithImpl<$Res> Object? steps = null, Object? tags = null, }) { - return _then( - _$RecipeCreateEntityImpl( - title: - freezed == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String?, - typeOfRecipe: - freezed == typeOfRecipe - ? _value.typeOfRecipe - : typeOfRecipe // ignore: cast_nullable_to_non_nullable - as TypeOfRecipe?, - countOfPortions: - freezed == countOfPortions - ? _value.countOfPortions - : countOfPortions // ignore: cast_nullable_to_non_nullable - as int?, - energyInOnePortion: - freezed == energyInOnePortion - ? _value.energyInOnePortion - : energyInOnePortion // ignore: cast_nullable_to_non_nullable - as double?, - totalCookHours: - freezed == totalCookHours - ? _value.totalCookHours - : totalCookHours // ignore: cast_nullable_to_non_nullable - as int?, - totalCookMinutes: - freezed == totalCookMinutes - ? _value.totalCookMinutes - : totalCookMinutes // ignore: cast_nullable_to_non_nullable - as int?, - activeCookHours: - freezed == activeCookHours - ? _value.activeCookHours - : activeCookHours // ignore: cast_nullable_to_non_nullable - as int?, - activeCookMinutes: - freezed == activeCookMinutes - ? _value.activeCookMinutes - : activeCookMinutes // ignore: cast_nullable_to_non_nullable - as int?, - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as File?, - videoUrl: - freezed == videoUrl - ? _value.videoUrl - : videoUrl // ignore: cast_nullable_to_non_nullable - as String?, - ingredients: - null == ingredients - ? _value._ingredients - : ingredients // ignore: cast_nullable_to_non_nullable - as List, - steps: - null == steps - ? _value._steps - : steps // ignore: cast_nullable_to_non_nullable - as List, - tags: - null == tags - ? _value._tags - : tags // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + return _then(_$RecipeCreateEntityImpl( + title: freezed == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + typeOfRecipe: freezed == typeOfRecipe + ? _value.typeOfRecipe + : typeOfRecipe // ignore: cast_nullable_to_non_nullable + as TypeOfRecipe?, + countOfPortions: freezed == countOfPortions + ? _value.countOfPortions + : countOfPortions // ignore: cast_nullable_to_non_nullable + as int?, + energyInOnePortion: freezed == energyInOnePortion + ? _value.energyInOnePortion + : energyInOnePortion // ignore: cast_nullable_to_non_nullable + as double?, + totalCookHours: freezed == totalCookHours + ? _value.totalCookHours + : totalCookHours // ignore: cast_nullable_to_non_nullable + as int?, + totalCookMinutes: freezed == totalCookMinutes + ? _value.totalCookMinutes + : totalCookMinutes // ignore: cast_nullable_to_non_nullable + as int?, + activeCookHours: freezed == activeCookHours + ? _value.activeCookHours + : activeCookHours // ignore: cast_nullable_to_non_nullable + as int?, + activeCookMinutes: freezed == activeCookMinutes + ? _value.activeCookMinutes + : activeCookMinutes // ignore: cast_nullable_to_non_nullable + as int?, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as File?, + videoUrl: freezed == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String?, + ingredients: null == ingredients + ? _value._ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List, + steps: null == steps + ? _value._steps + : steps // ignore: cast_nullable_to_non_nullable + as List, + tags: null == tags + ? _value._tags + : tags // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc class _$RecipeCreateEntityImpl extends _RecipeCreateEntity { - const _$RecipeCreateEntityImpl({ - this.title, - this.typeOfRecipe, - this.countOfPortions, - this.energyInOnePortion, - this.totalCookHours, - this.totalCookMinutes, - this.activeCookHours, - this.activeCookMinutes, - this.description, - this.image, - this.videoUrl, - required final List ingredients, - required final List steps, - required final List tags, - }) : _ingredients = ingredients, - _steps = steps, - _tags = tags, - super._(); + const _$RecipeCreateEntityImpl( + {this.title, + this.typeOfRecipe, + this.countOfPortions, + this.energyInOnePortion, + this.totalCookHours, + this.totalCookMinutes, + this.activeCookHours, + this.activeCookMinutes, + this.description, + this.image, + this.videoUrl, + required final List ingredients, + required final List steps, + required final List tags}) + : _ingredients = ingredients, + _steps = steps, + _tags = tags, + super._(); @override final String? title; @@ -404,32 +365,29 @@ class _$RecipeCreateEntityImpl extends _RecipeCreateEntity { (identical(other.image, image) || other.image == image) && (identical(other.videoUrl, videoUrl) || other.videoUrl == videoUrl) && - const DeepCollectionEquality().equals( - other._ingredients, - _ingredients, - ) && + const DeepCollectionEquality() + .equals(other._ingredients, _ingredients) && const DeepCollectionEquality().equals(other._steps, _steps) && const DeepCollectionEquality().equals(other._tags, _tags)); } @override int get hashCode => Object.hash( - runtimeType, - title, - typeOfRecipe, - countOfPortions, - energyInOnePortion, - totalCookHours, - totalCookMinutes, - activeCookHours, - activeCookMinutes, - description, - image, - videoUrl, - const DeepCollectionEquality().hash(_ingredients), - const DeepCollectionEquality().hash(_steps), - const DeepCollectionEquality().hash(_tags), - ); + runtimeType, + title, + typeOfRecipe, + countOfPortions, + energyInOnePortion, + totalCookHours, + totalCookMinutes, + activeCookHours, + activeCookMinutes, + description, + image, + videoUrl, + const DeepCollectionEquality().hash(_ingredients), + const DeepCollectionEquality().hash(_steps), + const DeepCollectionEquality().hash(_tags)); /// Create a copy of RecipeCreateEntity /// with the given fields replaced by the non-null parameter values. @@ -438,28 +396,25 @@ class _$RecipeCreateEntityImpl extends _RecipeCreateEntity { @pragma('vm:prefer-inline') _$$RecipeCreateEntityImplCopyWith<_$RecipeCreateEntityImpl> get copyWith => __$$RecipeCreateEntityImplCopyWithImpl<_$RecipeCreateEntityImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _RecipeCreateEntity extends RecipeCreateEntity { - const factory _RecipeCreateEntity({ - final String? title, - final TypeOfRecipe? typeOfRecipe, - final int? countOfPortions, - final double? energyInOnePortion, - final int? totalCookHours, - final int? totalCookMinutes, - final int? activeCookHours, - final int? activeCookMinutes, - final String? description, - final File? image, - final String? videoUrl, - required final List ingredients, - required final List steps, - required final List tags, - }) = _$RecipeCreateEntityImpl; + const factory _RecipeCreateEntity( + {final String? title, + final TypeOfRecipe? typeOfRecipe, + final int? countOfPortions, + final double? energyInOnePortion, + final int? totalCookHours, + final int? totalCookMinutes, + final int? activeCookHours, + final int? activeCookMinutes, + final String? description, + final File? image, + final String? videoUrl, + required final List ingredients, + required final List steps, + required final List tags}) = _$RecipeCreateEntityImpl; const _RecipeCreateEntity._() : super._(); @override @@ -514,9 +469,8 @@ mixin _$StepEntity { /// @nodoc abstract class $StepEntityCopyWith<$Res> { factory $StepEntityCopyWith( - StepEntity value, - $Res Function(StepEntity) then, - ) = _$StepEntityCopyWithImpl<$Res, StepEntity>; + StepEntity value, $Res Function(StepEntity) then) = + _$StepEntityCopyWithImpl<$Res, StepEntity>; @useResult $Res call({String? description, File? image}); } @@ -535,22 +489,20 @@ class _$StepEntityCopyWithImpl<$Res, $Val extends StepEntity> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? description = freezed, Object? image = freezed}) { - return _then( - _value.copyWith( - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as File?, - ) - as $Val, - ); + $Res call({ + Object? description = freezed, + Object? image = freezed, + }) { + return _then(_value.copyWith( + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as File?, + ) as $Val); } } @@ -558,9 +510,8 @@ class _$StepEntityCopyWithImpl<$Res, $Val extends StepEntity> abstract class _$$StepEntityImplCopyWith<$Res> implements $StepEntityCopyWith<$Res> { factory _$$StepEntityImplCopyWith( - _$StepEntityImpl value, - $Res Function(_$StepEntityImpl) then, - ) = __$$StepEntityImplCopyWithImpl<$Res>; + _$StepEntityImpl value, $Res Function(_$StepEntityImpl) then) = + __$$StepEntityImplCopyWithImpl<$Res>; @override @useResult $Res call({String? description, File? image}); @@ -571,29 +522,27 @@ class __$$StepEntityImplCopyWithImpl<$Res> extends _$StepEntityCopyWithImpl<$Res, _$StepEntityImpl> implements _$$StepEntityImplCopyWith<$Res> { __$$StepEntityImplCopyWithImpl( - _$StepEntityImpl _value, - $Res Function(_$StepEntityImpl) _then, - ) : super(_value, _then); + _$StepEntityImpl _value, $Res Function(_$StepEntityImpl) _then) + : super(_value, _then); /// Create a copy of StepEntity /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? description = freezed, Object? image = freezed}) { - return _then( - _$StepEntityImpl( - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as File?, - ), - ); + $Res call({ + Object? description = freezed, + Object? image = freezed, + }) { + return _then(_$StepEntityImpl( + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as File?, + )); } } diff --git a/lib/features/create_recipe/models/ingredient.freezed.dart b/lib/features/create_recipe/models/ingredient.freezed.dart index 238889d2..2bf96fb3 100644 --- a/lib/features/create_recipe/models/ingredient.freezed.dart +++ b/lib/features/create_recipe/models/ingredient.freezed.dart @@ -12,8 +12,7 @@ part of 'ingredient.dart'; 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', -); + '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'); Ingredient _$IngredientFromJson(Map json) { return _Ingredient.fromJson(json); @@ -38,9 +37,8 @@ mixin _$Ingredient { /// @nodoc abstract class $IngredientCopyWith<$Res> { factory $IngredientCopyWith( - Ingredient value, - $Res Function(Ingredient) then, - ) = _$IngredientCopyWithImpl<$Res, Ingredient>; + Ingredient value, $Res Function(Ingredient) then) = + _$IngredientCopyWithImpl<$Res, Ingredient>; @useResult $Res call({String name, String unit, String portion}); } @@ -64,26 +62,20 @@ class _$IngredientCopyWithImpl<$Res, $Val extends Ingredient> Object? unit = null, Object? portion = null, }) { - return _then( - _value.copyWith( - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - unit: - null == unit - ? _value.unit - : unit // ignore: cast_nullable_to_non_nullable - as String, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + unit: null == unit + ? _value.unit + : unit // ignore: cast_nullable_to_non_nullable + as String, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -91,9 +83,8 @@ class _$IngredientCopyWithImpl<$Res, $Val extends Ingredient> abstract class _$$IngredientImplCopyWith<$Res> implements $IngredientCopyWith<$Res> { factory _$$IngredientImplCopyWith( - _$IngredientImpl value, - $Res Function(_$IngredientImpl) then, - ) = __$$IngredientImplCopyWithImpl<$Res>; + _$IngredientImpl value, $Res Function(_$IngredientImpl) then) = + __$$IngredientImplCopyWithImpl<$Res>; @override @useResult $Res call({String name, String unit, String portion}); @@ -104,9 +95,8 @@ class __$$IngredientImplCopyWithImpl<$Res> extends _$IngredientCopyWithImpl<$Res, _$IngredientImpl> implements _$$IngredientImplCopyWith<$Res> { __$$IngredientImplCopyWithImpl( - _$IngredientImpl _value, - $Res Function(_$IngredientImpl) _then, - ) : super(_value, _then); + _$IngredientImpl _value, $Res Function(_$IngredientImpl) _then) + : super(_value, _then); /// Create a copy of Ingredient /// with the given fields replaced by the non-null parameter values. @@ -117,36 +107,28 @@ class __$$IngredientImplCopyWithImpl<$Res> Object? unit = null, Object? portion = null, }) { - return _then( - _$IngredientImpl( - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - unit: - null == unit - ? _value.unit - : unit // ignore: cast_nullable_to_non_nullable - as String, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + return _then(_$IngredientImpl( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + unit: null == unit + ? _value.unit + : unit // ignore: cast_nullable_to_non_nullable + as String, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as String, + )); } } /// @nodoc @JsonSerializable() class _$IngredientImpl implements _Ingredient { - const _$IngredientImpl({ - required this.name, - required this.unit, - required this.portion, - }); + const _$IngredientImpl( + {required this.name, required this.unit, required this.portion}); factory _$IngredientImpl.fromJson(Map json) => _$$IngredientImplFromJson(json); @@ -187,16 +169,17 @@ class _$IngredientImpl implements _Ingredient { @override Map toJson() { - return _$$IngredientImplToJson(this); + return _$$IngredientImplToJson( + this, + ); } } abstract class _Ingredient implements Ingredient { - const factory _Ingredient({ - required final String name, - required final String unit, - required final String portion, - }) = _$IngredientImpl; + const factory _Ingredient( + {required final String name, + required final String unit, + required final String portion}) = _$IngredientImpl; factory _Ingredient.fromJson(Map json) = _$IngredientImpl.fromJson; diff --git a/lib/features/create_recipe/models/product.freezed.dart b/lib/features/create_recipe/models/product.freezed.dart index f65d6cb7..610656fb 100644 --- a/lib/features/create_recipe/models/product.freezed.dart +++ b/lib/features/create_recipe/models/product.freezed.dart @@ -12,8 +12,7 @@ part of 'product.dart'; 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', -); + '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'); Product _$ProductFromJson(Map json) { return _Product.fromJson(json); @@ -55,31 +54,28 @@ class _$ProductCopyWithImpl<$Res, $Val extends Product> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? id = null, Object? name = null}) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } /// @nodoc abstract class _$$ProductImplCopyWith<$Res> implements $ProductCopyWith<$Res> { factory _$$ProductImplCopyWith( - _$ProductImpl value, - $Res Function(_$ProductImpl) then, - ) = __$$ProductImplCopyWithImpl<$Res>; + _$ProductImpl value, $Res Function(_$ProductImpl) then) = + __$$ProductImplCopyWithImpl<$Res>; @override @useResult $Res call({int id, String name}); @@ -90,29 +86,27 @@ class __$$ProductImplCopyWithImpl<$Res> extends _$ProductCopyWithImpl<$Res, _$ProductImpl> implements _$$ProductImplCopyWith<$Res> { __$$ProductImplCopyWithImpl( - _$ProductImpl _value, - $Res Function(_$ProductImpl) _then, - ) : super(_value, _then); + _$ProductImpl _value, $Res Function(_$ProductImpl) _then) + : super(_value, _then); /// Create a copy of Product /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? id = null, Object? name = null}) { - return _then( - _$ProductImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_$ProductImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -157,7 +151,9 @@ class _$ProductImpl implements _Product { @override Map toJson() { - return _$$ProductImplToJson(this); + return _$$ProductImplToJson( + this, + ); } } diff --git a/lib/features/create_recipe/models/product.g.dart b/lib/features/create_recipe/models/product.g.dart index fc7323b7..74331101 100644 --- a/lib/features/create_recipe/models/product.g.dart +++ b/lib/features/create_recipe/models/product.g.dart @@ -13,4 +13,7 @@ _$ProductImpl _$$ProductImplFromJson(Map json) => ); Map _$$ProductImplToJson(_$ProductImpl instance) => - {'id': instance.id, 'name': instance.name}; + { + 'id': instance.id, + 'name': instance.name, + }; diff --git a/lib/features/create_recipe/models/recipe_create_model.dart b/lib/features/create_recipe/models/recipe_create_model.dart index a38398d9..e98f3f20 100644 --- a/lib/features/create_recipe/models/recipe_create_model.dart +++ b/lib/features/create_recipe/models/recipe_create_model.dart @@ -7,8 +7,8 @@ part 'recipe_create_model.freezed.dart'; part 'recipe_create_model.g.dart'; enum RecipeType { - first_meals, - second_meals, + @JsonKey(name: 'first_meals') firstMeals, + @JsonKey(name: 'second_meals') secondMeals, salads, snacks, sweets, diff --git a/lib/features/create_recipe/models/recipe_create_model.freezed.dart b/lib/features/create_recipe/models/recipe_create_model.freezed.dart index 5e4efb8d..fef77824 100644 --- a/lib/features/create_recipe/models/recipe_create_model.freezed.dart +++ b/lib/features/create_recipe/models/recipe_create_model.freezed.dart @@ -12,8 +12,7 @@ part of 'recipe_create_model.dart'; 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', -); + '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'); RecipeCreateModel _$RecipeCreateModelFromJson(Map json) { return _RecipeCreateModel.fromJson(json); @@ -52,24 +51,22 @@ mixin _$RecipeCreateModel { /// @nodoc abstract class $RecipeCreateModelCopyWith<$Res> { factory $RecipeCreateModelCopyWith( - RecipeCreateModel value, - $Res Function(RecipeCreateModel) then, - ) = _$RecipeCreateModelCopyWithImpl<$Res, RecipeCreateModel>; + RecipeCreateModel value, $Res Function(RecipeCreateModel) then) = + _$RecipeCreateModelCopyWithImpl<$Res, RecipeCreateModel>; @useResult - $Res call({ - String title, - String state, - @JsonKey(name: 'description_md') String description, - RecipeType type, - @JsonKey(name: 'video_url') String? videoUrl, - @JsonKey(name: 'cooking_time') String? cookingTime, - @JsonKey(name: 'active_time') String? activeTime, - String servings, - @JsonKey(name: 'energy_per_serving') String energyPerServing, - List tags, - List ingredients, - List steps, - }); + $Res call( + {String title, + String state, + @JsonKey(name: 'description_md') String description, + RecipeType type, + @JsonKey(name: 'video_url') String? videoUrl, + @JsonKey(name: 'cooking_time') String? cookingTime, + @JsonKey(name: 'active_time') String? activeTime, + String servings, + @JsonKey(name: 'energy_per_serving') String energyPerServing, + List tags, + List ingredients, + List steps}); } /// @nodoc @@ -100,107 +97,89 @@ class _$RecipeCreateModelCopyWithImpl<$Res, $Val extends RecipeCreateModel> Object? ingredients = null, Object? steps = null, }) { - return _then( - _value.copyWith( - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as RecipeType, - videoUrl: - freezed == videoUrl - ? _value.videoUrl - : videoUrl // ignore: cast_nullable_to_non_nullable - as String?, - cookingTime: - freezed == cookingTime - ? _value.cookingTime - : cookingTime // ignore: cast_nullable_to_non_nullable - as String?, - activeTime: - freezed == activeTime - ? _value.activeTime - : activeTime // ignore: cast_nullable_to_non_nullable - as String?, - servings: - null == servings - ? _value.servings - : servings // ignore: cast_nullable_to_non_nullable - as String, - energyPerServing: - null == energyPerServing - ? _value.energyPerServing - : energyPerServing // ignore: cast_nullable_to_non_nullable - as String, - tags: - null == tags - ? _value.tags - : tags // ignore: cast_nullable_to_non_nullable - as List, - ingredients: - null == ingredients - ? _value.ingredients - : ingredients // ignore: cast_nullable_to_non_nullable - as List, - steps: - null == steps - ? _value.steps - : steps // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + return _then(_value.copyWith( + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RecipeType, + videoUrl: freezed == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String?, + cookingTime: freezed == cookingTime + ? _value.cookingTime + : cookingTime // ignore: cast_nullable_to_non_nullable + as String?, + activeTime: freezed == activeTime + ? _value.activeTime + : activeTime // ignore: cast_nullable_to_non_nullable + as String?, + servings: null == servings + ? _value.servings + : servings // ignore: cast_nullable_to_non_nullable + as String, + energyPerServing: null == energyPerServing + ? _value.energyPerServing + : energyPerServing // ignore: cast_nullable_to_non_nullable + as String, + tags: null == tags + ? _value.tags + : tags // ignore: cast_nullable_to_non_nullable + as List, + ingredients: null == ingredients + ? _value.ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List, + steps: null == steps + ? _value.steps + : steps // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } } /// @nodoc abstract class _$$RecipeCreateModelImplCopyWith<$Res> implements $RecipeCreateModelCopyWith<$Res> { - factory _$$RecipeCreateModelImplCopyWith( - _$RecipeCreateModelImpl value, - $Res Function(_$RecipeCreateModelImpl) then, - ) = __$$RecipeCreateModelImplCopyWithImpl<$Res>; + factory _$$RecipeCreateModelImplCopyWith(_$RecipeCreateModelImpl value, + $Res Function(_$RecipeCreateModelImpl) then) = + __$$RecipeCreateModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String title, - String state, - @JsonKey(name: 'description_md') String description, - RecipeType type, - @JsonKey(name: 'video_url') String? videoUrl, - @JsonKey(name: 'cooking_time') String? cookingTime, - @JsonKey(name: 'active_time') String? activeTime, - String servings, - @JsonKey(name: 'energy_per_serving') String energyPerServing, - List tags, - List ingredients, - List steps, - }); + $Res call( + {String title, + String state, + @JsonKey(name: 'description_md') String description, + RecipeType type, + @JsonKey(name: 'video_url') String? videoUrl, + @JsonKey(name: 'cooking_time') String? cookingTime, + @JsonKey(name: 'active_time') String? activeTime, + String servings, + @JsonKey(name: 'energy_per_serving') String energyPerServing, + List tags, + List ingredients, + List steps}); } /// @nodoc class __$$RecipeCreateModelImplCopyWithImpl<$Res> extends _$RecipeCreateModelCopyWithImpl<$Res, _$RecipeCreateModelImpl> implements _$$RecipeCreateModelImplCopyWith<$Res> { - __$$RecipeCreateModelImplCopyWithImpl( - _$RecipeCreateModelImpl _value, - $Res Function(_$RecipeCreateModelImpl) _then, - ) : super(_value, _then); + __$$RecipeCreateModelImplCopyWithImpl(_$RecipeCreateModelImpl _value, + $Res Function(_$RecipeCreateModelImpl) _then) + : super(_value, _then); /// Create a copy of RecipeCreateModel /// with the given fields replaced by the non-null parameter values. @@ -220,92 +199,78 @@ class __$$RecipeCreateModelImplCopyWithImpl<$Res> Object? ingredients = null, Object? steps = null, }) { - return _then( - _$RecipeCreateModelImpl( - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as RecipeType, - videoUrl: - freezed == videoUrl - ? _value.videoUrl - : videoUrl // ignore: cast_nullable_to_non_nullable - as String?, - cookingTime: - freezed == cookingTime - ? _value.cookingTime - : cookingTime // ignore: cast_nullable_to_non_nullable - as String?, - activeTime: - freezed == activeTime - ? _value.activeTime - : activeTime // ignore: cast_nullable_to_non_nullable - as String?, - servings: - null == servings - ? _value.servings - : servings // ignore: cast_nullable_to_non_nullable - as String, - energyPerServing: - null == energyPerServing - ? _value.energyPerServing - : energyPerServing // ignore: cast_nullable_to_non_nullable - as String, - tags: - null == tags - ? _value._tags - : tags // ignore: cast_nullable_to_non_nullable - as List, - ingredients: - null == ingredients - ? _value._ingredients - : ingredients // ignore: cast_nullable_to_non_nullable - as List, - steps: - null == steps - ? _value._steps - : steps // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + return _then(_$RecipeCreateModelImpl( + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RecipeType, + videoUrl: freezed == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String?, + cookingTime: freezed == cookingTime + ? _value.cookingTime + : cookingTime // ignore: cast_nullable_to_non_nullable + as String?, + activeTime: freezed == activeTime + ? _value.activeTime + : activeTime // ignore: cast_nullable_to_non_nullable + as String?, + servings: null == servings + ? _value.servings + : servings // ignore: cast_nullable_to_non_nullable + as String, + energyPerServing: null == energyPerServing + ? _value.energyPerServing + : energyPerServing // ignore: cast_nullable_to_non_nullable + as String, + tags: null == tags + ? _value._tags + : tags // ignore: cast_nullable_to_non_nullable + as List, + ingredients: null == ingredients + ? _value._ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List, + steps: null == steps + ? _value._steps + : steps // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc @JsonSerializable() class _$RecipeCreateModelImpl implements _RecipeCreateModel { - const _$RecipeCreateModelImpl({ - required this.title, - required this.state, - @JsonKey(name: 'description_md') required this.description, - required this.type, - @JsonKey(name: 'video_url') this.videoUrl, - @JsonKey(name: 'cooking_time') this.cookingTime, - @JsonKey(name: 'active_time') this.activeTime, - required this.servings, - @JsonKey(name: 'energy_per_serving') required this.energyPerServing, - required final List tags, - required final List ingredients, - required final List steps, - }) : _tags = tags, - _ingredients = ingredients, - _steps = steps; + const _$RecipeCreateModelImpl( + {required this.title, + required this.state, + @JsonKey(name: 'description_md') required this.description, + required this.type, + @JsonKey(name: 'video_url') this.videoUrl, + @JsonKey(name: 'cooking_time') this.cookingTime, + @JsonKey(name: 'active_time') this.activeTime, + required this.servings, + @JsonKey(name: 'energy_per_serving') required this.energyPerServing, + required final List tags, + required final List ingredients, + required final List steps}) + : _tags = tags, + _ingredients = ingredients, + _steps = steps; factory _$RecipeCreateModelImpl.fromJson(Map json) => _$$RecipeCreateModelImplFromJson(json); @@ -383,30 +348,27 @@ class _$RecipeCreateModelImpl implements _RecipeCreateModel { (identical(other.energyPerServing, energyPerServing) || other.energyPerServing == energyPerServing) && const DeepCollectionEquality().equals(other._tags, _tags) && - const DeepCollectionEquality().equals( - other._ingredients, - _ingredients, - ) && + const DeepCollectionEquality() + .equals(other._ingredients, _ingredients) && const DeepCollectionEquality().equals(other._steps, _steps)); } @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - title, - state, - description, - type, - videoUrl, - cookingTime, - activeTime, - servings, - energyPerServing, - const DeepCollectionEquality().hash(_tags), - const DeepCollectionEquality().hash(_ingredients), - const DeepCollectionEquality().hash(_steps), - ); + runtimeType, + title, + state, + description, + type, + videoUrl, + cookingTime, + activeTime, + servings, + energyPerServing, + const DeepCollectionEquality().hash(_tags), + const DeepCollectionEquality().hash(_ingredients), + const DeepCollectionEquality().hash(_steps)); /// Create a copy of RecipeCreateModel /// with the given fields replaced by the non-null parameter values. @@ -415,31 +377,31 @@ class _$RecipeCreateModelImpl implements _RecipeCreateModel { @pragma('vm:prefer-inline') _$$RecipeCreateModelImplCopyWith<_$RecipeCreateModelImpl> get copyWith => __$$RecipeCreateModelImplCopyWithImpl<_$RecipeCreateModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$RecipeCreateModelImplToJson(this); + return _$$RecipeCreateModelImplToJson( + this, + ); } } abstract class _RecipeCreateModel implements RecipeCreateModel { - const factory _RecipeCreateModel({ - required final String title, - required final String state, - @JsonKey(name: 'description_md') required final String description, - required final RecipeType type, - @JsonKey(name: 'video_url') final String? videoUrl, - @JsonKey(name: 'cooking_time') final String? cookingTime, - @JsonKey(name: 'active_time') final String? activeTime, - required final String servings, - @JsonKey(name: 'energy_per_serving') required final String energyPerServing, - required final List tags, - required final List ingredients, - required final List steps, - }) = _$RecipeCreateModelImpl; + const factory _RecipeCreateModel( + {required final String title, + required final String state, + @JsonKey(name: 'description_md') required final String description, + required final RecipeType type, + @JsonKey(name: 'video_url') final String? videoUrl, + @JsonKey(name: 'cooking_time') final String? cookingTime, + @JsonKey(name: 'active_time') final String? activeTime, + required final String servings, + @JsonKey(name: 'energy_per_serving') + required final String energyPerServing, + required final List tags, + required final List ingredients, + required final List steps}) = _$RecipeCreateModelImpl; factory _RecipeCreateModel.fromJson(Map json) = _$RecipeCreateModelImpl.fromJson; diff --git a/lib/features/create_recipe/models/recipe_create_model.g.dart b/lib/features/create_recipe/models/recipe_create_model.g.dart index 6f3efc13..4760bb91 100644 --- a/lib/features/create_recipe/models/recipe_create_model.g.dart +++ b/lib/features/create_recipe/models/recipe_create_model.g.dart @@ -7,48 +7,46 @@ part of 'recipe_create_model.dart'; // ************************************************************************** _$RecipeCreateModelImpl _$$RecipeCreateModelImplFromJson( - Map json, -) => _$RecipeCreateModelImpl( - title: json['title'] as String, - state: json['state'] as String, - description: json['description_md'] as String, - type: $enumDecode(_$RecipeTypeEnumMap, json['type']), - videoUrl: json['video_url'] as String?, - cookingTime: json['cooking_time'] as String?, - activeTime: json['active_time'] as String?, - servings: json['servings'] as String, - energyPerServing: json['energy_per_serving'] as String, - tags: (json['tags'] as List).map((e) => e as String).toList(), - ingredients: - (json['ingredients'] as List) + Map json) => + _$RecipeCreateModelImpl( + title: json['title'] as String, + state: json['state'] as String, + description: json['description_md'] as String, + type: $enumDecode(_$RecipeTypeEnumMap, json['type']), + videoUrl: json['video_url'] as String?, + cookingTime: json['cooking_time'] as String?, + activeTime: json['active_time'] as String?, + servings: json['servings'] as String, + energyPerServing: json['energy_per_serving'] as String, + tags: (json['tags'] as List).map((e) => e as String).toList(), + ingredients: (json['ingredients'] as List) .map((e) => Ingredient.fromJson(e as Map)) .toList(), - steps: - (json['steps'] as List) + steps: (json['steps'] as List) .map((e) => Step.fromJson(e as Map)) .toList(), -); + ); Map _$$RecipeCreateModelImplToJson( - _$RecipeCreateModelImpl instance, -) => { - 'title': instance.title, - 'state': instance.state, - 'description_md': instance.description, - 'type': _$RecipeTypeEnumMap[instance.type]!, - 'video_url': instance.videoUrl, - 'cooking_time': instance.cookingTime, - 'active_time': instance.activeTime, - 'servings': instance.servings, - 'energy_per_serving': instance.energyPerServing, - 'tags': instance.tags, - 'ingredients': instance.ingredients, - 'steps': instance.steps, -}; + _$RecipeCreateModelImpl instance) => + { + 'title': instance.title, + 'state': instance.state, + 'description_md': instance.description, + 'type': _$RecipeTypeEnumMap[instance.type]!, + 'video_url': instance.videoUrl, + 'cooking_time': instance.cookingTime, + 'active_time': instance.activeTime, + 'servings': instance.servings, + 'energy_per_serving': instance.energyPerServing, + 'tags': instance.tags, + 'ingredients': instance.ingredients, + 'steps': instance.steps, + }; const _$RecipeTypeEnumMap = { - RecipeType.first_meals: 'first_meals', - RecipeType.second_meals: 'second_meals', + RecipeType.firstMeals: 'firstMeals', + RecipeType.secondMeals: 'secondMeals', RecipeType.salads: 'salads', RecipeType.snacks: 'snacks', RecipeType.sweets: 'sweets', diff --git a/lib/features/create_recipe/models/recipe_model.dart b/lib/features/create_recipe/models/recipe_model.dart index b79425d1..87cd6bda 100644 --- a/lib/features/create_recipe/models/recipe_model.dart +++ b/lib/features/create_recipe/models/recipe_model.dart @@ -16,12 +16,12 @@ class RecipeModel with _$RecipeModel { String? state, String? title, String? description, - String? video_url, + @JsonKey(name: 'video_url') String? videoUrl, String? image, int? totalCookingTime, int? activeCookTime, - int? servings, - int? energyPerServing, + int? servings, + int? energyPerServing, }) = _RecipeModel; factory RecipeModel.fromJson(Map json) => _$RecipeModelFromJson(json); diff --git a/lib/features/create_recipe/models/recipe_model.freezed.dart b/lib/features/create_recipe/models/recipe_model.freezed.dart index c1cd9ff9..b55ebd17 100644 --- a/lib/features/create_recipe/models/recipe_model.freezed.dart +++ b/lib/features/create_recipe/models/recipe_model.freezed.dart @@ -12,8 +12,7 @@ part of 'recipe_model.dart'; 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', -); + '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'); RecipeModel _$RecipeModelFromJson(Map json) { return _RecipeModel.fromJson(json); @@ -28,7 +27,8 @@ mixin _$RecipeModel { String? get state => throw _privateConstructorUsedError; String? get title => throw _privateConstructorUsedError; String? get description => throw _privateConstructorUsedError; - String? get video_url => throw _privateConstructorUsedError; + @JsonKey(name: 'video_url') + String? get videoUrl => throw _privateConstructorUsedError; String? get image => throw _privateConstructorUsedError; int? get totalCookingTime => throw _privateConstructorUsedError; int? get activeCookTime => throw _privateConstructorUsedError; @@ -48,25 +48,23 @@ mixin _$RecipeModel { /// @nodoc abstract class $RecipeModelCopyWith<$Res> { factory $RecipeModelCopyWith( - RecipeModel value, - $Res Function(RecipeModel) then, - ) = _$RecipeModelCopyWithImpl<$Res, RecipeModel>; + RecipeModel value, $Res Function(RecipeModel) then) = + _$RecipeModelCopyWithImpl<$Res, RecipeModel>; @useResult - $Res call({ - List? ingredients, - List? steps, - List? tags, - String? type, - String? state, - String? title, - String? description, - String? video_url, - String? image, - int? totalCookingTime, - int? activeCookTime, - int? servings, - int? energyPerServing, - }); + $Res call( + {List? ingredients, + List? steps, + List? tags, + String? type, + String? state, + String? title, + String? description, + @JsonKey(name: 'video_url') String? videoUrl, + String? image, + int? totalCookingTime, + int? activeCookTime, + int? servings, + int? energyPerServing}); } /// @nodoc @@ -91,83 +89,67 @@ class _$RecipeModelCopyWithImpl<$Res, $Val extends RecipeModel> Object? state = freezed, Object? title = freezed, Object? description = freezed, - Object? video_url = freezed, + Object? videoUrl = freezed, Object? image = freezed, Object? totalCookingTime = freezed, Object? activeCookTime = freezed, Object? servings = freezed, Object? energyPerServing = freezed, }) { - return _then( - _value.copyWith( - ingredients: - freezed == ingredients - ? _value.ingredients - : ingredients // ignore: cast_nullable_to_non_nullable - as List?, - steps: - freezed == steps - ? _value.steps - : steps // ignore: cast_nullable_to_non_nullable - as List?, - tags: - freezed == tags - ? _value.tags - : tags // ignore: cast_nullable_to_non_nullable - as List?, - type: - freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - state: - freezed == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String?, - title: - freezed == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String?, - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - video_url: - freezed == video_url - ? _value.video_url - : video_url // ignore: cast_nullable_to_non_nullable - as String?, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - totalCookingTime: - freezed == totalCookingTime - ? _value.totalCookingTime - : totalCookingTime // ignore: cast_nullable_to_non_nullable - as int?, - activeCookTime: - freezed == activeCookTime - ? _value.activeCookTime - : activeCookTime // ignore: cast_nullable_to_non_nullable - as int?, - servings: - freezed == servings - ? _value.servings - : servings // ignore: cast_nullable_to_non_nullable - as int?, - energyPerServing: - freezed == energyPerServing - ? _value.energyPerServing - : energyPerServing // ignore: cast_nullable_to_non_nullable - as int?, - ) - as $Val, - ); + return _then(_value.copyWith( + ingredients: freezed == ingredients + ? _value.ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List?, + steps: freezed == steps + ? _value.steps + : steps // ignore: cast_nullable_to_non_nullable + as List?, + tags: freezed == tags + ? _value.tags + : tags // ignore: cast_nullable_to_non_nullable + as List?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + videoUrl: freezed == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String?, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + totalCookingTime: freezed == totalCookingTime + ? _value.totalCookingTime + : totalCookingTime // ignore: cast_nullable_to_non_nullable + as int?, + activeCookTime: freezed == activeCookTime + ? _value.activeCookTime + : activeCookTime // ignore: cast_nullable_to_non_nullable + as int?, + servings: freezed == servings + ? _value.servings + : servings // ignore: cast_nullable_to_non_nullable + as int?, + energyPerServing: freezed == energyPerServing + ? _value.energyPerServing + : energyPerServing // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); } } @@ -175,26 +157,24 @@ class _$RecipeModelCopyWithImpl<$Res, $Val extends RecipeModel> abstract class _$$RecipeModelImplCopyWith<$Res> implements $RecipeModelCopyWith<$Res> { factory _$$RecipeModelImplCopyWith( - _$RecipeModelImpl value, - $Res Function(_$RecipeModelImpl) then, - ) = __$$RecipeModelImplCopyWithImpl<$Res>; + _$RecipeModelImpl value, $Res Function(_$RecipeModelImpl) then) = + __$$RecipeModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - List? ingredients, - List? steps, - List? tags, - String? type, - String? state, - String? title, - String? description, - String? video_url, - String? image, - int? totalCookingTime, - int? activeCookTime, - int? servings, - int? energyPerServing, - }); + $Res call( + {List? ingredients, + List? steps, + List? tags, + String? type, + String? state, + String? title, + String? description, + @JsonKey(name: 'video_url') String? videoUrl, + String? image, + int? totalCookingTime, + int? activeCookTime, + int? servings, + int? energyPerServing}); } /// @nodoc @@ -202,9 +182,8 @@ class __$$RecipeModelImplCopyWithImpl<$Res> extends _$RecipeModelCopyWithImpl<$Res, _$RecipeModelImpl> implements _$$RecipeModelImplCopyWith<$Res> { __$$RecipeModelImplCopyWithImpl( - _$RecipeModelImpl _value, - $Res Function(_$RecipeModelImpl) _then, - ) : super(_value, _then); + _$RecipeModelImpl _value, $Res Function(_$RecipeModelImpl) _then) + : super(_value, _then); /// Create a copy of RecipeModel /// with the given fields replaced by the non-null parameter values. @@ -218,105 +197,90 @@ class __$$RecipeModelImplCopyWithImpl<$Res> Object? state = freezed, Object? title = freezed, Object? description = freezed, - Object? video_url = freezed, + Object? videoUrl = freezed, Object? image = freezed, Object? totalCookingTime = freezed, Object? activeCookTime = freezed, Object? servings = freezed, Object? energyPerServing = freezed, }) { - return _then( - _$RecipeModelImpl( - ingredients: - freezed == ingredients - ? _value._ingredients - : ingredients // ignore: cast_nullable_to_non_nullable - as List?, - steps: - freezed == steps - ? _value._steps - : steps // ignore: cast_nullable_to_non_nullable - as List?, - tags: - freezed == tags - ? _value._tags - : tags // ignore: cast_nullable_to_non_nullable - as List?, - type: - freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - state: - freezed == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String?, - title: - freezed == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String?, - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - video_url: - freezed == video_url - ? _value.video_url - : video_url // ignore: cast_nullable_to_non_nullable - as String?, - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - totalCookingTime: - freezed == totalCookingTime - ? _value.totalCookingTime - : totalCookingTime // ignore: cast_nullable_to_non_nullable - as int?, - activeCookTime: - freezed == activeCookTime - ? _value.activeCookTime - : activeCookTime // ignore: cast_nullable_to_non_nullable - as int?, - servings: - freezed == servings - ? _value.servings - : servings // ignore: cast_nullable_to_non_nullable - as int?, - energyPerServing: - freezed == energyPerServing - ? _value.energyPerServing - : energyPerServing // ignore: cast_nullable_to_non_nullable - as int?, - ), - ); + return _then(_$RecipeModelImpl( + ingredients: freezed == ingredients + ? _value._ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List?, + steps: freezed == steps + ? _value._steps + : steps // ignore: cast_nullable_to_non_nullable + as List?, + tags: freezed == tags + ? _value._tags + : tags // ignore: cast_nullable_to_non_nullable + as List?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + videoUrl: freezed == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String?, + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + totalCookingTime: freezed == totalCookingTime + ? _value.totalCookingTime + : totalCookingTime // ignore: cast_nullable_to_non_nullable + as int?, + activeCookTime: freezed == activeCookTime + ? _value.activeCookTime + : activeCookTime // ignore: cast_nullable_to_non_nullable + as int?, + servings: freezed == servings + ? _value.servings + : servings // ignore: cast_nullable_to_non_nullable + as int?, + energyPerServing: freezed == energyPerServing + ? _value.energyPerServing + : energyPerServing // ignore: cast_nullable_to_non_nullable + as int?, + )); } } /// @nodoc @JsonSerializable() class _$RecipeModelImpl implements _RecipeModel { - const _$RecipeModelImpl({ - final List? ingredients, - final List? steps, - final List? tags, - this.type, - this.state, - this.title, - this.description, - this.video_url, - this.image, - this.totalCookingTime, - this.activeCookTime, - this.servings, - this.energyPerServing, - }) : _ingredients = ingredients, - _steps = steps, - _tags = tags; + const _$RecipeModelImpl( + {final List? ingredients, + final List? steps, + final List? tags, + this.type, + this.state, + this.title, + this.description, + @JsonKey(name: 'video_url') this.videoUrl, + this.image, + this.totalCookingTime, + this.activeCookTime, + this.servings, + this.energyPerServing}) + : _ingredients = ingredients, + _steps = steps, + _tags = tags; factory _$RecipeModelImpl.fromJson(Map json) => _$$RecipeModelImplFromJson(json); @@ -360,7 +324,8 @@ class _$RecipeModelImpl implements _RecipeModel { @override final String? description; @override - final String? video_url; + @JsonKey(name: 'video_url') + final String? videoUrl; @override final String? image; @override @@ -374,7 +339,7 @@ class _$RecipeModelImpl implements _RecipeModel { @override String toString() { - return 'RecipeModel(ingredients: $ingredients, steps: $steps, tags: $tags, type: $type, state: $state, title: $title, description: $description, video_url: $video_url, image: $image, totalCookingTime: $totalCookingTime, activeCookTime: $activeCookTime, servings: $servings, energyPerServing: $energyPerServing)'; + return 'RecipeModel(ingredients: $ingredients, steps: $steps, tags: $tags, type: $type, state: $state, title: $title, description: $description, videoUrl: $videoUrl, image: $image, totalCookingTime: $totalCookingTime, activeCookTime: $activeCookTime, servings: $servings, energyPerServing: $energyPerServing)'; } @override @@ -382,10 +347,8 @@ class _$RecipeModelImpl implements _RecipeModel { return identical(this, other) || (other.runtimeType == runtimeType && other is _$RecipeModelImpl && - const DeepCollectionEquality().equals( - other._ingredients, - _ingredients, - ) && + const DeepCollectionEquality() + .equals(other._ingredients, _ingredients) && const DeepCollectionEquality().equals(other._steps, _steps) && const DeepCollectionEquality().equals(other._tags, _tags) && (identical(other.type, type) || other.type == type) && @@ -393,8 +356,8 @@ class _$RecipeModelImpl implements _RecipeModel { (identical(other.title, title) || other.title == title) && (identical(other.description, description) || other.description == description) && - (identical(other.video_url, video_url) || - other.video_url == video_url) && + (identical(other.videoUrl, videoUrl) || + other.videoUrl == videoUrl) && (identical(other.image, image) || other.image == image) && (identical(other.totalCookingTime, totalCookingTime) || other.totalCookingTime == totalCookingTime) && @@ -409,21 +372,20 @@ class _$RecipeModelImpl implements _RecipeModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_ingredients), - const DeepCollectionEquality().hash(_steps), - const DeepCollectionEquality().hash(_tags), - type, - state, - title, - description, - video_url, - image, - totalCookingTime, - activeCookTime, - servings, - energyPerServing, - ); + runtimeType, + const DeepCollectionEquality().hash(_ingredients), + const DeepCollectionEquality().hash(_steps), + const DeepCollectionEquality().hash(_tags), + type, + state, + title, + description, + videoUrl, + image, + totalCookingTime, + activeCookTime, + servings, + energyPerServing); /// Create a copy of RecipeModel /// with the given fields replaced by the non-null parameter values. @@ -435,26 +397,27 @@ class _$RecipeModelImpl implements _RecipeModel { @override Map toJson() { - return _$$RecipeModelImplToJson(this); + return _$$RecipeModelImplToJson( + this, + ); } } abstract class _RecipeModel implements RecipeModel { - const factory _RecipeModel({ - final List? ingredients, - final List? steps, - final List? tags, - final String? type, - final String? state, - final String? title, - final String? description, - final String? video_url, - final String? image, - final int? totalCookingTime, - final int? activeCookTime, - final int? servings, - final int? energyPerServing, - }) = _$RecipeModelImpl; + const factory _RecipeModel( + {final List? ingredients, + final List? steps, + final List? tags, + final String? type, + final String? state, + final String? title, + final String? description, + @JsonKey(name: 'video_url') final String? videoUrl, + final String? image, + final int? totalCookingTime, + final int? activeCookTime, + final int? servings, + final int? energyPerServing}) = _$RecipeModelImpl; factory _RecipeModel.fromJson(Map json) = _$RecipeModelImpl.fromJson; @@ -474,7 +437,8 @@ abstract class _RecipeModel implements RecipeModel { @override String? get description; @override - String? get video_url; + @JsonKey(name: 'video_url') + String? get videoUrl; @override String? get image; @override diff --git a/lib/features/create_recipe/models/recipe_model.g.dart b/lib/features/create_recipe/models/recipe_model.g.dart index 8d2115b3..f8cceca2 100644 --- a/lib/features/create_recipe/models/recipe_model.g.dart +++ b/lib/features/create_recipe/models/recipe_model.g.dart @@ -8,28 +8,20 @@ part of 'recipe_model.dart'; _$RecipeModelImpl _$$RecipeModelImplFromJson(Map json) => _$RecipeModelImpl( - ingredients: - (json['ingredients'] as List?) - ?.map( - (e) => - e == null - ? null - : Ingredient.fromJson(e as Map), - ) - .toList(), - steps: - (json['steps'] as List?) - ?.map( - (e) => - e == null ? null : Step.fromJson(e as Map), - ) - .toList(), + ingredients: (json['ingredients'] as List?) + ?.map((e) => + e == null ? null : Ingredient.fromJson(e as Map)) + .toList(), + steps: (json['steps'] as List?) + ?.map((e) => + e == null ? null : Step.fromJson(e as Map)) + .toList(), tags: (json['tags'] as List?)?.map((e) => e as String).toList(), type: json['type'] as String?, state: json['state'] as String?, title: json['title'] as String?, description: json['description'] as String?, - video_url: json['video_url'] as String?, + videoUrl: json['video_url'] as String?, image: json['image'] as String?, totalCookingTime: (json['totalCookingTime'] as num?)?.toInt(), activeCookTime: (json['activeCookTime'] as num?)?.toInt(), @@ -46,7 +38,7 @@ Map _$$RecipeModelImplToJson(_$RecipeModelImpl instance) => 'state': instance.state, 'title': instance.title, 'description': instance.description, - 'video_url': instance.video_url, + 'video_url': instance.videoUrl, 'image': instance.image, 'totalCookingTime': instance.totalCookingTime, 'activeCookTime': instance.activeCookTime, diff --git a/lib/features/create_recipe/models/recipe_tag_model.freezed.dart b/lib/features/create_recipe/models/recipe_tag_model.freezed.dart index 192f8ca8..d9993da3 100644 --- a/lib/features/create_recipe/models/recipe_tag_model.freezed.dart +++ b/lib/features/create_recipe/models/recipe_tag_model.freezed.dart @@ -12,8 +12,7 @@ part of 'recipe_tag_model.dart'; 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', -); + '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'); RecipeTagModel _$RecipeTagModelFromJson(Map json) { return _RecipeTagModel.fromJson(json); @@ -41,15 +40,13 @@ mixin _$RecipeTagModel { /// @nodoc abstract class $RecipeTagModelCopyWith<$Res> { factory $RecipeTagModelCopyWith( - RecipeTagModel value, - $Res Function(RecipeTagModel) then, - ) = _$RecipeTagModelCopyWithImpl<$Res, RecipeTagModel>; + RecipeTagModel value, $Res Function(RecipeTagModel) then) = + _$RecipeTagModelCopyWithImpl<$Res, RecipeTagModel>; @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "links") Links links, - @JsonKey(name: "meta") Meta meta, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); $LinksCopyWith<$Res> get links; $MetaCopyWith<$Res> get meta; @@ -69,27 +66,25 @@ class _$RecipeTagModelCopyWithImpl<$Res, $Val extends RecipeTagModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _value.copyWith( - data: - null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ) - as $Val, - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_value.copyWith( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + ) as $Val); } /// Create a copy of RecipeTagModel @@ -116,17 +111,15 @@ class _$RecipeTagModelCopyWithImpl<$Res, $Val extends RecipeTagModel> /// @nodoc abstract class _$$RecipeTagModelImplCopyWith<$Res> implements $RecipeTagModelCopyWith<$Res> { - factory _$$RecipeTagModelImplCopyWith( - _$RecipeTagModelImpl value, - $Res Function(_$RecipeTagModelImpl) then, - ) = __$$RecipeTagModelImplCopyWithImpl<$Res>; + factory _$$RecipeTagModelImplCopyWith(_$RecipeTagModelImpl value, + $Res Function(_$RecipeTagModelImpl) then) = + __$$RecipeTagModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "links") Links links, - @JsonKey(name: "meta") Meta meta, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); @override $LinksCopyWith<$Res> get links; @@ -139,45 +132,43 @@ class __$$RecipeTagModelImplCopyWithImpl<$Res> extends _$RecipeTagModelCopyWithImpl<$Res, _$RecipeTagModelImpl> implements _$$RecipeTagModelImplCopyWith<$Res> { __$$RecipeTagModelImplCopyWithImpl( - _$RecipeTagModelImpl _value, - $Res Function(_$RecipeTagModelImpl) _then, - ) : super(_value, _then); + _$RecipeTagModelImpl _value, $Res Function(_$RecipeTagModelImpl) _then) + : super(_value, _then); /// Create a copy of RecipeTagModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _$RecipeTagModelImpl( - data: - null == data - ? _value._data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ), - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_$RecipeTagModelImpl( + data: null == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + )); } } /// @nodoc @JsonSerializable() class _$RecipeTagModelImpl implements _RecipeTagModel { - const _$RecipeTagModelImpl({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "links") required this.links, - @JsonKey(name: "meta") required this.meta, - }) : _data = data; + const _$RecipeTagModelImpl( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "links") required this.links, + @JsonKey(name: "meta") required this.meta}) + : _data = data; factory _$RecipeTagModelImpl.fromJson(Map json) => _$$RecipeTagModelImplFromJson(json); @@ -216,11 +207,7 @@ class _$RecipeTagModelImpl implements _RecipeTagModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_data), - links, - meta, - ); + runtimeType, const DeepCollectionEquality().hash(_data), links, meta); /// Create a copy of RecipeTagModel /// with the given fields replaced by the non-null parameter values. @@ -229,22 +216,21 @@ class _$RecipeTagModelImpl implements _RecipeTagModel { @pragma('vm:prefer-inline') _$$RecipeTagModelImplCopyWith<_$RecipeTagModelImpl> get copyWith => __$$RecipeTagModelImplCopyWithImpl<_$RecipeTagModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$RecipeTagModelImplToJson(this); + return _$$RecipeTagModelImplToJson( + this, + ); } } abstract class _RecipeTagModel implements RecipeTagModel { - const factory _RecipeTagModel({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "links") required final Links links, - @JsonKey(name: "meta") required final Meta meta, - }) = _$RecipeTagModelImpl; + const factory _RecipeTagModel( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "links") required final Links links, + @JsonKey(name: "meta") required final Meta meta}) = _$RecipeTagModelImpl; factory _RecipeTagModel.fromJson(Map json) = _$RecipeTagModelImpl.fromJson; @@ -299,13 +285,12 @@ abstract class $RecipeTagCopyWith<$Res> { factory $RecipeTagCopyWith(RecipeTag value, $Res Function(RecipeTag) then) = _$RecipeTagCopyWithImpl<$Res, RecipeTag>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "name") String name, - @JsonKey(name: "recipes_count") int recipesCount, - @JsonKey(name: "created_at") DateTime createdAt, - @JsonKey(name: "updated_at") DateTime updatedAt, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "name") String name, + @JsonKey(name: "recipes_count") int recipesCount, + @JsonKey(name: "created_at") DateTime createdAt, + @JsonKey(name: "updated_at") DateTime updatedAt}); } /// @nodoc @@ -329,36 +314,28 @@ class _$RecipeTagCopyWithImpl<$Res, $Val extends RecipeTag> Object? createdAt = null, Object? updatedAt = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - recipesCount: - null == recipesCount - ? _value.recipesCount - : recipesCount // ignore: cast_nullable_to_non_nullable - as int, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + recipesCount: null == recipesCount + ? _value.recipesCount + : recipesCount // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ) as $Val); } } @@ -366,18 +343,16 @@ class _$RecipeTagCopyWithImpl<$Res, $Val extends RecipeTag> abstract class _$$RecipeTagImplCopyWith<$Res> implements $RecipeTagCopyWith<$Res> { factory _$$RecipeTagImplCopyWith( - _$RecipeTagImpl value, - $Res Function(_$RecipeTagImpl) then, - ) = __$$RecipeTagImplCopyWithImpl<$Res>; + _$RecipeTagImpl value, $Res Function(_$RecipeTagImpl) then) = + __$$RecipeTagImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "name") String name, - @JsonKey(name: "recipes_count") int recipesCount, - @JsonKey(name: "created_at") DateTime createdAt, - @JsonKey(name: "updated_at") DateTime updatedAt, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "name") String name, + @JsonKey(name: "recipes_count") int recipesCount, + @JsonKey(name: "created_at") DateTime createdAt, + @JsonKey(name: "updated_at") DateTime updatedAt}); } /// @nodoc @@ -385,9 +360,8 @@ class __$$RecipeTagImplCopyWithImpl<$Res> extends _$RecipeTagCopyWithImpl<$Res, _$RecipeTagImpl> implements _$$RecipeTagImplCopyWith<$Res> { __$$RecipeTagImplCopyWithImpl( - _$RecipeTagImpl _value, - $Res Function(_$RecipeTagImpl) _then, - ) : super(_value, _then); + _$RecipeTagImpl _value, $Res Function(_$RecipeTagImpl) _then) + : super(_value, _then); /// Create a copy of RecipeTag /// with the given fields replaced by the non-null parameter values. @@ -400,48 +374,40 @@ class __$$RecipeTagImplCopyWithImpl<$Res> Object? createdAt = null, Object? updatedAt = null, }) { - return _then( - _$RecipeTagImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - recipesCount: - null == recipesCount - ? _value.recipesCount - : recipesCount // ignore: cast_nullable_to_non_nullable - as int, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - ), - ); + return _then(_$RecipeTagImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + recipesCount: null == recipesCount + ? _value.recipesCount + : recipesCount // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); } } /// @nodoc @JsonSerializable() class _$RecipeTagImpl implements _RecipeTag { - const _$RecipeTagImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "name") required this.name, - @JsonKey(name: "recipes_count") required this.recipesCount, - @JsonKey(name: "created_at") required this.createdAt, - @JsonKey(name: "updated_at") required this.updatedAt, - }); + const _$RecipeTagImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "name") required this.name, + @JsonKey(name: "recipes_count") required this.recipesCount, + @JsonKey(name: "created_at") required this.createdAt, + @JsonKey(name: "updated_at") required this.updatedAt}); factory _$RecipeTagImpl.fromJson(Map json) => _$$RecipeTagImplFromJson(json); @@ -497,18 +463,20 @@ class _$RecipeTagImpl implements _RecipeTag { @override Map toJson() { - return _$$RecipeTagImplToJson(this); + return _$$RecipeTagImplToJson( + this, + ); } } abstract class _RecipeTag implements RecipeTag { - const factory _RecipeTag({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "name") required final String name, - @JsonKey(name: "recipes_count") required final int recipesCount, - @JsonKey(name: "created_at") required final DateTime createdAt, - @JsonKey(name: "updated_at") required final DateTime updatedAt, - }) = _$RecipeTagImpl; + const factory _RecipeTag( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "name") required final String name, + @JsonKey(name: "recipes_count") required final int recipesCount, + @JsonKey(name: "created_at") required final DateTime createdAt, + @JsonKey(name: "updated_at") required final DateTime updatedAt}) = + _$RecipeTagImpl; factory _RecipeTag.fromJson(Map json) = _$RecipeTagImpl.fromJson; diff --git a/lib/features/create_recipe/models/recipe_tag_model.g.dart b/lib/features/create_recipe/models/recipe_tag_model.g.dart index 423540f1..cd387547 100644 --- a/lib/features/create_recipe/models/recipe_tag_model.g.dart +++ b/lib/features/create_recipe/models/recipe_tag_model.g.dart @@ -8,21 +8,20 @@ part of 'recipe_tag_model.dart'; _$RecipeTagModelImpl _$$RecipeTagModelImplFromJson(Map json) => _$RecipeTagModelImpl( - data: - (json['data'] as List) - .map((e) => RecipeTag.fromJson(e as Map)) - .toList(), + data: (json['data'] as List) + .map((e) => RecipeTag.fromJson(e as Map)) + .toList(), links: Links.fromJson(json['links'] as Map), meta: Meta.fromJson(json['meta'] as Map), ); Map _$$RecipeTagModelImplToJson( - _$RecipeTagModelImpl instance, -) => { - 'data': instance.data, - 'links': instance.links, - 'meta': instance.meta, -}; + _$RecipeTagModelImpl instance) => + { + 'data': instance.data, + 'links': instance.links, + 'meta': instance.meta, + }; _$RecipeTagImpl _$$RecipeTagImplFromJson(Map json) => _$RecipeTagImpl( diff --git a/lib/features/create_recipe/models/step.freezed.dart b/lib/features/create_recipe/models/step.freezed.dart index b365e053..040dd5aa 100644 --- a/lib/features/create_recipe/models/step.freezed.dart +++ b/lib/features/create_recipe/models/step.freezed.dart @@ -12,8 +12,7 @@ part of 'step.dart'; 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', -); + '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'); Step _$StepFromJson(Map json) { return _Step.fromJson(json); @@ -55,31 +54,28 @@ class _$StepCopyWithImpl<$Res, $Val extends Step> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? image = freezed, Object? description = freezed}) { - return _then( - _value.copyWith( - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + $Res call({ + Object? image = freezed, + Object? description = freezed, + }) { + return _then(_value.copyWith( + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } } /// @nodoc abstract class _$$StepImplCopyWith<$Res> implements $StepCopyWith<$Res> { factory _$$StepImplCopyWith( - _$StepImpl value, - $Res Function(_$StepImpl) then, - ) = __$$StepImplCopyWithImpl<$Res>; + _$StepImpl value, $Res Function(_$StepImpl) then) = + __$$StepImplCopyWithImpl<$Res>; @override @useResult $Res call({String? image, String? description}); @@ -90,27 +86,26 @@ class __$$StepImplCopyWithImpl<$Res> extends _$StepCopyWithImpl<$Res, _$StepImpl> implements _$$StepImplCopyWith<$Res> { __$$StepImplCopyWithImpl(_$StepImpl _value, $Res Function(_$StepImpl) _then) - : super(_value, _then); + : super(_value, _then); /// Create a copy of Step /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? image = freezed, Object? description = freezed}) { - return _then( - _$StepImpl( - image: - freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - description: - freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + $Res call({ + Object? image = freezed, + Object? description = freezed, + }) { + return _then(_$StepImpl( + image: freezed == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + )); } } @@ -156,7 +151,9 @@ class _$StepImpl implements _Step { @override Map toJson() { - return _$$StepImplToJson(this); + return _$$StepImplToJson( + this, + ); } } diff --git a/lib/features/create_recipe/models/step.g.dart b/lib/features/create_recipe/models/step.g.dart index f14df943..31d97f9f 100644 --- a/lib/features/create_recipe/models/step.g.dart +++ b/lib/features/create_recipe/models/step.g.dart @@ -7,9 +7,9 @@ part of 'step.dart'; // ************************************************************************** _$StepImpl _$$StepImplFromJson(Map json) => _$StepImpl( - image: json['image'] as String?, - description: json['description'] as String?, -); + image: json['image'] as String?, + description: json['description'] as String?, + ); Map _$$StepImplToJson(_$StepImpl instance) => { diff --git a/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart b/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart index c171e720..809944b9 100644 --- a/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart +++ b/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart @@ -11,9 +11,9 @@ class CreateRecipeCubit extends Cubit { final RecipeRepository recipeRepository; CreateRecipeCubit({required this.recipeRepository}) : super( - CreateRecipeState( + const CreateRecipeState( entity: RecipeCreateEntity( - typeOfRecipe: TypeOfRecipe.first_meals, + typeOfRecipe: TypeOfRecipe.firstMeals, ingredients: [], steps: [StepEntity()], tags: [], @@ -26,7 +26,7 @@ class CreateRecipeCubit extends Cubit { state.copyWith.entity( steps: [ ...state.entity.steps, - StepEntity(), + const StepEntity(), ], ), ); diff --git a/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.freezed.dart b/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.freezed.dart index 716edf47..302f048c 100644 --- a/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.freezed.dart +++ b/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.freezed.dart @@ -12,8 +12,7 @@ part of 'create_recipe_state.dart'; 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', -); + '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'); /// @nodoc mixin _$CreateRecipeState { @@ -37,20 +36,18 @@ mixin _$CreateRecipeState { /// @nodoc abstract class $CreateRecipeStateCopyWith<$Res> { factory $CreateRecipeStateCopyWith( - CreateRecipeState value, - $Res Function(CreateRecipeState) then, - ) = _$CreateRecipeStateCopyWithImpl<$Res, CreateRecipeState>; + CreateRecipeState value, $Res Function(CreateRecipeState) then) = + _$CreateRecipeStateCopyWithImpl<$Res, CreateRecipeState>; @useResult - $Res call({ - RecipeCreateEntity entity, - String? titleValidationError, - String? descriptionValidationError, - String? cookingTimeValidationError, - String? activeTimeValidationError, - String? servingsValidationError, - String? energyPerServingValidationError, - String? imageValidationError, - }); + $Res call( + {RecipeCreateEntity entity, + String? titleValidationError, + String? descriptionValidationError, + String? cookingTimeValidationError, + String? activeTimeValidationError, + String? servingsValidationError, + String? energyPerServingValidationError, + String? imageValidationError}); $RecipeCreateEntityCopyWith<$Res> get entity; } @@ -79,51 +76,41 @@ class _$CreateRecipeStateCopyWithImpl<$Res, $Val extends CreateRecipeState> Object? energyPerServingValidationError = freezed, Object? imageValidationError = freezed, }) { - return _then( - _value.copyWith( - entity: - null == entity - ? _value.entity - : entity // ignore: cast_nullable_to_non_nullable - as RecipeCreateEntity, - titleValidationError: - freezed == titleValidationError - ? _value.titleValidationError - : titleValidationError // ignore: cast_nullable_to_non_nullable - as String?, - descriptionValidationError: - freezed == descriptionValidationError - ? _value.descriptionValidationError - : descriptionValidationError // ignore: cast_nullable_to_non_nullable - as String?, - cookingTimeValidationError: - freezed == cookingTimeValidationError - ? _value.cookingTimeValidationError - : cookingTimeValidationError // ignore: cast_nullable_to_non_nullable - as String?, - activeTimeValidationError: - freezed == activeTimeValidationError - ? _value.activeTimeValidationError - : activeTimeValidationError // ignore: cast_nullable_to_non_nullable - as String?, - servingsValidationError: - freezed == servingsValidationError - ? _value.servingsValidationError - : servingsValidationError // ignore: cast_nullable_to_non_nullable - as String?, - energyPerServingValidationError: - freezed == energyPerServingValidationError - ? _value.energyPerServingValidationError - : energyPerServingValidationError // ignore: cast_nullable_to_non_nullable - as String?, - imageValidationError: - freezed == imageValidationError - ? _value.imageValidationError - : imageValidationError // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + entity: null == entity + ? _value.entity + : entity // ignore: cast_nullable_to_non_nullable + as RecipeCreateEntity, + titleValidationError: freezed == titleValidationError + ? _value.titleValidationError + : titleValidationError // ignore: cast_nullable_to_non_nullable + as String?, + descriptionValidationError: freezed == descriptionValidationError + ? _value.descriptionValidationError + : descriptionValidationError // ignore: cast_nullable_to_non_nullable + as String?, + cookingTimeValidationError: freezed == cookingTimeValidationError + ? _value.cookingTimeValidationError + : cookingTimeValidationError // ignore: cast_nullable_to_non_nullable + as String?, + activeTimeValidationError: freezed == activeTimeValidationError + ? _value.activeTimeValidationError + : activeTimeValidationError // ignore: cast_nullable_to_non_nullable + as String?, + servingsValidationError: freezed == servingsValidationError + ? _value.servingsValidationError + : servingsValidationError // ignore: cast_nullable_to_non_nullable + as String?, + energyPerServingValidationError: freezed == + energyPerServingValidationError + ? _value.energyPerServingValidationError + : energyPerServingValidationError // ignore: cast_nullable_to_non_nullable + as String?, + imageValidationError: freezed == imageValidationError + ? _value.imageValidationError + : imageValidationError // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } /// Create a copy of CreateRecipeState @@ -140,22 +127,20 @@ class _$CreateRecipeStateCopyWithImpl<$Res, $Val extends CreateRecipeState> /// @nodoc abstract class _$$CreateRecipeStateImplCopyWith<$Res> implements $CreateRecipeStateCopyWith<$Res> { - factory _$$CreateRecipeStateImplCopyWith( - _$CreateRecipeStateImpl value, - $Res Function(_$CreateRecipeStateImpl) then, - ) = __$$CreateRecipeStateImplCopyWithImpl<$Res>; + factory _$$CreateRecipeStateImplCopyWith(_$CreateRecipeStateImpl value, + $Res Function(_$CreateRecipeStateImpl) then) = + __$$CreateRecipeStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - RecipeCreateEntity entity, - String? titleValidationError, - String? descriptionValidationError, - String? cookingTimeValidationError, - String? activeTimeValidationError, - String? servingsValidationError, - String? energyPerServingValidationError, - String? imageValidationError, - }); + $Res call( + {RecipeCreateEntity entity, + String? titleValidationError, + String? descriptionValidationError, + String? cookingTimeValidationError, + String? activeTimeValidationError, + String? servingsValidationError, + String? energyPerServingValidationError, + String? imageValidationError}); @override $RecipeCreateEntityCopyWith<$Res> get entity; @@ -165,10 +150,9 @@ abstract class _$$CreateRecipeStateImplCopyWith<$Res> class __$$CreateRecipeStateImplCopyWithImpl<$Res> extends _$CreateRecipeStateCopyWithImpl<$Res, _$CreateRecipeStateImpl> implements _$$CreateRecipeStateImplCopyWith<$Res> { - __$$CreateRecipeStateImplCopyWithImpl( - _$CreateRecipeStateImpl _value, - $Res Function(_$CreateRecipeStateImpl) _then, - ) : super(_value, _then); + __$$CreateRecipeStateImplCopyWithImpl(_$CreateRecipeStateImpl _value, + $Res Function(_$CreateRecipeStateImpl) _then) + : super(_value, _then); /// Create a copy of CreateRecipeState /// with the given fields replaced by the non-null parameter values. @@ -184,66 +168,56 @@ class __$$CreateRecipeStateImplCopyWithImpl<$Res> Object? energyPerServingValidationError = freezed, Object? imageValidationError = freezed, }) { - return _then( - _$CreateRecipeStateImpl( - entity: - null == entity - ? _value.entity - : entity // ignore: cast_nullable_to_non_nullable - as RecipeCreateEntity, - titleValidationError: - freezed == titleValidationError - ? _value.titleValidationError - : titleValidationError // ignore: cast_nullable_to_non_nullable - as String?, - descriptionValidationError: - freezed == descriptionValidationError - ? _value.descriptionValidationError - : descriptionValidationError // ignore: cast_nullable_to_non_nullable - as String?, - cookingTimeValidationError: - freezed == cookingTimeValidationError - ? _value.cookingTimeValidationError - : cookingTimeValidationError // ignore: cast_nullable_to_non_nullable - as String?, - activeTimeValidationError: - freezed == activeTimeValidationError - ? _value.activeTimeValidationError - : activeTimeValidationError // ignore: cast_nullable_to_non_nullable - as String?, - servingsValidationError: - freezed == servingsValidationError - ? _value.servingsValidationError - : servingsValidationError // ignore: cast_nullable_to_non_nullable - as String?, - energyPerServingValidationError: - freezed == energyPerServingValidationError - ? _value.energyPerServingValidationError - : energyPerServingValidationError // ignore: cast_nullable_to_non_nullable - as String?, - imageValidationError: - freezed == imageValidationError - ? _value.imageValidationError - : imageValidationError // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$CreateRecipeStateImpl( + entity: null == entity + ? _value.entity + : entity // ignore: cast_nullable_to_non_nullable + as RecipeCreateEntity, + titleValidationError: freezed == titleValidationError + ? _value.titleValidationError + : titleValidationError // ignore: cast_nullable_to_non_nullable + as String?, + descriptionValidationError: freezed == descriptionValidationError + ? _value.descriptionValidationError + : descriptionValidationError // ignore: cast_nullable_to_non_nullable + as String?, + cookingTimeValidationError: freezed == cookingTimeValidationError + ? _value.cookingTimeValidationError + : cookingTimeValidationError // ignore: cast_nullable_to_non_nullable + as String?, + activeTimeValidationError: freezed == activeTimeValidationError + ? _value.activeTimeValidationError + : activeTimeValidationError // ignore: cast_nullable_to_non_nullable + as String?, + servingsValidationError: freezed == servingsValidationError + ? _value.servingsValidationError + : servingsValidationError // ignore: cast_nullable_to_non_nullable + as String?, + energyPerServingValidationError: freezed == + energyPerServingValidationError + ? _value.energyPerServingValidationError + : energyPerServingValidationError // ignore: cast_nullable_to_non_nullable + as String?, + imageValidationError: freezed == imageValidationError + ? _value.imageValidationError + : imageValidationError // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc class _$CreateRecipeStateImpl implements _CreateRecipeState { - const _$CreateRecipeStateImpl({ - required this.entity, - this.titleValidationError, - this.descriptionValidationError, - this.cookingTimeValidationError, - this.activeTimeValidationError, - this.servingsValidationError, - this.energyPerServingValidationError, - this.imageValidationError, - }); + const _$CreateRecipeStateImpl( + {required this.entity, + this.titleValidationError, + this.descriptionValidationError, + this.cookingTimeValidationError, + this.activeTimeValidationError, + this.servingsValidationError, + this.energyPerServingValidationError, + this.imageValidationError}); @override final RecipeCreateEntity entity; @@ -275,32 +249,22 @@ class _$CreateRecipeStateImpl implements _CreateRecipeState { (identical(other.entity, entity) || other.entity == entity) && (identical(other.titleValidationError, titleValidationError) || other.titleValidationError == titleValidationError) && - (identical( - other.descriptionValidationError, - descriptionValidationError, - ) || + (identical(other.descriptionValidationError, + descriptionValidationError) || other.descriptionValidationError == descriptionValidationError) && - (identical( - other.cookingTimeValidationError, - cookingTimeValidationError, - ) || + (identical(other.cookingTimeValidationError, + cookingTimeValidationError) || other.cookingTimeValidationError == cookingTimeValidationError) && - (identical( - other.activeTimeValidationError, - activeTimeValidationError, - ) || + (identical(other.activeTimeValidationError, + activeTimeValidationError) || other.activeTimeValidationError == activeTimeValidationError) && (identical( - other.servingsValidationError, - servingsValidationError, - ) || + other.servingsValidationError, servingsValidationError) || other.servingsValidationError == servingsValidationError) && - (identical( - other.energyPerServingValidationError, - energyPerServingValidationError, - ) || + (identical(other.energyPerServingValidationError, + energyPerServingValidationError) || other.energyPerServingValidationError == energyPerServingValidationError) && (identical(other.imageValidationError, imageValidationError) || @@ -309,16 +273,15 @@ class _$CreateRecipeStateImpl implements _CreateRecipeState { @override int get hashCode => Object.hash( - runtimeType, - entity, - titleValidationError, - descriptionValidationError, - cookingTimeValidationError, - activeTimeValidationError, - servingsValidationError, - energyPerServingValidationError, - imageValidationError, - ); + runtimeType, + entity, + titleValidationError, + descriptionValidationError, + cookingTimeValidationError, + activeTimeValidationError, + servingsValidationError, + energyPerServingValidationError, + imageValidationError); /// Create a copy of CreateRecipeState /// with the given fields replaced by the non-null parameter values. @@ -327,22 +290,19 @@ class _$CreateRecipeStateImpl implements _CreateRecipeState { @pragma('vm:prefer-inline') _$$CreateRecipeStateImplCopyWith<_$CreateRecipeStateImpl> get copyWith => __$$CreateRecipeStateImplCopyWithImpl<_$CreateRecipeStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _CreateRecipeState implements CreateRecipeState { - const factory _CreateRecipeState({ - required final RecipeCreateEntity entity, - final String? titleValidationError, - final String? descriptionValidationError, - final String? cookingTimeValidationError, - final String? activeTimeValidationError, - final String? servingsValidationError, - final String? energyPerServingValidationError, - final String? imageValidationError, - }) = _$CreateRecipeStateImpl; + const factory _CreateRecipeState( + {required final RecipeCreateEntity entity, + final String? titleValidationError, + final String? descriptionValidationError, + final String? cookingTimeValidationError, + final String? activeTimeValidationError, + final String? servingsValidationError, + final String? energyPerServingValidationError, + final String? imageValidationError}) = _$CreateRecipeStateImpl; @override RecipeCreateEntity get entity; diff --git a/lib/features/create_recipe/presentation/pages/recipe_create_screen.dart b/lib/features/create_recipe/presentation/pages/recipe_create_screen.dart index 3647ebdd..7d5ee805 100644 --- a/lib/features/create_recipe/presentation/pages/recipe_create_screen.dart +++ b/lib/features/create_recipe/presentation/pages/recipe_create_screen.dart @@ -30,11 +30,11 @@ class _RecipeCreateScreenState extends State { return BlocProvider( create: (BuildContext context) => sl(), child: Scaffold( - backgroundColor: Color(0xFFF0F2F5), + backgroundColor: const Color(0xFFF0F2F5), appBar: AppBar( - title: Text('Добавление рецепта'), + title: const Text('Добавление рецепта'), centerTitle: true, - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical( bottom: Radius.circular(12), ), @@ -42,13 +42,13 @@ class _RecipeCreateScreenState extends State { ), body: SingleChildScrollView( physics: const BouncingScrollPhysics(), - padding: EdgeInsets.only(top: 8, bottom: 32), + padding: const EdgeInsets.only(top: 8, bottom: 32), child: Column( spacing: 16, children: [ - InfoAboutRecipeWidget(), - IngredientsWidget(), - StepsWidget(), + const InfoAboutRecipeWidget(), + const IngredientsWidget(), + const StepsWidget(), BlocBuilder( builder: (context, state) { return Builder( @@ -58,7 +58,8 @@ class _RecipeCreateScreenState extends State { if (context.read().validateAll()) { final isSuccess = await context.read().publishRecipe(); if (isSuccess) { - Future.delayed(Duration(milliseconds: 500), () { + Future.delayed(const Duration(milliseconds: 500), () { + if (!context.mounted) return; context.pop(); showBottomSheetWithBlur( userRootNavigator: true, @@ -69,6 +70,7 @@ class _RecipeCreateScreenState extends State { ); }); } else { + if (!context.mounted) return; showErrorDialog(context, title: '${s.could_not_publish_recipe} ${state.entity.title}'); } } @@ -83,7 +85,7 @@ class _RecipeCreateScreenState extends State { child: Container( padding: const EdgeInsets.all(16), alignment: Alignment.center, - child: Text( + child: const Text( 'Опубликовать', style: TextStyle( fontSize: 16, diff --git a/lib/features/create_recipe/presentation/widgets/image_widget.dart b/lib/features/create_recipe/presentation/widgets/image_widget.dart index 5422d895..534499e4 100644 --- a/lib/features/create_recipe/presentation/widgets/image_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/image_widget.dart @@ -50,12 +50,12 @@ class _ImageWidgetState extends State { createRecipeCubit.replaceImage(null); }, child: Container( - padding: EdgeInsets.all(4), - decoration: BoxDecoration( + padding: const EdgeInsets.all(4), + decoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), - child: Icon(Icons.close_rounded), + child: const Icon(Icons.close_rounded), ), ), ), @@ -78,10 +78,11 @@ class _ImageWidgetState extends State { createRecipeCubit.replaceImage(File(image.path)); createRecipeCubit.validateImage(); } + if (!context.mounted) return; Navigator.of(context).pop(); }, child: const Row( - children: const [ + children: [ Icon(Icons.photo_camera), SizedBox(width: 8), Text('Фото'), @@ -97,10 +98,11 @@ class _ImageWidgetState extends State { createRecipeCubit.replaceImage(File(image.path)); createRecipeCubit.validateImage(); } + if (!context.mounted) return; Navigator.of(context).pop(); }, child: const Row( - children: const [ + children: [ Icon(Icons.photo), SizedBox(width: 8), Text('Галерея'), diff --git a/lib/features/create_recipe/presentation/widgets/info_about_recipe_widget.dart b/lib/features/create_recipe/presentation/widgets/info_about_recipe_widget.dart index 86a14896..a83ee2a3 100644 --- a/lib/features/create_recipe/presentation/widgets/info_about_recipe_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/info_about_recipe_widget.dart @@ -41,8 +41,8 @@ class _InfoAboutRecipeWidgetState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('Название'), - SizedBox(height: 4), + const Text('Название'), + const SizedBox(height: 4), BlocBuilder( buildWhen: (previous, current) => previous.titleValidationError != current.titleValidationError, builder: (context, state) { @@ -59,7 +59,7 @@ class _InfoAboutRecipeWidgetState extends State { }, ), if (state.titleValidationError != null) ...[ - SizedBox(height: 4), + const SizedBox(height: 4), CustomErrorWidget( error: state.titleValidationError!, ), @@ -69,8 +69,8 @@ class _InfoAboutRecipeWidgetState extends State { }, ), const SizedBox(height: 12), - Text('Тип блюда'), - SizedBox(height: 4), + const Text('Тип блюда'), + const SizedBox(height: 4), CustomDropDown( items: items, value: selectedType, @@ -84,14 +84,14 @@ class _InfoAboutRecipeWidgetState extends State { }, ), const SizedBox(height: 12), - TagsWidget(), + const TagsWidget(), const SizedBox(height: 12), - PortionWidget(), + const PortionWidget(), const SizedBox(height: 12), - TimeOfCookWidget(), + const TimeOfCookWidget(), const SizedBox(height: 12), - Text('Описание'), - SizedBox(height: 4), + const Text('Описание'), + const SizedBox(height: 4), BlocBuilder( buildWhen: (previous, current) => previous.descriptionValidationError != current.descriptionValidationError, builder: (context, state) { @@ -110,7 +110,7 @@ class _InfoAboutRecipeWidgetState extends State { }, ), if (state.descriptionValidationError != null) ...[ - SizedBox(height: 4), + const SizedBox(height: 4), CustomErrorWidget( error: state.descriptionValidationError!, ), @@ -120,21 +120,21 @@ class _InfoAboutRecipeWidgetState extends State { }, ), const SizedBox(height: 12), - Text('Фото обложка'), - SizedBox(height: 4), + const Text('Фото обложка'), + const SizedBox(height: 4), BlocBuilder( buildWhen: (previous, current) => previous.imageValidationError != current.imageValidationError || previous.entity.image != current.entity.image, builder: (context, state) { return Column( children: [ Container( - child: ImageWidget(image: state.entity.image), decoration: state.imageValidationError != null ? BoxDecoration(border: Border.all(width: 1, color: appTheme.red), borderRadius: BorderRadius.circular(8)) : null, + child: ImageWidget(image: state.entity.image), ), if (state.imageValidationError != null) ...[ - SizedBox(height: 4), + const SizedBox(height: 4), CustomErrorWidget( error: state.imageValidationError!, ), @@ -144,8 +144,8 @@ class _InfoAboutRecipeWidgetState extends State { }, ), const SizedBox(height: 12), - Text('Ссылка на видео (если есть)'), - SizedBox(height: 4), + const Text('Ссылка на видео (если есть)'), + const SizedBox(height: 4), CustomTextFormField( hintText: 'Прикрепите ссылку на видео', onChanged: (value) { diff --git a/lib/features/create_recipe/presentation/widgets/ingredients_widget.dart b/lib/features/create_recipe/presentation/widgets/ingredients_widget.dart index a3700bb3..53a2c7fc 100644 --- a/lib/features/create_recipe/presentation/widgets/ingredients_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/ingredients_widget.dart @@ -37,8 +37,8 @@ class _IngredientsWidgetState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), child: Text( 'Ингредиенты ', style: TextStyle( @@ -62,7 +62,7 @@ class _IngredientsWidgetState extends State { children: [ for (int index = 0; index < state.entity.ingredients.length; index += 1) ListTile( - contentPadding: EdgeInsets.symmetric(horizontal: 16), + contentPadding: const EdgeInsets.symmetric(horizontal: 16), key: Key('$index'), leading: Icon( Icons.drag_handle_rounded, @@ -90,7 +90,7 @@ class _IngredientsWidgetState extends State { showModalBottomSheet( useRootNavigator: true, context: context, - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(top: Radius.circular(12)), ), isScrollControlled: true, @@ -106,7 +106,7 @@ class _IngredientsWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text( + const Text( 'Добавление ингредиента', style: TextStyle( fontSize: 20, @@ -179,7 +179,7 @@ class _IngredientsWidgetState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Добавить', style: TextStyle( diff --git a/lib/features/create_recipe/presentation/widgets/portion_widget.dart b/lib/features/create_recipe/presentation/widgets/portion_widget.dart index a6044738..2b2bc008 100644 --- a/lib/features/create_recipe/presentation/widgets/portion_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/portion_widget.dart @@ -38,8 +38,8 @@ class _PortionWidgetState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('Кол-во порций'), - SizedBox(height: 4), + const Text('Кол-во порций'), + const SizedBox(height: 4), Column( children: [ CustomTextFormField( @@ -54,7 +54,7 @@ class _PortionWidgetState extends State { }, ), if (state.servingsValidationError != null) ...[ - SizedBox(height: 4), + const SizedBox(height: 4), CustomErrorWidget( error: state.servingsValidationError!, ), @@ -70,15 +70,15 @@ class _PortionWidgetState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('Ккал в одной порции'), - SizedBox(height: 4), + const Text('Ккал в одной порции'), + const SizedBox(height: 4), Column( children: [ CustomTextFormField( hintText: '100', hasError: state.energyPerServingValidationError != null, suffixText: 'Ккал', - textInputType: TextInputType.numberWithOptions(decimal: true), + textInputType: const TextInputType.numberWithOptions(decimal: true), onChanged: (value) { createRecipeCubit.replaceEnegryInPortion(double.parse(value)); if (state.energyPerServingValidationError != null) { @@ -87,7 +87,7 @@ class _PortionWidgetState extends State { }, ), if (state.energyPerServingValidationError != null) ...[ - SizedBox(height: 4), + const SizedBox(height: 4), CustomErrorWidget( error: state.energyPerServingValidationError!, ), diff --git a/lib/features/create_recipe/presentation/widgets/step_image_widget.dart b/lib/features/create_recipe/presentation/widgets/step_image_widget.dart index b2922c92..35f534a5 100644 --- a/lib/features/create_recipe/presentation/widgets/step_image_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/step_image_widget.dart @@ -59,12 +59,12 @@ class _StepImageWidgetState extends State { createRecipeCubit.replaceImageInStep(null, widget.index); }, child: Container( - padding: EdgeInsets.all(4), - decoration: BoxDecoration( + padding: const EdgeInsets.all(4), + decoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), - child: Icon(Icons.close_rounded), + child: const Icon(Icons.close_rounded), ), ), ), @@ -86,10 +86,11 @@ class _StepImageWidgetState extends State { if (image != null) { createRecipeCubit.replaceImageInStep(File(image!.path), widget.index); } + if (!context.mounted) return; Navigator.of(context).pop(); }, child: const Row( - children: const [ + children: [ Icon(Icons.photo_camera), SizedBox(width: 8), Text('Фото'), @@ -104,10 +105,11 @@ class _StepImageWidgetState extends State { if (image != null) { createRecipeCubit.replaceImageInStep(File(image!.path), widget.index); } + if (!context.mounted) return; Navigator.of(context).pop(); }, child: const Row( - children: const [ + children: [ Icon(Icons.photo), SizedBox(width: 8), Text('Галерея'), diff --git a/lib/features/create_recipe/presentation/widgets/steps_widget.dart b/lib/features/create_recipe/presentation/widgets/steps_widget.dart index 726438d8..934510f4 100644 --- a/lib/features/create_recipe/presentation/widgets/steps_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/steps_widget.dart @@ -35,7 +35,7 @@ class _StepsWidgetState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Пошаговая инструкция', style: TextStyle( fontSize: 20, @@ -54,7 +54,7 @@ class _StepsWidgetState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - padding: EdgeInsets.symmetric( + padding: const EdgeInsets.symmetric( horizontal: 12, vertical: 4, ), @@ -64,7 +64,7 @@ class _StepsWidgetState extends State { ), child: Text( 'Шаг ${index + 1}', - style: TextStyle( + style: const TextStyle( color: Colors.white, fontWeight: FontWeight.w600, ), @@ -74,13 +74,13 @@ class _StepsWidgetState extends State { onTap: () { context.read().removeStep(state.entity.steps[index]); }, - child: Icon(Icons.delete_outline_rounded), + child: const Icon(Icons.delete_outline_rounded), ), ], ), const SizedBox(height: 12), - Text('Описание'), - SizedBox(height: 4), + const Text('Описание'), + const SizedBox(height: 4), CustomTextFormField( hintText: 'Например: подготовьте ингредиенты', maxLines: 5, @@ -90,8 +90,8 @@ class _StepsWidgetState extends State { }, ), const SizedBox(height: 12), - Text('Фото шага'), - SizedBox(height: 4), + const Text('Фото шага'), + const SizedBox(height: 4), StepImageWidget( index: index, ), @@ -114,7 +114,7 @@ class _StepsWidgetState extends State { child: Container( padding: const EdgeInsets.all(16), alignment: Alignment.center, - child: Text( + child: const Text( 'Добавить шаг', style: TextStyle( fontSize: 16, diff --git a/lib/features/create_recipe/presentation/widgets/tags_widget.dart b/lib/features/create_recipe/presentation/widgets/tags_widget.dart index 53ef22bf..26b9d23b 100644 --- a/lib/features/create_recipe/presentation/widgets/tags_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/tags_widget.dart @@ -18,8 +18,8 @@ class _TagsWidgetState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('Теги'), - SizedBox(height: 4), + const Text('Теги'), + const SizedBox(height: 4), CustomTextFormField( hintText: 'Например: без майонеза', controller: tagController, @@ -52,7 +52,7 @@ class _TagsWidgetState extends State { }, borderRadius: BorderRadius.circular(16), child: Ink( - padding: EdgeInsets.symmetric(vertical: 4, horizontal: 12), + padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12), decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), color: Colors.grey.shade200, diff --git a/lib/features/create_recipe/presentation/widgets/time_of_cook_widget.dart b/lib/features/create_recipe/presentation/widgets/time_of_cook_widget.dart index 29c2bdaa..64269dcc 100644 --- a/lib/features/create_recipe/presentation/widgets/time_of_cook_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/time_of_cook_widget.dart @@ -34,13 +34,13 @@ class _TimeOfCookWidgetState extends State { children: [ Row( children: [ - Text('Общее время приготовления'), + const Text('Общее время приготовления'), const SizedBox(width: 8), GestureDetector( onTap: () { showDialog( context: context, - builder: (context) => AlertDialog( + builder: (context) => const AlertDialog( content: Text( 'Общее время приготовления - это период времени от начала приготовления блюда до подачи его на стол.', style: TextStyle( @@ -60,7 +60,7 @@ class _TimeOfCookWidgetState extends State { ), ], ), - SizedBox(height: 4), + const SizedBox(height: 4), Row( mainAxisSize: MainAxisSize.min, children: [ @@ -81,7 +81,7 @@ class _TimeOfCookWidgetState extends State { }, ), if (state.cookingTimeValidationError != null) ...[ - SizedBox(height: 4), + const SizedBox(height: 4), CustomErrorWidget( error: state.cookingTimeValidationError!, ), @@ -107,7 +107,7 @@ class _TimeOfCookWidgetState extends State { }, ), if (state.cookingTimeValidationError != null) ...[ - SizedBox(height: 4), + const SizedBox(height: 4), CustomErrorWidget( error: state.cookingTimeValidationError!, ), @@ -120,13 +120,13 @@ class _TimeOfCookWidgetState extends State { const SizedBox(height: 12), Row( children: [ - Text('Активное время приготовления'), + const Text('Активное время приготовления'), const SizedBox(width: 8), GestureDetector( onTap: () { showDialog( context: context, - builder: (context) => AlertDialog( + builder: (context) => const AlertDialog( content: Text( 'Активное время приготовления - это период времени, требующий активного участия в приготовлении блюда. Оно включает мытье и очистку продуктов, нарезку, шинковку, взбивание, перемешивание, размешивание, перекладывание и т.п.', style: TextStyle( @@ -146,7 +146,7 @@ class _TimeOfCookWidgetState extends State { ), ], ), - SizedBox(height: 4), + const SizedBox(height: 4), Row( mainAxisSize: MainAxisSize.min, children: [ @@ -168,7 +168,7 @@ class _TimeOfCookWidgetState extends State { }, ), if (state.activeTimeValidationError != null) ...[ - SizedBox(height: 4), + const SizedBox(height: 4), CustomErrorWidget( error: state.activeTimeValidationError!, ), @@ -195,7 +195,7 @@ class _TimeOfCookWidgetState extends State { }, ), if (state.activeTimeValidationError != null) ...[ - SizedBox(height: 4), + const SizedBox(height: 4), CustomErrorWidget( error: state.activeTimeValidationError!, ), diff --git a/lib/features/create_recipe/reporitories/recipe_repository.dart b/lib/features/create_recipe/reporitories/recipe_repository.dart index 233c2c88..a0c2a08b 100644 --- a/lib/features/create_recipe/reporitories/recipe_repository.dart +++ b/lib/features/create_recipe/reporitories/recipe_repository.dart @@ -61,7 +61,7 @@ class RecipeRepository { 'title': recipe.title, 'tags': recipe.tags, 'description_md': recipe.description, - 'video_url': recipe.video_url, + 'video_url': recipe.videoUrl, 'ingredients': ingredientsMap, 'steps': stepsMap, 'cooking_time': recipe.totalCookingTime, diff --git a/lib/features/create_recipe/services/recipe_service.g.dart b/lib/features/create_recipe/services/recipe_service.g.dart index bc1210f4..58b81059 100644 --- a/lib/features/create_recipe/services/recipe_service.g.dart +++ b/lib/features/create_recipe/services/recipe_service.g.dart @@ -143,11 +143,11 @@ class _CreateRecipeService implements CreateRecipeService { final _data = formData; final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/recipes/create', diff --git a/lib/features/dev_tools/presentation/dev_tools_screen.dart b/lib/features/dev_tools/presentation/dev_tools_screen.dart index 32de0606..4658b10a 100644 --- a/lib/features/dev_tools/presentation/dev_tools_screen.dart +++ b/lib/features/dev_tools/presentation/dev_tools_screen.dart @@ -59,7 +59,7 @@ class _DevToolsScreenContentState extends State { void initState() { super.initState(); setState(() { - this.baseUrlForTest = baseUrl; + baseUrlForTest = baseUrl; }); testsStates = List.generate(testCases.length, (index) => TestState.notRun); } @@ -67,13 +67,13 @@ class _DevToolsScreenContentState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: Text('Для разработчиков')), + appBar: AppBar(title: const Text('Для разработчиков')), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( children: [ - Padding(padding: const EdgeInsets.all(8.0), child: Row(children: [Text('BaseUrl: ${baseUrlForTest}')])), + Padding(padding: const EdgeInsets.all(8.0), child: Row(children: [Text('BaseUrl: $baseUrlForTest')])), Row( children: [ Expanded(child: CustomTextFormField(controller: controller, hintText: 'type new base url')), @@ -94,16 +94,16 @@ class _DevToolsScreenContentState extends State { text: 'Set dev2 base url', onPressed: () { setState(() { - this.baseUrlForTest = baseUrl; + baseUrlForTest = baseUrl; }); }, - buttonStyle: ButtonStyle(), + buttonStyle: const ButtonStyle(), ), SizedBox(height: baseUrlForTest != baseUrl ? 40 : 10), ListView.builder( shrinkWrap: true, itemCount: testCases.length, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) => Padding( padding: const EdgeInsets.only(bottom: 10.0), @@ -137,14 +137,14 @@ class _DevToolsScreenContentState extends State { showErrorToast('${testCases[index].name} failed'); } }, - buttonStyle: ButtonStyle(), + buttonStyle: const ButtonStyle(), ), - SizedBox(width: 5), + const SizedBox(width: 5), switch (testsStates[index]) { TestState.success => Container(width: 20, height: 20, color: Colors.green), TestState.fail => Container(width: 20, height: 20, color: Colors.red), TestState.notRun => Container(width: 20, height: 20, color: Colors.grey), - TestState.loading => Container( + TestState.loading => const SizedBox( width: 20, height: 20, child: SizedBox(height: 20, width: 20, child: Center(child: CircularProgressIndicator())), @@ -159,7 +159,7 @@ class _DevToolsScreenContentState extends State { const SizedBox(height: 10), CustomOutlinedButton( text: 'add token to server', - buttonStyle: ButtonStyle(), + buttonStyle: const ButtonStyle(), onPressed: () async { try { final dio = sl(); @@ -179,7 +179,7 @@ class _DevToolsScreenContentState extends State { const SizedBox(height: 10), CustomOutlinedButton( text: 'copy token', - buttonStyle: ButtonStyle(), + buttonStyle: const ButtonStyle(), onPressed: () async { try { final token = await FirebaseApi().getToken(); @@ -197,7 +197,7 @@ class _DevToolsScreenContentState extends State { const SizedBox(height: 10), CustomOutlinedButton( text: 'remove token from server', - buttonStyle: ButtonStyle(), + buttonStyle: const ButtonStyle(), onPressed: () async { try { final dio = sl(); @@ -217,11 +217,11 @@ class _DevToolsScreenContentState extends State { const SizedBox(height: 10), CustomOutlinedButton( text: 'send notification', - buttonStyle: ButtonStyle(), + buttonStyle: const ButtonStyle(), onPressed: () async { try { final dio = sl(); - Future.delayed(Duration(seconds: 3), () async { + Future.delayed(const Duration(seconds: 3), () async { await dio.post('/api/profile/notification/token/test'); }); } catch (e) { diff --git a/lib/features/dev_tools/test_cases.dart b/lib/features/dev_tools/test_cases.dart index 1db0bb30..1b2f8961 100644 --- a/lib/features/dev_tools/test_cases.dart +++ b/lib/features/dev_tools/test_cases.dart @@ -29,7 +29,7 @@ class CreateRecipeTask implements TestCases { final dio = sl(); final recipeRepository = RecipeRepository(recipeService: CreateRecipeService(dio, baseUrl: baseUrl)); await recipeRepository.publishRecipe( - RecipeModel( + const RecipeModel( title: 'Title', state: 'active', activeCookTime: 10, @@ -79,7 +79,7 @@ class Test850task implements TestCases { log('unexpected error7: $e'); return false; } - await Future.delayed(Duration(seconds: 3)); + await Future.delayed(const Duration(seconds: 3)); } try { await dietsService.startDiet(id: diet.id, body: {'date': yesterday.format('yyyy-MM-dd')}); @@ -105,7 +105,7 @@ class Test850task implements TestCases { return false; } - await Future.delayed(Duration(seconds: 3)); + await Future.delayed(const Duration(seconds: 3)); // test start diet with correct date try { diff --git a/lib/features/diary/models/diary_day_model.dart b/lib/features/diary/models/diary_day_model.dart index e9e129d9..9493ffb1 100644 --- a/lib/features/diary/models/diary_day_model.dart +++ b/lib/features/diary/models/diary_day_model.dart @@ -6,13 +6,13 @@ part 'diary_day_model.g.dart'; enum PortionState { active, - filled_diet, - eaten_from_diet, + filledDiet, + eatenFromDiet, eaten, - eaten_deleted, - eaten_edited, + eatenDeleted, + eatenEdited, commented, - reviewed_by_user, + revieweByUser, } @freezed diff --git a/lib/features/diary/models/diary_day_model.freezed.dart b/lib/features/diary/models/diary_day_model.freezed.dart index a9efec29..38983ff8 100644 --- a/lib/features/diary/models/diary_day_model.freezed.dart +++ b/lib/features/diary/models/diary_day_model.freezed.dart @@ -12,8 +12,7 @@ part of 'diary_day_model.dart'; 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', -); + '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'); DiaryDayWrapperModel _$DiaryDayWrapperModelFromJson(Map json) { return _DiaryDayWrapperModel.fromJson(json); @@ -36,10 +35,9 @@ mixin _$DiaryDayWrapperModel { /// @nodoc abstract class $DiaryDayWrapperModelCopyWith<$Res> { - factory $DiaryDayWrapperModelCopyWith( - DiaryDayWrapperModel value, - $Res Function(DiaryDayWrapperModel) then, - ) = _$DiaryDayWrapperModelCopyWithImpl<$Res, DiaryDayWrapperModel>; + factory $DiaryDayWrapperModelCopyWith(DiaryDayWrapperModel value, + $Res Function(DiaryDayWrapperModel) then) = + _$DiaryDayWrapperModelCopyWithImpl<$Res, DiaryDayWrapperModel>; @useResult $Res call({@JsonKey(name: "diary") DiaryDayModel diary}); @@ -47,10 +45,8 @@ abstract class $DiaryDayWrapperModelCopyWith<$Res> { } /// @nodoc -class _$DiaryDayWrapperModelCopyWithImpl< - $Res, - $Val extends DiaryDayWrapperModel -> +class _$DiaryDayWrapperModelCopyWithImpl<$Res, + $Val extends DiaryDayWrapperModel> implements $DiaryDayWrapperModelCopyWith<$Res> { _$DiaryDayWrapperModelCopyWithImpl(this._value, this._then); @@ -63,17 +59,15 @@ class _$DiaryDayWrapperModelCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? diary = null}) { - return _then( - _value.copyWith( - diary: - null == diary - ? _value.diary - : diary // ignore: cast_nullable_to_non_nullable - as DiaryDayModel, - ) - as $Val, - ); + $Res call({ + Object? diary = null, + }) { + return _then(_value.copyWith( + diary: null == diary + ? _value.diary + : diary // ignore: cast_nullable_to_non_nullable + as DiaryDayModel, + ) as $Val); } /// Create a copy of DiaryDayWrapperModel @@ -90,10 +84,9 @@ class _$DiaryDayWrapperModelCopyWithImpl< /// @nodoc abstract class _$$DiaryDayWrapperModelImplCopyWith<$Res> implements $DiaryDayWrapperModelCopyWith<$Res> { - factory _$$DiaryDayWrapperModelImplCopyWith( - _$DiaryDayWrapperModelImpl value, - $Res Function(_$DiaryDayWrapperModelImpl) then, - ) = __$$DiaryDayWrapperModelImplCopyWithImpl<$Res>; + factory _$$DiaryDayWrapperModelImplCopyWith(_$DiaryDayWrapperModelImpl value, + $Res Function(_$DiaryDayWrapperModelImpl) then) = + __$$DiaryDayWrapperModelImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: "diary") DiaryDayModel diary}); @@ -106,34 +99,31 @@ abstract class _$$DiaryDayWrapperModelImplCopyWith<$Res> class __$$DiaryDayWrapperModelImplCopyWithImpl<$Res> extends _$DiaryDayWrapperModelCopyWithImpl<$Res, _$DiaryDayWrapperModelImpl> implements _$$DiaryDayWrapperModelImplCopyWith<$Res> { - __$$DiaryDayWrapperModelImplCopyWithImpl( - _$DiaryDayWrapperModelImpl _value, - $Res Function(_$DiaryDayWrapperModelImpl) _then, - ) : super(_value, _then); + __$$DiaryDayWrapperModelImplCopyWithImpl(_$DiaryDayWrapperModelImpl _value, + $Res Function(_$DiaryDayWrapperModelImpl) _then) + : super(_value, _then); /// Create a copy of DiaryDayWrapperModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? diary = null}) { - return _then( - _$DiaryDayWrapperModelImpl( - diary: - null == diary - ? _value.diary - : diary // ignore: cast_nullable_to_non_nullable - as DiaryDayModel, - ), - ); + $Res call({ + Object? diary = null, + }) { + return _then(_$DiaryDayWrapperModelImpl( + diary: null == diary + ? _value.diary + : diary // ignore: cast_nullable_to_non_nullable + as DiaryDayModel, + )); } } /// @nodoc @JsonSerializable() class _$DiaryDayWrapperModelImpl implements _DiaryDayWrapperModel { - const _$DiaryDayWrapperModelImpl({ - @JsonKey(name: "diary") required this.diary, - }); + const _$DiaryDayWrapperModelImpl( + {@JsonKey(name: "diary") required this.diary}); factory _$DiaryDayWrapperModelImpl.fromJson(Map json) => _$$DiaryDayWrapperModelImplFromJson(json); @@ -165,22 +155,22 @@ class _$DiaryDayWrapperModelImpl implements _DiaryDayWrapperModel { @override @pragma('vm:prefer-inline') _$$DiaryDayWrapperModelImplCopyWith<_$DiaryDayWrapperModelImpl> - get copyWith => - __$$DiaryDayWrapperModelImplCopyWithImpl<_$DiaryDayWrapperModelImpl>( - this, - _$identity, - ); + get copyWith => + __$$DiaryDayWrapperModelImplCopyWithImpl<_$DiaryDayWrapperModelImpl>( + this, _$identity); @override Map toJson() { - return _$$DiaryDayWrapperModelImplToJson(this); + return _$$DiaryDayWrapperModelImplToJson( + this, + ); } } abstract class _DiaryDayWrapperModel implements DiaryDayWrapperModel { - const factory _DiaryDayWrapperModel({ - @JsonKey(name: "diary") required final DiaryDayModel diary, - }) = _$DiaryDayWrapperModelImpl; + const factory _DiaryDayWrapperModel( + {@JsonKey(name: "diary") required final DiaryDayModel diary}) = + _$DiaryDayWrapperModelImpl; factory _DiaryDayWrapperModel.fromJson(Map json) = _$DiaryDayWrapperModelImpl.fromJson; @@ -194,7 +184,7 @@ abstract class _DiaryDayWrapperModel implements DiaryDayWrapperModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$DiaryDayWrapperModelImplCopyWith<_$DiaryDayWrapperModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } DiaryDayModel _$DiaryDayModelFromJson(Map json) { @@ -233,20 +223,18 @@ mixin _$DiaryDayModel { /// @nodoc abstract class $DiaryDayModelCopyWith<$Res> { factory $DiaryDayModelCopyWith( - DiaryDayModel value, - $Res Function(DiaryDayModel) then, - ) = _$DiaryDayModelCopyWithImpl<$Res, DiaryDayModel>; + DiaryDayModel value, $Res Function(DiaryDayModel) then) = + _$DiaryDayModelCopyWithImpl<$Res, DiaryDayModel>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "date") String date, - @JsonKey(name: "wakeup") String? wakeup, - @JsonKey(name: "retire") String? retire, - @JsonKey(name: "closed") int closed, - @JsonKey(name: "comment") String comment, - @JsonKey(name: "state") TypeOfDiaryModel typeOfDiary, - @JsonKey(name: "meals") List meals, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "date") String date, + @JsonKey(name: "wakeup") String? wakeup, + @JsonKey(name: "retire") String? retire, + @JsonKey(name: "closed") int closed, + @JsonKey(name: "comment") String comment, + @JsonKey(name: "state") TypeOfDiaryModel typeOfDiary, + @JsonKey(name: "meals") List meals}); $TypeOfDiaryModelCopyWith<$Res> get typeOfDiary; } @@ -275,51 +263,40 @@ class _$DiaryDayModelCopyWithImpl<$Res, $Val extends DiaryDayModel> Object? typeOfDiary = null, Object? meals = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as String, - wakeup: - freezed == wakeup - ? _value.wakeup - : wakeup // ignore: cast_nullable_to_non_nullable - as String?, - retire: - freezed == retire - ? _value.retire - : retire // ignore: cast_nullable_to_non_nullable - as String?, - closed: - null == closed - ? _value.closed - : closed // ignore: cast_nullable_to_non_nullable - as int, - comment: - null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeOfDiary: - null == typeOfDiary - ? _value.typeOfDiary - : typeOfDiary // ignore: cast_nullable_to_non_nullable - as TypeOfDiaryModel, - meals: - null == meals - ? _value.meals - : meals // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as String, + wakeup: freezed == wakeup + ? _value.wakeup + : wakeup // ignore: cast_nullable_to_non_nullable + as String?, + retire: freezed == retire + ? _value.retire + : retire // ignore: cast_nullable_to_non_nullable + as String?, + closed: null == closed + ? _value.closed + : closed // ignore: cast_nullable_to_non_nullable + as int, + comment: null == comment + ? _value.comment + : comment // ignore: cast_nullable_to_non_nullable + as String, + typeOfDiary: null == typeOfDiary + ? _value.typeOfDiary + : typeOfDiary // ignore: cast_nullable_to_non_nullable + as TypeOfDiaryModel, + meals: null == meals + ? _value.meals + : meals // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } /// Create a copy of DiaryDayModel @@ -337,21 +314,19 @@ class _$DiaryDayModelCopyWithImpl<$Res, $Val extends DiaryDayModel> abstract class _$$DiaryDayModelImplCopyWith<$Res> implements $DiaryDayModelCopyWith<$Res> { factory _$$DiaryDayModelImplCopyWith( - _$DiaryDayModelImpl value, - $Res Function(_$DiaryDayModelImpl) then, - ) = __$$DiaryDayModelImplCopyWithImpl<$Res>; + _$DiaryDayModelImpl value, $Res Function(_$DiaryDayModelImpl) then) = + __$$DiaryDayModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "date") String date, - @JsonKey(name: "wakeup") String? wakeup, - @JsonKey(name: "retire") String? retire, - @JsonKey(name: "closed") int closed, - @JsonKey(name: "comment") String comment, - @JsonKey(name: "state") TypeOfDiaryModel typeOfDiary, - @JsonKey(name: "meals") List meals, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "date") String date, + @JsonKey(name: "wakeup") String? wakeup, + @JsonKey(name: "retire") String? retire, + @JsonKey(name: "closed") int closed, + @JsonKey(name: "comment") String comment, + @JsonKey(name: "state") TypeOfDiaryModel typeOfDiary, + @JsonKey(name: "meals") List meals}); @override $TypeOfDiaryModelCopyWith<$Res> get typeOfDiary; @@ -362,9 +337,8 @@ class __$$DiaryDayModelImplCopyWithImpl<$Res> extends _$DiaryDayModelCopyWithImpl<$Res, _$DiaryDayModelImpl> implements _$$DiaryDayModelImplCopyWith<$Res> { __$$DiaryDayModelImplCopyWithImpl( - _$DiaryDayModelImpl _value, - $Res Function(_$DiaryDayModelImpl) _then, - ) : super(_value, _then); + _$DiaryDayModelImpl _value, $Res Function(_$DiaryDayModelImpl) _then) + : super(_value, _then); /// Create a copy of DiaryDayModel /// with the given fields replaced by the non-null parameter values. @@ -380,66 +354,56 @@ class __$$DiaryDayModelImplCopyWithImpl<$Res> Object? typeOfDiary = null, Object? meals = null, }) { - return _then( - _$DiaryDayModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as String, - wakeup: - freezed == wakeup - ? _value.wakeup - : wakeup // ignore: cast_nullable_to_non_nullable - as String?, - retire: - freezed == retire - ? _value.retire - : retire // ignore: cast_nullable_to_non_nullable - as String?, - closed: - null == closed - ? _value.closed - : closed // ignore: cast_nullable_to_non_nullable - as int, - comment: - null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeOfDiary: - null == typeOfDiary - ? _value.typeOfDiary - : typeOfDiary // ignore: cast_nullable_to_non_nullable - as TypeOfDiaryModel, - meals: - null == meals - ? _value._meals - : meals // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + return _then(_$DiaryDayModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as String, + wakeup: freezed == wakeup + ? _value.wakeup + : wakeup // ignore: cast_nullable_to_non_nullable + as String?, + retire: freezed == retire + ? _value.retire + : retire // ignore: cast_nullable_to_non_nullable + as String?, + closed: null == closed + ? _value.closed + : closed // ignore: cast_nullable_to_non_nullable + as int, + comment: null == comment + ? _value.comment + : comment // ignore: cast_nullable_to_non_nullable + as String, + typeOfDiary: null == typeOfDiary + ? _value.typeOfDiary + : typeOfDiary // ignore: cast_nullable_to_non_nullable + as TypeOfDiaryModel, + meals: null == meals + ? _value._meals + : meals // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc @JsonSerializable() class _$DiaryDayModelImpl implements _DiaryDayModel { - const _$DiaryDayModelImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "date") required this.date, - @JsonKey(name: "wakeup") this.wakeup, - @JsonKey(name: "retire") this.retire, - @JsonKey(name: "closed") required this.closed, - @JsonKey(name: "comment") required this.comment, - @JsonKey(name: "state") required this.typeOfDiary, - @JsonKey(name: "meals") required final List meals, - }) : _meals = meals; + const _$DiaryDayModelImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "date") required this.date, + @JsonKey(name: "wakeup") this.wakeup, + @JsonKey(name: "retire") this.retire, + @JsonKey(name: "closed") required this.closed, + @JsonKey(name: "comment") required this.comment, + @JsonKey(name: "state") required this.typeOfDiary, + @JsonKey(name: "meals") required final List meals}) + : _meals = meals; factory _$DiaryDayModelImpl.fromJson(Map json) => _$$DiaryDayModelImplFromJson(json); @@ -497,17 +461,8 @@ class _$DiaryDayModelImpl implements _DiaryDayModel { @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - id, - date, - wakeup, - retire, - closed, - comment, - typeOfDiary, - const DeepCollectionEquality().hash(_meals), - ); + int get hashCode => Object.hash(runtimeType, id, date, wakeup, retire, closed, + comment, typeOfDiary, const DeepCollectionEquality().hash(_meals)); /// Create a copy of DiaryDayModel /// with the given fields replaced by the non-null parameter values. @@ -519,21 +474,23 @@ class _$DiaryDayModelImpl implements _DiaryDayModel { @override Map toJson() { - return _$$DiaryDayModelImplToJson(this); + return _$$DiaryDayModelImplToJson( + this, + ); } } abstract class _DiaryDayModel implements DiaryDayModel { - const factory _DiaryDayModel({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "date") required final String date, - @JsonKey(name: "wakeup") final String? wakeup, - @JsonKey(name: "retire") final String? retire, - @JsonKey(name: "closed") required final int closed, - @JsonKey(name: "comment") required final String comment, - @JsonKey(name: "state") required final TypeOfDiaryModel typeOfDiary, - @JsonKey(name: "meals") required final List meals, - }) = _$DiaryDayModelImpl; + const factory _DiaryDayModel( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "date") required final String date, + @JsonKey(name: "wakeup") final String? wakeup, + @JsonKey(name: "retire") final String? retire, + @JsonKey(name: "closed") required final int closed, + @JsonKey(name: "comment") required final String comment, + @JsonKey(name: "state") required final TypeOfDiaryModel typeOfDiary, + @JsonKey(name: "meals") required final List meals}) = + _$DiaryDayModelImpl; factory _DiaryDayModel.fromJson(Map json) = _$DiaryDayModelImpl.fromJson; @@ -607,15 +564,14 @@ abstract class $MealModelCopyWith<$Res> { factory $MealModelCopyWith(MealModel value, $Res Function(MealModel) then) = _$MealModelCopyWithImpl<$Res, MealModel>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "time") String time, - @JsonKey(name: "type_no") int typeNumber, - @JsonKey(name: "satiety") int satiety, - @JsonKey(name: "mood") int mood, - @JsonKey(name: "portions") List portions, - @JsonKey(name: "photos") List photos, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "time") String time, + @JsonKey(name: "type_no") int typeNumber, + @JsonKey(name: "satiety") int satiety, + @JsonKey(name: "mood") int mood, + @JsonKey(name: "portions") List portions, + @JsonKey(name: "photos") List photos}); } /// @nodoc @@ -641,46 +597,36 @@ class _$MealModelCopyWithImpl<$Res, $Val extends MealModel> Object? portions = null, Object? photos = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - time: - null == time - ? _value.time - : time // ignore: cast_nullable_to_non_nullable - as String, - typeNumber: - null == typeNumber - ? _value.typeNumber - : typeNumber // ignore: cast_nullable_to_non_nullable - as int, - satiety: - null == satiety - ? _value.satiety - : satiety // ignore: cast_nullable_to_non_nullable - as int, - mood: - null == mood - ? _value.mood - : mood // ignore: cast_nullable_to_non_nullable - as int, - portions: - null == portions - ? _value.portions - : portions // ignore: cast_nullable_to_non_nullable - as List, - photos: - null == photos - ? _value.photos - : photos // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + time: null == time + ? _value.time + : time // ignore: cast_nullable_to_non_nullable + as String, + typeNumber: null == typeNumber + ? _value.typeNumber + : typeNumber // ignore: cast_nullable_to_non_nullable + as int, + satiety: null == satiety + ? _value.satiety + : satiety // ignore: cast_nullable_to_non_nullable + as int, + mood: null == mood + ? _value.mood + : mood // ignore: cast_nullable_to_non_nullable + as int, + portions: null == portions + ? _value.portions + : portions // ignore: cast_nullable_to_non_nullable + as List, + photos: null == photos + ? _value.photos + : photos // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } } @@ -688,20 +634,18 @@ class _$MealModelCopyWithImpl<$Res, $Val extends MealModel> abstract class _$$MealModelImplCopyWith<$Res> implements $MealModelCopyWith<$Res> { factory _$$MealModelImplCopyWith( - _$MealModelImpl value, - $Res Function(_$MealModelImpl) then, - ) = __$$MealModelImplCopyWithImpl<$Res>; + _$MealModelImpl value, $Res Function(_$MealModelImpl) then) = + __$$MealModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "time") String time, - @JsonKey(name: "type_no") int typeNumber, - @JsonKey(name: "satiety") int satiety, - @JsonKey(name: "mood") int mood, - @JsonKey(name: "portions") List portions, - @JsonKey(name: "photos") List photos, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "time") String time, + @JsonKey(name: "type_no") int typeNumber, + @JsonKey(name: "satiety") int satiety, + @JsonKey(name: "mood") int mood, + @JsonKey(name: "portions") List portions, + @JsonKey(name: "photos") List photos}); } /// @nodoc @@ -709,9 +653,8 @@ class __$$MealModelImplCopyWithImpl<$Res> extends _$MealModelCopyWithImpl<$Res, _$MealModelImpl> implements _$$MealModelImplCopyWith<$Res> { __$$MealModelImplCopyWithImpl( - _$MealModelImpl _value, - $Res Function(_$MealModelImpl) _then, - ) : super(_value, _then); + _$MealModelImpl _value, $Res Function(_$MealModelImpl) _then) + : super(_value, _then); /// Create a copy of MealModel /// with the given fields replaced by the non-null parameter values. @@ -726,61 +669,52 @@ class __$$MealModelImplCopyWithImpl<$Res> Object? portions = null, Object? photos = null, }) { - return _then( - _$MealModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - time: - null == time - ? _value.time - : time // ignore: cast_nullable_to_non_nullable - as String, - typeNumber: - null == typeNumber - ? _value.typeNumber - : typeNumber // ignore: cast_nullable_to_non_nullable - as int, - satiety: - null == satiety - ? _value.satiety - : satiety // ignore: cast_nullable_to_non_nullable - as int, - mood: - null == mood - ? _value.mood - : mood // ignore: cast_nullable_to_non_nullable - as int, - portions: - null == portions - ? _value._portions - : portions // ignore: cast_nullable_to_non_nullable - as List, - photos: - null == photos - ? _value._photos - : photos // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + return _then(_$MealModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + time: null == time + ? _value.time + : time // ignore: cast_nullable_to_non_nullable + as String, + typeNumber: null == typeNumber + ? _value.typeNumber + : typeNumber // ignore: cast_nullable_to_non_nullable + as int, + satiety: null == satiety + ? _value.satiety + : satiety // ignore: cast_nullable_to_non_nullable + as int, + mood: null == mood + ? _value.mood + : mood // ignore: cast_nullable_to_non_nullable + as int, + portions: null == portions + ? _value._portions + : portions // ignore: cast_nullable_to_non_nullable + as List, + photos: null == photos + ? _value._photos + : photos // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc @JsonSerializable() class _$MealModelImpl implements _MealModel { - const _$MealModelImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "time") required this.time, - @JsonKey(name: "type_no") required this.typeNumber, - @JsonKey(name: "satiety") required this.satiety, - @JsonKey(name: "mood") required this.mood, - @JsonKey(name: "portions") required final List portions, - @JsonKey(name: "photos") required final List photos, - }) : _portions = portions, - _photos = photos; + const _$MealModelImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "time") required this.time, + @JsonKey(name: "type_no") required this.typeNumber, + @JsonKey(name: "satiety") required this.satiety, + @JsonKey(name: "mood") required this.mood, + @JsonKey(name: "portions") required final List portions, + @JsonKey(name: "photos") required final List photos}) + : _portions = portions, + _photos = photos; factory _$MealModelImpl.fromJson(Map json) => _$$MealModelImplFromJson(json); @@ -841,15 +775,14 @@ class _$MealModelImpl implements _MealModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - id, - time, - typeNumber, - satiety, - mood, - const DeepCollectionEquality().hash(_portions), - const DeepCollectionEquality().hash(_photos), - ); + runtimeType, + id, + time, + typeNumber, + satiety, + mood, + const DeepCollectionEquality().hash(_portions), + const DeepCollectionEquality().hash(_photos)); /// Create a copy of MealModel /// with the given fields replaced by the non-null parameter values. @@ -861,20 +794,22 @@ class _$MealModelImpl implements _MealModel { @override Map toJson() { - return _$$MealModelImplToJson(this); + return _$$MealModelImplToJson( + this, + ); } } abstract class _MealModel implements MealModel { - const factory _MealModel({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "time") required final String time, - @JsonKey(name: "type_no") required final int typeNumber, - @JsonKey(name: "satiety") required final int satiety, - @JsonKey(name: "mood") required final int mood, - @JsonKey(name: "portions") required final List portions, - @JsonKey(name: "photos") required final List photos, - }) = _$MealModelImpl; + const factory _MealModel( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "time") required final String time, + @JsonKey(name: "type_no") required final int typeNumber, + @JsonKey(name: "satiety") required final int satiety, + @JsonKey(name: "mood") required final int mood, + @JsonKey(name: "portions") required final List portions, + @JsonKey(name: "photos") + required final List photos}) = _$MealModelImpl; factory _MealModel.fromJson(Map json) = _$MealModelImpl.fromJson; @@ -937,16 +872,14 @@ mixin _$DiaryPhotoModel { /// @nodoc abstract class $DiaryPhotoModelCopyWith<$Res> { factory $DiaryPhotoModelCopyWith( - DiaryPhotoModel value, - $Res Function(DiaryPhotoModel) then, - ) = _$DiaryPhotoModelCopyWithImpl<$Res, DiaryPhotoModel>; + DiaryPhotoModel value, $Res Function(DiaryPhotoModel) then) = + _$DiaryPhotoModelCopyWithImpl<$Res, DiaryPhotoModel>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "original_name") String originalName, - @JsonKey(name: "path") String path, - @JsonKey(name: "size") int size, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "original_name") String originalName, + @JsonKey(name: "path") String path, + @JsonKey(name: "size") int size}); } /// @nodoc @@ -969,49 +902,40 @@ class _$DiaryPhotoModelCopyWithImpl<$Res, $Val extends DiaryPhotoModel> Object? path = null, Object? size = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - originalName: - null == originalName - ? _value.originalName - : originalName // ignore: cast_nullable_to_non_nullable - as String, - path: - null == path - ? _value.path - : path // ignore: cast_nullable_to_non_nullable - as String, - size: - null == size - ? _value.size - : size // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + originalName: null == originalName + ? _value.originalName + : originalName // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + size: null == size + ? _value.size + : size // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } /// @nodoc abstract class _$$DiaryPhotoModelImplCopyWith<$Res> implements $DiaryPhotoModelCopyWith<$Res> { - factory _$$DiaryPhotoModelImplCopyWith( - _$DiaryPhotoModelImpl value, - $Res Function(_$DiaryPhotoModelImpl) then, - ) = __$$DiaryPhotoModelImplCopyWithImpl<$Res>; + factory _$$DiaryPhotoModelImplCopyWith(_$DiaryPhotoModelImpl value, + $Res Function(_$DiaryPhotoModelImpl) then) = + __$$DiaryPhotoModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "original_name") String originalName, - @JsonKey(name: "path") String path, - @JsonKey(name: "size") int size, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "original_name") String originalName, + @JsonKey(name: "path") String path, + @JsonKey(name: "size") int size}); } /// @nodoc @@ -1019,9 +943,8 @@ class __$$DiaryPhotoModelImplCopyWithImpl<$Res> extends _$DiaryPhotoModelCopyWithImpl<$Res, _$DiaryPhotoModelImpl> implements _$$DiaryPhotoModelImplCopyWith<$Res> { __$$DiaryPhotoModelImplCopyWithImpl( - _$DiaryPhotoModelImpl _value, - $Res Function(_$DiaryPhotoModelImpl) _then, - ) : super(_value, _then); + _$DiaryPhotoModelImpl _value, $Res Function(_$DiaryPhotoModelImpl) _then) + : super(_value, _then); /// Create a copy of DiaryPhotoModel /// with the given fields replaced by the non-null parameter values. @@ -1033,42 +956,35 @@ class __$$DiaryPhotoModelImplCopyWithImpl<$Res> Object? path = null, Object? size = null, }) { - return _then( - _$DiaryPhotoModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - originalName: - null == originalName - ? _value.originalName - : originalName // ignore: cast_nullable_to_non_nullable - as String, - path: - null == path - ? _value.path - : path // ignore: cast_nullable_to_non_nullable - as String, - size: - null == size - ? _value.size - : size // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$DiaryPhotoModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + originalName: null == originalName + ? _value.originalName + : originalName // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + size: null == size + ? _value.size + : size // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc @JsonSerializable() class _$DiaryPhotoModelImpl implements _DiaryPhotoModel { - const _$DiaryPhotoModelImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "original_name") required this.originalName, - @JsonKey(name: "path") required this.path, - @JsonKey(name: "size") required this.size, - }); + const _$DiaryPhotoModelImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "original_name") required this.originalName, + @JsonKey(name: "path") required this.path, + @JsonKey(name: "size") required this.size}); factory _$DiaryPhotoModelImpl.fromJson(Map json) => _$$DiaryPhotoModelImplFromJson(json); @@ -1114,23 +1030,22 @@ class _$DiaryPhotoModelImpl implements _DiaryPhotoModel { @pragma('vm:prefer-inline') _$$DiaryPhotoModelImplCopyWith<_$DiaryPhotoModelImpl> get copyWith => __$$DiaryPhotoModelImplCopyWithImpl<_$DiaryPhotoModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$DiaryPhotoModelImplToJson(this); + return _$$DiaryPhotoModelImplToJson( + this, + ); } } abstract class _DiaryPhotoModel implements DiaryPhotoModel { - const factory _DiaryPhotoModel({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "original_name") required final String originalName, - @JsonKey(name: "path") required final String path, - @JsonKey(name: "size") required final int size, - }) = _$DiaryPhotoModelImpl; + const factory _DiaryPhotoModel( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "original_name") required final String originalName, + @JsonKey(name: "path") required final String path, + @JsonKey(name: "size") required final int size}) = _$DiaryPhotoModelImpl; factory _DiaryPhotoModel.fromJson(Map json) = _$DiaryPhotoModelImpl.fromJson; @@ -1190,20 +1105,18 @@ mixin _$PortionModel { /// @nodoc abstract class $PortionModelCopyWith<$Res> { factory $PortionModelCopyWith( - PortionModel value, - $Res Function(PortionModel) then, - ) = _$PortionModelCopyWithImpl<$Res, PortionModel>; + PortionModel value, $Res Function(PortionModel) then) = + _$PortionModelCopyWithImpl<$Res, PortionModel>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "product_nutritional_value_id") - int? productNutritionalValueId, - @JsonKey(name: "product_name") String productName, - @JsonKey(name: "quantity") int quantity, - @JsonKey(name: "portion") String portion, - @JsonKey(name: "from_diet") bool fromDiet, - @JsonKey(name: "state") PortionState portionState, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "product_nutritional_value_id") + int? productNutritionalValueId, + @JsonKey(name: "product_name") String productName, + @JsonKey(name: "quantity") int quantity, + @JsonKey(name: "portion") String portion, + @JsonKey(name: "from_diet") bool fromDiet, + @JsonKey(name: "state") PortionState portionState}); } /// @nodoc @@ -1229,46 +1142,36 @@ class _$PortionModelCopyWithImpl<$Res, $Val extends PortionModel> Object? fromDiet = null, Object? portionState = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - productNutritionalValueId: - freezed == productNutritionalValueId - ? _value.productNutritionalValueId - : productNutritionalValueId // ignore: cast_nullable_to_non_nullable - as int?, - productName: - null == productName - ? _value.productName - : productName // ignore: cast_nullable_to_non_nullable - as String, - quantity: - null == quantity - ? _value.quantity - : quantity // ignore: cast_nullable_to_non_nullable - as int, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as String, - fromDiet: - null == fromDiet - ? _value.fromDiet - : fromDiet // ignore: cast_nullable_to_non_nullable - as bool, - portionState: - null == portionState - ? _value.portionState - : portionState // ignore: cast_nullable_to_non_nullable - as PortionState, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + productNutritionalValueId: freezed == productNutritionalValueId + ? _value.productNutritionalValueId + : productNutritionalValueId // ignore: cast_nullable_to_non_nullable + as int?, + productName: null == productName + ? _value.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as String, + fromDiet: null == fromDiet + ? _value.fromDiet + : fromDiet // ignore: cast_nullable_to_non_nullable + as bool, + portionState: null == portionState + ? _value.portionState + : portionState // ignore: cast_nullable_to_non_nullable + as PortionState, + ) as $Val); } } @@ -1276,21 +1179,19 @@ class _$PortionModelCopyWithImpl<$Res, $Val extends PortionModel> abstract class _$$PortionModelImplCopyWith<$Res> implements $PortionModelCopyWith<$Res> { factory _$$PortionModelImplCopyWith( - _$PortionModelImpl value, - $Res Function(_$PortionModelImpl) then, - ) = __$$PortionModelImplCopyWithImpl<$Res>; + _$PortionModelImpl value, $Res Function(_$PortionModelImpl) then) = + __$$PortionModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "product_nutritional_value_id") - int? productNutritionalValueId, - @JsonKey(name: "product_name") String productName, - @JsonKey(name: "quantity") int quantity, - @JsonKey(name: "portion") String portion, - @JsonKey(name: "from_diet") bool fromDiet, - @JsonKey(name: "state") PortionState portionState, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "product_nutritional_value_id") + int? productNutritionalValueId, + @JsonKey(name: "product_name") String productName, + @JsonKey(name: "quantity") int quantity, + @JsonKey(name: "portion") String portion, + @JsonKey(name: "from_diet") bool fromDiet, + @JsonKey(name: "state") PortionState portionState}); } /// @nodoc @@ -1298,9 +1199,8 @@ class __$$PortionModelImplCopyWithImpl<$Res> extends _$PortionModelCopyWithImpl<$Res, _$PortionModelImpl> implements _$$PortionModelImplCopyWith<$Res> { __$$PortionModelImplCopyWithImpl( - _$PortionModelImpl _value, - $Res Function(_$PortionModelImpl) _then, - ) : super(_value, _then); + _$PortionModelImpl _value, $Res Function(_$PortionModelImpl) _then) + : super(_value, _then); /// Create a copy of PortionModel /// with the given fields replaced by the non-null parameter values. @@ -1315,61 +1215,51 @@ class __$$PortionModelImplCopyWithImpl<$Res> Object? fromDiet = null, Object? portionState = null, }) { - return _then( - _$PortionModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - productNutritionalValueId: - freezed == productNutritionalValueId - ? _value.productNutritionalValueId - : productNutritionalValueId // ignore: cast_nullable_to_non_nullable - as int?, - productName: - null == productName - ? _value.productName - : productName // ignore: cast_nullable_to_non_nullable - as String, - quantity: - null == quantity - ? _value.quantity - : quantity // ignore: cast_nullable_to_non_nullable - as int, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as String, - fromDiet: - null == fromDiet - ? _value.fromDiet - : fromDiet // ignore: cast_nullable_to_non_nullable - as bool, - portionState: - null == portionState - ? _value.portionState - : portionState // ignore: cast_nullable_to_non_nullable - as PortionState, - ), - ); + return _then(_$PortionModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + productNutritionalValueId: freezed == productNutritionalValueId + ? _value.productNutritionalValueId + : productNutritionalValueId // ignore: cast_nullable_to_non_nullable + as int?, + productName: null == productName + ? _value.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as String, + fromDiet: null == fromDiet + ? _value.fromDiet + : fromDiet // ignore: cast_nullable_to_non_nullable + as bool, + portionState: null == portionState + ? _value.portionState + : portionState // ignore: cast_nullable_to_non_nullable + as PortionState, + )); } } /// @nodoc @JsonSerializable() class _$PortionModelImpl implements _PortionModel { - const _$PortionModelImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "product_nutritional_value_id") - this.productNutritionalValueId, - @JsonKey(name: "product_name") required this.productName, - @JsonKey(name: "quantity") required this.quantity, - @JsonKey(name: "portion") required this.portion, - @JsonKey(name: "from_diet") required this.fromDiet, - @JsonKey(name: "state") required this.portionState, - }); + const _$PortionModelImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "product_nutritional_value_id") + this.productNutritionalValueId, + @JsonKey(name: "product_name") required this.productName, + @JsonKey(name: "quantity") required this.quantity, + @JsonKey(name: "portion") required this.portion, + @JsonKey(name: "from_diet") required this.fromDiet, + @JsonKey(name: "state") required this.portionState}); factory _$PortionModelImpl.fromJson(Map json) => _$$PortionModelImplFromJson(json); @@ -1407,10 +1297,8 @@ class _$PortionModelImpl implements _PortionModel { (other.runtimeType == runtimeType && other is _$PortionModelImpl && (identical(other.id, id) || other.id == id) && - (identical( - other.productNutritionalValueId, - productNutritionalValueId, - ) || + (identical(other.productNutritionalValueId, + productNutritionalValueId) || other.productNutritionalValueId == productNutritionalValueId) && (identical(other.productName, productName) || other.productName == productName) && @@ -1425,16 +1313,8 @@ class _$PortionModelImpl implements _PortionModel { @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - id, - productNutritionalValueId, - productName, - quantity, - portion, - fromDiet, - portionState, - ); + int get hashCode => Object.hash(runtimeType, id, productNutritionalValueId, + productName, quantity, portion, fromDiet, portionState); /// Create a copy of PortionModel /// with the given fields replaced by the non-null parameter values. @@ -1446,21 +1326,23 @@ class _$PortionModelImpl implements _PortionModel { @override Map toJson() { - return _$$PortionModelImplToJson(this); + return _$$PortionModelImplToJson( + this, + ); } } abstract class _PortionModel implements PortionModel { - const factory _PortionModel({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "product_nutritional_value_id") - final int? productNutritionalValueId, - @JsonKey(name: "product_name") required final String productName, - @JsonKey(name: "quantity") required final int quantity, - @JsonKey(name: "portion") required final String portion, - @JsonKey(name: "from_diet") required final bool fromDiet, - @JsonKey(name: "state") required final PortionState portionState, - }) = _$PortionModelImpl; + const factory _PortionModel( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "product_nutritional_value_id") + final int? productNutritionalValueId, + @JsonKey(name: "product_name") required final String productName, + @JsonKey(name: "quantity") required final int quantity, + @JsonKey(name: "portion") required final String portion, + @JsonKey(name: "from_diet") required final bool fromDiet, + @JsonKey(name: "state") required final PortionState portionState}) = + _$PortionModelImpl; factory _PortionModel.fromJson(Map json) = _$PortionModelImpl.fromJson; @@ -1519,14 +1401,12 @@ mixin _$TypeOfDiaryModel { /// @nodoc abstract class $TypeOfDiaryModelCopyWith<$Res> { factory $TypeOfDiaryModelCopyWith( - TypeOfDiaryModel value, - $Res Function(TypeOfDiaryModel) then, - ) = _$TypeOfDiaryModelCopyWithImpl<$Res, TypeOfDiaryModel>; + TypeOfDiaryModel value, $Res Function(TypeOfDiaryModel) then) = + _$TypeOfDiaryModelCopyWithImpl<$Res, TypeOfDiaryModel>; @useResult - $Res call({ - @JsonKey(name: "has_chosen_diet") bool hasChosenDiet, - @JsonKey(name: "has_chosen_plan") bool hasChosenPlan, - }); + $Res call( + {@JsonKey(name: "has_chosen_diet") bool hasChosenDiet, + @JsonKey(name: "has_chosen_plan") bool hasChosenPlan}); } /// @nodoc @@ -1543,78 +1423,71 @@ class _$TypeOfDiaryModelCopyWithImpl<$Res, $Val extends TypeOfDiaryModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? hasChosenDiet = null, Object? hasChosenPlan = null}) { - return _then( - _value.copyWith( - hasChosenDiet: - null == hasChosenDiet - ? _value.hasChosenDiet - : hasChosenDiet // ignore: cast_nullable_to_non_nullable - as bool, - hasChosenPlan: - null == hasChosenPlan - ? _value.hasChosenPlan - : hasChosenPlan // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + $Res call({ + Object? hasChosenDiet = null, + Object? hasChosenPlan = null, + }) { + return _then(_value.copyWith( + hasChosenDiet: null == hasChosenDiet + ? _value.hasChosenDiet + : hasChosenDiet // ignore: cast_nullable_to_non_nullable + as bool, + hasChosenPlan: null == hasChosenPlan + ? _value.hasChosenPlan + : hasChosenPlan // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } } /// @nodoc abstract class _$$TypeOfDiaryModelImplCopyWith<$Res> implements $TypeOfDiaryModelCopyWith<$Res> { - factory _$$TypeOfDiaryModelImplCopyWith( - _$TypeOfDiaryModelImpl value, - $Res Function(_$TypeOfDiaryModelImpl) then, - ) = __$$TypeOfDiaryModelImplCopyWithImpl<$Res>; + factory _$$TypeOfDiaryModelImplCopyWith(_$TypeOfDiaryModelImpl value, + $Res Function(_$TypeOfDiaryModelImpl) then) = + __$$TypeOfDiaryModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "has_chosen_diet") bool hasChosenDiet, - @JsonKey(name: "has_chosen_plan") bool hasChosenPlan, - }); + $Res call( + {@JsonKey(name: "has_chosen_diet") bool hasChosenDiet, + @JsonKey(name: "has_chosen_plan") bool hasChosenPlan}); } /// @nodoc class __$$TypeOfDiaryModelImplCopyWithImpl<$Res> extends _$TypeOfDiaryModelCopyWithImpl<$Res, _$TypeOfDiaryModelImpl> implements _$$TypeOfDiaryModelImplCopyWith<$Res> { - __$$TypeOfDiaryModelImplCopyWithImpl( - _$TypeOfDiaryModelImpl _value, - $Res Function(_$TypeOfDiaryModelImpl) _then, - ) : super(_value, _then); + __$$TypeOfDiaryModelImplCopyWithImpl(_$TypeOfDiaryModelImpl _value, + $Res Function(_$TypeOfDiaryModelImpl) _then) + : super(_value, _then); /// Create a copy of TypeOfDiaryModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? hasChosenDiet = null, Object? hasChosenPlan = null}) { - return _then( - _$TypeOfDiaryModelImpl( - hasChosenDiet: - null == hasChosenDiet - ? _value.hasChosenDiet - : hasChosenDiet // ignore: cast_nullable_to_non_nullable - as bool, - hasChosenPlan: - null == hasChosenPlan - ? _value.hasChosenPlan - : hasChosenPlan // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + $Res call({ + Object? hasChosenDiet = null, + Object? hasChosenPlan = null, + }) { + return _then(_$TypeOfDiaryModelImpl( + hasChosenDiet: null == hasChosenDiet + ? _value.hasChosenDiet + : hasChosenDiet // ignore: cast_nullable_to_non_nullable + as bool, + hasChosenPlan: null == hasChosenPlan + ? _value.hasChosenPlan + : hasChosenPlan // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc @JsonSerializable() class _$TypeOfDiaryModelImpl implements _TypeOfDiaryModel { - const _$TypeOfDiaryModelImpl({ - @JsonKey(name: "has_chosen_diet") required this.hasChosenDiet, - @JsonKey(name: "has_chosen_plan") required this.hasChosenPlan, - }); + const _$TypeOfDiaryModelImpl( + {@JsonKey(name: "has_chosen_diet") required this.hasChosenDiet, + @JsonKey(name: "has_chosen_plan") required this.hasChosenPlan}); factory _$TypeOfDiaryModelImpl.fromJson(Map json) => _$$TypeOfDiaryModelImplFromJson(json); @@ -1653,21 +1526,21 @@ class _$TypeOfDiaryModelImpl implements _TypeOfDiaryModel { @pragma('vm:prefer-inline') _$$TypeOfDiaryModelImplCopyWith<_$TypeOfDiaryModelImpl> get copyWith => __$$TypeOfDiaryModelImplCopyWithImpl<_$TypeOfDiaryModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$TypeOfDiaryModelImplToJson(this); + return _$$TypeOfDiaryModelImplToJson( + this, + ); } } abstract class _TypeOfDiaryModel implements TypeOfDiaryModel { - const factory _TypeOfDiaryModel({ - @JsonKey(name: "has_chosen_diet") required final bool hasChosenDiet, - @JsonKey(name: "has_chosen_plan") required final bool hasChosenPlan, - }) = _$TypeOfDiaryModelImpl; + const factory _TypeOfDiaryModel( + {@JsonKey(name: "has_chosen_diet") required final bool hasChosenDiet, + @JsonKey(name: "has_chosen_plan") + required final bool hasChosenPlan}) = _$TypeOfDiaryModelImpl; factory _TypeOfDiaryModel.fromJson(Map json) = _$TypeOfDiaryModelImpl.fromJson; @@ -1713,15 +1586,13 @@ mixin _$ProductInMeal { /// @nodoc abstract class $ProductInMealCopyWith<$Res> { factory $ProductInMealCopyWith( - ProductInMeal value, - $Res Function(ProductInMeal) then, - ) = _$ProductInMealCopyWithImpl<$Res, ProductInMeal>; + ProductInMeal value, $Res Function(ProductInMeal) then) = + _$ProductInMealCopyWithImpl<$Res, ProductInMeal>; @useResult - $Res call({ - @JsonKey(name: 'product_name') String productName, - @JsonKey(name: 'portion') String portion, - @JsonKey(name: 'quantity') int quantity, - }); + $Res call( + {@JsonKey(name: 'product_name') String productName, + @JsonKey(name: 'portion') String portion, + @JsonKey(name: 'quantity') int quantity}); } /// @nodoc @@ -1743,26 +1614,20 @@ class _$ProductInMealCopyWithImpl<$Res, $Val extends ProductInMeal> Object? portion = null, Object? quantity = null, }) { - return _then( - _value.copyWith( - productName: - null == productName - ? _value.productName - : productName // ignore: cast_nullable_to_non_nullable - as String, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as String, - quantity: - null == quantity - ? _value.quantity - : quantity // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + return _then(_value.copyWith( + productName: null == productName + ? _value.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as String, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } @@ -1770,16 +1635,14 @@ class _$ProductInMealCopyWithImpl<$Res, $Val extends ProductInMeal> abstract class _$$ProductInMealImplCopyWith<$Res> implements $ProductInMealCopyWith<$Res> { factory _$$ProductInMealImplCopyWith( - _$ProductInMealImpl value, - $Res Function(_$ProductInMealImpl) then, - ) = __$$ProductInMealImplCopyWithImpl<$Res>; + _$ProductInMealImpl value, $Res Function(_$ProductInMealImpl) then) = + __$$ProductInMealImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'product_name') String productName, - @JsonKey(name: 'portion') String portion, - @JsonKey(name: 'quantity') int quantity, - }); + $Res call( + {@JsonKey(name: 'product_name') String productName, + @JsonKey(name: 'portion') String portion, + @JsonKey(name: 'quantity') int quantity}); } /// @nodoc @@ -1787,9 +1650,8 @@ class __$$ProductInMealImplCopyWithImpl<$Res> extends _$ProductInMealCopyWithImpl<$Res, _$ProductInMealImpl> implements _$$ProductInMealImplCopyWith<$Res> { __$$ProductInMealImplCopyWithImpl( - _$ProductInMealImpl _value, - $Res Function(_$ProductInMealImpl) _then, - ) : super(_value, _then); + _$ProductInMealImpl _value, $Res Function(_$ProductInMealImpl) _then) + : super(_value, _then); /// Create a copy of ProductInMeal /// with the given fields replaced by the non-null parameter values. @@ -1800,36 +1662,30 @@ class __$$ProductInMealImplCopyWithImpl<$Res> Object? portion = null, Object? quantity = null, }) { - return _then( - _$ProductInMealImpl( - productName: - null == productName - ? _value.productName - : productName // ignore: cast_nullable_to_non_nullable - as String, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as String, - quantity: - null == quantity - ? _value.quantity - : quantity // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$ProductInMealImpl( + productName: null == productName + ? _value.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as String, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc @JsonSerializable() class _$ProductInMealImpl implements _ProductInMeal { - const _$ProductInMealImpl({ - @JsonKey(name: 'product_name') required this.productName, - @JsonKey(name: 'portion') required this.portion, - @JsonKey(name: 'quantity') required this.quantity, - }); + const _$ProductInMealImpl( + {@JsonKey(name: 'product_name') required this.productName, + @JsonKey(name: 'portion') required this.portion, + @JsonKey(name: 'quantity') required this.quantity}); factory _$ProductInMealImpl.fromJson(Map json) => _$$ProductInMealImplFromJson(json); @@ -1875,16 +1731,18 @@ class _$ProductInMealImpl implements _ProductInMeal { @override Map toJson() { - return _$$ProductInMealImplToJson(this); + return _$$ProductInMealImplToJson( + this, + ); } } abstract class _ProductInMeal implements ProductInMeal { - const factory _ProductInMeal({ - @JsonKey(name: 'product_name') required final String productName, - @JsonKey(name: 'portion') required final String portion, - @JsonKey(name: 'quantity') required final int quantity, - }) = _$ProductInMealImpl; + const factory _ProductInMeal( + {@JsonKey(name: 'product_name') required final String productName, + @JsonKey(name: 'portion') required final String portion, + @JsonKey(name: 'quantity') required final int quantity}) = + _$ProductInMealImpl; factory _ProductInMeal.fromJson(Map json) = _$ProductInMealImpl.fromJson; diff --git a/lib/features/diary/models/diary_day_model.g.dart b/lib/features/diary/models/diary_day_model.g.dart index c36c90e0..c48e76bf 100644 --- a/lib/features/diary/models/diary_day_model.g.dart +++ b/lib/features/diary/models/diary_day_model.g.dart @@ -7,14 +7,16 @@ part of 'diary_day_model.dart'; // ************************************************************************** _$DiaryDayWrapperModelImpl _$$DiaryDayWrapperModelImplFromJson( - Map json, -) => _$DiaryDayWrapperModelImpl( - diary: DiaryDayModel.fromJson(json['diary'] as Map), -); + Map json) => + _$DiaryDayWrapperModelImpl( + diary: DiaryDayModel.fromJson(json['diary'] as Map), + ); Map _$$DiaryDayWrapperModelImplToJson( - _$DiaryDayWrapperModelImpl instance, -) => {'diary': instance.diary}; + _$DiaryDayWrapperModelImpl instance) => + { + 'diary': instance.diary, + }; _$DiaryDayModelImpl _$$DiaryDayModelImplFromJson(Map json) => _$DiaryDayModelImpl( @@ -24,13 +26,11 @@ _$DiaryDayModelImpl _$$DiaryDayModelImplFromJson(Map json) => retire: json['retire'] as String?, closed: (json['closed'] as num).toInt(), comment: json['comment'] as String, - typeOfDiary: TypeOfDiaryModel.fromJson( - json['state'] as Map, - ), - meals: - (json['meals'] as List) - .map((e) => MealModel.fromJson(e as Map)) - .toList(), + typeOfDiary: + TypeOfDiaryModel.fromJson(json['state'] as Map), + meals: (json['meals'] as List) + .map((e) => MealModel.fromJson(e as Map)) + .toList(), ); Map _$$DiaryDayModelImplToJson(_$DiaryDayModelImpl instance) => @@ -52,14 +52,12 @@ _$MealModelImpl _$$MealModelImplFromJson(Map json) => typeNumber: (json['type_no'] as num).toInt(), satiety: (json['satiety'] as num).toInt(), mood: (json['mood'] as num).toInt(), - portions: - (json['portions'] as List) - .map((e) => PortionModel.fromJson(e as Map)) - .toList(), - photos: - (json['photos'] as List) - .map((e) => DiaryPhotoModel.fromJson(e as Map)) - .toList(), + portions: (json['portions'] as List) + .map((e) => PortionModel.fromJson(e as Map)) + .toList(), + photos: (json['photos'] as List) + .map((e) => DiaryPhotoModel.fromJson(e as Map)) + .toList(), ); Map _$$MealModelImplToJson(_$MealModelImpl instance) => @@ -74,22 +72,22 @@ Map _$$MealModelImplToJson(_$MealModelImpl instance) => }; _$DiaryPhotoModelImpl _$$DiaryPhotoModelImplFromJson( - Map json, -) => _$DiaryPhotoModelImpl( - id: (json['id'] as num).toInt(), - originalName: json['original_name'] as String, - path: json['path'] as String, - size: (json['size'] as num).toInt(), -); + Map json) => + _$DiaryPhotoModelImpl( + id: (json['id'] as num).toInt(), + originalName: json['original_name'] as String, + path: json['path'] as String, + size: (json['size'] as num).toInt(), + ); Map _$$DiaryPhotoModelImplToJson( - _$DiaryPhotoModelImpl instance, -) => { - 'id': instance.id, - 'original_name': instance.originalName, - 'path': instance.path, - 'size': instance.size, -}; + _$DiaryPhotoModelImpl instance) => + { + 'id': instance.id, + 'original_name': instance.originalName, + 'path': instance.path, + 'size': instance.size, + }; _$PortionModelImpl _$$PortionModelImplFromJson(Map json) => _$PortionModelImpl( @@ -116,28 +114,28 @@ Map _$$PortionModelImplToJson(_$PortionModelImpl instance) => const _$PortionStateEnumMap = { PortionState.active: 'active', - PortionState.filled_diet: 'filled_diet', - PortionState.eaten_from_diet: 'eaten_from_diet', + PortionState.filledDiet: 'filledDiet', + PortionState.eatenFromDiet: 'eatenFromDiet', PortionState.eaten: 'eaten', - PortionState.eaten_deleted: 'eaten_deleted', - PortionState.eaten_edited: 'eaten_edited', + PortionState.eatenDeleted: 'eatenDeleted', + PortionState.eatenEdited: 'eatenEdited', PortionState.commented: 'commented', - PortionState.reviewed_by_user: 'reviewed_by_user', + PortionState.revieweByUser: 'revieweByUser', }; _$TypeOfDiaryModelImpl _$$TypeOfDiaryModelImplFromJson( - Map json, -) => _$TypeOfDiaryModelImpl( - hasChosenDiet: json['has_chosen_diet'] as bool, - hasChosenPlan: json['has_chosen_plan'] as bool, -); + Map json) => + _$TypeOfDiaryModelImpl( + hasChosenDiet: json['has_chosen_diet'] as bool, + hasChosenPlan: json['has_chosen_plan'] as bool, + ); Map _$$TypeOfDiaryModelImplToJson( - _$TypeOfDiaryModelImpl instance, -) => { - 'has_chosen_diet': instance.hasChosenDiet, - 'has_chosen_plan': instance.hasChosenPlan, -}; + _$TypeOfDiaryModelImpl instance) => + { + 'has_chosen_diet': instance.hasChosenDiet, + 'has_chosen_plan': instance.hasChosenPlan, + }; _$ProductInMealImpl _$$ProductInMealImplFromJson(Map json) => _$ProductInMealImpl( diff --git a/lib/features/diary/models/diary_index_model.freezed.dart b/lib/features/diary/models/diary_index_model.freezed.dart index 206c1069..9b78696c 100644 --- a/lib/features/diary/models/diary_index_model.freezed.dart +++ b/lib/features/diary/models/diary_index_model.freezed.dart @@ -12,8 +12,7 @@ part of 'diary_index_model.dart'; 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', -); + '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'); DiaryIndexModel _$DiaryIndexModelFromJson(Map json) { return _DiaryIndexModel.fromJson(json); @@ -36,9 +35,8 @@ mixin _$DiaryIndexModel { /// @nodoc abstract class $DiaryIndexModelCopyWith<$Res> { factory $DiaryIndexModelCopyWith( - DiaryIndexModel value, - $Res Function(DiaryIndexModel) then, - ) = _$DiaryIndexModelCopyWithImpl<$Res, DiaryIndexModel>; + DiaryIndexModel value, $Res Function(DiaryIndexModel) then) = + _$DiaryIndexModelCopyWithImpl<$Res, DiaryIndexModel>; @useResult $Res call({int id}); } @@ -57,27 +55,24 @@ class _$DiaryIndexModelCopyWithImpl<$Res, $Val extends DiaryIndexModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? id = null}) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + $Res call({ + Object? id = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } /// @nodoc abstract class _$$DiaryIndexModelImplCopyWith<$Res> implements $DiaryIndexModelCopyWith<$Res> { - factory _$$DiaryIndexModelImplCopyWith( - _$DiaryIndexModelImpl value, - $Res Function(_$DiaryIndexModelImpl) then, - ) = __$$DiaryIndexModelImplCopyWithImpl<$Res>; + factory _$$DiaryIndexModelImplCopyWith(_$DiaryIndexModelImpl value, + $Res Function(_$DiaryIndexModelImpl) then) = + __$$DiaryIndexModelImplCopyWithImpl<$Res>; @override @useResult $Res call({int id}); @@ -88,24 +83,22 @@ class __$$DiaryIndexModelImplCopyWithImpl<$Res> extends _$DiaryIndexModelCopyWithImpl<$Res, _$DiaryIndexModelImpl> implements _$$DiaryIndexModelImplCopyWith<$Res> { __$$DiaryIndexModelImplCopyWithImpl( - _$DiaryIndexModelImpl _value, - $Res Function(_$DiaryIndexModelImpl) _then, - ) : super(_value, _then); + _$DiaryIndexModelImpl _value, $Res Function(_$DiaryIndexModelImpl) _then) + : super(_value, _then); /// Create a copy of DiaryIndexModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? id = null}) { - return _then( - _$DiaryIndexModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + $Res call({ + Object? id = null, + }) { + return _then(_$DiaryIndexModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + )); } } @@ -144,13 +137,13 @@ class _$DiaryIndexModelImpl implements _DiaryIndexModel { @pragma('vm:prefer-inline') _$$DiaryIndexModelImplCopyWith<_$DiaryIndexModelImpl> get copyWith => __$$DiaryIndexModelImplCopyWithImpl<_$DiaryIndexModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$DiaryIndexModelImplToJson(this); + return _$$DiaryIndexModelImplToJson( + this, + ); } } diff --git a/lib/features/diary/models/diary_index_model.g.dart b/lib/features/diary/models/diary_index_model.g.dart index c59e6a83..268132fa 100644 --- a/lib/features/diary/models/diary_index_model.g.dart +++ b/lib/features/diary/models/diary_index_model.g.dart @@ -7,9 +7,13 @@ part of 'diary_index_model.dart'; // ************************************************************************** _$DiaryIndexModelImpl _$$DiaryIndexModelImplFromJson( - Map json, -) => _$DiaryIndexModelImpl(id: (json['id'] as num).toInt()); + Map json) => + _$DiaryIndexModelImpl( + id: (json['id'] as num).toInt(), + ); Map _$$DiaryIndexModelImplToJson( - _$DiaryIndexModelImpl instance, -) => {'id': instance.id}; + _$DiaryIndexModelImpl instance) => + { + 'id': instance.id, + }; diff --git a/lib/features/diary/models/finish_diary_day_model.freezed.dart b/lib/features/diary/models/finish_diary_day_model.freezed.dart index a6631f37..9c473c9c 100644 --- a/lib/features/diary/models/finish_diary_day_model.freezed.dart +++ b/lib/features/diary/models/finish_diary_day_model.freezed.dart @@ -12,8 +12,7 @@ part of 'finish_diary_day_model.dart'; 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', -); + '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'); FinishDiaryDayModel _$FinishDiaryDayModelFromJson(Map json) { return _FinishDiaryDayModel.fromJson(json); @@ -39,15 +38,13 @@ mixin _$FinishDiaryDayModel { /// @nodoc abstract class $FinishDiaryDayModelCopyWith<$Res> { factory $FinishDiaryDayModelCopyWith( - FinishDiaryDayModel value, - $Res Function(FinishDiaryDayModel) then, - ) = _$FinishDiaryDayModelCopyWithImpl<$Res, FinishDiaryDayModel>; + FinishDiaryDayModel value, $Res Function(FinishDiaryDayModel) then) = + _$FinishDiaryDayModelCopyWithImpl<$Res, FinishDiaryDayModel>; @useResult - $Res call({ - String wakeUp, - String retire, - @JsonKey(includeIfNull: false) String? comment, - }); + $Res call( + {String wakeUp, + String retire, + @JsonKey(includeIfNull: false) String? comment}); } /// @nodoc @@ -69,53 +66,44 @@ class _$FinishDiaryDayModelCopyWithImpl<$Res, $Val extends FinishDiaryDayModel> Object? retire = null, Object? comment = freezed, }) { - return _then( - _value.copyWith( - wakeUp: - null == wakeUp - ? _value.wakeUp - : wakeUp // ignore: cast_nullable_to_non_nullable - as String, - retire: - null == retire - ? _value.retire - : retire // ignore: cast_nullable_to_non_nullable - as String, - comment: - freezed == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + wakeUp: null == wakeUp + ? _value.wakeUp + : wakeUp // ignore: cast_nullable_to_non_nullable + as String, + retire: null == retire + ? _value.retire + : retire // ignore: cast_nullable_to_non_nullable + as String, + comment: freezed == comment + ? _value.comment + : comment // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } } /// @nodoc abstract class _$$FinishDiaryDayModelImplCopyWith<$Res> implements $FinishDiaryDayModelCopyWith<$Res> { - factory _$$FinishDiaryDayModelImplCopyWith( - _$FinishDiaryDayModelImpl value, - $Res Function(_$FinishDiaryDayModelImpl) then, - ) = __$$FinishDiaryDayModelImplCopyWithImpl<$Res>; + factory _$$FinishDiaryDayModelImplCopyWith(_$FinishDiaryDayModelImpl value, + $Res Function(_$FinishDiaryDayModelImpl) then) = + __$$FinishDiaryDayModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String wakeUp, - String retire, - @JsonKey(includeIfNull: false) String? comment, - }); + $Res call( + {String wakeUp, + String retire, + @JsonKey(includeIfNull: false) String? comment}); } /// @nodoc class __$$FinishDiaryDayModelImplCopyWithImpl<$Res> extends _$FinishDiaryDayModelCopyWithImpl<$Res, _$FinishDiaryDayModelImpl> implements _$$FinishDiaryDayModelImplCopyWith<$Res> { - __$$FinishDiaryDayModelImplCopyWithImpl( - _$FinishDiaryDayModelImpl _value, - $Res Function(_$FinishDiaryDayModelImpl) _then, - ) : super(_value, _then); + __$$FinishDiaryDayModelImplCopyWithImpl(_$FinishDiaryDayModelImpl _value, + $Res Function(_$FinishDiaryDayModelImpl) _then) + : super(_value, _then); /// Create a copy of FinishDiaryDayModel /// with the given fields replaced by the non-null parameter values. @@ -126,36 +114,30 @@ class __$$FinishDiaryDayModelImplCopyWithImpl<$Res> Object? retire = null, Object? comment = freezed, }) { - return _then( - _$FinishDiaryDayModelImpl( - wakeUp: - null == wakeUp - ? _value.wakeUp - : wakeUp // ignore: cast_nullable_to_non_nullable - as String, - retire: - null == retire - ? _value.retire - : retire // ignore: cast_nullable_to_non_nullable - as String, - comment: - freezed == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$FinishDiaryDayModelImpl( + wakeUp: null == wakeUp + ? _value.wakeUp + : wakeUp // ignore: cast_nullable_to_non_nullable + as String, + retire: null == retire + ? _value.retire + : retire // ignore: cast_nullable_to_non_nullable + as String, + comment: freezed == comment + ? _value.comment + : comment // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc @JsonSerializable() class _$FinishDiaryDayModelImpl implements _FinishDiaryDayModel { - const _$FinishDiaryDayModelImpl({ - required this.wakeUp, - required this.retire, - @JsonKey(includeIfNull: false) this.comment, - }); + const _$FinishDiaryDayModelImpl( + {required this.wakeUp, + required this.retire, + @JsonKey(includeIfNull: false) this.comment}); factory _$FinishDiaryDayModelImpl.fromJson(Map json) => _$$FinishDiaryDayModelImplFromJson(json); @@ -194,22 +176,22 @@ class _$FinishDiaryDayModelImpl implements _FinishDiaryDayModel { @pragma('vm:prefer-inline') _$$FinishDiaryDayModelImplCopyWith<_$FinishDiaryDayModelImpl> get copyWith => __$$FinishDiaryDayModelImplCopyWithImpl<_$FinishDiaryDayModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$FinishDiaryDayModelImplToJson(this); + return _$$FinishDiaryDayModelImplToJson( + this, + ); } } abstract class _FinishDiaryDayModel implements FinishDiaryDayModel { - const factory _FinishDiaryDayModel({ - required final String wakeUp, - required final String retire, - @JsonKey(includeIfNull: false) final String? comment, - }) = _$FinishDiaryDayModelImpl; + const factory _FinishDiaryDayModel( + {required final String wakeUp, + required final String retire, + @JsonKey(includeIfNull: false) final String? comment}) = + _$FinishDiaryDayModelImpl; factory _FinishDiaryDayModel.fromJson(Map json) = _$FinishDiaryDayModelImpl.fromJson; diff --git a/lib/features/diary/models/finish_diary_day_model.g.dart b/lib/features/diary/models/finish_diary_day_model.g.dart index 5721deda..d6dde88a 100644 --- a/lib/features/diary/models/finish_diary_day_model.g.dart +++ b/lib/features/diary/models/finish_diary_day_model.g.dart @@ -7,17 +7,17 @@ part of 'finish_diary_day_model.dart'; // ************************************************************************** _$FinishDiaryDayModelImpl _$$FinishDiaryDayModelImplFromJson( - Map json, -) => _$FinishDiaryDayModelImpl( - wakeUp: json['wakeUp'] as String, - retire: json['retire'] as String, - comment: json['comment'] as String?, -); + Map json) => + _$FinishDiaryDayModelImpl( + wakeUp: json['wakeUp'] as String, + retire: json['retire'] as String, + comment: json['comment'] as String?, + ); Map _$$FinishDiaryDayModelImplToJson( - _$FinishDiaryDayModelImpl instance, -) => { - 'wakeUp': instance.wakeUp, - 'retire': instance.retire, - if (instance.comment case final value?) 'comment': value, -}; + _$FinishDiaryDayModelImpl instance) => + { + 'wakeUp': instance.wakeUp, + 'retire': instance.retire, + if (instance.comment case final value?) 'comment': value, + }; diff --git a/lib/features/diary/models/nutrition_model.freezed.dart b/lib/features/diary/models/nutrition_model.freezed.dart index 827c3519..46da50b5 100644 --- a/lib/features/diary/models/nutrition_model.freezed.dart +++ b/lib/features/diary/models/nutrition_model.freezed.dart @@ -12,8 +12,7 @@ part of 'nutrition_model.dart'; 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', -); + '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'); NutritionDataModel _$NutritionDataModelFromJson(Map json) { return _NutritionDataModel.fromJson(json); @@ -38,14 +37,12 @@ mixin _$NutritionDataModel { /// @nodoc abstract class $NutritionDataModelCopyWith<$Res> { factory $NutritionDataModelCopyWith( - NutritionDataModel value, - $Res Function(NutritionDataModel) then, - ) = _$NutritionDataModelCopyWithImpl<$Res, NutritionDataModel>; + NutritionDataModel value, $Res Function(NutritionDataModel) then) = + _$NutritionDataModelCopyWithImpl<$Res, NutritionDataModel>; @useResult - $Res call({ - NutritionModel dailyNutritionIntake, - NutritionModel dailyNutritionRecommendation, - }); + $Res call( + {NutritionModel dailyNutritionIntake, + NutritionModel dailyNutritionRecommendation}); $NutritionModelCopyWith<$Res> get dailyNutritionIntake; $NutritionModelCopyWith<$Res> get dailyNutritionRecommendation; @@ -69,21 +66,16 @@ class _$NutritionDataModelCopyWithImpl<$Res, $Val extends NutritionDataModel> Object? dailyNutritionIntake = null, Object? dailyNutritionRecommendation = null, }) { - return _then( - _value.copyWith( - dailyNutritionIntake: - null == dailyNutritionIntake - ? _value.dailyNutritionIntake - : dailyNutritionIntake // ignore: cast_nullable_to_non_nullable - as NutritionModel, - dailyNutritionRecommendation: - null == dailyNutritionRecommendation - ? _value.dailyNutritionRecommendation - : dailyNutritionRecommendation // ignore: cast_nullable_to_non_nullable - as NutritionModel, - ) - as $Val, - ); + return _then(_value.copyWith( + dailyNutritionIntake: null == dailyNutritionIntake + ? _value.dailyNutritionIntake + : dailyNutritionIntake // ignore: cast_nullable_to_non_nullable + as NutritionModel, + dailyNutritionRecommendation: null == dailyNutritionRecommendation + ? _value.dailyNutritionRecommendation + : dailyNutritionRecommendation // ignore: cast_nullable_to_non_nullable + as NutritionModel, + ) as $Val); } /// Create a copy of NutritionDataModel @@ -101,12 +93,10 @@ class _$NutritionDataModelCopyWithImpl<$Res, $Val extends NutritionDataModel> @override @pragma('vm:prefer-inline') $NutritionModelCopyWith<$Res> get dailyNutritionRecommendation { - return $NutritionModelCopyWith<$Res>(_value.dailyNutritionRecommendation, ( - value, - ) { + return $NutritionModelCopyWith<$Res>(_value.dailyNutritionRecommendation, + (value) { return _then( - _value.copyWith(dailyNutritionRecommendation: value) as $Val, - ); + _value.copyWith(dailyNutritionRecommendation: value) as $Val); }); } } @@ -114,16 +104,14 @@ class _$NutritionDataModelCopyWithImpl<$Res, $Val extends NutritionDataModel> /// @nodoc abstract class _$$NutritionDataModelImplCopyWith<$Res> implements $NutritionDataModelCopyWith<$Res> { - factory _$$NutritionDataModelImplCopyWith( - _$NutritionDataModelImpl value, - $Res Function(_$NutritionDataModelImpl) then, - ) = __$$NutritionDataModelImplCopyWithImpl<$Res>; + factory _$$NutritionDataModelImplCopyWith(_$NutritionDataModelImpl value, + $Res Function(_$NutritionDataModelImpl) then) = + __$$NutritionDataModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - NutritionModel dailyNutritionIntake, - NutritionModel dailyNutritionRecommendation, - }); + $Res call( + {NutritionModel dailyNutritionIntake, + NutritionModel dailyNutritionRecommendation}); @override $NutritionModelCopyWith<$Res> get dailyNutritionIntake; @@ -135,10 +123,9 @@ abstract class _$$NutritionDataModelImplCopyWith<$Res> class __$$NutritionDataModelImplCopyWithImpl<$Res> extends _$NutritionDataModelCopyWithImpl<$Res, _$NutritionDataModelImpl> implements _$$NutritionDataModelImplCopyWith<$Res> { - __$$NutritionDataModelImplCopyWithImpl( - _$NutritionDataModelImpl _value, - $Res Function(_$NutritionDataModelImpl) _then, - ) : super(_value, _then); + __$$NutritionDataModelImplCopyWithImpl(_$NutritionDataModelImpl _value, + $Res Function(_$NutritionDataModelImpl) _then) + : super(_value, _then); /// Create a copy of NutritionDataModel /// with the given fields replaced by the non-null parameter values. @@ -148,30 +135,25 @@ class __$$NutritionDataModelImplCopyWithImpl<$Res> Object? dailyNutritionIntake = null, Object? dailyNutritionRecommendation = null, }) { - return _then( - _$NutritionDataModelImpl( - dailyNutritionIntake: - null == dailyNutritionIntake - ? _value.dailyNutritionIntake - : dailyNutritionIntake // ignore: cast_nullable_to_non_nullable - as NutritionModel, - dailyNutritionRecommendation: - null == dailyNutritionRecommendation - ? _value.dailyNutritionRecommendation - : dailyNutritionRecommendation // ignore: cast_nullable_to_non_nullable - as NutritionModel, - ), - ); + return _then(_$NutritionDataModelImpl( + dailyNutritionIntake: null == dailyNutritionIntake + ? _value.dailyNutritionIntake + : dailyNutritionIntake // ignore: cast_nullable_to_non_nullable + as NutritionModel, + dailyNutritionRecommendation: null == dailyNutritionRecommendation + ? _value.dailyNutritionRecommendation + : dailyNutritionRecommendation // ignore: cast_nullable_to_non_nullable + as NutritionModel, + )); } } /// @nodoc @JsonSerializable() class _$NutritionDataModelImpl implements _NutritionDataModel { - const _$NutritionDataModelImpl({ - required this.dailyNutritionIntake, - required this.dailyNutritionRecommendation, - }); + const _$NutritionDataModelImpl( + {required this.dailyNutritionIntake, + required this.dailyNutritionRecommendation}); factory _$NutritionDataModelImpl.fromJson(Map json) => _$$NutritionDataModelImplFromJson(json); @@ -193,10 +175,8 @@ class _$NutritionDataModelImpl implements _NutritionDataModel { other is _$NutritionDataModelImpl && (identical(other.dailyNutritionIntake, dailyNutritionIntake) || other.dailyNutritionIntake == dailyNutritionIntake) && - (identical( - other.dailyNutritionRecommendation, - dailyNutritionRecommendation, - ) || + (identical(other.dailyNutritionRecommendation, + dailyNutritionRecommendation) || other.dailyNutritionRecommendation == dailyNutritionRecommendation)); } @@ -204,10 +184,7 @@ class _$NutritionDataModelImpl implements _NutritionDataModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - dailyNutritionIntake, - dailyNutritionRecommendation, - ); + runtimeType, dailyNutritionIntake, dailyNutritionRecommendation); /// Create a copy of NutritionDataModel /// with the given fields replaced by the non-null parameter values. @@ -216,21 +193,21 @@ class _$NutritionDataModelImpl implements _NutritionDataModel { @pragma('vm:prefer-inline') _$$NutritionDataModelImplCopyWith<_$NutritionDataModelImpl> get copyWith => __$$NutritionDataModelImplCopyWithImpl<_$NutritionDataModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$NutritionDataModelImplToJson(this); + return _$$NutritionDataModelImplToJson( + this, + ); } } abstract class _NutritionDataModel implements NutritionDataModel { - const factory _NutritionDataModel({ - required final NutritionModel dailyNutritionIntake, - required final NutritionModel dailyNutritionRecommendation, - }) = _$NutritionDataModelImpl; + const factory _NutritionDataModel( + {required final NutritionModel dailyNutritionIntake, + required final NutritionModel dailyNutritionRecommendation}) = + _$NutritionDataModelImpl; factory _NutritionDataModel.fromJson(Map json) = _$NutritionDataModelImpl.fromJson; @@ -272,16 +249,11 @@ mixin _$NutritionModel { /// @nodoc abstract class $NutritionModelCopyWith<$Res> { factory $NutritionModelCopyWith( - NutritionModel value, - $Res Function(NutritionModel) then, - ) = _$NutritionModelCopyWithImpl<$Res, NutritionModel>; + NutritionModel value, $Res Function(NutritionModel) then) = + _$NutritionModelCopyWithImpl<$Res, NutritionModel>; @useResult - $Res call({ - double energy, - double proteins, - double fats, - double carbohydrates, - }); + $Res call( + {double energy, double proteins, double fats, double carbohydrates}); } /// @nodoc @@ -304,49 +276,37 @@ class _$NutritionModelCopyWithImpl<$Res, $Val extends NutritionModel> Object? fats = null, Object? carbohydrates = null, }) { - return _then( - _value.copyWith( - energy: - null == energy - ? _value.energy - : energy // ignore: cast_nullable_to_non_nullable - as double, - proteins: - null == proteins - ? _value.proteins - : proteins // ignore: cast_nullable_to_non_nullable - as double, - fats: - null == fats - ? _value.fats - : fats // ignore: cast_nullable_to_non_nullable - as double, - carbohydrates: - null == carbohydrates - ? _value.carbohydrates - : carbohydrates // ignore: cast_nullable_to_non_nullable - as double, - ) - as $Val, - ); + return _then(_value.copyWith( + energy: null == energy + ? _value.energy + : energy // ignore: cast_nullable_to_non_nullable + as double, + proteins: null == proteins + ? _value.proteins + : proteins // ignore: cast_nullable_to_non_nullable + as double, + fats: null == fats + ? _value.fats + : fats // ignore: cast_nullable_to_non_nullable + as double, + carbohydrates: null == carbohydrates + ? _value.carbohydrates + : carbohydrates // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); } } /// @nodoc abstract class _$$NutritionModelImplCopyWith<$Res> implements $NutritionModelCopyWith<$Res> { - factory _$$NutritionModelImplCopyWith( - _$NutritionModelImpl value, - $Res Function(_$NutritionModelImpl) then, - ) = __$$NutritionModelImplCopyWithImpl<$Res>; + factory _$$NutritionModelImplCopyWith(_$NutritionModelImpl value, + $Res Function(_$NutritionModelImpl) then) = + __$$NutritionModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - double energy, - double proteins, - double fats, - double carbohydrates, - }); + $Res call( + {double energy, double proteins, double fats, double carbohydrates}); } /// @nodoc @@ -354,9 +314,8 @@ class __$$NutritionModelImplCopyWithImpl<$Res> extends _$NutritionModelCopyWithImpl<$Res, _$NutritionModelImpl> implements _$$NutritionModelImplCopyWith<$Res> { __$$NutritionModelImplCopyWithImpl( - _$NutritionModelImpl _value, - $Res Function(_$NutritionModelImpl) _then, - ) : super(_value, _then); + _$NutritionModelImpl _value, $Res Function(_$NutritionModelImpl) _then) + : super(_value, _then); /// Create a copy of NutritionModel /// with the given fields replaced by the non-null parameter values. @@ -368,42 +327,35 @@ class __$$NutritionModelImplCopyWithImpl<$Res> Object? fats = null, Object? carbohydrates = null, }) { - return _then( - _$NutritionModelImpl( - energy: - null == energy - ? _value.energy - : energy // ignore: cast_nullable_to_non_nullable - as double, - proteins: - null == proteins - ? _value.proteins - : proteins // ignore: cast_nullable_to_non_nullable - as double, - fats: - null == fats - ? _value.fats - : fats // ignore: cast_nullable_to_non_nullable - as double, - carbohydrates: - null == carbohydrates - ? _value.carbohydrates - : carbohydrates // ignore: cast_nullable_to_non_nullable - as double, - ), - ); + return _then(_$NutritionModelImpl( + energy: null == energy + ? _value.energy + : energy // ignore: cast_nullable_to_non_nullable + as double, + proteins: null == proteins + ? _value.proteins + : proteins // ignore: cast_nullable_to_non_nullable + as double, + fats: null == fats + ? _value.fats + : fats // ignore: cast_nullable_to_non_nullable + as double, + carbohydrates: null == carbohydrates + ? _value.carbohydrates + : carbohydrates // ignore: cast_nullable_to_non_nullable + as double, + )); } } /// @nodoc @JsonSerializable() class _$NutritionModelImpl implements _NutritionModel { - const _$NutritionModelImpl({ - required this.energy, - required this.proteins, - required this.fats, - required this.carbohydrates, - }); + const _$NutritionModelImpl( + {required this.energy, + required this.proteins, + required this.fats, + required this.carbohydrates}); factory _$NutritionModelImpl.fromJson(Map json) => _$$NutritionModelImplFromJson(json); @@ -447,23 +399,22 @@ class _$NutritionModelImpl implements _NutritionModel { @pragma('vm:prefer-inline') _$$NutritionModelImplCopyWith<_$NutritionModelImpl> get copyWith => __$$NutritionModelImplCopyWithImpl<_$NutritionModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$NutritionModelImplToJson(this); + return _$$NutritionModelImplToJson( + this, + ); } } abstract class _NutritionModel implements NutritionModel { - const factory _NutritionModel({ - required final double energy, - required final double proteins, - required final double fats, - required final double carbohydrates, - }) = _$NutritionModelImpl; + const factory _NutritionModel( + {required final double energy, + required final double proteins, + required final double fats, + required final double carbohydrates}) = _$NutritionModelImpl; factory _NutritionModel.fromJson(Map json) = _$NutritionModelImpl.fromJson; diff --git a/lib/features/diary/models/nutrition_model.g.dart b/lib/features/diary/models/nutrition_model.g.dart index 88c1d938..6ecd533c 100644 --- a/lib/features/diary/models/nutrition_model.g.dart +++ b/lib/features/diary/models/nutrition_model.g.dart @@ -7,22 +7,20 @@ part of 'nutrition_model.dart'; // ************************************************************************** _$NutritionDataModelImpl _$$NutritionDataModelImplFromJson( - Map json, -) => _$NutritionDataModelImpl( - dailyNutritionIntake: NutritionModel.fromJson( - json['dailyNutritionIntake'] as Map, - ), - dailyNutritionRecommendation: NutritionModel.fromJson( - json['dailyNutritionRecommendation'] as Map, - ), -); + Map json) => + _$NutritionDataModelImpl( + dailyNutritionIntake: NutritionModel.fromJson( + json['dailyNutritionIntake'] as Map), + dailyNutritionRecommendation: NutritionModel.fromJson( + json['dailyNutritionRecommendation'] as Map), + ); Map _$$NutritionDataModelImplToJson( - _$NutritionDataModelImpl instance, -) => { - 'dailyNutritionIntake': instance.dailyNutritionIntake, - 'dailyNutritionRecommendation': instance.dailyNutritionRecommendation, -}; + _$NutritionDataModelImpl instance) => + { + 'dailyNutritionIntake': instance.dailyNutritionIntake, + 'dailyNutritionRecommendation': instance.dailyNutritionRecommendation, + }; _$NutritionModelImpl _$$NutritionModelImplFromJson(Map json) => _$NutritionModelImpl( @@ -33,10 +31,10 @@ _$NutritionModelImpl _$$NutritionModelImplFromJson(Map json) => ); Map _$$NutritionModelImplToJson( - _$NutritionModelImpl instance, -) => { - 'energy': instance.energy, - 'proteins': instance.proteins, - 'fats': instance.fats, - 'carbohydrates': instance.carbohydrates, -}; + _$NutritionModelImpl instance) => + { + 'energy': instance.energy, + 'proteins': instance.proteins, + 'fats': instance.fats, + 'carbohydrates': instance.carbohydrates, + }; diff --git a/lib/features/diary/models/product_moderation_model.freezed.dart b/lib/features/diary/models/product_moderation_model.freezed.dart index 047b1311..ec1db929 100644 --- a/lib/features/diary/models/product_moderation_model.freezed.dart +++ b/lib/features/diary/models/product_moderation_model.freezed.dart @@ -12,12 +12,10 @@ part of 'product_moderation_model.dart'; 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', -); + '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'); ProductModerationModel _$ProductModerationModelFromJson( - Map json, -) { + Map json) { return _ProductModerationModel.fromJson(json); } @@ -45,25 +43,21 @@ mixin _$ProductModerationModel { /// @nodoc abstract class $ProductModerationModelCopyWith<$Res> { - factory $ProductModerationModelCopyWith( - ProductModerationModel value, - $Res Function(ProductModerationModel) then, - ) = _$ProductModerationModelCopyWithImpl<$Res, ProductModerationModel>; + factory $ProductModerationModelCopyWith(ProductModerationModel value, + $Res Function(ProductModerationModel) then) = + _$ProductModerationModelCopyWithImpl<$Res, ProductModerationModel>; @useResult - $Res call({ - String name, - @JsonKey(name: 'energy_on_100gr') double energy, - @JsonKey(name: 'proteins_on_100gr') double proteins, - @JsonKey(name: 'fats_on_100gr') double fats, - @JsonKey(name: 'carbohydrates_on_100gr') double carbohydrates, - }); + $Res call( + {String name, + @JsonKey(name: 'energy_on_100gr') double energy, + @JsonKey(name: 'proteins_on_100gr') double proteins, + @JsonKey(name: 'fats_on_100gr') double fats, + @JsonKey(name: 'carbohydrates_on_100gr') double carbohydrates}); } /// @nodoc -class _$ProductModerationModelCopyWithImpl< - $Res, - $Val extends ProductModerationModel -> +class _$ProductModerationModelCopyWithImpl<$Res, + $Val extends ProductModerationModel> implements $ProductModerationModelCopyWith<$Res> { _$ProductModerationModelCopyWithImpl(this._value, this._then); @@ -83,36 +77,28 @@ class _$ProductModerationModelCopyWithImpl< Object? fats = null, Object? carbohydrates = null, }) { - return _then( - _value.copyWith( - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - energy: - null == energy - ? _value.energy - : energy // ignore: cast_nullable_to_non_nullable - as double, - proteins: - null == proteins - ? _value.proteins - : proteins // ignore: cast_nullable_to_non_nullable - as double, - fats: - null == fats - ? _value.fats - : fats // ignore: cast_nullable_to_non_nullable - as double, - carbohydrates: - null == carbohydrates - ? _value.carbohydrates - : carbohydrates // ignore: cast_nullable_to_non_nullable - as double, - ) - as $Val, - ); + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + energy: null == energy + ? _value.energy + : energy // ignore: cast_nullable_to_non_nullable + as double, + proteins: null == proteins + ? _value.proteins + : proteins // ignore: cast_nullable_to_non_nullable + as double, + fats: null == fats + ? _value.fats + : fats // ignore: cast_nullable_to_non_nullable + as double, + carbohydrates: null == carbohydrates + ? _value.carbohydrates + : carbohydrates // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); } } @@ -120,29 +106,28 @@ class _$ProductModerationModelCopyWithImpl< abstract class _$$ProductModerationModelImplCopyWith<$Res> implements $ProductModerationModelCopyWith<$Res> { factory _$$ProductModerationModelImplCopyWith( - _$ProductModerationModelImpl value, - $Res Function(_$ProductModerationModelImpl) then, - ) = __$$ProductModerationModelImplCopyWithImpl<$Res>; + _$ProductModerationModelImpl value, + $Res Function(_$ProductModerationModelImpl) then) = + __$$ProductModerationModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String name, - @JsonKey(name: 'energy_on_100gr') double energy, - @JsonKey(name: 'proteins_on_100gr') double proteins, - @JsonKey(name: 'fats_on_100gr') double fats, - @JsonKey(name: 'carbohydrates_on_100gr') double carbohydrates, - }); + $Res call( + {String name, + @JsonKey(name: 'energy_on_100gr') double energy, + @JsonKey(name: 'proteins_on_100gr') double proteins, + @JsonKey(name: 'fats_on_100gr') double fats, + @JsonKey(name: 'carbohydrates_on_100gr') double carbohydrates}); } /// @nodoc class __$$ProductModerationModelImplCopyWithImpl<$Res> - extends - _$ProductModerationModelCopyWithImpl<$Res, _$ProductModerationModelImpl> + extends _$ProductModerationModelCopyWithImpl<$Res, + _$ProductModerationModelImpl> implements _$$ProductModerationModelImplCopyWith<$Res> { __$$ProductModerationModelImplCopyWithImpl( - _$ProductModerationModelImpl _value, - $Res Function(_$ProductModerationModelImpl) _then, - ) : super(_value, _then); + _$ProductModerationModelImpl _value, + $Res Function(_$ProductModerationModelImpl) _then) + : super(_value, _then); /// Create a copy of ProductModerationModel /// with the given fields replaced by the non-null parameter values. @@ -155,48 +140,40 @@ class __$$ProductModerationModelImplCopyWithImpl<$Res> Object? fats = null, Object? carbohydrates = null, }) { - return _then( - _$ProductModerationModelImpl( - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - energy: - null == energy - ? _value.energy - : energy // ignore: cast_nullable_to_non_nullable - as double, - proteins: - null == proteins - ? _value.proteins - : proteins // ignore: cast_nullable_to_non_nullable - as double, - fats: - null == fats - ? _value.fats - : fats // ignore: cast_nullable_to_non_nullable - as double, - carbohydrates: - null == carbohydrates - ? _value.carbohydrates - : carbohydrates // ignore: cast_nullable_to_non_nullable - as double, - ), - ); + return _then(_$ProductModerationModelImpl( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + energy: null == energy + ? _value.energy + : energy // ignore: cast_nullable_to_non_nullable + as double, + proteins: null == proteins + ? _value.proteins + : proteins // ignore: cast_nullable_to_non_nullable + as double, + fats: null == fats + ? _value.fats + : fats // ignore: cast_nullable_to_non_nullable + as double, + carbohydrates: null == carbohydrates + ? _value.carbohydrates + : carbohydrates // ignore: cast_nullable_to_non_nullable + as double, + )); } } /// @nodoc @JsonSerializable() class _$ProductModerationModelImpl implements _ProductModerationModel { - const _$ProductModerationModelImpl({ - required this.name, - @JsonKey(name: 'energy_on_100gr') required this.energy, - @JsonKey(name: 'proteins_on_100gr') required this.proteins, - @JsonKey(name: 'fats_on_100gr') required this.fats, - @JsonKey(name: 'carbohydrates_on_100gr') required this.carbohydrates, - }); + const _$ProductModerationModelImpl( + {required this.name, + @JsonKey(name: 'energy_on_100gr') required this.energy, + @JsonKey(name: 'proteins_on_100gr') required this.proteins, + @JsonKey(name: 'fats_on_100gr') required this.fats, + @JsonKey(name: 'carbohydrates_on_100gr') required this.carbohydrates}); factory _$ProductModerationModelImpl.fromJson(Map json) => _$$ProductModerationModelImplFromJson(json); @@ -246,27 +223,25 @@ class _$ProductModerationModelImpl implements _ProductModerationModel { @override @pragma('vm:prefer-inline') _$$ProductModerationModelImplCopyWith<_$ProductModerationModelImpl> - get copyWith => - __$$ProductModerationModelImplCopyWithImpl<_$ProductModerationModelImpl>( - this, - _$identity, - ); + get copyWith => __$$ProductModerationModelImplCopyWithImpl< + _$ProductModerationModelImpl>(this, _$identity); @override Map toJson() { - return _$$ProductModerationModelImplToJson(this); + return _$$ProductModerationModelImplToJson( + this, + ); } } abstract class _ProductModerationModel implements ProductModerationModel { - const factory _ProductModerationModel({ - required final String name, - @JsonKey(name: 'energy_on_100gr') required final double energy, - @JsonKey(name: 'proteins_on_100gr') required final double proteins, - @JsonKey(name: 'fats_on_100gr') required final double fats, - @JsonKey(name: 'carbohydrates_on_100gr') - required final double carbohydrates, - }) = _$ProductModerationModelImpl; + const factory _ProductModerationModel( + {required final String name, + @JsonKey(name: 'energy_on_100gr') required final double energy, + @JsonKey(name: 'proteins_on_100gr') required final double proteins, + @JsonKey(name: 'fats_on_100gr') required final double fats, + @JsonKey(name: 'carbohydrates_on_100gr') + required final double carbohydrates}) = _$ProductModerationModelImpl; factory _ProductModerationModel.fromJson(Map json) = _$ProductModerationModelImpl.fromJson; @@ -291,5 +266,5 @@ abstract class _ProductModerationModel implements ProductModerationModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$ProductModerationModelImplCopyWith<_$ProductModerationModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/diary/models/product_moderation_model.g.dart b/lib/features/diary/models/product_moderation_model.g.dart index ce1fe7d7..cb27b8a5 100644 --- a/lib/features/diary/models/product_moderation_model.g.dart +++ b/lib/features/diary/models/product_moderation_model.g.dart @@ -7,21 +7,21 @@ part of 'product_moderation_model.dart'; // ************************************************************************** _$ProductModerationModelImpl _$$ProductModerationModelImplFromJson( - Map json, -) => _$ProductModerationModelImpl( - name: json['name'] as String, - energy: (json['energy_on_100gr'] as num).toDouble(), - proteins: (json['proteins_on_100gr'] as num).toDouble(), - fats: (json['fats_on_100gr'] as num).toDouble(), - carbohydrates: (json['carbohydrates_on_100gr'] as num).toDouble(), -); + Map json) => + _$ProductModerationModelImpl( + name: json['name'] as String, + energy: (json['energy_on_100gr'] as num).toDouble(), + proteins: (json['proteins_on_100gr'] as num).toDouble(), + fats: (json['fats_on_100gr'] as num).toDouble(), + carbohydrates: (json['carbohydrates_on_100gr'] as num).toDouble(), + ); Map _$$ProductModerationModelImplToJson( - _$ProductModerationModelImpl instance, -) => { - 'name': instance.name, - 'energy_on_100gr': instance.energy, - 'proteins_on_100gr': instance.proteins, - 'fats_on_100gr': instance.fats, - 'carbohydrates_on_100gr': instance.carbohydrates, -}; + _$ProductModerationModelImpl instance) => + { + 'name': instance.name, + 'energy_on_100gr': instance.energy, + 'proteins_on_100gr': instance.proteins, + 'fats_on_100gr': instance.fats, + 'carbohydrates_on_100gr': instance.carbohydrates, + }; diff --git a/lib/features/diary/presentation/bloc/diary_cubit.dart b/lib/features/diary/presentation/bloc/diary_cubit.dart index 7d57a35d..ce54bc87 100644 --- a/lib/features/diary/presentation/bloc/diary_cubit.dart +++ b/lib/features/diary/presentation/bloc/diary_cubit.dart @@ -49,7 +49,7 @@ class DiaryCubit extends Cubit { ); } catch (e) { emit(DiaryState.error(errorMessage: e.toString())); - throw e; + rethrow; } } @@ -91,7 +91,7 @@ class DiaryCubit extends Cubit { int? productNutritionalValueId, required PortionState portionState, }) async { - if (portionState == PortionState.filled_diet || portionState == PortionState.eaten_from_diet) { + if (portionState == PortionState.filledDiet || portionState == PortionState.eatenFromDiet) { await diaryRepository.addPortionToMeal( diaryId: diaryId, mealId: mealId, diff --git a/lib/features/diary/presentation/bloc/diary_state.freezed.dart b/lib/features/diary/presentation/bloc/diary_state.freezed.dart index 47a89b60..176be0c9 100644 --- a/lib/features/diary/presentation/bloc/diary_state.freezed.dart +++ b/lib/features/diary/presentation/bloc/diary_state.freezed.dart @@ -12,8 +12,7 @@ part of 'diary_state.dart'; 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', -); + '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'); /// @nodoc mixin _$DiaryState { @@ -22,55 +21,48 @@ mixin _$DiaryState { TResult Function() $default, { required TResult Function() loading, required TResult Function(String errorMessage) error, - required TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - ) - loaded, - }) => throw _privateConstructorUsedError; + required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal) + loaded, + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(String errorMessage)? error, - TResult? Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, - }) => throw _privateConstructorUsedError; + TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, TResult Function(String errorMessage)? error, - TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, + TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_DiaryState value) $default, { required TResult Function(DiaryStateLoading value) loading, required TResult Function(DiaryStateError value) error, required TResult Function(DiaryStateLoaded value) loaded, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_DiaryState value)? $default, { TResult? Function(DiaryStateLoading value)? loading, TResult? Function(DiaryStateError value)? error, TResult? Function(DiaryStateLoaded value)? loaded, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_DiaryState value)? $default, { @@ -78,15 +70,15 @@ mixin _$DiaryState { TResult Function(DiaryStateError value)? error, TResult Function(DiaryStateLoaded value)? loaded, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $DiaryStateCopyWith<$Res> { factory $DiaryStateCopyWith( - DiaryState value, - $Res Function(DiaryState) then, - ) = _$DiaryStateCopyWithImpl<$Res, DiaryState>; + DiaryState value, $Res Function(DiaryState) then) = + _$DiaryStateCopyWithImpl<$Res, DiaryState>; } /// @nodoc @@ -106,9 +98,8 @@ class _$DiaryStateCopyWithImpl<$Res, $Val extends DiaryState> /// @nodoc abstract class _$$DiaryStateImplCopyWith<$Res> { factory _$$DiaryStateImplCopyWith( - _$DiaryStateImpl value, - $Res Function(_$DiaryStateImpl) then, - ) = __$$DiaryStateImplCopyWithImpl<$Res>; + _$DiaryStateImpl value, $Res Function(_$DiaryStateImpl) then) = + __$$DiaryStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -116,9 +107,8 @@ class __$$DiaryStateImplCopyWithImpl<$Res> extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateImpl> implements _$$DiaryStateImplCopyWith<$Res> { __$$DiaryStateImplCopyWithImpl( - _$DiaryStateImpl _value, - $Res Function(_$DiaryStateImpl) _then, - ) : super(_value, _then); + _$DiaryStateImpl _value, $Res Function(_$DiaryStateImpl) _then) + : super(_value, _then); /// Create a copy of DiaryState /// with the given fields replaced by the non-null parameter values. @@ -149,13 +139,9 @@ class _$DiaryStateImpl implements _DiaryState { TResult Function() $default, { required TResult Function() loading, required TResult Function(String errorMessage) error, - required TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - ) - loaded, + required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal) + loaded, }) { return $default(); } @@ -166,13 +152,9 @@ class _$DiaryStateImpl implements _DiaryState { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(String errorMessage)? error, - TResult? Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, + TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, }) { return $default?.call(); } @@ -183,13 +165,9 @@ class _$DiaryStateImpl implements _DiaryState { TResult Function()? $default, { TResult Function()? loading, TResult Function(String errorMessage)? error, - TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, + TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, required TResult orElse(), }) { if ($default != null) { @@ -242,20 +220,18 @@ abstract class _DiaryState implements DiaryState { /// @nodoc abstract class _$$DiaryStateLoadingImplCopyWith<$Res> { - factory _$$DiaryStateLoadingImplCopyWith( - _$DiaryStateLoadingImpl value, - $Res Function(_$DiaryStateLoadingImpl) then, - ) = __$$DiaryStateLoadingImplCopyWithImpl<$Res>; + factory _$$DiaryStateLoadingImplCopyWith(_$DiaryStateLoadingImpl value, + $Res Function(_$DiaryStateLoadingImpl) then) = + __$$DiaryStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$DiaryStateLoadingImplCopyWithImpl<$Res> extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateLoadingImpl> implements _$$DiaryStateLoadingImplCopyWith<$Res> { - __$$DiaryStateLoadingImplCopyWithImpl( - _$DiaryStateLoadingImpl _value, - $Res Function(_$DiaryStateLoadingImpl) _then, - ) : super(_value, _then); + __$$DiaryStateLoadingImplCopyWithImpl(_$DiaryStateLoadingImpl _value, + $Res Function(_$DiaryStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of DiaryState /// with the given fields replaced by the non-null parameter values. @@ -286,13 +262,9 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading { TResult Function() $default, { required TResult Function() loading, required TResult Function(String errorMessage) error, - required TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - ) - loaded, + required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal) + loaded, }) { return loading(); } @@ -303,13 +275,9 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(String errorMessage)? error, - TResult? Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, + TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, }) { return loading?.call(); } @@ -320,13 +288,9 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading { TResult Function()? $default, { TResult Function()? loading, TResult Function(String errorMessage)? error, - TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, + TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, required TResult orElse(), }) { if (loading != null) { @@ -379,10 +343,9 @@ abstract class DiaryStateLoading implements DiaryState { /// @nodoc abstract class _$$DiaryStateErrorImplCopyWith<$Res> { - factory _$$DiaryStateErrorImplCopyWith( - _$DiaryStateErrorImpl value, - $Res Function(_$DiaryStateErrorImpl) then, - ) = __$$DiaryStateErrorImplCopyWithImpl<$Res>; + factory _$$DiaryStateErrorImplCopyWith(_$DiaryStateErrorImpl value, + $Res Function(_$DiaryStateErrorImpl) then) = + __$$DiaryStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -392,24 +355,22 @@ class __$$DiaryStateErrorImplCopyWithImpl<$Res> extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateErrorImpl> implements _$$DiaryStateErrorImplCopyWith<$Res> { __$$DiaryStateErrorImplCopyWithImpl( - _$DiaryStateErrorImpl _value, - $Res Function(_$DiaryStateErrorImpl) _then, - ) : super(_value, _then); + _$DiaryStateErrorImpl _value, $Res Function(_$DiaryStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of DiaryState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$DiaryStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$DiaryStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -445,9 +406,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError { @pragma('vm:prefer-inline') _$$DiaryStateErrorImplCopyWith<_$DiaryStateErrorImpl> get copyWith => __$$DiaryStateErrorImplCopyWithImpl<_$DiaryStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -455,13 +414,9 @@ class _$DiaryStateErrorImpl implements DiaryStateError { TResult Function() $default, { required TResult Function() loading, required TResult Function(String errorMessage) error, - required TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - ) - loaded, + required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal) + loaded, }) { return error(errorMessage); } @@ -472,13 +427,9 @@ class _$DiaryStateErrorImpl implements DiaryStateError { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(String errorMessage)? error, - TResult? Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, + TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, }) { return error?.call(errorMessage); } @@ -489,13 +440,9 @@ class _$DiaryStateErrorImpl implements DiaryStateError { TResult Function()? $default, { TResult Function()? loading, TResult Function(String errorMessage)? error, - TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, + TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, required TResult orElse(), }) { if (error != null) { @@ -557,17 +504,15 @@ abstract class DiaryStateError implements DiaryState { /// @nodoc abstract class _$$DiaryStateLoadedImplCopyWith<$Res> { - factory _$$DiaryStateLoadedImplCopyWith( - _$DiaryStateLoadedImpl value, - $Res Function(_$DiaryStateLoadedImpl) then, - ) = __$$DiaryStateLoadedImplCopyWithImpl<$Res>; + factory _$$DiaryStateLoadedImplCopyWith(_$DiaryStateLoadedImpl value, + $Res Function(_$DiaryStateLoadedImpl) then) = + __$$DiaryStateLoadedImplCopyWithImpl<$Res>; @useResult - $Res call({ - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - }); + $Res call( + {DiaryDayModel diary, + NutritionDataModel nutrition, + DateTime selectedDay, + int selectedMeal}); $DiaryDayModelCopyWith<$Res> get diary; $NutritionDataModelCopyWith<$Res> get nutrition; @@ -577,10 +522,9 @@ abstract class _$$DiaryStateLoadedImplCopyWith<$Res> { class __$$DiaryStateLoadedImplCopyWithImpl<$Res> extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateLoadedImpl> implements _$$DiaryStateLoadedImplCopyWith<$Res> { - __$$DiaryStateLoadedImplCopyWithImpl( - _$DiaryStateLoadedImpl _value, - $Res Function(_$DiaryStateLoadedImpl) _then, - ) : super(_value, _then); + __$$DiaryStateLoadedImplCopyWithImpl(_$DiaryStateLoadedImpl _value, + $Res Function(_$DiaryStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of DiaryState /// with the given fields replaced by the non-null parameter values. @@ -592,30 +536,24 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res> Object? selectedDay = null, Object? selectedMeal = null, }) { - return _then( - _$DiaryStateLoadedImpl( - diary: - null == diary - ? _value.diary - : diary // ignore: cast_nullable_to_non_nullable - as DiaryDayModel, - nutrition: - null == nutrition - ? _value.nutrition - : nutrition // ignore: cast_nullable_to_non_nullable - as NutritionDataModel, - selectedDay: - null == selectedDay - ? _value.selectedDay - : selectedDay // ignore: cast_nullable_to_non_nullable - as DateTime, - selectedMeal: - null == selectedMeal - ? _value.selectedMeal - : selectedMeal // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$DiaryStateLoadedImpl( + diary: null == diary + ? _value.diary + : diary // ignore: cast_nullable_to_non_nullable + as DiaryDayModel, + nutrition: null == nutrition + ? _value.nutrition + : nutrition // ignore: cast_nullable_to_non_nullable + as NutritionDataModel, + selectedDay: null == selectedDay + ? _value.selectedDay + : selectedDay // ignore: cast_nullable_to_non_nullable + as DateTime, + selectedMeal: null == selectedMeal + ? _value.selectedMeal + : selectedMeal // ignore: cast_nullable_to_non_nullable + as int, + )); } /// Create a copy of DiaryState @@ -642,12 +580,11 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res> /// @nodoc class _$DiaryStateLoadedImpl implements DiaryStateLoaded { - const _$DiaryStateLoadedImpl({ - required this.diary, - required this.nutrition, - required this.selectedDay, - required this.selectedMeal, - }); + const _$DiaryStateLoadedImpl( + {required this.diary, + required this.nutrition, + required this.selectedDay, + required this.selectedMeal}); @override final DiaryDayModel diary; @@ -688,9 +625,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { @pragma('vm:prefer-inline') _$$DiaryStateLoadedImplCopyWith<_$DiaryStateLoadedImpl> get copyWith => __$$DiaryStateLoadedImplCopyWithImpl<_$DiaryStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -698,13 +633,9 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { TResult Function() $default, { required TResult Function() loading, required TResult Function(String errorMessage) error, - required TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - ) - loaded, + required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal) + loaded, }) { return loaded(diary, nutrition, selectedDay, selectedMeal); } @@ -715,13 +646,9 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(String errorMessage)? error, - TResult? Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, + TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, }) { return loaded?.call(diary, nutrition, selectedDay, selectedMeal); } @@ -732,13 +659,9 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { TResult Function()? $default, { TResult Function()? loading, TResult Function(String errorMessage)? error, - TResult Function( - DiaryDayModel diary, - NutritionDataModel nutrition, - DateTime selectedDay, - int selectedMeal, - )? - loaded, + TResult Function(DiaryDayModel diary, NutritionDataModel nutrition, + DateTime selectedDay, int selectedMeal)? + loaded, required TResult orElse(), }) { if (loaded != null) { @@ -786,12 +709,11 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { } abstract class DiaryStateLoaded implements DiaryState { - const factory DiaryStateLoaded({ - required final DiaryDayModel diary, - required final NutritionDataModel nutrition, - required final DateTime selectedDay, - required final int selectedMeal, - }) = _$DiaryStateLoadedImpl; + const factory DiaryStateLoaded( + {required final DiaryDayModel diary, + required final NutritionDataModel nutrition, + required final DateTime selectedDay, + required final int selectedMeal}) = _$DiaryStateLoadedImpl; DiaryDayModel get diary; NutritionDataModel get nutrition; diff --git a/lib/features/diary/presentation/pages/diary_screen.dart b/lib/features/diary/presentation/pages/diary_screen.dart index 7f230e2b..fe8298c6 100644 --- a/lib/features/diary/presentation/pages/diary_screen.dart +++ b/lib/features/diary/presentation/pages/diary_screen.dart @@ -46,14 +46,14 @@ class _DiaryScreenState extends State { physics: const BouncingScrollPhysics(), child: Column( children: [ - CalendarWidget(), + const CalendarWidget(), if (state is DiaryStateLoading) const Loader(), - if (state is DiaryStateLoaded) WakeupAndRetireWidget(), + if (state is DiaryStateLoaded) const WakeupAndRetireWidget(), const SizedBox(height: 12), - if (state is DiaryStateLoaded) MealWidget(), - if (state is DiaryStateLoaded) CaloriesChartWidget(), + if (state is DiaryStateLoaded) const MealWidget(), + if (state is DiaryStateLoaded) const CaloriesChartWidget(), const SizedBox(height: 12), - if (state is DiaryStateLoaded) CommentForConsultantWidget(), + if (state is DiaryStateLoaded) const CommentForConsultantWidget(), if (state is DiaryStateLoaded && state.diary.closed == 0) Padding( padding: const EdgeInsets.only(top: 12), diff --git a/lib/features/diary/presentation/widgets/add_product_button_widget.dart b/lib/features/diary/presentation/widgets/add_product_button_widget.dart index 2e01eeed..0c7534b1 100644 --- a/lib/features/diary/presentation/widgets/add_product_button_widget.dart +++ b/lib/features/diary/presentation/widgets/add_product_button_widget.dart @@ -25,7 +25,7 @@ class _AddProductButtonWidgetState extends State { return showModalBottomSheet( useRootNavigator: true, context: context, - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(top: Radius.circular(12)), ), isScrollControlled: true, @@ -45,16 +45,16 @@ class _AddProductButtonWidgetState extends State { onTap: () => addProductInMeal(state), borderRadius: BorderRadius.circular(20), child: Ink( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), width: MediaQuery.of(context).size.width - 32, decoration: BoxDecoration( color: appTheme.blueA400, borderRadius: BorderRadius.circular(20), ), child: Container( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), alignment: Alignment.center, - child: Text( + child: const Text( 'Добавить', style: TextStyle( color: Colors.white, diff --git a/lib/features/diary/presentation/widgets/add_product_modal.dart b/lib/features/diary/presentation/widgets/add_product_modal.dart index 88d30914..b55a979f 100644 --- a/lib/features/diary/presentation/widgets/add_product_modal.dart +++ b/lib/features/diary/presentation/widgets/add_product_modal.dart @@ -66,7 +66,7 @@ class _AddProductModalState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text( + const Text( 'Добавление блюда', style: TextStyle( fontSize: 20, @@ -87,7 +87,7 @@ class _AddProductModalState extends State { onChanged: (query) { EasyDebounce.debounce( 'glossary-search', - Duration(milliseconds: 250), + const Duration(milliseconds: 250), () async { selectedGlossary = null; if (query.isEmpty) { @@ -124,7 +124,7 @@ class _AddProductModalState extends State { ), glossariesList.isEmpty ? const SizedBox(height: 16) : const SizedBox.shrink(), Container( - constraints: BoxConstraints( + constraints: const BoxConstraints( maxHeight: 256, ), child: ListView.separated( @@ -146,7 +146,7 @@ class _AddProductModalState extends State { ), title: Text( glossariesList[i].name, - style: TextStyle( + style: const TextStyle( height: 1, ), ), @@ -163,12 +163,12 @@ class _AddProductModalState extends State { Icons.add_rounded, color: Colors.grey.shade400, ), - contentPadding: EdgeInsets.only(left: 12), + contentPadding: const EdgeInsets.only(left: 12), ); }, itemCount: glossariesList.length, separatorBuilder: (BuildContext context, int index) { - return CustomDivider(); + return const CustomDivider(); }, ), ), @@ -190,9 +190,9 @@ class _AddProductModalState extends State { height: 52, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), ), - child: Icon( + child: const Icon( Icons.delete_outline_rounded, color: Colors.red, ), @@ -259,7 +259,7 @@ class _AddProductModalState extends State { child: Center( child: Text( widget.portion == null ? 'Добавить' : 'Сохранить', - style: TextStyle( + style: const TextStyle( fontSize: 18, fontWeight: FontWeight.w600, color: Colors.white, diff --git a/lib/features/diary/presentation/widgets/calendar_widget.dart b/lib/features/diary/presentation/widgets/calendar_widget.dart index 7a224546..009d12ad 100644 --- a/lib/features/diary/presentation/widgets/calendar_widget.dart +++ b/lib/features/diary/presentation/widgets/calendar_widget.dart @@ -40,7 +40,7 @@ class _CalendarWidgetState extends State { locale: 'ru_RU', startingDayOfWeek: StartingDayOfWeek.monday, calendarFormat: _calendarFormat, - headerStyle: HeaderStyle( + headerStyle: const HeaderStyle( titleCentered: true, formatButtonVisible: false, leftChevronVisible: false, @@ -69,11 +69,11 @@ class _CalendarWidgetState extends State { } }, calendarStyle: CalendarStyle( - weekendDecoration: BoxDecoration( + weekendDecoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), - defaultDecoration: BoxDecoration( + defaultDecoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), @@ -81,7 +81,7 @@ class _CalendarWidgetState extends State { color: appTheme.blueA400, shape: BoxShape.circle, ), - todayTextStyle: TextStyle( + todayTextStyle: const TextStyle( color: Colors.black, ), todayDecoration: BoxDecoration( diff --git a/lib/features/diary/presentation/widgets/calories_chart_widget.dart b/lib/features/diary/presentation/widgets/calories_chart_widget.dart index ddb7cbb8..6cdc6e86 100644 --- a/lib/features/diary/presentation/widgets/calories_chart_widget.dart +++ b/lib/features/diary/presentation/widgets/calories_chart_widget.dart @@ -6,6 +6,8 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncfusion_flutter_gauges/gauges.dart'; class CaloriesChartWidget extends StatelessWidget { + const CaloriesChartWidget({super.key}); + @override Widget build(BuildContext context) { return BlocBuilder( @@ -26,7 +28,7 @@ class CaloriesChartWidget extends StatelessWidget { onTap: () { showDialog( context: context, - builder: (context) => AlertDialog( + builder: (context) => const AlertDialog( content: Text( 'График отображает сколько калорий вам нужно ежедневно для похуденияи поддержания веса, согласно формуле Харриса-Бенедикта.\nИзменить коэффициент физической нагрузки можно в настройках.', style: TextStyle( @@ -60,7 +62,7 @@ class CaloriesChartWidget extends StatelessWidget { radiusFactor: 0.7, showAxisLine: false, pointers: [ - RangePointer( + const RangePointer( value: 100, width: 0.16, animationDuration: 2000, @@ -79,7 +81,7 @@ class CaloriesChartWidget extends StatelessWidget { enableAnimation: true, cornerStyle: CornerStyle.bothCurve, ), - RangePointer( + const RangePointer( value: 100, width: 0.16, animationDuration: 2000, @@ -100,7 +102,7 @@ class CaloriesChartWidget extends StatelessWidget { cornerStyle: CornerStyle.bothCurve, pointerOffset: -0.18, ), - RangePointer( + const RangePointer( value: 100, width: 0.16, animationDuration: 2000, @@ -121,7 +123,7 @@ class CaloriesChartWidget extends StatelessWidget { cornerStyle: CornerStyle.bothCurve, pointerOffset: -0.36, ), - RangePointer( + const RangePointer( value: 100, width: 0.16, animationDuration: 2000, @@ -147,7 +149,7 @@ class CaloriesChartWidget extends StatelessWidget { GaugeAnnotation( widget: Transform.rotate( angle: 30.1, - child: Text( + child: const Text( 'Углеводы', style: TextStyle( color: Colors.white, @@ -161,7 +163,7 @@ class CaloriesChartWidget extends StatelessWidget { GaugeAnnotation( widget: Transform.rotate( angle: 30, - child: Text( + child: const Text( 'Жиры', style: TextStyle( color: Colors.white, @@ -175,7 +177,7 @@ class CaloriesChartWidget extends StatelessWidget { GaugeAnnotation( widget: Transform.rotate( angle: 30, - child: Text( + child: const Text( 'Белки', style: TextStyle( color: Colors.white, @@ -189,7 +191,7 @@ class CaloriesChartWidget extends StatelessWidget { GaugeAnnotation( widget: Transform.rotate( angle: 30, - child: Text( + child: const Text( 'Калории', style: TextStyle( color: Colors.white, @@ -246,7 +248,7 @@ class CaloriesChartWidget extends StatelessWidget { children: [ Text( title, - style: TextStyle( + style: const TextStyle( fontSize: 18, fontWeight: FontWeight.w500, color: Color(0xFF323F4B), @@ -254,7 +256,7 @@ class CaloriesChartWidget extends StatelessWidget { ), Text( value, - style: TextStyle( + style: const TextStyle( fontSize: 18, fontWeight: FontWeight.w500, color: Color(0xFF323F4B), diff --git a/lib/features/diary/presentation/widgets/comment_for_consultant_widget.dart b/lib/features/diary/presentation/widgets/comment_for_consultant_widget.dart index 0e276f72..5e05b859 100644 --- a/lib/features/diary/presentation/widgets/comment_for_consultant_widget.dart +++ b/lib/features/diary/presentation/widgets/comment_for_consultant_widget.dart @@ -22,7 +22,7 @@ class _CommentForConsultantWidgetState extends State child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Дополнительная информация для консультанта', textAlign: TextAlign.center, style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Color(0xFF323F4B), height: 1), @@ -30,7 +30,7 @@ class _CommentForConsultantWidgetState extends State const SizedBox(height: 12), CustomTextFormField( onChanged: (value) { - EasyDebounce.debounce('client-typing', Duration(seconds: 3), () => context.read().fillComment(value)); + EasyDebounce.debounce('client-typing', const Duration(seconds: 3), () => context.read().fillComment(value)); }, hintText: 'Укажите дополнительную информацию', minLines: 4, diff --git a/lib/features/diary/presentation/widgets/finish_day_button_widget.dart b/lib/features/diary/presentation/widgets/finish_day_button_widget.dart index 651f4a66..e5d4e30c 100644 --- a/lib/features/diary/presentation/widgets/finish_day_button_widget.dart +++ b/lib/features/diary/presentation/widgets/finish_day_button_widget.dart @@ -26,13 +26,13 @@ class _FinishDayButtonWidgetState extends State { ), borderRadius: BorderRadius.circular(20), child: Ink( - padding: EdgeInsets.symmetric(horizontal: 8), + padding: const EdgeInsets.symmetric(horizontal: 8), width: MediaQuery.of(context).size.width - 16, decoration: BoxDecoration(color: appTheme.blueA400, borderRadius: BorderRadius.circular(20)), child: Container( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), alignment: Alignment.center, - child: Text('Закончить день', style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600)), + child: const Text('Закончить день', style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600)), ), ), ); diff --git a/lib/features/diary/presentation/widgets/glossary_moderation_request_modal_widget.dart b/lib/features/diary/presentation/widgets/glossary_moderation_request_modal_widget.dart index 4f49747f..f4991494 100644 --- a/lib/features/diary/presentation/widgets/glossary_moderation_request_modal_widget.dart +++ b/lib/features/diary/presentation/widgets/glossary_moderation_request_modal_widget.dart @@ -52,7 +52,7 @@ class _GlossaryModerationRequestModalWidgetState extends State { height: 32, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), - color: state.selectedMeal == widget.mealNumber ? appTheme.blueA400 : Color(0xFFF1F2F6), + color: state.selectedMeal == widget.mealNumber ? appTheme.blueA400 : const Color(0xFFF1F2F6), ), child: Center( child: Text( '${widget.mealNumber}', style: TextStyle( - color: state.selectedMeal == widget.mealNumber ? Colors.white : Color(0xFF6D6F71), + color: state.selectedMeal == widget.mealNumber ? Colors.white : const Color(0xFF6D6F71), fontSize: 16, fontWeight: FontWeight.w600, ), diff --git a/lib/features/diary/presentation/widgets/meal_widget.dart b/lib/features/diary/presentation/widgets/meal_widget.dart index d1c1f59f..16d9cfac 100644 --- a/lib/features/diary/presentation/widgets/meal_widget.dart +++ b/lib/features/diary/presentation/widgets/meal_widget.dart @@ -20,8 +20,8 @@ class _MealWidgetState extends State { return Material( borderRadius: BorderRadius.circular(20), color: Colors.white, - child: Padding( - padding: const EdgeInsets.all(16), + child: const Padding( + padding: EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -33,7 +33,7 @@ class _MealWidgetState extends State { fontWeight: FontWeight.w500, ), ), - const SizedBox(height: 16), + SizedBox(height: 16), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -44,17 +44,17 @@ class _MealWidgetState extends State { MealButtonWidget(mealNumber: 5), ], ), - const SizedBox(height: 12), + SizedBox(height: 12), TimeOfMealPickerWidget(), - const SizedBox(height: 12), + SizedBox(height: 12), ProductsListWidget(), - const SizedBox(height: 12), + SizedBox(height: 12), AddProductButtonWidget(), - const SizedBox(height: 12), + SizedBox(height: 12), PhotoGalleryWidget(), - const SizedBox(height: 12), + SizedBox(height: 12), SatietyRatingWidget(), - const SizedBox(height: 12), + SizedBox(height: 12), MoodRatingWidget(), ], ), diff --git a/lib/features/diary/presentation/widgets/mood_rating_widget.dart b/lib/features/diary/presentation/widgets/mood_rating_widget.dart index 9d8c6dab..cb673098 100644 --- a/lib/features/diary/presentation/widgets/mood_rating_widget.dart +++ b/lib/features/diary/presentation/widgets/mood_rating_widget.dart @@ -7,6 +7,8 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:flutter_svg/flutter_svg.dart'; class MoodRatingWidget extends StatefulWidget { + const MoodRatingWidget({super.key}); + @override State createState() => _MoodRatingWidgetState(); } @@ -29,7 +31,7 @@ class _MoodRatingWidgetState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Text( + const Text( 'Ваше настроение после приёма пищи', style: TextStyle( fontSize: 16, @@ -54,22 +56,22 @@ class _MoodRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 1 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 1 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFFC82222), + color: const Color(0xFFC82222), border: currentSelectedRating == 1 ? Border.all( width: 2, - color: Color(0xFFAA3333), + color: const Color(0xFFAA3333), strokeAlign: BorderSide.strokeAlignOutside, ) : null, borderRadius: currentSelectedRating == 1 - ? BorderRadius.horizontal( + ? const BorderRadius.horizontal( left: Radius.circular(8), right: Radius.circular(2), ) - : BorderRadius.horizontal( + : const BorderRadius.horizontal( left: Radius.circular(8), ), ), @@ -78,13 +80,13 @@ class _MoodRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 2 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 2 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFFFF3E3E), + color: const Color(0xFFFF3E3E), border: currentSelectedRating == 2 ? Border.all( width: 2, - color: Color(0xFF550000), + color: const Color(0xFF550000), strokeAlign: BorderSide.strokeAlignOutside, ) : null, @@ -95,13 +97,13 @@ class _MoodRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 3 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 3 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFFF8C926), + color: const Color(0xFFF8C926), border: currentSelectedRating == 3 ? Border.all( width: 2, - color: Color(0xFF8C5D00), + color: const Color(0xFF8C5D00), strokeAlign: BorderSide.strokeAlignOutside, ) : null, @@ -112,13 +114,13 @@ class _MoodRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 4 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 4 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFFFFF3BF), + color: const Color(0xFFFFF3BF), border: currentSelectedRating == 4 ? Border.all( width: 2, - color: Color(0xFFB5911B), + color: const Color(0xFFB5911B), strokeAlign: BorderSide.strokeAlignOutside, ) : null, @@ -129,13 +131,13 @@ class _MoodRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 5 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 5 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFF62E833), + color: const Color(0xFF62E833), border: currentSelectedRating == 5 ? Border.all( width: 2, - color: Color(0xFF276918), + color: const Color(0xFF276918), strokeAlign: BorderSide.strokeAlignOutside, ) : null, @@ -146,22 +148,22 @@ class _MoodRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 6 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 6 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFF4DCE20), + color: const Color(0xFF4DCE20), border: currentSelectedRating == 6 ? Border.all( width: 2, - color: Color(0xFF184D12), + color: const Color(0xFF184D12), strokeAlign: BorderSide.strokeAlignOutside, ) : null, borderRadius: currentSelectedRating == 6 - ? BorderRadius.horizontal( + ? const BorderRadius.horizontal( left: Radius.circular(2), right: Radius.circular(8), ) - : BorderRadius.horizontal( + : const BorderRadius.horizontal( right: Radius.circular(8), ), ), @@ -174,7 +176,7 @@ class _MoodRatingWidgetState extends State { }); EasyDebounce.debounce( 'change-satiety', - Duration(milliseconds: 250), + const Duration(milliseconds: 250), () { context.read().fillMood(diaryId: state.diary.id, mood: currentSelectedRating.toInt() - 1); }, diff --git a/lib/features/diary/presentation/widgets/photo_gallery_widget.dart b/lib/features/diary/presentation/widgets/photo_gallery_widget.dart index 3c0521aa..320db629 100644 --- a/lib/features/diary/presentation/widgets/photo_gallery_widget.dart +++ b/lib/features/diary/presentation/widgets/photo_gallery_widget.dart @@ -39,14 +39,15 @@ class _PhotoGalleryWidgetState extends State { Navigator.of(context).pop(); final picker = ImagePicker(); XFile? image = await picker.pickImage(source: ImageSource.camera); - if (image != null) + if (image != null) { diaryCubit.uploadPhotos( files: [File(image.path)], diaryId: diaryDay.id, ); + } }, child: const Row( - children: const [ + children: [ Icon(Icons.photo_camera), SizedBox(width: 8), Text('Фото'), @@ -58,14 +59,15 @@ class _PhotoGalleryWidgetState extends State { Navigator.of(context).pop(); final picker = ImagePicker(); List? images = await picker.pickMultiImage(); - if (images.isNotEmpty) + if (images.isNotEmpty) { diaryCubit.uploadPhotos( files: images.map((f) => File(f.path)).toList(), diaryId: diaryDay.id, ); + } }, child: const Row( - children: const [ + children: [ Icon(Icons.photo), SizedBox(width: 8), Text('Галерея'), @@ -107,7 +109,7 @@ class _PhotoGalleryWidgetState extends State { ClipRRect( borderRadius: BorderRadius.circular(12), child: CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + state.diary.meals[mealIndex].photos[currentSelectedPhotoIndex].path, + imageUrl: '$baseUrl/storage/${state.diary.meals[mealIndex].photos[currentSelectedPhotoIndex].path}', ), ), Padding( @@ -128,7 +130,7 @@ class _PhotoGalleryWidgetState extends State { } }); }, - icon: Icon( + icon: const Icon( Icons.close_rounded, color: Colors.grey, ), @@ -156,7 +158,7 @@ class _PhotoGalleryWidgetState extends State { width: 52, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: Color(0xFFF1F2F6), + color: const Color(0xFFF1F2F6), ), child: Icon( Icons.add_rounded, @@ -178,7 +180,7 @@ class _PhotoGalleryWidgetState extends State { height: 52, width: 52, child: CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + state.diary.meals[mealIndex].photos[i].path, + imageUrl: '$baseUrl/storage/${state.diary.meals[mealIndex].photos[i].path}', fit: BoxFit.fitWidth, ), ), diff --git a/lib/features/diary/presentation/widgets/product_widget.dart b/lib/features/diary/presentation/widgets/product_widget.dart index 3c6e01df..71ac4c5a 100644 --- a/lib/features/diary/presentation/widgets/product_widget.dart +++ b/lib/features/diary/presentation/widgets/product_widget.dart @@ -29,15 +29,16 @@ class _ProductWidgetState extends State { void initState() { super.initState(); diaryCubit = context.read(); - portionName = widget.portion == 'gr' ? 'гр' : 'шт'; - isEaten = widget.portion.portionState == PortionState.eaten_from_diet ? true : false; + portionName = widget.portion.portion == 'gr' ? 'гр' : 'шт'; + + isEaten = widget.portion.portionState == PortionState.eatenFromDiet ? true : false; } updateProductInMeal(DiaryStateLoaded state, PortionModel portion) { return showModalBottomSheet( useRootNavigator: true, context: context, - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(top: Radius.circular(12)), ), isScrollControlled: true, @@ -54,14 +55,14 @@ class _ProductWidgetState extends State { return BlocBuilder( builder: (context, state) { if (state is DiaryStateLoaded) { - if (widget.portion.portionState == PortionState.eaten_deleted) { + if (widget.portion.portionState == PortionState.eatenDeleted) { return DottedBorder( - dashPattern: [6, 6], + dashPattern: const [6, 6], padding: EdgeInsets.zero, borderPadding: EdgeInsets.zero, borderType: BorderType.RRect, - radius: Radius.circular(20), - color: Color(0xFF6D6F71), + radius: const Radius.circular(20), + color: const Color(0xFF6D6F71), child: ListTile( onTap: () => diaryCubit.restore( diaryId: state.diary.id, @@ -72,19 +73,20 @@ class _ProductWidgetState extends State { 'assets/icons/revert_product.svg', ), horizontalTitleGap: 0, - contentPadding: widget.portion.fromDiet ? EdgeInsets.only(right: 24, left: 4) : null, + contentPadding: widget.portion.fromDiet ? const EdgeInsets.only(right: 24, left: 4) : null, title: Text(widget.portion.productName), subtitle: Text('${widget.portion.quantity} ${widget.portion.portion == 'gr' ? 'гр' : 'шт'}'), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), - tileColor: Color(0xFFF6FAFF03).withValues(alpha: 0.01), + // ignore: use_full_hex_values_for_flutter_colors + tileColor: const Color(0xfff6faff03).withValues(alpha: 0.01), ), ); } else { return ListTile( onTap: () => updateProductInMeal(state, widget.portion), - trailing: Icon(Icons.more_vert_rounded), + trailing: const Icon(Icons.more_vert_rounded), leading: widget.portion.fromDiet ? Transform.scale( scale: 1.2, @@ -112,20 +114,20 @@ class _ProductWidgetState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(4), ), - side: BorderSide( + side: const BorderSide( color: Color(0xFF809CB9), ), ), ) : null, horizontalTitleGap: 0, - contentPadding: widget.portion.fromDiet ? EdgeInsets.only(right: 24, left: 4) : null, + contentPadding: widget.portion.fromDiet ? const EdgeInsets.only(right: 24, left: 4) : null, title: Text(widget.portion.productName), subtitle: Text('${widget.portion.quantity} ${widget.portion.portion == 'gr' ? 'гр' : 'шт'}'), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), - tileColor: Color(0xFFF6FAFF), + tileColor: const Color(0xFFF6FAFF), ); } } diff --git a/lib/features/diary/presentation/widgets/satiety_rating_widget.dart b/lib/features/diary/presentation/widgets/satiety_rating_widget.dart index 28ab9996..04bf3e64 100644 --- a/lib/features/diary/presentation/widgets/satiety_rating_widget.dart +++ b/lib/features/diary/presentation/widgets/satiety_rating_widget.dart @@ -7,6 +7,8 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:flutter_svg/flutter_svg.dart'; class SatietyRatingWidget extends StatefulWidget { + const SatietyRatingWidget({super.key}); + @override State createState() => _SatietyRatingWidgetState(); } @@ -29,7 +31,7 @@ class _SatietyRatingWidgetState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Text( + const Text( 'Ваша сытость после приёма пищи', style: TextStyle( fontSize: 16, @@ -54,22 +56,22 @@ class _SatietyRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 1 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 1 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFFC82222), + color: const Color(0xFFC82222), border: currentSelectedRating == 1 ? Border.all( width: 2, - color: Color(0xFFAA3333), + color: const Color(0xFFAA3333), strokeAlign: BorderSide.strokeAlignOutside, ) : null, borderRadius: currentSelectedRating == 1 - ? BorderRadius.horizontal( + ? const BorderRadius.horizontal( left: Radius.circular(8), right: Radius.circular(2), ) - : BorderRadius.horizontal( + : const BorderRadius.horizontal( left: Radius.circular(8), ), ), @@ -78,13 +80,13 @@ class _SatietyRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 2 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 2 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFFFF3E3E), + color: const Color(0xFFFF3E3E), border: currentSelectedRating == 2 ? Border.all( width: 2, - color: Color(0xFF550000), + color: const Color(0xFF550000), strokeAlign: BorderSide.strokeAlignOutside, ) : null, @@ -95,13 +97,13 @@ class _SatietyRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 3 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 3 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFFF8C926), + color: const Color(0xFFF8C926), border: currentSelectedRating == 3 ? Border.all( width: 2, - color: Color(0xFF8C5D00), + color: const Color(0xFF8C5D00), strokeAlign: BorderSide.strokeAlignOutside, ) : null, @@ -112,13 +114,13 @@ class _SatietyRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 4 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 4 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFFFFF3BF), + color: const Color(0xFFFFF3BF), border: currentSelectedRating == 4 ? Border.all( width: 2, - color: Color(0xFFB5911B), + color: const Color(0xFFB5911B), strokeAlign: BorderSide.strokeAlignOutside, ) : null, @@ -129,13 +131,13 @@ class _SatietyRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 5 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 5 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFF62E833), + color: const Color(0xFF62E833), border: currentSelectedRating == 5 ? Border.all( width: 2, - color: Color(0xFF276918), + color: const Color(0xFF276918), strokeAlign: BorderSide.strokeAlignOutside, ) : null, @@ -146,22 +148,22 @@ class _SatietyRatingWidgetState extends State { return Container( width: MediaQuery.of(context).size.width / 6, height: 24, - margin: currentSelectedRating == 6 ? EdgeInsets.symmetric(horizontal: 2) : null, + margin: currentSelectedRating == 6 ? const EdgeInsets.symmetric(horizontal: 2) : null, decoration: BoxDecoration( - color: Color(0xFF4DCE20), + color: const Color(0xFF4DCE20), border: currentSelectedRating == 6 ? Border.all( width: 2, - color: Color(0xFF184D12), + color: const Color(0xFF184D12), strokeAlign: BorderSide.strokeAlignOutside, ) : null, borderRadius: currentSelectedRating == 6 - ? BorderRadius.horizontal( + ? const BorderRadius.horizontal( left: Radius.circular(2), right: Radius.circular(8), ) - : BorderRadius.horizontal( + : const BorderRadius.horizontal( right: Radius.circular(8), ), ), @@ -174,7 +176,7 @@ class _SatietyRatingWidgetState extends State { }); EasyDebounce.debounce( 'change-satiety', - Duration(milliseconds: 250), + const Duration(milliseconds: 250), () { context.read().fillSatiety(diaryId: state.diary.id, satiety: currentSelectedRating.toInt() - 1); }, diff --git a/lib/features/diary/presentation/widgets/time_of_meal_picker_widget.dart b/lib/features/diary/presentation/widgets/time_of_meal_picker_widget.dart index d099e936..6de52279 100644 --- a/lib/features/diary/presentation/widgets/time_of_meal_picker_widget.dart +++ b/lib/features/diary/presentation/widgets/time_of_meal_picker_widget.dart @@ -57,7 +57,7 @@ class _TimeOfMealPickerWidgetState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( @@ -82,13 +82,13 @@ class _TimeOfMealPickerWidgetState extends State { if (state is DiaryStateLoaded) { return Column( children: [ - CustomDivider(), + const CustomDivider(), Padding( padding: const EdgeInsets.symmetric(vertical: 12), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( + const Text( 'Время приема пищи', style: TextStyle( color: Color(0xFF323F4B), @@ -103,14 +103,14 @@ class _TimeOfMealPickerWidgetState extends State { height: 32, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), - color: Color(0xFFF1F2F6), + color: const Color(0xFFF1F2F6), ), child: Container( alignment: Alignment.center, - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( state.diary.meals[state.selectedMeal - 1].time.substring(0, state.diary.meals[state.selectedMeal - 1].time.length - 3), - style: TextStyle( + style: const TextStyle( color: Color(0xFF6D6F71), fontSize: 17, fontWeight: FontWeight.w500, @@ -122,7 +122,7 @@ class _TimeOfMealPickerWidgetState extends State { ], ), ), - CustomDivider(), + const CustomDivider(), ], ); } diff --git a/lib/features/diary/presentation/widgets/wakeup_and_retire_widget.dart b/lib/features/diary/presentation/widgets/wakeup_and_retire_widget.dart index 65c3cbe8..114489e6 100644 --- a/lib/features/diary/presentation/widgets/wakeup_and_retire_widget.dart +++ b/lib/features/diary/presentation/widgets/wakeup_and_retire_widget.dart @@ -73,7 +73,7 @@ class _WakeupAndRetireWidgetState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( @@ -116,7 +116,7 @@ class _WakeupAndRetireWidgetState extends State { children: [ SvgPicture.asset('assets/icons/wakeup.svg'), const SizedBox(width: 8), - Text( + const Text( 'Подъём', style: TextStyle( fontSize: 16, @@ -134,17 +134,17 @@ class _WakeupAndRetireWidgetState extends State { height: 32, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), - color: Color(0xFFF1F2F6), + color: const Color(0xFFF1F2F6), ), child: Container( alignment: Alignment.center, - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( state.diary.wakeup.toString().substring( 0, state.diary.wakeup.toString().length - 3, ), - style: TextStyle( + style: const TextStyle( color: Color(0xFF6D6F71), fontSize: 17, fontWeight: FontWeight.w500, @@ -175,7 +175,7 @@ class _WakeupAndRetireWidgetState extends State { children: [ SvgPicture.asset('assets/icons/retire.svg'), const SizedBox(width: 8), - Text( + const Text( 'Уход ко сну', style: TextStyle( fontSize: 16, @@ -193,17 +193,17 @@ class _WakeupAndRetireWidgetState extends State { height: 32, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), - color: Color(0xFFF1F2F6), + color: const Color(0xFFF1F2F6), ), child: Container( alignment: Alignment.center, - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( state.diary.retire.toString().substring( 0, state.diary.retire.toString().length - 3, ), - style: TextStyle( + style: const TextStyle( color: Color(0xFF6D6F71), fontSize: 17, fontWeight: FontWeight.w500, @@ -221,7 +221,7 @@ class _WakeupAndRetireWidgetState extends State { ), ); } else { - return SizedBox.shrink(); + return const SizedBox.shrink(); } }, ); diff --git a/lib/features/diary/services/diary_service.g.dart b/lib/features/diary/services/diary_service.g.dart index 16bd7dbe..1262bf09 100644 --- a/lib/features/diary/services/diary_service.g.dart +++ b/lib/features/diary/services/diary_service.g.dart @@ -38,13 +38,11 @@ class _DiaryService implements DiaryService { final _result = await _dio.fetch>(_options); late List _value; try { - _value = - _result.data! - .map( - (dynamic i) => - DiaryDayModel.fromJson(i as Map), - ) - .toList(); + _value = _result.data! + .map( + (dynamic i) => DiaryDayModel.fromJson(i as Map), + ) + .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; @@ -127,11 +125,11 @@ class _DiaryService implements DiaryService { ); final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/diary/${diary}/meals/${typeNo}/photo/upload', diff --git a/lib/features/diets/models/diet_likes_model.freezed.dart b/lib/features/diets/models/diet_likes_model.freezed.dart index c851169c..7c1b630d 100644 --- a/lib/features/diets/models/diet_likes_model.freezed.dart +++ b/lib/features/diets/models/diet_likes_model.freezed.dart @@ -12,8 +12,7 @@ part of 'diet_likes_model.dart'; 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', -); + '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'); DietLikesModel _$DietLikesModelFromJson(Map json) { return _DietLikesModel.fromJson(json); @@ -39,14 +38,12 @@ mixin _$DietLikesModel { /// @nodoc abstract class $DietLikesModelCopyWith<$Res> { factory $DietLikesModelCopyWith( - DietLikesModel value, - $Res Function(DietLikesModel) then, - ) = _$DietLikesModelCopyWithImpl<$Res, DietLikesModel>; + DietLikesModel value, $Res Function(DietLikesModel) then) = + _$DietLikesModelCopyWithImpl<$Res, DietLikesModel>; @useResult - $Res call({ - @JsonKey(name: 'total_likers') int totalLikes, - @JsonKey(name: 'is_liked') bool isLiked, - }); + $Res call( + {@JsonKey(name: 'total_likers') int totalLikes, + @JsonKey(name: 'is_liked') bool isLiked}); } /// @nodoc @@ -63,38 +60,34 @@ class _$DietLikesModelCopyWithImpl<$Res, $Val extends DietLikesModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? totalLikes = null, Object? isLiked = null}) { - return _then( - _value.copyWith( - totalLikes: - null == totalLikes - ? _value.totalLikes - : totalLikes // ignore: cast_nullable_to_non_nullable - as int, - isLiked: - null == isLiked - ? _value.isLiked - : isLiked // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + $Res call({ + Object? totalLikes = null, + Object? isLiked = null, + }) { + return _then(_value.copyWith( + totalLikes: null == totalLikes + ? _value.totalLikes + : totalLikes // ignore: cast_nullable_to_non_nullable + as int, + isLiked: null == isLiked + ? _value.isLiked + : isLiked // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } } /// @nodoc abstract class _$$DietLikesModelImplCopyWith<$Res> implements $DietLikesModelCopyWith<$Res> { - factory _$$DietLikesModelImplCopyWith( - _$DietLikesModelImpl value, - $Res Function(_$DietLikesModelImpl) then, - ) = __$$DietLikesModelImplCopyWithImpl<$Res>; + factory _$$DietLikesModelImplCopyWith(_$DietLikesModelImpl value, + $Res Function(_$DietLikesModelImpl) then) = + __$$DietLikesModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'total_likers') int totalLikes, - @JsonKey(name: 'is_liked') bool isLiked, - }); + $Res call( + {@JsonKey(name: 'total_likers') int totalLikes, + @JsonKey(name: 'is_liked') bool isLiked}); } /// @nodoc @@ -102,39 +95,36 @@ class __$$DietLikesModelImplCopyWithImpl<$Res> extends _$DietLikesModelCopyWithImpl<$Res, _$DietLikesModelImpl> implements _$$DietLikesModelImplCopyWith<$Res> { __$$DietLikesModelImplCopyWithImpl( - _$DietLikesModelImpl _value, - $Res Function(_$DietLikesModelImpl) _then, - ) : super(_value, _then); + _$DietLikesModelImpl _value, $Res Function(_$DietLikesModelImpl) _then) + : super(_value, _then); /// Create a copy of DietLikesModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? totalLikes = null, Object? isLiked = null}) { - return _then( - _$DietLikesModelImpl( - totalLikes: - null == totalLikes - ? _value.totalLikes - : totalLikes // ignore: cast_nullable_to_non_nullable - as int, - isLiked: - null == isLiked - ? _value.isLiked - : isLiked // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + $Res call({ + Object? totalLikes = null, + Object? isLiked = null, + }) { + return _then(_$DietLikesModelImpl( + totalLikes: null == totalLikes + ? _value.totalLikes + : totalLikes // ignore: cast_nullable_to_non_nullable + as int, + isLiked: null == isLiked + ? _value.isLiked + : isLiked // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc @JsonSerializable() class _$DietLikesModelImpl implements _DietLikesModel { - const _$DietLikesModelImpl({ - @JsonKey(name: 'total_likers') required this.totalLikes, - @JsonKey(name: 'is_liked') required this.isLiked, - }); + const _$DietLikesModelImpl( + {@JsonKey(name: 'total_likers') required this.totalLikes, + @JsonKey(name: 'is_liked') required this.isLiked}); factory _$DietLikesModelImpl.fromJson(Map json) => _$$DietLikesModelImplFromJson(json); @@ -172,21 +162,21 @@ class _$DietLikesModelImpl implements _DietLikesModel { @pragma('vm:prefer-inline') _$$DietLikesModelImplCopyWith<_$DietLikesModelImpl> get copyWith => __$$DietLikesModelImplCopyWithImpl<_$DietLikesModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$DietLikesModelImplToJson(this); + return _$$DietLikesModelImplToJson( + this, + ); } } abstract class _DietLikesModel implements DietLikesModel { - const factory _DietLikesModel({ - @JsonKey(name: 'total_likers') required final int totalLikes, - @JsonKey(name: 'is_liked') required final bool isLiked, - }) = _$DietLikesModelImpl; + const factory _DietLikesModel( + {@JsonKey(name: 'total_likers') required final int totalLikes, + @JsonKey(name: 'is_liked') required final bool isLiked}) = + _$DietLikesModelImpl; factory _DietLikesModel.fromJson(Map json) = _$DietLikesModelImpl.fromJson; diff --git a/lib/features/diets/models/diet_likes_model.g.dart b/lib/features/diets/models/diet_likes_model.g.dart index 5b0ab3c5..36ddacba 100644 --- a/lib/features/diets/models/diet_likes_model.g.dart +++ b/lib/features/diets/models/diet_likes_model.g.dart @@ -13,8 +13,8 @@ _$DietLikesModelImpl _$$DietLikesModelImplFromJson(Map json) => ); Map _$$DietLikesModelImplToJson( - _$DietLikesModelImpl instance, -) => { - 'total_likers': instance.totalLikes, - 'is_liked': instance.isLiked, -}; + _$DietLikesModelImpl instance) => + { + 'total_likers': instance.totalLikes, + 'is_liked': instance.isLiked, + }; diff --git a/lib/features/diets/presentation/cubit/about_diet_cubit.dart b/lib/features/diets/presentation/cubit/about_diet_cubit.dart index 07532799..a257a0e9 100644 --- a/lib/features/diets/presentation/cubit/about_diet_cubit.dart +++ b/lib/features/diets/presentation/cubit/about_diet_cubit.dart @@ -10,7 +10,7 @@ import 'package:eatvio_app/features/profile/repositories/profile_repository.dart import 'package:flutter_bloc/flutter_bloc.dart'; class AboutDietCubit extends Cubit { - AboutDietCubit({required this.dietsRepository, required this.profileRepository}) : super(AboutDietState.initial()); + AboutDietCubit({required this.dietsRepository, required this.profileRepository}) : super(const AboutDietState.initial()); final DietRepository dietsRepository; final ProfileRepository profileRepository; bool isCurrentDietStarted = false; @@ -32,7 +32,7 @@ class AboutDietCubit extends Cubit { Future initDietPage(int id) async { try { - emit(AboutDietState.loading()); + emit(const AboutDietState.loading()); final diet = await dietsRepository.getDiet(id); final chosenDiets = await profileRepository.getChosenDiets(); final lastChosenDiet = chosenDiets.firstOrNull; @@ -81,7 +81,7 @@ class AboutDietCubit extends Cubit { EasyDebounce.debounce( 'like_diet', - Duration(seconds: 1), + const Duration(seconds: 1), () async { try { await dietsRepository.likeDiet(id); @@ -112,7 +112,7 @@ class AboutDietCubit extends Cubit { EasyDebounce.debounce( 'add_or_remove_diet_to_favorites', - Duration(seconds: 1), + const Duration(seconds: 1), () async { try { await dietsRepository.addToFavorite(id); @@ -143,7 +143,7 @@ class AboutDietCubit extends Cubit { EasyDebounce.debounce( 'add_or_remove_diet_to_favorites', - Duration(seconds: 1), + const Duration(seconds: 1), () async { try { await dietsRepository.removeFromFavorite(id); diff --git a/lib/features/diets/presentation/cubit/about_diet_state.freezed.dart b/lib/features/diets/presentation/cubit/about_diet_state.freezed.dart index 7cb9b86e..493edb32 100644 --- a/lib/features/diets/presentation/cubit/about_diet_state.freezed.dart +++ b/lib/features/diets/presentation/cubit/about_diet_state.freezed.dart @@ -12,8 +12,7 @@ part of 'about_diet_state.dart'; 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', -); + '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'); /// @nodoc mixin _$AboutDietState { @@ -23,9 +22,10 @@ mixin _$AboutDietState { required TResult Function() initial, required TResult Function() loading, required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet) - loaded, + loaded, required TResult Function(String message) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { @@ -33,7 +33,8 @@ mixin _$AboutDietState { TResult? Function()? loading, TResult? Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded, TResult? Function(String message)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -42,7 +43,8 @@ mixin _$AboutDietState { TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded, TResult Function(String message)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_AboutDietState value) $default, { @@ -50,7 +52,8 @@ mixin _$AboutDietState { required TResult Function(DietStateLoading value) loading, required TResult Function(DietStateLoaded value) loaded, required TResult Function(DietStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_AboutDietState value)? $default, { @@ -58,7 +61,8 @@ mixin _$AboutDietState { TResult? Function(DietStateLoading value)? loading, TResult? Function(DietStateLoaded value)? loaded, TResult? Function(DietStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_AboutDietState value)? $default, { @@ -67,15 +71,15 @@ mixin _$AboutDietState { TResult Function(DietStateLoaded value)? loaded, TResult Function(DietStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $AboutDietStateCopyWith<$Res> { factory $AboutDietStateCopyWith( - AboutDietState value, - $Res Function(AboutDietState) then, - ) = _$AboutDietStateCopyWithImpl<$Res, AboutDietState>; + AboutDietState value, $Res Function(AboutDietState) then) = + _$AboutDietStateCopyWithImpl<$Res, AboutDietState>; } /// @nodoc @@ -94,10 +98,9 @@ class _$AboutDietStateCopyWithImpl<$Res, $Val extends AboutDietState> /// @nodoc abstract class _$$AboutDietStateImplCopyWith<$Res> { - factory _$$AboutDietStateImplCopyWith( - _$AboutDietStateImpl value, - $Res Function(_$AboutDietStateImpl) then, - ) = __$$AboutDietStateImplCopyWithImpl<$Res>; + factory _$$AboutDietStateImplCopyWith(_$AboutDietStateImpl value, + $Res Function(_$AboutDietStateImpl) then) = + __$$AboutDietStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -105,9 +108,8 @@ class __$$AboutDietStateImplCopyWithImpl<$Res> extends _$AboutDietStateCopyWithImpl<$Res, _$AboutDietStateImpl> implements _$$AboutDietStateImplCopyWith<$Res> { __$$AboutDietStateImplCopyWithImpl( - _$AboutDietStateImpl _value, - $Res Function(_$AboutDietStateImpl) _then, - ) : super(_value, _then); + _$AboutDietStateImpl _value, $Res Function(_$AboutDietStateImpl) _then) + : super(_value, _then); /// Create a copy of AboutDietState /// with the given fields replaced by the non-null parameter values. @@ -139,7 +141,7 @@ class _$AboutDietStateImpl implements _AboutDietState { required TResult Function() initial, required TResult Function() loading, required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet) - loaded, + loaded, required TResult Function(String message) error, }) { return $default(); @@ -220,20 +222,18 @@ abstract class _AboutDietState implements AboutDietState { /// @nodoc abstract class _$$DietStateInitialImplCopyWith<$Res> { - factory _$$DietStateInitialImplCopyWith( - _$DietStateInitialImpl value, - $Res Function(_$DietStateInitialImpl) then, - ) = __$$DietStateInitialImplCopyWithImpl<$Res>; + factory _$$DietStateInitialImplCopyWith(_$DietStateInitialImpl value, + $Res Function(_$DietStateInitialImpl) then) = + __$$DietStateInitialImplCopyWithImpl<$Res>; } /// @nodoc class __$$DietStateInitialImplCopyWithImpl<$Res> extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateInitialImpl> implements _$$DietStateInitialImplCopyWith<$Res> { - __$$DietStateInitialImplCopyWithImpl( - _$DietStateInitialImpl _value, - $Res Function(_$DietStateInitialImpl) _then, - ) : super(_value, _then); + __$$DietStateInitialImplCopyWithImpl(_$DietStateInitialImpl _value, + $Res Function(_$DietStateInitialImpl) _then) + : super(_value, _then); /// Create a copy of AboutDietState /// with the given fields replaced by the non-null parameter values. @@ -265,7 +265,7 @@ class _$DietStateInitialImpl implements DietStateInitial { required TResult Function() initial, required TResult Function() loading, required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet) - loaded, + loaded, required TResult Function(String message) error, }) { return initial(); @@ -346,20 +346,18 @@ abstract class DietStateInitial implements AboutDietState { /// @nodoc abstract class _$$DietStateLoadingImplCopyWith<$Res> { - factory _$$DietStateLoadingImplCopyWith( - _$DietStateLoadingImpl value, - $Res Function(_$DietStateLoadingImpl) then, - ) = __$$DietStateLoadingImplCopyWithImpl<$Res>; + factory _$$DietStateLoadingImplCopyWith(_$DietStateLoadingImpl value, + $Res Function(_$DietStateLoadingImpl) then) = + __$$DietStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$DietStateLoadingImplCopyWithImpl<$Res> extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateLoadingImpl> implements _$$DietStateLoadingImplCopyWith<$Res> { - __$$DietStateLoadingImplCopyWithImpl( - _$DietStateLoadingImpl _value, - $Res Function(_$DietStateLoadingImpl) _then, - ) : super(_value, _then); + __$$DietStateLoadingImplCopyWithImpl(_$DietStateLoadingImpl _value, + $Res Function(_$DietStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of AboutDietState /// with the given fields replaced by the non-null parameter values. @@ -391,7 +389,7 @@ class _$DietStateLoadingImpl implements DietStateLoading { required TResult Function() initial, required TResult Function() loading, required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet) - loaded, + loaded, required TResult Function(String message) error, }) { return loading(); @@ -472,10 +470,9 @@ abstract class DietStateLoading implements AboutDietState { /// @nodoc abstract class _$$DietStateLoadedImplCopyWith<$Res> { - factory _$$DietStateLoadedImplCopyWith( - _$DietStateLoadedImpl value, - $Res Function(_$DietStateLoadedImpl) then, - ) = __$$DietStateLoadedImplCopyWithImpl<$Res>; + factory _$$DietStateLoadedImplCopyWith(_$DietStateLoadedImpl value, + $Res Function(_$DietStateLoadedImpl) then) = + __$$DietStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({Diet diet, bool isStarted, bool hasStartedDiet}); @@ -487,9 +484,8 @@ class __$$DietStateLoadedImplCopyWithImpl<$Res> extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateLoadedImpl> implements _$$DietStateLoadedImplCopyWith<$Res> { __$$DietStateLoadedImplCopyWithImpl( - _$DietStateLoadedImpl _value, - $Res Function(_$DietStateLoadedImpl) _then, - ) : super(_value, _then); + _$DietStateLoadedImpl _value, $Res Function(_$DietStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of AboutDietState /// with the given fields replaced by the non-null parameter values. @@ -500,25 +496,20 @@ class __$$DietStateLoadedImplCopyWithImpl<$Res> Object? isStarted = null, Object? hasStartedDiet = null, }) { - return _then( - _$DietStateLoadedImpl( - diet: - null == diet - ? _value.diet - : diet // ignore: cast_nullable_to_non_nullable - as Diet, - isStarted: - null == isStarted - ? _value.isStarted - : isStarted // ignore: cast_nullable_to_non_nullable - as bool, - hasStartedDiet: - null == hasStartedDiet - ? _value.hasStartedDiet - : hasStartedDiet // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + return _then(_$DietStateLoadedImpl( + diet: null == diet + ? _value.diet + : diet // ignore: cast_nullable_to_non_nullable + as Diet, + isStarted: null == isStarted + ? _value.isStarted + : isStarted // ignore: cast_nullable_to_non_nullable + as bool, + hasStartedDiet: null == hasStartedDiet + ? _value.hasStartedDiet + : hasStartedDiet // ignore: cast_nullable_to_non_nullable + as bool, + )); } /// Create a copy of AboutDietState @@ -535,11 +526,10 @@ class __$$DietStateLoadedImplCopyWithImpl<$Res> /// @nodoc class _$DietStateLoadedImpl implements DietStateLoaded { - const _$DietStateLoadedImpl({ - required this.diet, - this.isStarted = false, - this.hasStartedDiet = false, - }); + const _$DietStateLoadedImpl( + {required this.diet, + this.isStarted = false, + this.hasStartedDiet = false}); @override final Diet diet; @@ -577,9 +567,7 @@ class _$DietStateLoadedImpl implements DietStateLoaded { @pragma('vm:prefer-inline') _$$DietStateLoadedImplCopyWith<_$DietStateLoadedImpl> get copyWith => __$$DietStateLoadedImplCopyWithImpl<_$DietStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -588,7 +576,7 @@ class _$DietStateLoadedImpl implements DietStateLoaded { required TResult Function() initial, required TResult Function() loading, required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet) - loaded, + loaded, required TResult Function(String message) error, }) { return loaded(diet, isStarted, hasStartedDiet); @@ -664,11 +652,10 @@ class _$DietStateLoadedImpl implements DietStateLoaded { } abstract class DietStateLoaded implements AboutDietState { - const factory DietStateLoaded({ - required final Diet diet, - final bool isStarted, - final bool hasStartedDiet, - }) = _$DietStateLoadedImpl; + const factory DietStateLoaded( + {required final Diet diet, + final bool isStarted, + final bool hasStartedDiet}) = _$DietStateLoadedImpl; Diet get diet; bool get isStarted; @@ -683,10 +670,9 @@ abstract class DietStateLoaded implements AboutDietState { /// @nodoc abstract class _$$DietStateErrorImplCopyWith<$Res> { - factory _$$DietStateErrorImplCopyWith( - _$DietStateErrorImpl value, - $Res Function(_$DietStateErrorImpl) then, - ) = __$$DietStateErrorImplCopyWithImpl<$Res>; + factory _$$DietStateErrorImplCopyWith(_$DietStateErrorImpl value, + $Res Function(_$DietStateErrorImpl) then) = + __$$DietStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String message}); } @@ -696,24 +682,22 @@ class __$$DietStateErrorImplCopyWithImpl<$Res> extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateErrorImpl> implements _$$DietStateErrorImplCopyWith<$Res> { __$$DietStateErrorImplCopyWithImpl( - _$DietStateErrorImpl _value, - $Res Function(_$DietStateErrorImpl) _then, - ) : super(_value, _then); + _$DietStateErrorImpl _value, $Res Function(_$DietStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of AboutDietState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? message = null}) { - return _then( - _$DietStateErrorImpl( - message: - null == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? message = null, + }) { + return _then(_$DietStateErrorImpl( + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -748,9 +732,7 @@ class _$DietStateErrorImpl implements DietStateError { @pragma('vm:prefer-inline') _$$DietStateErrorImplCopyWith<_$DietStateErrorImpl> get copyWith => __$$DietStateErrorImplCopyWithImpl<_$DietStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -759,7 +741,7 @@ class _$DietStateErrorImpl implements DietStateError { required TResult Function() initial, required TResult Function() loading, required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet) - loaded, + loaded, required TResult Function(String message) error, }) { return error(message); diff --git a/lib/features/diets/presentation/pages/about_diet_screen.dart b/lib/features/diets/presentation/pages/about_diet_screen.dart index c5953c36..1d480f9c 100644 --- a/lib/features/diets/presentation/pages/about_diet_screen.dart +++ b/lib/features/diets/presentation/pages/about_diet_screen.dart @@ -98,7 +98,7 @@ class _AboutDietScreenState extends State { return BlocBuilder( builder: (context, dietState) { if (dietState is DietStateLoaded) { - Future.delayed(Duration(milliseconds: 500), () { + Future.delayed(const Duration(milliseconds: 500), () { if (widget.navigateToComments && !_jumped) { _scrollToBottom(); } @@ -107,7 +107,7 @@ class _AboutDietScreenState extends State { backgroundColor: appTheme.gray100, resizeToAvoidBottomInset: true, bottomSheet: Container( - padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), + padding: const EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), decoration: BoxDecoration( color: Colors.white, border: Border( @@ -169,7 +169,7 @@ class _AboutDietScreenState extends State { ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), BookmarkButton( isFavorite: dietState.diet.isFavorite, onTap: () { @@ -188,7 +188,7 @@ class _AboutDietScreenState extends State { ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -209,17 +209,17 @@ class _AboutDietScreenState extends State { ), height: 32, width: 32, - child: Icon( + child: const Icon( Icons.close_rounded, size: 18, color: Colors.white, ), ), ), - if (replyId != null) SizedBox(width: 8), + if (replyId != null) const SizedBox(width: 8), Expanded( child: ConstrainedBox( - constraints: BoxConstraints(minHeight: 52), + constraints: const BoxConstraints(minHeight: 52), child: TextFormField( textCapitalization: TextCapitalization.sentences, onChanged: (_) { @@ -229,7 +229,7 @@ class _AboutDietScreenState extends State { maxLines: 5, minLines: 1, keyboardType: TextInputType.multiline, - style: TextStyle( + style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, @@ -237,9 +237,9 @@ class _AboutDietScreenState extends State { ), decoration: InputDecoration( isDense: false, // убираем true, чтобы padding учитывался корректно - contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен hintText: 'Комментарий', - hintStyle: TextStyle( + hintStyle: const TextStyle( fontSize: 16, fontWeight: FontWeight.w400, height: 1.2, @@ -248,21 +248,21 @@ class _AboutDietScreenState extends State { filled: true, border: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), ), ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), GestureDetector( onTap: () { if (textEditingController.text.length > 2) { @@ -277,7 +277,7 @@ class _AboutDietScreenState extends State { textEditingController.clear(); replyId = null; }); - Future.delayed(Duration(milliseconds: 500), () { + Future.delayed(const Duration(milliseconds: 500), () { dietsCubit.getDiet(widget.diet.id, index: widget.index); }); FocusManager.instance.primaryFocus?.unfocus(); @@ -321,7 +321,7 @@ class _AboutDietScreenState extends State { complainedContentType: ComplainedContent.diet, id: widget.diet.id, ), - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight, @@ -343,11 +343,11 @@ class _AboutDietScreenState extends State { ), body: SingleChildScrollView( controller: scrollController, - padding: EdgeInsets.only(bottom: 160), + padding: const EdgeInsets.only(bottom: 160), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 8), + const SizedBox(height: 8), MainBackgroundBouble( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -355,7 +355,7 @@ class _AboutDietScreenState extends State { Stack( children: [ CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + widget.diet.image, + imageUrl: '$baseUrl/storage/${widget.diet.image}', height: 300, width: MediaQuery.sizeOf(context).width, fit: BoxFit.fill, @@ -368,22 +368,23 @@ class _AboutDietScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset('assets/icons/eye.svg', width: 18, height: 12), - SizedBox(width: 8), + const SizedBox(width: 8), Text( dietState.diet.totalViews.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), - SizedBox(width: 12), + const SizedBox(width: 12), GestureDetector( onTap: () { dietsCubit.likeDiet(widget.diet.id, widget.index); }, child: InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset( 'assets/icons/heart.svg', @@ -391,33 +392,32 @@ class _AboutDietScreenState extends State { height: 12, colorFilter: dietState.diet.wasLikedByMe ? ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn) : null, ), - SizedBox(width: 8), + const SizedBox(width: 8), Text( dietState.diet.totalLikes.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), ), - SizedBox(width: 12), + const SizedBox(width: 12), InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset('assets/icons/comment2.svg', width: 13, height: 12), - SizedBox(width: 8), + const SizedBox(width: 8), Text( dietState.diet.totalComments.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), ], ), ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( @@ -425,7 +425,7 @@ class _AboutDietScreenState extends State { style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), InfoRow( diet: widget.diet, type: ProductType.diet, @@ -433,7 +433,7 @@ class _AboutDietScreenState extends State { ExpandableText( text: widget.diet.details, ), - SizedBox(height: 20), + const SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: AuthorCard( @@ -441,17 +441,17 @@ class _AboutDietScreenState extends State { title: s.diet_author, ), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ), - SizedBox(height: 16), + const SizedBox(height: 16), MainBackgroundBouble( child: Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: Center( child: Text( - s.diet_plan + '(${widget.diet.duration.toString()} ' + getDayForm(widget.diet.duration, s) + ')', + '${s.diet_plan}(${widget.diet.duration.toString()} ${getDayForm(widget.diet.duration, s)})', style: TextStyles.headingXLSemibold.copyWith( color: appTheme.black, ), @@ -459,9 +459,9 @@ class _AboutDietScreenState extends State { ), ), ), - SizedBox(height: 8), + const SizedBox(height: 8), ListView.builder( - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { return _dayOfPlan(widget.diet.dailySchedule[index + 1] ?? {}, index, s); @@ -469,20 +469,20 @@ class _AboutDietScreenState extends State { itemCount: widget.diet.dailySchedule.length, ), MainBackgroundBouble( - padding: EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 16), child: Column( children: [ Container( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), alignment: Alignment.centerLeft, child: Text( - dietState.diet.totalComments.toString() + ' ' + getCommentForm(dietState.diet.totalComments, s), + '${dietState.diet.totalComments} ${getCommentForm(dietState.diet.totalComments, s)}', style: TextStyles.textMMedium.copyWith( color: appTheme.gray500, ), ), ), - SizedBox(height: 16), + const SizedBox(height: 16), if (state is CommentsStateLoading) const Loader(), if (state is CommentsStateLoaded) CommentsWidget( @@ -519,7 +519,7 @@ class _AboutDietScreenState extends State { complainedContentType: ComplainedContent.diet, id: widget.diet.id, ), - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight, @@ -563,7 +563,7 @@ class _AboutDietScreenState extends State { complainedContentType: ComplainedContent.diet, id: widget.diet.id, ), - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight, @@ -594,7 +594,7 @@ class _AboutDietScreenState extends State { } _dayOfPlan(Map> day, int dayNumber, S s) { - _choiceChipWidget(int index) { + choiceChipWidget(int index) { return ChoiceChip( selectedColor: appTheme.blueA400, pressElevation: 0, @@ -621,7 +621,7 @@ class _AboutDietScreenState extends State { return Padding( padding: const EdgeInsets.only(bottom: 8), child: MainBackgroundBouble( - padding: EdgeInsets.only( + padding: const EdgeInsets.only( top: 16, ), child: Column( @@ -632,13 +632,13 @@ class _AboutDietScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - s.day + ' ' + (dayNumber + 1).toString(), + '${s.day} ${dayNumber + 1}', style: TextStyles.headingXLSemibold.copyWith( color: appTheme.black, ), ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 12), + const Padding( + padding: EdgeInsets.symmetric(vertical: 12), child: CustomDivider(), ), Text( @@ -650,21 +650,21 @@ class _AboutDietScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - _choiceChipWidget(0), - _choiceChipWidget(1), - _choiceChipWidget(2), - _choiceChipWidget(3), - _choiceChipWidget(4), + choiceChipWidget(0), + choiceChipWidget(1), + choiceChipWidget(2), + choiceChipWidget(3), + choiceChipWidget(4), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), ListView.builder( shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) => _daily(day[widget.selectedIndexes[dayNumber] + 1]?[index + 1], s), itemCount: day[widget.selectedIndexes[dayNumber] + 1]?.length ?? 0, ), - SizedBox(height: 8), + const SizedBox(height: 8), ], ), ), @@ -695,9 +695,9 @@ class _AboutDietScreenState extends State { ), ), ), - Spacer(), + const Spacer(), Text( - daily.quantity.toString() + ' ' + getLocalizedMeasurementUnits(s, daily.portion), + '${daily.quantity} ${getLocalizedMeasurementUnits(s, daily.portion)}', style: TextStyles.textMSemibold.copyWith( color: appTheme.black, ), diff --git a/lib/features/diets/presentation/widgets/author_card.dart b/lib/features/diets/presentation/widgets/author_card.dart index 1a8cfcbe..c65ea4cb 100644 --- a/lib/features/diets/presentation/widgets/author_card.dart +++ b/lib/features/diets/presentation/widgets/author_card.dart @@ -7,14 +7,16 @@ import 'package:flutter_svg/svg.dart'; import 'package:go_router/go_router.dart'; class AuthorCard extends StatelessWidget { - const AuthorCard({super.key, required this.author, required this.title}); + const AuthorCard({super.key, required this.author, required this.title, this.backgroundColor, this.titleStyle}); final Author author; final String title; + final Color? backgroundColor; + final TextStyle? titleStyle; @override - Widget build(BuildContext context) { + Widget build(BuildContext context) { return Container( width: MediaQuery.sizeOf(context).width, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: appTheme.cardBackground), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: backgroundColor ?? appTheme.cardBackground), child: Stack( children: [ Padding( @@ -42,7 +44,7 @@ class AuthorCard extends StatelessWidget { ), title: Text( title, - style: TextStyles.textSSemibold.copyWith( + style: titleStyle ?? TextStyles.textSSemibold.copyWith( color: appTheme.gray, ), ), @@ -55,7 +57,7 @@ class AuthorCard extends StatelessWidget { color: appTheme.black, ), ), - SizedBox(width: 10), + const SizedBox(width: 10), if (author.authorPlaceInRating != null) InfoBouble( radius: 12, diff --git a/lib/features/diets/presentation/widgets/calendar_widget.dart b/lib/features/diets/presentation/widgets/calendar_widget.dart index 3ca86847..316913b3 100644 --- a/lib/features/diets/presentation/widgets/calendar_widget.dart +++ b/lib/features/diets/presentation/widgets/calendar_widget.dart @@ -34,13 +34,13 @@ class _CalendarWidgetState extends State { final dateFormatter = DateFormat('MMMM', 'ru_RU'); return Center( child: Text( - '${dateFormatter.format(day).capitalize()}', + dateFormatter.format(day).capitalize(), style: TextStyle(color: appTheme.black, fontSize: 16, fontWeight: FontWeight.w400), ), ); }, ), - headerStyle: HeaderStyle( + headerStyle: const HeaderStyle( titleCentered: true, formatButtonVisible: false, leftChevronVisible: false, diff --git a/lib/features/diets/presentation/widgets/cancel_diet_bottom_sheet.dart b/lib/features/diets/presentation/widgets/cancel_diet_bottom_sheet.dart index 08a2dbf2..3a324c19 100644 --- a/lib/features/diets/presentation/widgets/cancel_diet_bottom_sheet.dart +++ b/lib/features/diets/presentation/widgets/cancel_diet_bottom_sheet.dart @@ -18,9 +18,9 @@ class CancelDietBottomSheet extends StatelessWidget { return Column( mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 4), - BottomSheetHandlerBar(), - SizedBox(height: 12), + const SizedBox(height: 4), + const BottomSheetHandlerBar(), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 25.0), child: Text( @@ -32,12 +32,13 @@ class CancelDietBottomSheet extends StatelessWidget { ), ), Padding( - padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28), + padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28), child: CustomOutlinedButton( onPressed: () async { if (title != null) { final result = await aboutDietCubit.cancelDiet(); if (result) { + if (!context.mounted) return; Navigator.pop(context); showSuccessToast('предыдущая диета отменена'); showModalBottomSheet( @@ -48,16 +49,19 @@ class CancelDietBottomSheet extends StatelessWidget { ); } else { showErrorToast('Не удалось отменить диету'); + if (!context.mounted) return; Navigator.pop(context); } } else { final result = await aboutDietCubit.cancelDiet(); if (result) { showSuccessToast('Диета отменена'); + if (!context.mounted) return; Navigator.pop(context); aboutDietCubit.clearStartedDietsState(); } else { showErrorToast('Не удалось отменить диету'); + if (!context.mounted) return; Navigator.pop(context); } } @@ -69,7 +73,7 @@ class CancelDietBottomSheet extends StatelessWidget { ), buttonStyle: ButtonStyle( backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), ), ), diff --git a/lib/features/diets/presentation/widgets/expandable_text.dart b/lib/features/diets/presentation/widgets/expandable_text.dart index 72f7467b..18de6ae5 100644 --- a/lib/features/diets/presentation/widgets/expandable_text.dart +++ b/lib/features/diets/presentation/widgets/expandable_text.dart @@ -10,10 +10,10 @@ class ExpandableText extends StatefulWidget { final String text; final int maxLines; - ExpandableText({required this.text, this.maxLines = 3}); + const ExpandableText({super.key, required this.text, this.maxLines = 3}); @override - _ExpandableTextState createState() => _ExpandableTextState(); + State createState() => _ExpandableTextState(); } class _ExpandableTextState extends State { diff --git a/lib/features/diets/presentation/widgets/info_bouble.dart b/lib/features/diets/presentation/widgets/info_bouble.dart index fc27b4b2..d32c534c 100644 --- a/lib/features/diets/presentation/widgets/info_bouble.dart +++ b/lib/features/diets/presentation/widgets/info_bouble.dart @@ -10,7 +10,7 @@ class InfoBouble extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - padding: padding ?? EdgeInsets.symmetric(horizontal: 12, vertical: 8.5), + padding: padding ?? const EdgeInsets.symmetric(horizontal: 12, vertical: 8.5), decoration: BoxDecoration( color: backgroundColor ?? appTheme.gray50, borderRadius: BorderRadius.circular(radius), diff --git a/lib/features/diets/presentation/widgets/more_options.dart b/lib/features/diets/presentation/widgets/more_options.dart index 3d2d54d6..63494590 100644 --- a/lib/features/diets/presentation/widgets/more_options.dart +++ b/lib/features/diets/presentation/widgets/more_options.dart @@ -25,6 +25,7 @@ class MoreOptions extends StatelessWidget { final s = S.of(context); return MainBackgroundBouble( enableShadow: true, + width: 272, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), child: Column( @@ -45,13 +46,13 @@ class MoreOptions extends StatelessWidget { color: appTheme.black, ), ), - Spacer(), + const Spacer(), SvgPicture.asset('assets/icons/copy2.svg', width: 16, height: 20), ], ), ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 12.0), + const Padding( + padding: EdgeInsets.symmetric(vertical: 12.0), child: CustomDivider(), ), GestureDetector( @@ -74,13 +75,13 @@ class MoreOptions extends StatelessWidget { color: appTheme.black, ), ), - Spacer(), + const Spacer(), SvgPicture.asset('assets/icons/share2.svg', width: 16, height: 20), ], ), ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 12.0), + const Padding( + padding: EdgeInsets.symmetric(vertical: 12.0), child: CustomDivider(), ), GestureDetector( @@ -107,7 +108,7 @@ class MoreOptions extends StatelessWidget { color: appTheme.black, ), ), - Spacer(), + const Spacer(), SvgPicture.asset('assets/icons/complain.svg', width: 16, height: 20), ], ), @@ -115,7 +116,6 @@ class MoreOptions extends StatelessWidget { ], ), ), - width: 272, ); } } diff --git a/lib/features/diets/presentation/widgets/start_diet_bottom_sheet.dart b/lib/features/diets/presentation/widgets/start_diet_bottom_sheet.dart index e54fcf9c..d05dc121 100644 --- a/lib/features/diets/presentation/widgets/start_diet_bottom_sheet.dart +++ b/lib/features/diets/presentation/widgets/start_diet_bottom_sheet.dart @@ -25,16 +25,16 @@ class _StartDietBottomSheetState extends State { return Column( mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 4), - BottomSheetHandlerBar(), - SizedBox(height: 12), + const SizedBox(height: 4), + const BottomSheetHandlerBar(), + const SizedBox(height: 12), Text( s.startDiet, style: TextStyles.headingXLSemibold.copyWith( color: appTheme.black, ), ), - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 25.0), child: Text( @@ -45,25 +45,27 @@ class _StartDietBottomSheetState extends State { ), ), ), - SizedBox(height: 12), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), + const SizedBox(height: 12), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0), child: CustomDivider(), ), CalendarWidget( startDate: startDate, ), Padding( - padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28), + padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28), child: CustomOutlinedButton( onPressed: () async { final result = await widget.aboutDietCubit.startDiet(startDate[0]); if (result) { - showSuccessToast('Диета успешно начата'); + showSuccessToast('Диета успешно начата'); + if (!context.mounted) return; Navigator.pop(context); widget.aboutDietCubit.emitCurrentStartedDietsState(); } else { - showErrorToast('Не удалось начать диету'); + showErrorToast('Не удалось начать диету'); + if (!context.mounted) return; Navigator.pop(context); } }, @@ -74,7 +76,7 @@ class _StartDietBottomSheetState extends State { ), buttonStyle: ButtonStyle( backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), ), ), diff --git a/lib/features/diets/presentation/widgets/type_badges.dart b/lib/features/diets/presentation/widgets/type_badges.dart index 3d227464..e852b084 100644 --- a/lib/features/diets/presentation/widgets/type_badges.dart +++ b/lib/features/diets/presentation/widgets/type_badges.dart @@ -144,7 +144,7 @@ class _TypeBadgesState extends State { onClose: closeOverlay, child: PortalTarget( visible: overlaysVisibilityState[index], - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight, @@ -202,13 +202,13 @@ class _InfoOverlayEntry extends StatelessWidget { final String title; final String description; - final assetPath; + final String assetPath; final void Function() onClose; @override Widget build(BuildContext context) { return MainBackgroundBouble( - padding: EdgeInsets.all(8), + padding: const EdgeInsets.all(8), width: 343, child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -220,7 +220,7 @@ class _InfoOverlayEntry extends StatelessWidget { width: 20, height: 20, ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -233,7 +233,7 @@ class _InfoOverlayEntry extends StatelessWidget { color: appTheme.black, ), ), - SizedBox(height: 4), + const SizedBox(height: 4), Text( description, softWrap: true, @@ -261,11 +261,10 @@ class _InfoOverlayEntry extends StatelessWidget { class _Barrier extends StatelessWidget { const _Barrier({ - Key? key, required this.onClose, required this.visible, required this.child, - }) : super(key: key); + }); final Widget child; final VoidCallback onClose; diff --git a/lib/features/diets/repositories/diet_repository.dart b/lib/features/diets/repositories/diet_repository.dart index 070434ed..cefc0c26 100644 --- a/lib/features/diets/repositories/diet_repository.dart +++ b/lib/features/diets/repositories/diet_repository.dart @@ -75,7 +75,7 @@ class LikesState extends Equatable { final int totalLikes; final int index; - LikesState({ + const LikesState({ required this.wasLikedByMe, required this.totalLikes, required this.index, @@ -93,7 +93,7 @@ class FavoriteState extends Equatable { final bool isFavorite; final int index; - FavoriteState({ + const FavoriteState({ required this.isFavorite, required this.index, }); @@ -109,7 +109,7 @@ class CommentsState extends Equatable { final int index; final int totalComments; - CommentsState({ + const CommentsState({ required this.index, required this.totalComments, }); diff --git a/lib/features/feed/models/comment_model.freezed.dart b/lib/features/feed/models/comment_model.freezed.dart index 52044429..4e520131 100644 --- a/lib/features/feed/models/comment_model.freezed.dart +++ b/lib/features/feed/models/comment_model.freezed.dart @@ -12,8 +12,7 @@ part of 'comment_model.dart'; 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', -); + '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'); CommentModel _$CommentModelFromJson(Map json) { return _CommentModel.fromJson(json); @@ -41,15 +40,13 @@ mixin _$CommentModel { /// @nodoc abstract class $CommentModelCopyWith<$Res> { factory $CommentModelCopyWith( - CommentModel value, - $Res Function(CommentModel) then, - ) = _$CommentModelCopyWithImpl<$Res, CommentModel>; + CommentModel value, $Res Function(CommentModel) then) = + _$CommentModelCopyWithImpl<$Res, CommentModel>; @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "links") Links links, - @JsonKey(name: "meta") Meta meta, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); $LinksCopyWith<$Res> get links; $MetaCopyWith<$Res> get meta; @@ -69,27 +66,25 @@ class _$CommentModelCopyWithImpl<$Res, $Val extends CommentModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _value.copyWith( - data: - null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ) - as $Val, - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_value.copyWith( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + ) as $Val); } /// Create a copy of CommentModel @@ -117,16 +112,14 @@ class _$CommentModelCopyWithImpl<$Res, $Val extends CommentModel> abstract class _$$CommentModelImplCopyWith<$Res> implements $CommentModelCopyWith<$Res> { factory _$$CommentModelImplCopyWith( - _$CommentModelImpl value, - $Res Function(_$CommentModelImpl) then, - ) = __$$CommentModelImplCopyWithImpl<$Res>; + _$CommentModelImpl value, $Res Function(_$CommentModelImpl) then) = + __$$CommentModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "links") Links links, - @JsonKey(name: "meta") Meta meta, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); @override $LinksCopyWith<$Res> get links; @@ -139,45 +132,43 @@ class __$$CommentModelImplCopyWithImpl<$Res> extends _$CommentModelCopyWithImpl<$Res, _$CommentModelImpl> implements _$$CommentModelImplCopyWith<$Res> { __$$CommentModelImplCopyWithImpl( - _$CommentModelImpl _value, - $Res Function(_$CommentModelImpl) _then, - ) : super(_value, _then); + _$CommentModelImpl _value, $Res Function(_$CommentModelImpl) _then) + : super(_value, _then); /// Create a copy of CommentModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _$CommentModelImpl( - data: - null == data - ? _value._data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ), - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_$CommentModelImpl( + data: null == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + )); } } /// @nodoc @JsonSerializable() class _$CommentModelImpl implements _CommentModel { - const _$CommentModelImpl({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "links") required this.links, - @JsonKey(name: "meta") required this.meta, - }) : _data = data; + const _$CommentModelImpl( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "links") required this.links, + @JsonKey(name: "meta") required this.meta}) + : _data = data; factory _$CommentModelImpl.fromJson(Map json) => _$$CommentModelImplFromJson(json); @@ -216,11 +207,7 @@ class _$CommentModelImpl implements _CommentModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_data), - links, - meta, - ); + runtimeType, const DeepCollectionEquality().hash(_data), links, meta); /// Create a copy of CommentModel /// with the given fields replaced by the non-null parameter values. @@ -232,16 +219,17 @@ class _$CommentModelImpl implements _CommentModel { @override Map toJson() { - return _$$CommentModelImplToJson(this); + return _$$CommentModelImplToJson( + this, + ); } } abstract class _CommentModel implements CommentModel { - const factory _CommentModel({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "links") required final Links links, - @JsonKey(name: "meta") required final Meta meta, - }) = _$CommentModelImpl; + const factory _CommentModel( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "links") required final Links links, + @JsonKey(name: "meta") required final Meta meta}) = _$CommentModelImpl; factory _CommentModel.fromJson(Map json) = _$CommentModelImpl.fromJson; @@ -297,14 +285,13 @@ abstract class $CommentCopyWith<$Res> { factory $CommentCopyWith(Comment value, $Res Function(Comment) then) = _$CommentCopyWithImpl<$Res, Comment>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "author_name") String authorName, - @JsonKey(name: "author_profile_icon") String authorProfileIcon, - @JsonKey(name: "body") String body, - @JsonKey(name: "children_comments") List childrenComments, - @JsonKey(name: "created_at") DateTime createdAt, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "author_name") String authorName, + @JsonKey(name: "author_profile_icon") String authorProfileIcon, + @JsonKey(name: "body") String body, + @JsonKey(name: "children_comments") List childrenComments, + @JsonKey(name: "created_at") DateTime createdAt}); } /// @nodoc @@ -329,60 +316,49 @@ class _$CommentCopyWithImpl<$Res, $Val extends Comment> Object? childrenComments = null, Object? createdAt = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - authorName: - null == authorName - ? _value.authorName - : authorName // ignore: cast_nullable_to_non_nullable - as String, - authorProfileIcon: - null == authorProfileIcon - ? _value.authorProfileIcon - : authorProfileIcon // ignore: cast_nullable_to_non_nullable - as String, - body: - null == body - ? _value.body - : body // ignore: cast_nullable_to_non_nullable - as String, - childrenComments: - null == childrenComments - ? _value.childrenComments - : childrenComments // ignore: cast_nullable_to_non_nullable - as List, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + authorName: null == authorName + ? _value.authorName + : authorName // ignore: cast_nullable_to_non_nullable + as String, + authorProfileIcon: null == authorProfileIcon + ? _value.authorProfileIcon + : authorProfileIcon // ignore: cast_nullable_to_non_nullable + as String, + body: null == body + ? _value.body + : body // ignore: cast_nullable_to_non_nullable + as String, + childrenComments: null == childrenComments + ? _value.childrenComments + : childrenComments // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ) as $Val); } } /// @nodoc abstract class _$$CommentImplCopyWith<$Res> implements $CommentCopyWith<$Res> { factory _$$CommentImplCopyWith( - _$CommentImpl value, - $Res Function(_$CommentImpl) then, - ) = __$$CommentImplCopyWithImpl<$Res>; + _$CommentImpl value, $Res Function(_$CommentImpl) then) = + __$$CommentImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "author_name") String authorName, - @JsonKey(name: "author_profile_icon") String authorProfileIcon, - @JsonKey(name: "body") String body, - @JsonKey(name: "children_comments") List childrenComments, - @JsonKey(name: "created_at") DateTime createdAt, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "author_name") String authorName, + @JsonKey(name: "author_profile_icon") String authorProfileIcon, + @JsonKey(name: "body") String body, + @JsonKey(name: "children_comments") List childrenComments, + @JsonKey(name: "created_at") DateTime createdAt}); } /// @nodoc @@ -390,9 +366,8 @@ class __$$CommentImplCopyWithImpl<$Res> extends _$CommentCopyWithImpl<$Res, _$CommentImpl> implements _$$CommentImplCopyWith<$Res> { __$$CommentImplCopyWithImpl( - _$CommentImpl _value, - $Res Function(_$CommentImpl) _then, - ) : super(_value, _then); + _$CommentImpl _value, $Res Function(_$CommentImpl) _then) + : super(_value, _then); /// Create a copy of Comment /// with the given fields replaced by the non-null parameter values. @@ -406,55 +381,47 @@ class __$$CommentImplCopyWithImpl<$Res> Object? childrenComments = null, Object? createdAt = null, }) { - return _then( - _$CommentImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - authorName: - null == authorName - ? _value.authorName - : authorName // ignore: cast_nullable_to_non_nullable - as String, - authorProfileIcon: - null == authorProfileIcon - ? _value.authorProfileIcon - : authorProfileIcon // ignore: cast_nullable_to_non_nullable - as String, - body: - null == body - ? _value.body - : body // ignore: cast_nullable_to_non_nullable - as String, - childrenComments: - null == childrenComments - ? _value._childrenComments - : childrenComments // ignore: cast_nullable_to_non_nullable - as List, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - ), - ); + return _then(_$CommentImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + authorName: null == authorName + ? _value.authorName + : authorName // ignore: cast_nullable_to_non_nullable + as String, + authorProfileIcon: null == authorProfileIcon + ? _value.authorProfileIcon + : authorProfileIcon // ignore: cast_nullable_to_non_nullable + as String, + body: null == body + ? _value.body + : body // ignore: cast_nullable_to_non_nullable + as String, + childrenComments: null == childrenComments + ? _value._childrenComments + : childrenComments // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); } } /// @nodoc @JsonSerializable() class _$CommentImpl implements _Comment { - const _$CommentImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "author_name") required this.authorName, - @JsonKey(name: "author_profile_icon") required this.authorProfileIcon, - @JsonKey(name: "body") required this.body, - @JsonKey(name: "children_comments") - required final List childrenComments, - @JsonKey(name: "created_at") required this.createdAt, - }) : _childrenComments = childrenComments; + const _$CommentImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "author_name") required this.authorName, + @JsonKey(name: "author_profile_icon") required this.authorProfileIcon, + @JsonKey(name: "body") required this.body, + @JsonKey(name: "children_comments") + required final List childrenComments, + @JsonKey(name: "created_at") required this.createdAt}) + : _childrenComments = childrenComments; factory _$CommentImpl.fromJson(Map json) => _$$CommentImplFromJson(json); @@ -501,10 +468,8 @@ class _$CommentImpl implements _Comment { (identical(other.authorProfileIcon, authorProfileIcon) || other.authorProfileIcon == authorProfileIcon) && (identical(other.body, body) || other.body == body) && - const DeepCollectionEquality().equals( - other._childrenComments, - _childrenComments, - ) && + const DeepCollectionEquality() + .equals(other._childrenComments, _childrenComments) && (identical(other.createdAt, createdAt) || other.createdAt == createdAt)); } @@ -512,14 +477,13 @@ class _$CommentImpl implements _Comment { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - id, - authorName, - authorProfileIcon, - body, - const DeepCollectionEquality().hash(_childrenComments), - createdAt, - ); + runtimeType, + id, + authorName, + authorProfileIcon, + body, + const DeepCollectionEquality().hash(_childrenComments), + createdAt); /// Create a copy of Comment /// with the given fields replaced by the non-null parameter values. @@ -531,21 +495,23 @@ class _$CommentImpl implements _Comment { @override Map toJson() { - return _$$CommentImplToJson(this); + return _$$CommentImplToJson( + this, + ); } } abstract class _Comment implements Comment { - const factory _Comment({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "author_name") required final String authorName, - @JsonKey(name: "author_profile_icon") - required final String authorProfileIcon, - @JsonKey(name: "body") required final String body, - @JsonKey(name: "children_comments") - required final List childrenComments, - @JsonKey(name: "created_at") required final DateTime createdAt, - }) = _$CommentImpl; + const factory _Comment( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "author_name") required final String authorName, + @JsonKey(name: "author_profile_icon") + required final String authorProfileIcon, + @JsonKey(name: "body") required final String body, + @JsonKey(name: "children_comments") + required final List childrenComments, + @JsonKey(name: "created_at") required final DateTime createdAt}) = + _$CommentImpl; factory _Comment.fromJson(Map json) = _$CommentImpl.fromJson; diff --git a/lib/features/feed/models/comment_model.g.dart b/lib/features/feed/models/comment_model.g.dart index 99448179..1410cfcc 100644 --- a/lib/features/feed/models/comment_model.g.dart +++ b/lib/features/feed/models/comment_model.g.dart @@ -8,10 +8,9 @@ part of 'comment_model.dart'; _$CommentModelImpl _$$CommentModelImplFromJson(Map json) => _$CommentModelImpl( - data: - (json['data'] as List) - .map((e) => Comment.fromJson(e as Map)) - .toList(), + data: (json['data'] as List) + .map((e) => Comment.fromJson(e as Map)) + .toList(), links: Links.fromJson(json['links'] as Map), meta: Meta.fromJson(json['meta'] as Map), ); @@ -29,10 +28,9 @@ _$CommentImpl _$$CommentImplFromJson(Map json) => authorName: json['author_name'] as String, authorProfileIcon: json['author_profile_icon'] as String, body: json['body'] as String, - childrenComments: - (json['children_comments'] as List) - .map((e) => Comment.fromJson(e as Map)) - .toList(), + childrenComments: (json['children_comments'] as List) + .map((e) => Comment.fromJson(e as Map)) + .toList(), createdAt: DateTime.parse(json['created_at'] as String), ); diff --git a/lib/features/feed/models/diets_pagination_model.dart b/lib/features/feed/models/diets_pagination_model.dart index 00f8e520..14538a30 100644 --- a/lib/features/feed/models/diets_pagination_model.dart +++ b/lib/features/feed/models/diets_pagination_model.dart @@ -47,6 +47,7 @@ enum DietState { @JsonKey(name: 'personal') personal; + @override String toString() { switch (this) { case DietState.active: @@ -113,20 +114,20 @@ int _parseQuantity(dynamic quantity) { enum Portion { @JsonValue("gr") - GRAMS, + grams, @JsonValue("milliliters") - MILLILITERS, + milliliters, @JsonValue("pcs") - PCS; + pcs; static Portion? getPortionFromValue(String value) { switch (value) { case 'gr': - return Portion.GRAMS; + return Portion.grams; case 'milliliters': - return Portion.MILLILITERS; + return Portion.milliliters; case 'pcs': - return Portion.PCS; + return Portion.pcs; default: return null; } diff --git a/lib/features/feed/models/diets_pagination_model.freezed.dart b/lib/features/feed/models/diets_pagination_model.freezed.dart index ad7a4b07..80382503 100644 --- a/lib/features/feed/models/diets_pagination_model.freezed.dart +++ b/lib/features/feed/models/diets_pagination_model.freezed.dart @@ -12,8 +12,7 @@ part of 'diets_pagination_model.dart'; 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', -); + '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'); DietsPagination _$DietsPaginationFromJson(Map json) { return _DietsPagination.fromJson(json); @@ -41,15 +40,13 @@ mixin _$DietsPagination { /// @nodoc abstract class $DietsPaginationCopyWith<$Res> { factory $DietsPaginationCopyWith( - DietsPagination value, - $Res Function(DietsPagination) then, - ) = _$DietsPaginationCopyWithImpl<$Res, DietsPagination>; + DietsPagination value, $Res Function(DietsPagination) then) = + _$DietsPaginationCopyWithImpl<$Res, DietsPagination>; @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "links") Links links, - @JsonKey(name: "meta") Meta meta, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); $LinksCopyWith<$Res> get links; $MetaCopyWith<$Res> get meta; @@ -69,27 +66,25 @@ class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _value.copyWith( - data: - null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ) - as $Val, - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_value.copyWith( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + ) as $Val); } /// Create a copy of DietsPagination @@ -116,17 +111,15 @@ class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination> /// @nodoc abstract class _$$DietsPaginationImplCopyWith<$Res> implements $DietsPaginationCopyWith<$Res> { - factory _$$DietsPaginationImplCopyWith( - _$DietsPaginationImpl value, - $Res Function(_$DietsPaginationImpl) then, - ) = __$$DietsPaginationImplCopyWithImpl<$Res>; + factory _$$DietsPaginationImplCopyWith(_$DietsPaginationImpl value, + $Res Function(_$DietsPaginationImpl) then) = + __$$DietsPaginationImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "links") Links links, - @JsonKey(name: "meta") Meta meta, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); @override $LinksCopyWith<$Res> get links; @@ -139,45 +132,43 @@ class __$$DietsPaginationImplCopyWithImpl<$Res> extends _$DietsPaginationCopyWithImpl<$Res, _$DietsPaginationImpl> implements _$$DietsPaginationImplCopyWith<$Res> { __$$DietsPaginationImplCopyWithImpl( - _$DietsPaginationImpl _value, - $Res Function(_$DietsPaginationImpl) _then, - ) : super(_value, _then); + _$DietsPaginationImpl _value, $Res Function(_$DietsPaginationImpl) _then) + : super(_value, _then); /// Create a copy of DietsPagination /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _$DietsPaginationImpl( - data: - null == data - ? _value._data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ), - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_$DietsPaginationImpl( + data: null == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + )); } } /// @nodoc @JsonSerializable() class _$DietsPaginationImpl implements _DietsPagination { - const _$DietsPaginationImpl({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "links") required this.links, - @JsonKey(name: "meta") required this.meta, - }) : _data = data; + const _$DietsPaginationImpl( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "links") required this.links, + @JsonKey(name: "meta") required this.meta}) + : _data = data; factory _$DietsPaginationImpl.fromJson(Map json) => _$$DietsPaginationImplFromJson(json); @@ -216,11 +207,7 @@ class _$DietsPaginationImpl implements _DietsPagination { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_data), - links, - meta, - ); + runtimeType, const DeepCollectionEquality().hash(_data), links, meta); /// Create a copy of DietsPagination /// with the given fields replaced by the non-null parameter values. @@ -229,22 +216,21 @@ class _$DietsPaginationImpl implements _DietsPagination { @pragma('vm:prefer-inline') _$$DietsPaginationImplCopyWith<_$DietsPaginationImpl> get copyWith => __$$DietsPaginationImplCopyWithImpl<_$DietsPaginationImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$DietsPaginationImplToJson(this); + return _$$DietsPaginationImplToJson( + this, + ); } } abstract class _DietsPagination implements DietsPagination { - const factory _DietsPagination({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "links") required final Links links, - @JsonKey(name: "meta") required final Meta meta, - }) = _$DietsPaginationImpl; + const factory _DietsPagination( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "links") required final Links links, + @JsonKey(name: "meta") required final Meta meta}) = _$DietsPaginationImpl; factory _DietsPagination.fromJson(Map json) = _$DietsPaginationImpl.fromJson; @@ -319,24 +305,23 @@ abstract class $DietCopyWith<$Res> { factory $DietCopyWith(Diet value, $Res Function(Diet) then) = _$DietCopyWithImpl<$Res, Diet>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "name") String name, - @JsonKey(name: "image") String image, - @JsonKey(name: "duration") int duration, - @JsonKey(name: "state") DietState state, - @JsonKey(name: "type") DietType type, - @JsonKey(name: "description_md") String details, - @JsonKey(name: "daily_schedule") - Map>> dailySchedule, - @JsonKey(name: "author") Author author, - @JsonKey(name: "total_likes") int totalLikes, - @JsonKey(name: "total_views") int totalViews, - @JsonKey(name: "total_comments") int totalComments, - @JsonKey(name: "was_liked_by_me") bool wasLikedByMe, - @JsonKey(name: "is_favorite") bool isFavorite, - @JsonKey(name: "daily_nutrition") List dailyNutrition, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "name") String name, + @JsonKey(name: "image") String image, + @JsonKey(name: "duration") int duration, + @JsonKey(name: "state") DietState state, + @JsonKey(name: "type") DietType type, + @JsonKey(name: "description_md") String details, + @JsonKey(name: "daily_schedule") + Map>> dailySchedule, + @JsonKey(name: "author") Author author, + @JsonKey(name: "total_likes") int totalLikes, + @JsonKey(name: "total_views") int totalViews, + @JsonKey(name: "total_comments") int totalComments, + @JsonKey(name: "was_liked_by_me") bool wasLikedByMe, + @JsonKey(name: "is_favorite") bool isFavorite, + @JsonKey(name: "daily_nutrition") List dailyNutrition}); $DietTypeCopyWith<$Res> get type; $AuthorCopyWith<$Res> get author; @@ -373,86 +358,68 @@ class _$DietCopyWithImpl<$Res, $Val extends Diet> Object? isFavorite = null, Object? dailyNutrition = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - duration: - null == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as DietState, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as DietType, - details: - null == details - ? _value.details - : details // ignore: cast_nullable_to_non_nullable - as String, - dailySchedule: - null == dailySchedule - ? _value.dailySchedule - : dailySchedule // ignore: cast_nullable_to_non_nullable - as Map>>, - author: - null == author - ? _value.author - : author // ignore: cast_nullable_to_non_nullable - as Author, - totalLikes: - null == totalLikes - ? _value.totalLikes - : totalLikes // ignore: cast_nullable_to_non_nullable - as int, - totalViews: - null == totalViews - ? _value.totalViews - : totalViews // ignore: cast_nullable_to_non_nullable - as int, - totalComments: - null == totalComments - ? _value.totalComments - : totalComments // ignore: cast_nullable_to_non_nullable - as int, - wasLikedByMe: - null == wasLikedByMe - ? _value.wasLikedByMe - : wasLikedByMe // ignore: cast_nullable_to_non_nullable - as bool, - isFavorite: - null == isFavorite - ? _value.isFavorite - : isFavorite // ignore: cast_nullable_to_non_nullable - as bool, - dailyNutrition: - null == dailyNutrition - ? _value.dailyNutrition - : dailyNutrition // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + duration: null == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as int, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as DietState, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as DietType, + details: null == details + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as String, + dailySchedule: null == dailySchedule + ? _value.dailySchedule + : dailySchedule // ignore: cast_nullable_to_non_nullable + as Map>>, + author: null == author + ? _value.author + : author // ignore: cast_nullable_to_non_nullable + as Author, + totalLikes: null == totalLikes + ? _value.totalLikes + : totalLikes // ignore: cast_nullable_to_non_nullable + as int, + totalViews: null == totalViews + ? _value.totalViews + : totalViews // ignore: cast_nullable_to_non_nullable + as int, + totalComments: null == totalComments + ? _value.totalComments + : totalComments // ignore: cast_nullable_to_non_nullable + as int, + wasLikedByMe: null == wasLikedByMe + ? _value.wasLikedByMe + : wasLikedByMe // ignore: cast_nullable_to_non_nullable + as bool, + isFavorite: null == isFavorite + ? _value.isFavorite + : isFavorite // ignore: cast_nullable_to_non_nullable + as bool, + dailyNutrition: null == dailyNutrition + ? _value.dailyNutrition + : dailyNutrition // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } /// Create a copy of Diet @@ -479,29 +446,27 @@ class _$DietCopyWithImpl<$Res, $Val extends Diet> /// @nodoc abstract class _$$DietImplCopyWith<$Res> implements $DietCopyWith<$Res> { factory _$$DietImplCopyWith( - _$DietImpl value, - $Res Function(_$DietImpl) then, - ) = __$$DietImplCopyWithImpl<$Res>; + _$DietImpl value, $Res Function(_$DietImpl) then) = + __$$DietImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "name") String name, - @JsonKey(name: "image") String image, - @JsonKey(name: "duration") int duration, - @JsonKey(name: "state") DietState state, - @JsonKey(name: "type") DietType type, - @JsonKey(name: "description_md") String details, - @JsonKey(name: "daily_schedule") - Map>> dailySchedule, - @JsonKey(name: "author") Author author, - @JsonKey(name: "total_likes") int totalLikes, - @JsonKey(name: "total_views") int totalViews, - @JsonKey(name: "total_comments") int totalComments, - @JsonKey(name: "was_liked_by_me") bool wasLikedByMe, - @JsonKey(name: "is_favorite") bool isFavorite, - @JsonKey(name: "daily_nutrition") List dailyNutrition, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "name") String name, + @JsonKey(name: "image") String image, + @JsonKey(name: "duration") int duration, + @JsonKey(name: "state") DietState state, + @JsonKey(name: "type") DietType type, + @JsonKey(name: "description_md") String details, + @JsonKey(name: "daily_schedule") + Map>> dailySchedule, + @JsonKey(name: "author") Author author, + @JsonKey(name: "total_likes") int totalLikes, + @JsonKey(name: "total_views") int totalViews, + @JsonKey(name: "total_comments") int totalComments, + @JsonKey(name: "was_liked_by_me") bool wasLikedByMe, + @JsonKey(name: "is_favorite") bool isFavorite, + @JsonKey(name: "daily_nutrition") List dailyNutrition}); @override $DietTypeCopyWith<$Res> get type; @@ -514,7 +479,7 @@ class __$$DietImplCopyWithImpl<$Res> extends _$DietCopyWithImpl<$Res, _$DietImpl> implements _$$DietImplCopyWith<$Res> { __$$DietImplCopyWithImpl(_$DietImpl _value, $Res Function(_$DietImpl) _then) - : super(_value, _then); + : super(_value, _then); /// Create a copy of Diet /// with the given fields replaced by the non-null parameter values. @@ -537,111 +502,94 @@ class __$$DietImplCopyWithImpl<$Res> Object? isFavorite = null, Object? dailyNutrition = null, }) { - return _then( - _$DietImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - duration: - null == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as DietState, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as DietType, - details: - null == details - ? _value.details - : details // ignore: cast_nullable_to_non_nullable - as String, - dailySchedule: - null == dailySchedule - ? _value._dailySchedule - : dailySchedule // ignore: cast_nullable_to_non_nullable - as Map>>, - author: - null == author - ? _value.author - : author // ignore: cast_nullable_to_non_nullable - as Author, - totalLikes: - null == totalLikes - ? _value.totalLikes - : totalLikes // ignore: cast_nullable_to_non_nullable - as int, - totalViews: - null == totalViews - ? _value.totalViews - : totalViews // ignore: cast_nullable_to_non_nullable - as int, - totalComments: - null == totalComments - ? _value.totalComments - : totalComments // ignore: cast_nullable_to_non_nullable - as int, - wasLikedByMe: - null == wasLikedByMe - ? _value.wasLikedByMe - : wasLikedByMe // ignore: cast_nullable_to_non_nullable - as bool, - isFavorite: - null == isFavorite - ? _value.isFavorite - : isFavorite // ignore: cast_nullable_to_non_nullable - as bool, - dailyNutrition: - null == dailyNutrition - ? _value._dailyNutrition - : dailyNutrition // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + return _then(_$DietImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + duration: null == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as int, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as DietState, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as DietType, + details: null == details + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as String, + dailySchedule: null == dailySchedule + ? _value._dailySchedule + : dailySchedule // ignore: cast_nullable_to_non_nullable + as Map>>, + author: null == author + ? _value.author + : author // ignore: cast_nullable_to_non_nullable + as Author, + totalLikes: null == totalLikes + ? _value.totalLikes + : totalLikes // ignore: cast_nullable_to_non_nullable + as int, + totalViews: null == totalViews + ? _value.totalViews + : totalViews // ignore: cast_nullable_to_non_nullable + as int, + totalComments: null == totalComments + ? _value.totalComments + : totalComments // ignore: cast_nullable_to_non_nullable + as int, + wasLikedByMe: null == wasLikedByMe + ? _value.wasLikedByMe + : wasLikedByMe // ignore: cast_nullable_to_non_nullable + as bool, + isFavorite: null == isFavorite + ? _value.isFavorite + : isFavorite // ignore: cast_nullable_to_non_nullable + as bool, + dailyNutrition: null == dailyNutrition + ? _value._dailyNutrition + : dailyNutrition // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc @JsonSerializable() class _$DietImpl implements _Diet { - const _$DietImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "name") required this.name, - @JsonKey(name: "image") required this.image, - @JsonKey(name: "duration") required this.duration, - @JsonKey(name: "state") required this.state, - @JsonKey(name: "type") required this.type, - @JsonKey(name: "description_md") required this.details, - @JsonKey(name: "daily_schedule") - required final Map>> dailySchedule, - @JsonKey(name: "author") required this.author, - @JsonKey(name: "total_likes") required this.totalLikes, - @JsonKey(name: "total_views") required this.totalViews, - @JsonKey(name: "total_comments") required this.totalComments, - @JsonKey(name: "was_liked_by_me") required this.wasLikedByMe, - @JsonKey(name: "is_favorite") required this.isFavorite, - @JsonKey(name: "daily_nutrition") - required final List dailyNutrition, - }) : _dailySchedule = dailySchedule, - _dailyNutrition = dailyNutrition; + const _$DietImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "name") required this.name, + @JsonKey(name: "image") required this.image, + @JsonKey(name: "duration") required this.duration, + @JsonKey(name: "state") required this.state, + @JsonKey(name: "type") required this.type, + @JsonKey(name: "description_md") required this.details, + @JsonKey(name: "daily_schedule") + required final Map>> dailySchedule, + @JsonKey(name: "author") required this.author, + @JsonKey(name: "total_likes") required this.totalLikes, + @JsonKey(name: "total_views") required this.totalViews, + @JsonKey(name: "total_comments") required this.totalComments, + @JsonKey(name: "was_liked_by_me") required this.wasLikedByMe, + @JsonKey(name: "is_favorite") required this.isFavorite, + @JsonKey(name: "daily_nutrition") + required final List dailyNutrition}) + : _dailySchedule = dailySchedule, + _dailyNutrition = dailyNutrition; factory _$DietImpl.fromJson(Map json) => _$$DietImplFromJson(json); @@ -721,10 +669,8 @@ class _$DietImpl implements _Diet { (identical(other.state, state) || other.state == state) && (identical(other.type, type) || other.type == type) && (identical(other.details, details) || other.details == details) && - const DeepCollectionEquality().equals( - other._dailySchedule, - _dailySchedule, - ) && + const DeepCollectionEquality() + .equals(other._dailySchedule, _dailySchedule) && (identical(other.author, author) || other.author == author) && (identical(other.totalLikes, totalLikes) || other.totalLikes == totalLikes) && @@ -736,32 +682,29 @@ class _$DietImpl implements _Diet { other.wasLikedByMe == wasLikedByMe) && (identical(other.isFavorite, isFavorite) || other.isFavorite == isFavorite) && - const DeepCollectionEquality().equals( - other._dailyNutrition, - _dailyNutrition, - )); + const DeepCollectionEquality() + .equals(other._dailyNutrition, _dailyNutrition)); } @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - id, - name, - image, - duration, - state, - type, - details, - const DeepCollectionEquality().hash(_dailySchedule), - author, - totalLikes, - totalViews, - totalComments, - wasLikedByMe, - isFavorite, - const DeepCollectionEquality().hash(_dailyNutrition), - ); + runtimeType, + id, + name, + image, + duration, + state, + type, + details, + const DeepCollectionEquality().hash(_dailySchedule), + author, + totalLikes, + totalViews, + totalComments, + wasLikedByMe, + isFavorite, + const DeepCollectionEquality().hash(_dailyNutrition)); /// Create a copy of Diet /// with the given fields replaced by the non-null parameter values. @@ -773,30 +716,31 @@ class _$DietImpl implements _Diet { @override Map toJson() { - return _$$DietImplToJson(this); + return _$$DietImplToJson( + this, + ); } } abstract class _Diet implements Diet { - const factory _Diet({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "name") required final String name, - @JsonKey(name: "image") required final String image, - @JsonKey(name: "duration") required final int duration, - @JsonKey(name: "state") required final DietState state, - @JsonKey(name: "type") required final DietType type, - @JsonKey(name: "description_md") required final String details, - @JsonKey(name: "daily_schedule") - required final Map>> dailySchedule, - @JsonKey(name: "author") required final Author author, - @JsonKey(name: "total_likes") required final int totalLikes, - @JsonKey(name: "total_views") required final int totalViews, - @JsonKey(name: "total_comments") required final int totalComments, - @JsonKey(name: "was_liked_by_me") required final bool wasLikedByMe, - @JsonKey(name: "is_favorite") required final bool isFavorite, - @JsonKey(name: "daily_nutrition") - required final List dailyNutrition, - }) = _$DietImpl; + const factory _Diet( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "name") required final String name, + @JsonKey(name: "image") required final String image, + @JsonKey(name: "duration") required final int duration, + @JsonKey(name: "state") required final DietState state, + @JsonKey(name: "type") required final DietType type, + @JsonKey(name: "description_md") required final String details, + @JsonKey(name: "daily_schedule") + required final Map>> dailySchedule, + @JsonKey(name: "author") required final Author author, + @JsonKey(name: "total_likes") required final int totalLikes, + @JsonKey(name: "total_views") required final int totalViews, + @JsonKey(name: "total_comments") required final int totalComments, + @JsonKey(name: "was_liked_by_me") required final bool wasLikedByMe, + @JsonKey(name: "is_favorite") required final bool isFavorite, + @JsonKey(name: "daily_nutrition") + required final List dailyNutrition}) = _$DietImpl; factory _Diet.fromJson(Map json) = _$DietImpl.fromJson; @@ -876,9 +820,8 @@ mixin _$CreatedDiet { /// @nodoc abstract class $CreatedDietCopyWith<$Res> { factory $CreatedDietCopyWith( - CreatedDiet value, - $Res Function(CreatedDiet) then, - ) = _$CreatedDietCopyWithImpl<$Res, CreatedDiet>; + CreatedDiet value, $Res Function(CreatedDiet) then) = + _$CreatedDietCopyWithImpl<$Res, CreatedDiet>; @useResult $Res call({@JsonKey(name: "id") int id}); } @@ -897,17 +840,15 @@ class _$CreatedDietCopyWithImpl<$Res, $Val extends CreatedDiet> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? id = null}) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + $Res call({ + Object? id = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } @@ -915,9 +856,8 @@ class _$CreatedDietCopyWithImpl<$Res, $Val extends CreatedDiet> abstract class _$$CreatedDietImplCopyWith<$Res> implements $CreatedDietCopyWith<$Res> { factory _$$CreatedDietImplCopyWith( - _$CreatedDietImpl value, - $Res Function(_$CreatedDietImpl) then, - ) = __$$CreatedDietImplCopyWithImpl<$Res>; + _$CreatedDietImpl value, $Res Function(_$CreatedDietImpl) then) = + __$$CreatedDietImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: "id") int id}); @@ -928,24 +868,22 @@ class __$$CreatedDietImplCopyWithImpl<$Res> extends _$CreatedDietCopyWithImpl<$Res, _$CreatedDietImpl> implements _$$CreatedDietImplCopyWith<$Res> { __$$CreatedDietImplCopyWithImpl( - _$CreatedDietImpl _value, - $Res Function(_$CreatedDietImpl) _then, - ) : super(_value, _then); + _$CreatedDietImpl _value, $Res Function(_$CreatedDietImpl) _then) + : super(_value, _then); /// Create a copy of CreatedDiet /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? id = null}) { - return _then( - _$CreatedDietImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + $Res call({ + Object? id = null, + }) { + return _then(_$CreatedDietImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + )); } } @@ -988,7 +926,9 @@ class _$CreatedDietImpl implements _CreatedDiet { @override Map toJson() { - return _$$CreatedDietImplToJson(this); + return _$$CreatedDietImplToJson( + this, + ); } } @@ -1044,14 +984,13 @@ abstract class $AuthorCopyWith<$Res> { factory $AuthorCopyWith(Author value, $Res Function(Author) then) = _$AuthorCopyWithImpl<$Res, Author>; @useResult - $Res call({ - @JsonKey(name: "author_slug") String authorSlug, - @JsonKey(name: "author_name") String authorName, - @JsonKey(name: "author_profile_icon") String authorProfileIcon, - @JsonKey(name: "author_is_me") bool authorIsMe, - @JsonKey(name: "is_entity_subscribed_by_me") bool? isEntitySubscribedByMe, - @JsonKey(name: "author_place_in_rating") int? authorPlaceInRating, - }); + $Res call( + {@JsonKey(name: "author_slug") String authorSlug, + @JsonKey(name: "author_name") String authorName, + @JsonKey(name: "author_profile_icon") String authorProfileIcon, + @JsonKey(name: "author_is_me") bool authorIsMe, + @JsonKey(name: "is_entity_subscribed_by_me") bool? isEntitySubscribedByMe, + @JsonKey(name: "author_place_in_rating") int? authorPlaceInRating}); } /// @nodoc @@ -1076,60 +1015,49 @@ class _$AuthorCopyWithImpl<$Res, $Val extends Author> Object? isEntitySubscribedByMe = freezed, Object? authorPlaceInRating = freezed, }) { - return _then( - _value.copyWith( - authorSlug: - null == authorSlug - ? _value.authorSlug - : authorSlug // ignore: cast_nullable_to_non_nullable - as String, - authorName: - null == authorName - ? _value.authorName - : authorName // ignore: cast_nullable_to_non_nullable - as String, - authorProfileIcon: - null == authorProfileIcon - ? _value.authorProfileIcon - : authorProfileIcon // ignore: cast_nullable_to_non_nullable - as String, - authorIsMe: - null == authorIsMe - ? _value.authorIsMe - : authorIsMe // ignore: cast_nullable_to_non_nullable - as bool, - isEntitySubscribedByMe: - freezed == isEntitySubscribedByMe - ? _value.isEntitySubscribedByMe - : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable - as bool?, - authorPlaceInRating: - freezed == authorPlaceInRating - ? _value.authorPlaceInRating - : authorPlaceInRating // ignore: cast_nullable_to_non_nullable - as int?, - ) - as $Val, - ); + return _then(_value.copyWith( + authorSlug: null == authorSlug + ? _value.authorSlug + : authorSlug // ignore: cast_nullable_to_non_nullable + as String, + authorName: null == authorName + ? _value.authorName + : authorName // ignore: cast_nullable_to_non_nullable + as String, + authorProfileIcon: null == authorProfileIcon + ? _value.authorProfileIcon + : authorProfileIcon // ignore: cast_nullable_to_non_nullable + as String, + authorIsMe: null == authorIsMe + ? _value.authorIsMe + : authorIsMe // ignore: cast_nullable_to_non_nullable + as bool, + isEntitySubscribedByMe: freezed == isEntitySubscribedByMe + ? _value.isEntitySubscribedByMe + : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable + as bool?, + authorPlaceInRating: freezed == authorPlaceInRating + ? _value.authorPlaceInRating + : authorPlaceInRating // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); } } /// @nodoc abstract class _$$AuthorImplCopyWith<$Res> implements $AuthorCopyWith<$Res> { factory _$$AuthorImplCopyWith( - _$AuthorImpl value, - $Res Function(_$AuthorImpl) then, - ) = __$$AuthorImplCopyWithImpl<$Res>; + _$AuthorImpl value, $Res Function(_$AuthorImpl) then) = + __$$AuthorImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "author_slug") String authorSlug, - @JsonKey(name: "author_name") String authorName, - @JsonKey(name: "author_profile_icon") String authorProfileIcon, - @JsonKey(name: "author_is_me") bool authorIsMe, - @JsonKey(name: "is_entity_subscribed_by_me") bool? isEntitySubscribedByMe, - @JsonKey(name: "author_place_in_rating") int? authorPlaceInRating, - }); + $Res call( + {@JsonKey(name: "author_slug") String authorSlug, + @JsonKey(name: "author_name") String authorName, + @JsonKey(name: "author_profile_icon") String authorProfileIcon, + @JsonKey(name: "author_is_me") bool authorIsMe, + @JsonKey(name: "is_entity_subscribed_by_me") bool? isEntitySubscribedByMe, + @JsonKey(name: "author_place_in_rating") int? authorPlaceInRating}); } /// @nodoc @@ -1137,9 +1065,8 @@ class __$$AuthorImplCopyWithImpl<$Res> extends _$AuthorCopyWithImpl<$Res, _$AuthorImpl> implements _$$AuthorImplCopyWith<$Res> { __$$AuthorImplCopyWithImpl( - _$AuthorImpl _value, - $Res Function(_$AuthorImpl) _then, - ) : super(_value, _then); + _$AuthorImpl _value, $Res Function(_$AuthorImpl) _then) + : super(_value, _then); /// Create a copy of Author /// with the given fields replaced by the non-null parameter values. @@ -1153,54 +1080,45 @@ class __$$AuthorImplCopyWithImpl<$Res> Object? isEntitySubscribedByMe = freezed, Object? authorPlaceInRating = freezed, }) { - return _then( - _$AuthorImpl( - authorSlug: - null == authorSlug - ? _value.authorSlug - : authorSlug // ignore: cast_nullable_to_non_nullable - as String, - authorName: - null == authorName - ? _value.authorName - : authorName // ignore: cast_nullable_to_non_nullable - as String, - authorProfileIcon: - null == authorProfileIcon - ? _value.authorProfileIcon - : authorProfileIcon // ignore: cast_nullable_to_non_nullable - as String, - authorIsMe: - null == authorIsMe - ? _value.authorIsMe - : authorIsMe // ignore: cast_nullable_to_non_nullable - as bool, - isEntitySubscribedByMe: - freezed == isEntitySubscribedByMe - ? _value.isEntitySubscribedByMe - : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable - as bool?, - authorPlaceInRating: - freezed == authorPlaceInRating - ? _value.authorPlaceInRating - : authorPlaceInRating // ignore: cast_nullable_to_non_nullable - as int?, - ), - ); + return _then(_$AuthorImpl( + authorSlug: null == authorSlug + ? _value.authorSlug + : authorSlug // ignore: cast_nullable_to_non_nullable + as String, + authorName: null == authorName + ? _value.authorName + : authorName // ignore: cast_nullable_to_non_nullable + as String, + authorProfileIcon: null == authorProfileIcon + ? _value.authorProfileIcon + : authorProfileIcon // ignore: cast_nullable_to_non_nullable + as String, + authorIsMe: null == authorIsMe + ? _value.authorIsMe + : authorIsMe // ignore: cast_nullable_to_non_nullable + as bool, + isEntitySubscribedByMe: freezed == isEntitySubscribedByMe + ? _value.isEntitySubscribedByMe + : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable + as bool?, + authorPlaceInRating: freezed == authorPlaceInRating + ? _value.authorPlaceInRating + : authorPlaceInRating // ignore: cast_nullable_to_non_nullable + as int?, + )); } } /// @nodoc @JsonSerializable() class _$AuthorImpl implements _Author { - const _$AuthorImpl({ - @JsonKey(name: "author_slug") required this.authorSlug, - @JsonKey(name: "author_name") required this.authorName, - @JsonKey(name: "author_profile_icon") required this.authorProfileIcon, - @JsonKey(name: "author_is_me") required this.authorIsMe, - @JsonKey(name: "is_entity_subscribed_by_me") this.isEntitySubscribedByMe, - @JsonKey(name: "author_place_in_rating") this.authorPlaceInRating, - }); + const _$AuthorImpl( + {@JsonKey(name: "author_slug") required this.authorSlug, + @JsonKey(name: "author_name") required this.authorName, + @JsonKey(name: "author_profile_icon") required this.authorProfileIcon, + @JsonKey(name: "author_is_me") required this.authorIsMe, + @JsonKey(name: "is_entity_subscribed_by_me") this.isEntitySubscribedByMe, + @JsonKey(name: "author_place_in_rating") this.authorPlaceInRating}); factory _$AuthorImpl.fromJson(Map json) => _$$AuthorImplFromJson(json); @@ -1251,14 +1169,13 @@ class _$AuthorImpl implements _Author { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - authorSlug, - authorName, - authorProfileIcon, - authorIsMe, - isEntitySubscribedByMe, - authorPlaceInRating, - ); + runtimeType, + authorSlug, + authorName, + authorProfileIcon, + authorIsMe, + isEntitySubscribedByMe, + authorPlaceInRating); /// Create a copy of Author /// with the given fields replaced by the non-null parameter values. @@ -1270,21 +1187,23 @@ class _$AuthorImpl implements _Author { @override Map toJson() { - return _$$AuthorImplToJson(this); + return _$$AuthorImplToJson( + this, + ); } } abstract class _Author implements Author { - const factory _Author({ - @JsonKey(name: "author_slug") required final String authorSlug, - @JsonKey(name: "author_name") required final String authorName, - @JsonKey(name: "author_profile_icon") - required final String authorProfileIcon, - @JsonKey(name: "author_is_me") required final bool authorIsMe, - @JsonKey(name: "is_entity_subscribed_by_me") - final bool? isEntitySubscribedByMe, - @JsonKey(name: "author_place_in_rating") final int? authorPlaceInRating, - }) = _$AuthorImpl; + const factory _Author( + {@JsonKey(name: "author_slug") required final String authorSlug, + @JsonKey(name: "author_name") required final String authorName, + @JsonKey(name: "author_profile_icon") + required final String authorProfileIcon, + @JsonKey(name: "author_is_me") required final bool authorIsMe, + @JsonKey(name: "is_entity_subscribed_by_me") + final bool? isEntitySubscribedByMe, + @JsonKey(name: "author_place_in_rating") + final int? authorPlaceInRating}) = _$AuthorImpl; factory _Author.fromJson(Map json) = _$AuthorImpl.fromJson; @@ -1330,11 +1249,10 @@ mixin _$DailySchedule { @JsonKey(name: 'nutrition', includeToJson: false) DailyNutrition? get dailyNutrition => throw _privateConstructorUsedError; @JsonKey( - name: 'product_nutritional_value_id', - includeToJson: true, - includeFromJson: false, - includeIfNull: false, - ) + name: 'product_nutritional_value_id', + includeToJson: true, + includeFromJson: false, + includeIfNull: false) String? get productNutritionalValueId => throw _privateConstructorUsedError; /// Serializes this DailySchedule to a JSON map. @@ -1350,24 +1268,21 @@ mixin _$DailySchedule { /// @nodoc abstract class $DailyScheduleCopyWith<$Res> { factory $DailyScheduleCopyWith( - DailySchedule value, - $Res Function(DailySchedule) then, - ) = _$DailyScheduleCopyWithImpl<$Res, DailySchedule>; + DailySchedule value, $Res Function(DailySchedule) then) = + _$DailyScheduleCopyWithImpl<$Res, DailySchedule>; @useResult - $Res call({ - @JsonKey(name: "name") String name, - @JsonKey(name: "portion") Portion portion, - @JsonKey(name: "quantity", fromJson: _parseQuantity) int quantity, - @JsonKey(name: 'nutrition', includeToJson: false) - DailyNutrition? dailyNutrition, - @JsonKey( - name: 'product_nutritional_value_id', - includeToJson: true, - includeFromJson: false, - includeIfNull: false, - ) - String? productNutritionalValueId, - }); + $Res call( + {@JsonKey(name: "name") String name, + @JsonKey(name: "portion") Portion portion, + @JsonKey(name: "quantity", fromJson: _parseQuantity) int quantity, + @JsonKey(name: 'nutrition', includeToJson: false) + DailyNutrition? dailyNutrition, + @JsonKey( + name: 'product_nutritional_value_id', + includeToJson: true, + includeFromJson: false, + includeIfNull: false) + String? productNutritionalValueId}); $DailyNutritionCopyWith<$Res>? get dailyNutrition; } @@ -1393,36 +1308,28 @@ class _$DailyScheduleCopyWithImpl<$Res, $Val extends DailySchedule> Object? dailyNutrition = freezed, Object? productNutritionalValueId = freezed, }) { - return _then( - _value.copyWith( - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as Portion, - quantity: - null == quantity - ? _value.quantity - : quantity // ignore: cast_nullable_to_non_nullable - as int, - dailyNutrition: - freezed == dailyNutrition - ? _value.dailyNutrition - : dailyNutrition // ignore: cast_nullable_to_non_nullable - as DailyNutrition?, - productNutritionalValueId: - freezed == productNutritionalValueId - ? _value.productNutritionalValueId - : productNutritionalValueId // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as Portion, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + dailyNutrition: freezed == dailyNutrition + ? _value.dailyNutrition + : dailyNutrition // ignore: cast_nullable_to_non_nullable + as DailyNutrition?, + productNutritionalValueId: freezed == productNutritionalValueId + ? _value.productNutritionalValueId + : productNutritionalValueId // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } /// Create a copy of DailySchedule @@ -1444,25 +1351,22 @@ class _$DailyScheduleCopyWithImpl<$Res, $Val extends DailySchedule> abstract class _$$DailyScheduleImplCopyWith<$Res> implements $DailyScheduleCopyWith<$Res> { factory _$$DailyScheduleImplCopyWith( - _$DailyScheduleImpl value, - $Res Function(_$DailyScheduleImpl) then, - ) = __$$DailyScheduleImplCopyWithImpl<$Res>; + _$DailyScheduleImpl value, $Res Function(_$DailyScheduleImpl) then) = + __$$DailyScheduleImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "name") String name, - @JsonKey(name: "portion") Portion portion, - @JsonKey(name: "quantity", fromJson: _parseQuantity) int quantity, - @JsonKey(name: 'nutrition', includeToJson: false) - DailyNutrition? dailyNutrition, - @JsonKey( - name: 'product_nutritional_value_id', - includeToJson: true, - includeFromJson: false, - includeIfNull: false, - ) - String? productNutritionalValueId, - }); + $Res call( + {@JsonKey(name: "name") String name, + @JsonKey(name: "portion") Portion portion, + @JsonKey(name: "quantity", fromJson: _parseQuantity) int quantity, + @JsonKey(name: 'nutrition', includeToJson: false) + DailyNutrition? dailyNutrition, + @JsonKey( + name: 'product_nutritional_value_id', + includeToJson: true, + includeFromJson: false, + includeIfNull: false) + String? productNutritionalValueId}); @override $DailyNutritionCopyWith<$Res>? get dailyNutrition; @@ -1473,9 +1377,8 @@ class __$$DailyScheduleImplCopyWithImpl<$Res> extends _$DailyScheduleCopyWithImpl<$Res, _$DailyScheduleImpl> implements _$$DailyScheduleImplCopyWith<$Res> { __$$DailyScheduleImplCopyWithImpl( - _$DailyScheduleImpl _value, - $Res Function(_$DailyScheduleImpl) _then, - ) : super(_value, _then); + _$DailyScheduleImpl _value, $Res Function(_$DailyScheduleImpl) _then) + : super(_value, _then); /// Create a copy of DailySchedule /// with the given fields replaced by the non-null parameter values. @@ -1488,54 +1391,46 @@ class __$$DailyScheduleImplCopyWithImpl<$Res> Object? dailyNutrition = freezed, Object? productNutritionalValueId = freezed, }) { - return _then( - _$DailyScheduleImpl( - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as Portion, - quantity: - null == quantity - ? _value.quantity - : quantity // ignore: cast_nullable_to_non_nullable - as int, - dailyNutrition: - freezed == dailyNutrition - ? _value.dailyNutrition - : dailyNutrition // ignore: cast_nullable_to_non_nullable - as DailyNutrition?, - productNutritionalValueId: - freezed == productNutritionalValueId - ? _value.productNutritionalValueId - : productNutritionalValueId // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$DailyScheduleImpl( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as Portion, + quantity: null == quantity + ? _value.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + dailyNutrition: freezed == dailyNutrition + ? _value.dailyNutrition + : dailyNutrition // ignore: cast_nullable_to_non_nullable + as DailyNutrition?, + productNutritionalValueId: freezed == productNutritionalValueId + ? _value.productNutritionalValueId + : productNutritionalValueId // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc @JsonSerializable() class _$DailyScheduleImpl implements _DailySchedule { - const _$DailyScheduleImpl({ - @JsonKey(name: "name") required this.name, - @JsonKey(name: "portion") required this.portion, - @JsonKey(name: "quantity", fromJson: _parseQuantity) required this.quantity, - @JsonKey(name: 'nutrition', includeToJson: false) this.dailyNutrition, - @JsonKey( - name: 'product_nutritional_value_id', - includeToJson: true, - includeFromJson: false, - includeIfNull: false, - ) - this.productNutritionalValueId, - }); + const _$DailyScheduleImpl( + {@JsonKey(name: "name") required this.name, + @JsonKey(name: "portion") required this.portion, + @JsonKey(name: "quantity", fromJson: _parseQuantity) + required this.quantity, + @JsonKey(name: 'nutrition', includeToJson: false) this.dailyNutrition, + @JsonKey( + name: 'product_nutritional_value_id', + includeToJson: true, + includeFromJson: false, + includeIfNull: false) + this.productNutritionalValueId}); factory _$DailyScheduleImpl.fromJson(Map json) => _$$DailyScheduleImplFromJson(json); @@ -1554,11 +1449,10 @@ class _$DailyScheduleImpl implements _DailySchedule { final DailyNutrition? dailyNutrition; @override @JsonKey( - name: 'product_nutritional_value_id', - includeToJson: true, - includeFromJson: false, - includeIfNull: false, - ) + name: 'product_nutritional_value_id', + includeToJson: true, + includeFromJson: false, + includeIfNull: false) final String? productNutritionalValueId; @override @@ -1577,23 +1471,15 @@ class _$DailyScheduleImpl implements _DailySchedule { other.quantity == quantity) && (identical(other.dailyNutrition, dailyNutrition) || other.dailyNutrition == dailyNutrition) && - (identical( - other.productNutritionalValueId, - productNutritionalValueId, - ) || + (identical(other.productNutritionalValueId, + productNutritionalValueId) || other.productNutritionalValueId == productNutritionalValueId)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - name, - portion, - quantity, - dailyNutrition, - productNutritionalValueId, - ); + int get hashCode => Object.hash(runtimeType, name, portion, quantity, + dailyNutrition, productNutritionalValueId); /// Create a copy of DailySchedule /// with the given fields replaced by the non-null parameter values. @@ -1605,26 +1491,26 @@ class _$DailyScheduleImpl implements _DailySchedule { @override Map toJson() { - return _$$DailyScheduleImplToJson(this); + return _$$DailyScheduleImplToJson( + this, + ); } } abstract class _DailySchedule implements DailySchedule { - const factory _DailySchedule({ - @JsonKey(name: "name") required final String name, - @JsonKey(name: "portion") required final Portion portion, - @JsonKey(name: "quantity", fromJson: _parseQuantity) - required final int quantity, - @JsonKey(name: 'nutrition', includeToJson: false) - final DailyNutrition? dailyNutrition, - @JsonKey( - name: 'product_nutritional_value_id', - includeToJson: true, - includeFromJson: false, - includeIfNull: false, - ) - final String? productNutritionalValueId, - }) = _$DailyScheduleImpl; + const factory _DailySchedule( + {@JsonKey(name: "name") required final String name, + @JsonKey(name: "portion") required final Portion portion, + @JsonKey(name: "quantity", fromJson: _parseQuantity) + required final int quantity, + @JsonKey(name: 'nutrition', includeToJson: false) + final DailyNutrition? dailyNutrition, + @JsonKey( + name: 'product_nutritional_value_id', + includeToJson: true, + includeFromJson: false, + includeIfNull: false) + final String? productNutritionalValueId}) = _$DailyScheduleImpl; factory _DailySchedule.fromJson(Map json) = _$DailyScheduleImpl.fromJson; @@ -1643,11 +1529,10 @@ abstract class _DailySchedule implements DailySchedule { DailyNutrition? get dailyNutrition; @override @JsonKey( - name: 'product_nutritional_value_id', - includeToJson: true, - includeFromJson: false, - includeIfNull: false, - ) + name: 'product_nutritional_value_id', + includeToJson: true, + includeFromJson: false, + includeIfNull: false) String? get productNutritionalValueId; /// Create a copy of DailySchedule @@ -1688,12 +1573,11 @@ abstract class $DietTypeCopyWith<$Res> { factory $DietTypeCopyWith(DietType value, $Res Function(DietType) then) = _$DietTypeCopyWithImpl<$Res, DietType>; @useResult - $Res call({ - @JsonKey(name: "light") bool? light, - @JsonKey(name: "veg") bool? veg, - @JsonKey(name: "carb") bool? carb, - @JsonKey(name: "meat") bool? meat, - }); + $Res call( + {@JsonKey(name: "light") bool? light, + @JsonKey(name: "veg") bool? veg, + @JsonKey(name: "carb") bool? carb, + @JsonKey(name: "meat") bool? meat}); } /// @nodoc @@ -1716,31 +1600,24 @@ class _$DietTypeCopyWithImpl<$Res, $Val extends DietType> Object? carb = freezed, Object? meat = freezed, }) { - return _then( - _value.copyWith( - light: - freezed == light - ? _value.light - : light // ignore: cast_nullable_to_non_nullable - as bool?, - veg: - freezed == veg - ? _value.veg - : veg // ignore: cast_nullable_to_non_nullable - as bool?, - carb: - freezed == carb - ? _value.carb - : carb // ignore: cast_nullable_to_non_nullable - as bool?, - meat: - freezed == meat - ? _value.meat - : meat // ignore: cast_nullable_to_non_nullable - as bool?, - ) - as $Val, - ); + return _then(_value.copyWith( + light: freezed == light + ? _value.light + : light // ignore: cast_nullable_to_non_nullable + as bool?, + veg: freezed == veg + ? _value.veg + : veg // ignore: cast_nullable_to_non_nullable + as bool?, + carb: freezed == carb + ? _value.carb + : carb // ignore: cast_nullable_to_non_nullable + as bool?, + meat: freezed == meat + ? _value.meat + : meat // ignore: cast_nullable_to_non_nullable + as bool?, + ) as $Val); } } @@ -1748,17 +1625,15 @@ class _$DietTypeCopyWithImpl<$Res, $Val extends DietType> abstract class _$$DietTypeImplCopyWith<$Res> implements $DietTypeCopyWith<$Res> { factory _$$DietTypeImplCopyWith( - _$DietTypeImpl value, - $Res Function(_$DietTypeImpl) then, - ) = __$$DietTypeImplCopyWithImpl<$Res>; + _$DietTypeImpl value, $Res Function(_$DietTypeImpl) then) = + __$$DietTypeImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "light") bool? light, - @JsonKey(name: "veg") bool? veg, - @JsonKey(name: "carb") bool? carb, - @JsonKey(name: "meat") bool? meat, - }); + $Res call( + {@JsonKey(name: "light") bool? light, + @JsonKey(name: "veg") bool? veg, + @JsonKey(name: "carb") bool? carb, + @JsonKey(name: "meat") bool? meat}); } /// @nodoc @@ -1766,9 +1641,8 @@ class __$$DietTypeImplCopyWithImpl<$Res> extends _$DietTypeCopyWithImpl<$Res, _$DietTypeImpl> implements _$$DietTypeImplCopyWith<$Res> { __$$DietTypeImplCopyWithImpl( - _$DietTypeImpl _value, - $Res Function(_$DietTypeImpl) _then, - ) : super(_value, _then); + _$DietTypeImpl _value, $Res Function(_$DietTypeImpl) _then) + : super(_value, _then); /// Create a copy of DietType /// with the given fields replaced by the non-null parameter values. @@ -1780,42 +1654,36 @@ class __$$DietTypeImplCopyWithImpl<$Res> Object? carb = freezed, Object? meat = freezed, }) { - return _then( - _$DietTypeImpl( - light: - freezed == light - ? _value.light - : light // ignore: cast_nullable_to_non_nullable - as bool?, - veg: - freezed == veg - ? _value.veg - : veg // ignore: cast_nullable_to_non_nullable - as bool?, - carb: - freezed == carb - ? _value.carb - : carb // ignore: cast_nullable_to_non_nullable - as bool?, - meat: - freezed == meat - ? _value.meat - : meat // ignore: cast_nullable_to_non_nullable - as bool?, - ), - ); + return _then(_$DietTypeImpl( + light: freezed == light + ? _value.light + : light // ignore: cast_nullable_to_non_nullable + as bool?, + veg: freezed == veg + ? _value.veg + : veg // ignore: cast_nullable_to_non_nullable + as bool?, + carb: freezed == carb + ? _value.carb + : carb // ignore: cast_nullable_to_non_nullable + as bool?, + meat: freezed == meat + ? _value.meat + : meat // ignore: cast_nullable_to_non_nullable + as bool?, + )); } } /// @nodoc @JsonSerializable() class _$DietTypeImpl extends _DietType { - const _$DietTypeImpl({ - @JsonKey(name: "light") this.light, - @JsonKey(name: "veg") this.veg, - @JsonKey(name: "carb") this.carb, - @JsonKey(name: "meat") this.meat, - }) : super._(); + const _$DietTypeImpl( + {@JsonKey(name: "light") this.light, + @JsonKey(name: "veg") this.veg, + @JsonKey(name: "carb") this.carb, + @JsonKey(name: "meat") this.meat}) + : super._(); factory _$DietTypeImpl.fromJson(Map json) => _$$DietTypeImplFromJson(json); @@ -1863,17 +1731,18 @@ class _$DietTypeImpl extends _DietType { @override Map toJson() { - return _$$DietTypeImplToJson(this); + return _$$DietTypeImplToJson( + this, + ); } } abstract class _DietType extends DietType { - const factory _DietType({ - @JsonKey(name: "light") final bool? light, - @JsonKey(name: "veg") final bool? veg, - @JsonKey(name: "carb") final bool? carb, - @JsonKey(name: "meat") final bool? meat, - }) = _$DietTypeImpl; + const factory _DietType( + {@JsonKey(name: "light") final bool? light, + @JsonKey(name: "veg") final bool? veg, + @JsonKey(name: "carb") final bool? carb, + @JsonKey(name: "meat") final bool? meat}) = _$DietTypeImpl; const _DietType._() : super._(); factory _DietType.fromJson(Map json) = @@ -1928,16 +1797,14 @@ mixin _$DailyNutrition { /// @nodoc abstract class $DailyNutritionCopyWith<$Res> { factory $DailyNutritionCopyWith( - DailyNutrition value, - $Res Function(DailyNutrition) then, - ) = _$DailyNutritionCopyWithImpl<$Res, DailyNutrition>; + DailyNutrition value, $Res Function(DailyNutrition) then) = + _$DailyNutritionCopyWithImpl<$Res, DailyNutrition>; @useResult - $Res call({ - @JsonKey(name: 'energy') double energy, - @JsonKey(name: 'proteins') double proteins, - @JsonKey(name: 'fats') double fats, - @JsonKey(name: 'carbohydrates') double carbohydrates, - }); + $Res call( + {@JsonKey(name: 'energy') double energy, + @JsonKey(name: 'proteins') double proteins, + @JsonKey(name: 'fats') double fats, + @JsonKey(name: 'carbohydrates') double carbohydrates}); } /// @nodoc @@ -1960,49 +1827,40 @@ class _$DailyNutritionCopyWithImpl<$Res, $Val extends DailyNutrition> Object? fats = null, Object? carbohydrates = null, }) { - return _then( - _value.copyWith( - energy: - null == energy - ? _value.energy - : energy // ignore: cast_nullable_to_non_nullable - as double, - proteins: - null == proteins - ? _value.proteins - : proteins // ignore: cast_nullable_to_non_nullable - as double, - fats: - null == fats - ? _value.fats - : fats // ignore: cast_nullable_to_non_nullable - as double, - carbohydrates: - null == carbohydrates - ? _value.carbohydrates - : carbohydrates // ignore: cast_nullable_to_non_nullable - as double, - ) - as $Val, - ); + return _then(_value.copyWith( + energy: null == energy + ? _value.energy + : energy // ignore: cast_nullable_to_non_nullable + as double, + proteins: null == proteins + ? _value.proteins + : proteins // ignore: cast_nullable_to_non_nullable + as double, + fats: null == fats + ? _value.fats + : fats // ignore: cast_nullable_to_non_nullable + as double, + carbohydrates: null == carbohydrates + ? _value.carbohydrates + : carbohydrates // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); } } /// @nodoc abstract class _$$DailyNutritionImplCopyWith<$Res> implements $DailyNutritionCopyWith<$Res> { - factory _$$DailyNutritionImplCopyWith( - _$DailyNutritionImpl value, - $Res Function(_$DailyNutritionImpl) then, - ) = __$$DailyNutritionImplCopyWithImpl<$Res>; + factory _$$DailyNutritionImplCopyWith(_$DailyNutritionImpl value, + $Res Function(_$DailyNutritionImpl) then) = + __$$DailyNutritionImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'energy') double energy, - @JsonKey(name: 'proteins') double proteins, - @JsonKey(name: 'fats') double fats, - @JsonKey(name: 'carbohydrates') double carbohydrates, - }); + $Res call( + {@JsonKey(name: 'energy') double energy, + @JsonKey(name: 'proteins') double proteins, + @JsonKey(name: 'fats') double fats, + @JsonKey(name: 'carbohydrates') double carbohydrates}); } /// @nodoc @@ -2010,9 +1868,8 @@ class __$$DailyNutritionImplCopyWithImpl<$Res> extends _$DailyNutritionCopyWithImpl<$Res, _$DailyNutritionImpl> implements _$$DailyNutritionImplCopyWith<$Res> { __$$DailyNutritionImplCopyWithImpl( - _$DailyNutritionImpl _value, - $Res Function(_$DailyNutritionImpl) _then, - ) : super(_value, _then); + _$DailyNutritionImpl _value, $Res Function(_$DailyNutritionImpl) _then) + : super(_value, _then); /// Create a copy of DailyNutrition /// with the given fields replaced by the non-null parameter values. @@ -2024,42 +1881,35 @@ class __$$DailyNutritionImplCopyWithImpl<$Res> Object? fats = null, Object? carbohydrates = null, }) { - return _then( - _$DailyNutritionImpl( - energy: - null == energy - ? _value.energy - : energy // ignore: cast_nullable_to_non_nullable - as double, - proteins: - null == proteins - ? _value.proteins - : proteins // ignore: cast_nullable_to_non_nullable - as double, - fats: - null == fats - ? _value.fats - : fats // ignore: cast_nullable_to_non_nullable - as double, - carbohydrates: - null == carbohydrates - ? _value.carbohydrates - : carbohydrates // ignore: cast_nullable_to_non_nullable - as double, - ), - ); + return _then(_$DailyNutritionImpl( + energy: null == energy + ? _value.energy + : energy // ignore: cast_nullable_to_non_nullable + as double, + proteins: null == proteins + ? _value.proteins + : proteins // ignore: cast_nullable_to_non_nullable + as double, + fats: null == fats + ? _value.fats + : fats // ignore: cast_nullable_to_non_nullable + as double, + carbohydrates: null == carbohydrates + ? _value.carbohydrates + : carbohydrates // ignore: cast_nullable_to_non_nullable + as double, + )); } } /// @nodoc @JsonSerializable() class _$DailyNutritionImpl implements _DailyNutrition { - const _$DailyNutritionImpl({ - @JsonKey(name: 'energy') required this.energy, - @JsonKey(name: 'proteins') required this.proteins, - @JsonKey(name: 'fats') required this.fats, - @JsonKey(name: 'carbohydrates') required this.carbohydrates, - }); + const _$DailyNutritionImpl( + {@JsonKey(name: 'energy') required this.energy, + @JsonKey(name: 'proteins') required this.proteins, + @JsonKey(name: 'fats') required this.fats, + @JsonKey(name: 'carbohydrates') required this.carbohydrates}); factory _$DailyNutritionImpl.fromJson(Map json) => _$$DailyNutritionImplFromJson(json); @@ -2107,23 +1957,23 @@ class _$DailyNutritionImpl implements _DailyNutrition { @pragma('vm:prefer-inline') _$$DailyNutritionImplCopyWith<_$DailyNutritionImpl> get copyWith => __$$DailyNutritionImplCopyWithImpl<_$DailyNutritionImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$DailyNutritionImplToJson(this); + return _$$DailyNutritionImplToJson( + this, + ); } } abstract class _DailyNutrition implements DailyNutrition { - const factory _DailyNutrition({ - @JsonKey(name: 'energy') required final double energy, - @JsonKey(name: 'proteins') required final double proteins, - @JsonKey(name: 'fats') required final double fats, - @JsonKey(name: 'carbohydrates') required final double carbohydrates, - }) = _$DailyNutritionImpl; + const factory _DailyNutrition( + {@JsonKey(name: 'energy') required final double energy, + @JsonKey(name: 'proteins') required final double proteins, + @JsonKey(name: 'fats') required final double fats, + @JsonKey(name: 'carbohydrates') + required final double carbohydrates}) = _$DailyNutritionImpl; factory _DailyNutrition.fromJson(Map json) = _$DailyNutritionImpl.fromJson; diff --git a/lib/features/feed/models/diets_pagination_model.g.dart b/lib/features/feed/models/diets_pagination_model.g.dart index 93258944..e5c5ed6d 100644 --- a/lib/features/feed/models/diets_pagination_model.g.dart +++ b/lib/features/feed/models/diets_pagination_model.g.dart @@ -7,87 +7,75 @@ part of 'diets_pagination_model.dart'; // ************************************************************************** _$DietsPaginationImpl _$$DietsPaginationImplFromJson( - Map json, -) => _$DietsPaginationImpl( - data: - (json['data'] as List) + Map json) => + _$DietsPaginationImpl( + data: (json['data'] as List) .map((e) => Diet.fromJson(e as Map)) .toList(), - links: Links.fromJson(json['links'] as Map), - meta: Meta.fromJson(json['meta'] as Map), -); + links: Links.fromJson(json['links'] as Map), + meta: Meta.fromJson(json['meta'] as Map), + ); Map _$$DietsPaginationImplToJson( - _$DietsPaginationImpl instance, -) => { - 'data': instance.data, - 'links': instance.links, - 'meta': instance.meta, -}; + _$DietsPaginationImpl instance) => + { + 'data': instance.data, + 'links': instance.links, + 'meta': instance.meta, + }; _$DietImpl _$$DietImplFromJson(Map json) => _$DietImpl( - id: (json['id'] as num).toInt(), - name: json['name'] as String, - image: json['image'] as String, - duration: (json['duration'] as num).toInt(), - state: $enumDecode(_$DietStateEnumMap, json['state']), - type: DietType.fromJson(json['type'] as Map), - details: json['description_md'] as String, - dailySchedule: (json['daily_schedule'] as Map).map( - (k, e) => MapEntry( - int.parse(k), - (e as Map).map( + id: (json['id'] as num).toInt(), + name: json['name'] as String, + image: json['image'] as String, + duration: (json['duration'] as num).toInt(), + state: $enumDecode(_$DietStateEnumMap, json['state']), + type: DietType.fromJson(json['type'] as Map), + details: json['description_md'] as String, + dailySchedule: (json['daily_schedule'] as Map).map( (k, e) => MapEntry( - int.parse(k), - (e as Map).map( - (k, e) => MapEntry( - int.parse(k), - DailySchedule.fromJson(e as Map), - ), - ), - ), + int.parse(k), + (e as Map).map( + (k, e) => MapEntry( + int.parse(k), + (e as Map).map( + (k, e) => MapEntry(int.parse(k), + DailySchedule.fromJson(e as Map)), + )), + )), ), - ), - ), - author: Author.fromJson(json['author'] as Map), - totalLikes: (json['total_likes'] as num).toInt(), - totalViews: (json['total_views'] as num).toInt(), - totalComments: (json['total_comments'] as num).toInt(), - wasLikedByMe: json['was_liked_by_me'] as bool, - isFavorite: json['is_favorite'] as bool, - dailyNutrition: - (json['daily_nutrition'] as List) + author: Author.fromJson(json['author'] as Map), + totalLikes: (json['total_likes'] as num).toInt(), + totalViews: (json['total_views'] as num).toInt(), + totalComments: (json['total_comments'] as num).toInt(), + wasLikedByMe: json['was_liked_by_me'] as bool, + isFavorite: json['is_favorite'] as bool, + dailyNutrition: (json['daily_nutrition'] as List) .map((e) => DailyNutrition.fromJson(e as Map)) .toList(), -); + ); -Map _$$DietImplToJson( - _$DietImpl instance, -) => { - 'id': instance.id, - 'name': instance.name, - 'image': instance.image, - 'duration': instance.duration, - 'state': _$DietStateEnumMap[instance.state]!, - 'type': instance.type, - 'description_md': instance.details, - 'daily_schedule': instance.dailySchedule.map( - (k, e) => MapEntry( - k.toString(), - e.map( - (k, e) => - MapEntry(k.toString(), e.map((k, e) => MapEntry(k.toString(), e))), - ), - ), - ), - 'author': instance.author, - 'total_likes': instance.totalLikes, - 'total_views': instance.totalViews, - 'total_comments': instance.totalComments, - 'was_liked_by_me': instance.wasLikedByMe, - 'is_favorite': instance.isFavorite, - 'daily_nutrition': instance.dailyNutrition, -}; +Map _$$DietImplToJson(_$DietImpl instance) => + { + 'id': instance.id, + 'name': instance.name, + 'image': instance.image, + 'duration': instance.duration, + 'state': _$DietStateEnumMap[instance.state]!, + 'type': instance.type, + 'description_md': instance.details, + 'daily_schedule': instance.dailySchedule.map((k, e) => MapEntry( + k.toString(), + e.map((k, e) => MapEntry( + k.toString(), e.map((k, e) => MapEntry(k.toString(), e)))))), + 'author': instance.author, + 'total_likes': instance.totalLikes, + 'total_views': instance.totalViews, + 'total_comments': instance.totalComments, + 'was_liked_by_me': instance.wasLikedByMe, + 'is_favorite': instance.isFavorite, + 'daily_nutrition': instance.dailyNutrition, + }; const _$DietStateEnumMap = { DietState.active: 'active', @@ -96,19 +84,23 @@ const _$DietStateEnumMap = { }; _$CreatedDietImpl _$$CreatedDietImplFromJson(Map json) => - _$CreatedDietImpl(id: (json['id'] as num).toInt()); + _$CreatedDietImpl( + id: (json['id'] as num).toInt(), + ); Map _$$CreatedDietImplToJson(_$CreatedDietImpl instance) => - {'id': instance.id}; + { + 'id': instance.id, + }; _$AuthorImpl _$$AuthorImplFromJson(Map json) => _$AuthorImpl( - authorSlug: json['author_slug'] as String, - authorName: json['author_name'] as String, - authorProfileIcon: json['author_profile_icon'] as String, - authorIsMe: json['author_is_me'] as bool, - isEntitySubscribedByMe: json['is_entity_subscribed_by_me'] as bool?, - authorPlaceInRating: (json['author_place_in_rating'] as num?)?.toInt(), -); + authorSlug: json['author_slug'] as String, + authorName: json['author_name'] as String, + authorProfileIcon: json['author_profile_icon'] as String, + authorIsMe: json['author_is_me'] as bool, + isEntitySubscribedByMe: json['is_entity_subscribed_by_me'] as bool?, + authorPlaceInRating: (json['author_place_in_rating'] as num?)?.toInt(), + ); Map _$$AuthorImplToJson(_$AuthorImpl instance) => { @@ -125,12 +117,9 @@ _$DailyScheduleImpl _$$DailyScheduleImplFromJson(Map json) => name: json['name'] as String, portion: $enumDecode(_$PortionEnumMap, json['portion']), quantity: _parseQuantity(json['quantity']), - dailyNutrition: - json['nutrition'] == null - ? null - : DailyNutrition.fromJson( - json['nutrition'] as Map, - ), + dailyNutrition: json['nutrition'] == null + ? null + : DailyNutrition.fromJson(json['nutrition'] as Map), ); Map _$$DailyScheduleImplToJson(_$DailyScheduleImpl instance) => @@ -143,9 +132,9 @@ Map _$$DailyScheduleImplToJson(_$DailyScheduleImpl instance) => }; const _$PortionEnumMap = { - Portion.GRAMS: 'gr', - Portion.MILLILITERS: 'milliliters', - Portion.PCS: 'pcs', + Portion.grams: 'gr', + Portion.milliliters: 'milliliters', + Portion.pcs: 'pcs', }; _$DietTypeImpl _$$DietTypeImplFromJson(Map json) => @@ -173,10 +162,10 @@ _$DailyNutritionImpl _$$DailyNutritionImplFromJson(Map json) => ); Map _$$DailyNutritionImplToJson( - _$DailyNutritionImpl instance, -) => { - 'energy': instance.energy, - 'proteins': instance.proteins, - 'fats': instance.fats, - 'carbohydrates': instance.carbohydrates, -}; + _$DailyNutritionImpl instance) => + { + 'energy': instance.energy, + 'proteins': instance.proteins, + 'fats': instance.fats, + 'carbohydrates': instance.carbohydrates, + }; diff --git a/lib/features/feed/models/feed_blog_post_model.freezed.dart b/lib/features/feed/models/feed_blog_post_model.freezed.dart index 48ffdc6b..4b2ad476 100644 --- a/lib/features/feed/models/feed_blog_post_model.freezed.dart +++ b/lib/features/feed/models/feed_blog_post_model.freezed.dart @@ -12,8 +12,7 @@ part of 'feed_blog_post_model.dart'; 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', -); + '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'); FeedBlogPostModel _$FeedBlogPostModelFromJson(Map json) { return _FeedBlogPostModel.fromJson(json); @@ -55,25 +54,23 @@ mixin _$FeedBlogPostModel { /// @nodoc abstract class $FeedBlogPostModelCopyWith<$Res> { factory $FeedBlogPostModelCopyWith( - FeedBlogPostModel value, - $Res Function(FeedBlogPostModel) then, - ) = _$FeedBlogPostModelCopyWithImpl<$Res, FeedBlogPostModel>; + FeedBlogPostModel value, $Res Function(FeedBlogPostModel) then) = + _$FeedBlogPostModelCopyWithImpl<$Res, FeedBlogPostModel>; @useResult - $Res call({ - int id, - String state, - String image, - String description, - Author author, - @JsonKey(name: "video_url") String videoUrl, - @JsonKey(name: "created_at", fromJson: parseDate) DateTime createdAt, - @JsonKey(name: "updated_at", fromJson: parseDate) DateTime updatedAt, - String title, - @JsonKey(name: "total_likes") int totalLikes, - @JsonKey(name: "total_views") int totalViews, - @JsonKey(name: "total_comments") int totalComments, - @JsonKey(name: "was_liked_by_me") bool wasLikedByMe, - }); + $Res call( + {int id, + String state, + String image, + String description, + Author author, + @JsonKey(name: "video_url") String videoUrl, + @JsonKey(name: "created_at", fromJson: parseDate) DateTime createdAt, + @JsonKey(name: "updated_at", fromJson: parseDate) DateTime updatedAt, + String title, + @JsonKey(name: "total_likes") int totalLikes, + @JsonKey(name: "total_views") int totalViews, + @JsonKey(name: "total_comments") int totalComments, + @JsonKey(name: "was_liked_by_me") bool wasLikedByMe}); $AuthorCopyWith<$Res> get author; } @@ -107,76 +104,60 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> Object? totalComments = null, Object? wasLikedByMe = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - author: - null == author - ? _value.author - : author // ignore: cast_nullable_to_non_nullable - as Author, - videoUrl: - null == videoUrl - ? _value.videoUrl - : videoUrl // ignore: cast_nullable_to_non_nullable - as String, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - totalLikes: - null == totalLikes - ? _value.totalLikes - : totalLikes // ignore: cast_nullable_to_non_nullable - as int, - totalViews: - null == totalViews - ? _value.totalViews - : totalViews // ignore: cast_nullable_to_non_nullable - as int, - totalComments: - null == totalComments - ? _value.totalComments - : totalComments // ignore: cast_nullable_to_non_nullable - as int, - wasLikedByMe: - null == wasLikedByMe - ? _value.wasLikedByMe - : wasLikedByMe // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + author: null == author + ? _value.author + : author // ignore: cast_nullable_to_non_nullable + as Author, + videoUrl: null == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + totalLikes: null == totalLikes + ? _value.totalLikes + : totalLikes // ignore: cast_nullable_to_non_nullable + as int, + totalViews: null == totalViews + ? _value.totalViews + : totalViews // ignore: cast_nullable_to_non_nullable + as int, + totalComments: null == totalComments + ? _value.totalComments + : totalComments // ignore: cast_nullable_to_non_nullable + as int, + wasLikedByMe: null == wasLikedByMe + ? _value.wasLikedByMe + : wasLikedByMe // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } /// Create a copy of FeedBlogPostModel @@ -193,27 +174,25 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> /// @nodoc abstract class _$$FeedBlogPostModelImplCopyWith<$Res> implements $FeedBlogPostModelCopyWith<$Res> { - factory _$$FeedBlogPostModelImplCopyWith( - _$FeedBlogPostModelImpl value, - $Res Function(_$FeedBlogPostModelImpl) then, - ) = __$$FeedBlogPostModelImplCopyWithImpl<$Res>; + factory _$$FeedBlogPostModelImplCopyWith(_$FeedBlogPostModelImpl value, + $Res Function(_$FeedBlogPostModelImpl) then) = + __$$FeedBlogPostModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - int id, - String state, - String image, - String description, - Author author, - @JsonKey(name: "video_url") String videoUrl, - @JsonKey(name: "created_at", fromJson: parseDate) DateTime createdAt, - @JsonKey(name: "updated_at", fromJson: parseDate) DateTime updatedAt, - String title, - @JsonKey(name: "total_likes") int totalLikes, - @JsonKey(name: "total_views") int totalViews, - @JsonKey(name: "total_comments") int totalComments, - @JsonKey(name: "was_liked_by_me") bool wasLikedByMe, - }); + $Res call( + {int id, + String state, + String image, + String description, + Author author, + @JsonKey(name: "video_url") String videoUrl, + @JsonKey(name: "created_at", fromJson: parseDate) DateTime createdAt, + @JsonKey(name: "updated_at", fromJson: parseDate) DateTime updatedAt, + String title, + @JsonKey(name: "total_likes") int totalLikes, + @JsonKey(name: "total_views") int totalViews, + @JsonKey(name: "total_comments") int totalComments, + @JsonKey(name: "was_liked_by_me") bool wasLikedByMe}); @override $AuthorCopyWith<$Res> get author; @@ -223,10 +202,9 @@ abstract class _$$FeedBlogPostModelImplCopyWith<$Res> class __$$FeedBlogPostModelImplCopyWithImpl<$Res> extends _$FeedBlogPostModelCopyWithImpl<$Res, _$FeedBlogPostModelImpl> implements _$$FeedBlogPostModelImplCopyWith<$Res> { - __$$FeedBlogPostModelImplCopyWithImpl( - _$FeedBlogPostModelImpl _value, - $Res Function(_$FeedBlogPostModelImpl) _then, - ) : super(_value, _then); + __$$FeedBlogPostModelImplCopyWithImpl(_$FeedBlogPostModelImpl _value, + $Res Function(_$FeedBlogPostModelImpl) _then) + : super(_value, _then); /// Create a copy of FeedBlogPostModel /// with the given fields replaced by the non-null parameter values. @@ -247,96 +225,80 @@ class __$$FeedBlogPostModelImplCopyWithImpl<$Res> Object? totalComments = null, Object? wasLikedByMe = null, }) { - return _then( - _$FeedBlogPostModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - author: - null == author - ? _value.author - : author // ignore: cast_nullable_to_non_nullable - as Author, - videoUrl: - null == videoUrl - ? _value.videoUrl - : videoUrl // ignore: cast_nullable_to_non_nullable - as String, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - totalLikes: - null == totalLikes - ? _value.totalLikes - : totalLikes // ignore: cast_nullable_to_non_nullable - as int, - totalViews: - null == totalViews - ? _value.totalViews - : totalViews // ignore: cast_nullable_to_non_nullable - as int, - totalComments: - null == totalComments - ? _value.totalComments - : totalComments // ignore: cast_nullable_to_non_nullable - as int, - wasLikedByMe: - null == wasLikedByMe - ? _value.wasLikedByMe - : wasLikedByMe // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + return _then(_$FeedBlogPostModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + author: null == author + ? _value.author + : author // ignore: cast_nullable_to_non_nullable + as Author, + videoUrl: null == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + totalLikes: null == totalLikes + ? _value.totalLikes + : totalLikes // ignore: cast_nullable_to_non_nullable + as int, + totalViews: null == totalViews + ? _value.totalViews + : totalViews // ignore: cast_nullable_to_non_nullable + as int, + totalComments: null == totalComments + ? _value.totalComments + : totalComments // ignore: cast_nullable_to_non_nullable + as int, + wasLikedByMe: null == wasLikedByMe + ? _value.wasLikedByMe + : wasLikedByMe // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc @JsonSerializable() class _$FeedBlogPostModelImpl implements _FeedBlogPostModel { - const _$FeedBlogPostModelImpl({ - required this.id, - required this.state, - required this.image, - required this.description, - required this.author, - @JsonKey(name: "video_url") required this.videoUrl, - @JsonKey(name: "created_at", fromJson: parseDate) required this.createdAt, - @JsonKey(name: "updated_at", fromJson: parseDate) required this.updatedAt, - required this.title, - @JsonKey(name: "total_likes") required this.totalLikes, - @JsonKey(name: "total_views") required this.totalViews, - @JsonKey(name: "total_comments") required this.totalComments, - @JsonKey(name: "was_liked_by_me") required this.wasLikedByMe, - }); + const _$FeedBlogPostModelImpl( + {required this.id, + required this.state, + required this.image, + required this.description, + required this.author, + @JsonKey(name: "video_url") required this.videoUrl, + @JsonKey(name: "created_at", fromJson: parseDate) required this.createdAt, + @JsonKey(name: "updated_at", fromJson: parseDate) required this.updatedAt, + required this.title, + @JsonKey(name: "total_likes") required this.totalLikes, + @JsonKey(name: "total_views") required this.totalViews, + @JsonKey(name: "total_comments") required this.totalComments, + @JsonKey(name: "was_liked_by_me") required this.wasLikedByMe}); factory _$FeedBlogPostModelImpl.fromJson(Map json) => _$$FeedBlogPostModelImplFromJson(json); @@ -411,21 +373,20 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - id, - state, - image, - description, - author, - videoUrl, - createdAt, - updatedAt, - title, - totalLikes, - totalViews, - totalComments, - wasLikedByMe, - ); + runtimeType, + id, + state, + image, + description, + author, + videoUrl, + createdAt, + updatedAt, + title, + totalLikes, + totalViews, + totalComments, + wasLikedByMe); /// Create a copy of FeedBlogPostModel /// with the given fields replaced by the non-null parameter values. @@ -434,34 +395,34 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel { @pragma('vm:prefer-inline') _$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith => __$$FeedBlogPostModelImplCopyWithImpl<_$FeedBlogPostModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$FeedBlogPostModelImplToJson(this); + return _$$FeedBlogPostModelImplToJson( + this, + ); } } abstract class _FeedBlogPostModel implements FeedBlogPostModel { - const factory _FeedBlogPostModel({ - required final int id, - required final String state, - required final String image, - required final String description, - required final Author author, - @JsonKey(name: "video_url") required final String videoUrl, - @JsonKey(name: "created_at", fromJson: parseDate) - required final DateTime createdAt, - @JsonKey(name: "updated_at", fromJson: parseDate) - required final DateTime updatedAt, - required final String title, - @JsonKey(name: "total_likes") required final int totalLikes, - @JsonKey(name: "total_views") required final int totalViews, - @JsonKey(name: "total_comments") required final int totalComments, - @JsonKey(name: "was_liked_by_me") required final bool wasLikedByMe, - }) = _$FeedBlogPostModelImpl; + const factory _FeedBlogPostModel( + {required final int id, + required final String state, + required final String image, + required final String description, + required final Author author, + @JsonKey(name: "video_url") required final String videoUrl, + @JsonKey(name: "created_at", fromJson: parseDate) + required final DateTime createdAt, + @JsonKey(name: "updated_at", fromJson: parseDate) + required final DateTime updatedAt, + required final String title, + @JsonKey(name: "total_likes") required final int totalLikes, + @JsonKey(name: "total_views") required final int totalViews, + @JsonKey(name: "total_comments") required final int totalComments, + @JsonKey(name: "was_liked_by_me") required final bool wasLikedByMe}) = + _$FeedBlogPostModelImpl; factory _FeedBlogPostModel.fromJson(Map json) = _$FeedBlogPostModelImpl.fromJson; diff --git a/lib/features/feed/models/feed_blog_post_model.g.dart b/lib/features/feed/models/feed_blog_post_model.g.dart index 82fe9e9f..024d2b47 100644 --- a/lib/features/feed/models/feed_blog_post_model.g.dart +++ b/lib/features/feed/models/feed_blog_post_model.g.dart @@ -7,37 +7,37 @@ part of 'feed_blog_post_model.dart'; // ************************************************************************** _$FeedBlogPostModelImpl _$$FeedBlogPostModelImplFromJson( - Map json, -) => _$FeedBlogPostModelImpl( - id: (json['id'] as num).toInt(), - state: json['state'] as String, - image: json['image'] as String, - description: json['description'] as String, - author: Author.fromJson(json['author'] as Map), - videoUrl: json['video_url'] as String, - createdAt: parseDate(json['created_at'] as String), - updatedAt: parseDate(json['updated_at'] as String), - title: json['title'] as String, - totalLikes: (json['total_likes'] as num).toInt(), - totalViews: (json['total_views'] as num).toInt(), - totalComments: (json['total_comments'] as num).toInt(), - wasLikedByMe: json['was_liked_by_me'] as bool, -); + Map json) => + _$FeedBlogPostModelImpl( + id: (json['id'] as num).toInt(), + state: json['state'] as String, + image: json['image'] as String, + description: json['description'] as String, + author: Author.fromJson(json['author'] as Map), + videoUrl: json['video_url'] as String, + createdAt: parseDate(json['created_at'] as String), + updatedAt: parseDate(json['updated_at'] as String), + title: json['title'] as String, + totalLikes: (json['total_likes'] as num).toInt(), + totalViews: (json['total_views'] as num).toInt(), + totalComments: (json['total_comments'] as num).toInt(), + wasLikedByMe: json['was_liked_by_me'] as bool, + ); Map _$$FeedBlogPostModelImplToJson( - _$FeedBlogPostModelImpl instance, -) => { - 'id': instance.id, - 'state': instance.state, - 'image': instance.image, - 'description': instance.description, - 'author': instance.author, - 'video_url': instance.videoUrl, - 'created_at': instance.createdAt.toIso8601String(), - 'updated_at': instance.updatedAt.toIso8601String(), - 'title': instance.title, - 'total_likes': instance.totalLikes, - 'total_views': instance.totalViews, - 'total_comments': instance.totalComments, - 'was_liked_by_me': instance.wasLikedByMe, -}; + _$FeedBlogPostModelImpl instance) => + { + 'id': instance.id, + 'state': instance.state, + 'image': instance.image, + 'description': instance.description, + 'author': instance.author, + 'video_url': instance.videoUrl, + 'created_at': instance.createdAt.toIso8601String(), + 'updated_at': instance.updatedAt.toIso8601String(), + 'title': instance.title, + 'total_likes': instance.totalLikes, + 'total_views': instance.totalViews, + 'total_comments': instance.totalComments, + 'was_liked_by_me': instance.wasLikedByMe, + }; diff --git a/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart index fb7c0eb3..9bddceae 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart @@ -12,12 +12,10 @@ part of 'feed_blog_post_settings_model.dart'; 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', -); + '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'); FeedBlogPostSettingsModel _$FeedBlogPostSettingsModelFromJson( - Map json, -) { + Map json) { return _FeedBlogPostSettingsModel.fromJson(json); } @@ -40,24 +38,20 @@ mixin _$FeedBlogPostSettingsModel { /// @nodoc abstract class $FeedBlogPostSettingsModelCopyWith<$Res> { - factory $FeedBlogPostSettingsModelCopyWith( - FeedBlogPostSettingsModel value, - $Res Function(FeedBlogPostSettingsModel) then, - ) = _$FeedBlogPostSettingsModelCopyWithImpl<$Res, FeedBlogPostSettingsModel>; + factory $FeedBlogPostSettingsModelCopyWith(FeedBlogPostSettingsModel value, + $Res Function(FeedBlogPostSettingsModel) then) = + _$FeedBlogPostSettingsModelCopyWithImpl<$Res, FeedBlogPostSettingsModel>; @useResult - $Res call({ - @JsonKey(name: 'data') List feedBlogPostList, - Meta meta, - }); + $Res call( + {@JsonKey(name: 'data') List feedBlogPostList, + Meta meta}); $MetaCopyWith<$Res> get meta; } /// @nodoc -class _$FeedBlogPostSettingsModelCopyWithImpl< - $Res, - $Val extends FeedBlogPostSettingsModel -> +class _$FeedBlogPostSettingsModelCopyWithImpl<$Res, + $Val extends FeedBlogPostSettingsModel> implements $FeedBlogPostSettingsModelCopyWith<$Res> { _$FeedBlogPostSettingsModelCopyWithImpl(this._value, this._then); @@ -70,22 +64,20 @@ class _$FeedBlogPostSettingsModelCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? feedBlogPostList = null, Object? meta = null}) { - return _then( - _value.copyWith( - feedBlogPostList: - null == feedBlogPostList - ? _value.feedBlogPostList - : feedBlogPostList // ignore: cast_nullable_to_non_nullable - as List, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ) - as $Val, - ); + $Res call({ + Object? feedBlogPostList = null, + Object? meta = null, + }) { + return _then(_value.copyWith( + feedBlogPostList: null == feedBlogPostList + ? _value.feedBlogPostList + : feedBlogPostList // ignore: cast_nullable_to_non_nullable + as List, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + ) as $Val); } /// Create a copy of FeedBlogPostSettingsModel @@ -103,15 +95,14 @@ class _$FeedBlogPostSettingsModelCopyWithImpl< abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> implements $FeedBlogPostSettingsModelCopyWith<$Res> { factory _$$FeedBlogPostSettingsModelImplCopyWith( - _$FeedBlogPostSettingsModelImpl value, - $Res Function(_$FeedBlogPostSettingsModelImpl) then, - ) = __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>; + _$FeedBlogPostSettingsModelImpl value, + $Res Function(_$FeedBlogPostSettingsModelImpl) then) = + __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'data') List feedBlogPostList, - Meta meta, - }); + $Res call( + {@JsonKey(name: 'data') List feedBlogPostList, + Meta meta}); @override $MetaCopyWith<$Res> get meta; @@ -119,47 +110,43 @@ abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> /// @nodoc class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> - extends - _$FeedBlogPostSettingsModelCopyWithImpl< - $Res, - _$FeedBlogPostSettingsModelImpl - > + extends _$FeedBlogPostSettingsModelCopyWithImpl<$Res, + _$FeedBlogPostSettingsModelImpl> implements _$$FeedBlogPostSettingsModelImplCopyWith<$Res> { __$$FeedBlogPostSettingsModelImplCopyWithImpl( - _$FeedBlogPostSettingsModelImpl _value, - $Res Function(_$FeedBlogPostSettingsModelImpl) _then, - ) : super(_value, _then); + _$FeedBlogPostSettingsModelImpl _value, + $Res Function(_$FeedBlogPostSettingsModelImpl) _then) + : super(_value, _then); /// Create a copy of FeedBlogPostSettingsModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? feedBlogPostList = null, Object? meta = null}) { - return _then( - _$FeedBlogPostSettingsModelImpl( - feedBlogPostList: - null == feedBlogPostList - ? _value._feedBlogPostList - : feedBlogPostList // ignore: cast_nullable_to_non_nullable - as List, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ), - ); + $Res call({ + Object? feedBlogPostList = null, + Object? meta = null, + }) { + return _then(_$FeedBlogPostSettingsModelImpl( + feedBlogPostList: null == feedBlogPostList + ? _value._feedBlogPostList + : feedBlogPostList // ignore: cast_nullable_to_non_nullable + as List, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + )); } } /// @nodoc @JsonSerializable() class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { - const _$FeedBlogPostSettingsModelImpl({ - @JsonKey(name: 'data') - required final List feedBlogPostList, - required this.meta, - }) : _feedBlogPostList = feedBlogPostList; + const _$FeedBlogPostSettingsModelImpl( + {@JsonKey(name: 'data') + required final List feedBlogPostList, + required this.meta}) + : _feedBlogPostList = feedBlogPostList; factory _$FeedBlogPostSettingsModelImpl.fromJson(Map json) => _$$FeedBlogPostSettingsModelImplFromJson(json); @@ -187,20 +174,15 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedBlogPostSettingsModelImpl && - const DeepCollectionEquality().equals( - other._feedBlogPostList, - _feedBlogPostList, - ) && + const DeepCollectionEquality() + .equals(other._feedBlogPostList, _feedBlogPostList) && (identical(other.meta, meta) || other.meta == meta)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_feedBlogPostList), - meta, - ); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_feedBlogPostList), meta); /// Create a copy of FeedBlogPostSettingsModel /// with the given fields replaced by the non-null parameter values. @@ -208,22 +190,22 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { @override @pragma('vm:prefer-inline') _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> - get copyWith => __$$FeedBlogPostSettingsModelImplCopyWithImpl< - _$FeedBlogPostSettingsModelImpl - >(this, _$identity); + get copyWith => __$$FeedBlogPostSettingsModelImplCopyWithImpl< + _$FeedBlogPostSettingsModelImpl>(this, _$identity); @override Map toJson() { - return _$$FeedBlogPostSettingsModelImplToJson(this); + return _$$FeedBlogPostSettingsModelImplToJson( + this, + ); } } abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel { - const factory _FeedBlogPostSettingsModel({ - @JsonKey(name: 'data') - required final List feedBlogPostList, - required final Meta meta, - }) = _$FeedBlogPostSettingsModelImpl; + const factory _FeedBlogPostSettingsModel( + {@JsonKey(name: 'data') + required final List feedBlogPostList, + required final Meta meta}) = _$FeedBlogPostSettingsModelImpl; factory _FeedBlogPostSettingsModel.fromJson(Map json) = _$FeedBlogPostSettingsModelImpl.fromJson; @@ -239,5 +221,5 @@ abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/feed/models/feed_blog_post_settings_model.g.dart b/lib/features/feed/models/feed_blog_post_settings_model.g.dart index 510c3c4f..e300b594 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.g.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.g.dart @@ -7,18 +7,17 @@ part of 'feed_blog_post_settings_model.dart'; // ************************************************************************** _$FeedBlogPostSettingsModelImpl _$$FeedBlogPostSettingsModelImplFromJson( - Map json, -) => _$FeedBlogPostSettingsModelImpl( - feedBlogPostList: - (json['data'] as List) + Map json) => + _$FeedBlogPostSettingsModelImpl( + feedBlogPostList: (json['data'] as List) .map((e) => FeedBlogPostModel.fromJson(e as Map)) .toList(), - meta: Meta.fromJson(json['meta'] as Map), -); + meta: Meta.fromJson(json['meta'] as Map), + ); Map _$$FeedBlogPostSettingsModelImplToJson( - _$FeedBlogPostSettingsModelImpl instance, -) => { - 'data': instance.feedBlogPostList, - 'meta': instance.meta, -}; + _$FeedBlogPostSettingsModelImpl instance) => + { + 'data': instance.feedBlogPostList, + 'meta': instance.meta, + }; diff --git a/lib/features/feed/models/feed_consultant_model.freezed.dart b/lib/features/feed/models/feed_consultant_model.freezed.dart index 45ff6369..221e7201 100644 --- a/lib/features/feed/models/feed_consultant_model.freezed.dart +++ b/lib/features/feed/models/feed_consultant_model.freezed.dart @@ -12,12 +12,10 @@ part of 'feed_consultant_model.dart'; 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', -); + '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'); FeedConsultantPaginationModel _$FeedConsultantPaginationModelFromJson( - Map json, -) { + Map json) { return _FeedConsultantPaginationModel.fromJson(json); } @@ -34,19 +32,16 @@ mixin _$FeedConsultantPaginationModel { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) $FeedConsultantPaginationModelCopyWith - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $FeedConsultantPaginationModelCopyWith<$Res> { factory $FeedConsultantPaginationModelCopyWith( - FeedConsultantPaginationModel value, - $Res Function(FeedConsultantPaginationModel) then, - ) = - _$FeedConsultantPaginationModelCopyWithImpl< - $Res, - FeedConsultantPaginationModel - >; + FeedConsultantPaginationModel value, + $Res Function(FeedConsultantPaginationModel) then) = + _$FeedConsultantPaginationModelCopyWithImpl<$Res, + FeedConsultantPaginationModel>; @useResult $Res call({List data, Links links, Meta meta}); @@ -55,10 +50,8 @@ abstract class $FeedConsultantPaginationModelCopyWith<$Res> { } /// @nodoc -class _$FeedConsultantPaginationModelCopyWithImpl< - $Res, - $Val extends FeedConsultantPaginationModel -> +class _$FeedConsultantPaginationModelCopyWithImpl<$Res, + $Val extends FeedConsultantPaginationModel> implements $FeedConsultantPaginationModelCopyWith<$Res> { _$FeedConsultantPaginationModelCopyWithImpl(this._value, this._then); @@ -71,27 +64,25 @@ class _$FeedConsultantPaginationModelCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _value.copyWith( - data: - null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ) - as $Val, - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_value.copyWith( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + ) as $Val); } /// Create a copy of FeedConsultantPaginationModel @@ -119,9 +110,9 @@ class _$FeedConsultantPaginationModelCopyWithImpl< abstract class _$$FeedConsultantPaginationModelImplCopyWith<$Res> implements $FeedConsultantPaginationModelCopyWith<$Res> { factory _$$FeedConsultantPaginationModelImplCopyWith( - _$FeedConsultantPaginationModelImpl value, - $Res Function(_$FeedConsultantPaginationModelImpl) then, - ) = __$$FeedConsultantPaginationModelImplCopyWithImpl<$Res>; + _$FeedConsultantPaginationModelImpl value, + $Res Function(_$FeedConsultantPaginationModelImpl) then) = + __$$FeedConsultantPaginationModelImplCopyWithImpl<$Res>; @override @useResult $Res call({List data, Links links, Meta meta}); @@ -134,41 +125,37 @@ abstract class _$$FeedConsultantPaginationModelImplCopyWith<$Res> /// @nodoc class __$$FeedConsultantPaginationModelImplCopyWithImpl<$Res> - extends - _$FeedConsultantPaginationModelCopyWithImpl< - $Res, - _$FeedConsultantPaginationModelImpl - > + extends _$FeedConsultantPaginationModelCopyWithImpl<$Res, + _$FeedConsultantPaginationModelImpl> implements _$$FeedConsultantPaginationModelImplCopyWith<$Res> { __$$FeedConsultantPaginationModelImplCopyWithImpl( - _$FeedConsultantPaginationModelImpl _value, - $Res Function(_$FeedConsultantPaginationModelImpl) _then, - ) : super(_value, _then); + _$FeedConsultantPaginationModelImpl _value, + $Res Function(_$FeedConsultantPaginationModelImpl) _then) + : super(_value, _then); /// Create a copy of FeedConsultantPaginationModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _$FeedConsultantPaginationModelImpl( - data: - null == data - ? _value._data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ), - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_$FeedConsultantPaginationModelImpl( + data: null == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + )); } } @@ -176,15 +163,15 @@ class __$$FeedConsultantPaginationModelImplCopyWithImpl<$Res> @JsonSerializable() class _$FeedConsultantPaginationModelImpl implements _FeedConsultantPaginationModel { - const _$FeedConsultantPaginationModelImpl({ - required final List data, - required this.links, - required this.meta, - }) : _data = data; + const _$FeedConsultantPaginationModelImpl( + {required final List data, + required this.links, + required this.meta}) + : _data = data; factory _$FeedConsultantPaginationModelImpl.fromJson( - Map json, - ) => _$$FeedConsultantPaginationModelImplFromJson(json); + Map json) => + _$$FeedConsultantPaginationModelImplFromJson(json); final List _data; @override @@ -217,11 +204,7 @@ class _$FeedConsultantPaginationModelImpl @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_data), - links, - meta, - ); + runtimeType, const DeepCollectionEquality().hash(_data), links, meta); /// Create a copy of FeedConsultantPaginationModel /// with the given fields replaced by the non-null parameter values. @@ -229,25 +212,24 @@ class _$FeedConsultantPaginationModelImpl @override @pragma('vm:prefer-inline') _$$FeedConsultantPaginationModelImplCopyWith< - _$FeedConsultantPaginationModelImpl - > - get copyWith => __$$FeedConsultantPaginationModelImplCopyWithImpl< - _$FeedConsultantPaginationModelImpl - >(this, _$identity); + _$FeedConsultantPaginationModelImpl> + get copyWith => __$$FeedConsultantPaginationModelImplCopyWithImpl< + _$FeedConsultantPaginationModelImpl>(this, _$identity); @override Map toJson() { - return _$$FeedConsultantPaginationModelImplToJson(this); + return _$$FeedConsultantPaginationModelImplToJson( + this, + ); } } abstract class _FeedConsultantPaginationModel implements FeedConsultantPaginationModel { - const factory _FeedConsultantPaginationModel({ - required final List data, - required final Links links, - required final Meta meta, - }) = _$FeedConsultantPaginationModelImpl; + const factory _FeedConsultantPaginationModel( + {required final List data, + required final Links links, + required final Meta meta}) = _$FeedConsultantPaginationModelImpl; factory _FeedConsultantPaginationModel.fromJson(Map json) = _$FeedConsultantPaginationModelImpl.fromJson; @@ -264,9 +246,8 @@ abstract class _FeedConsultantPaginationModel @override @JsonKey(includeFromJson: false, includeToJson: false) _$$FeedConsultantPaginationModelImplCopyWith< - _$FeedConsultantPaginationModelImpl - > - get copyWith => throw _privateConstructorUsedError; + _$FeedConsultantPaginationModelImpl> + get copyWith => throw _privateConstructorUsedError; } FeedConsultantModel _$FeedConsultantModelFromJson(Map json) { @@ -300,19 +281,17 @@ mixin _$FeedConsultantModel { /// @nodoc abstract class $FeedConsultantModelCopyWith<$Res> { factory $FeedConsultantModelCopyWith( - FeedConsultantModel value, - $Res Function(FeedConsultantModel) then, - ) = _$FeedConsultantModelCopyWithImpl<$Res, FeedConsultantModel>; + FeedConsultantModel value, $Res Function(FeedConsultantModel) then) = + _$FeedConsultantModelCopyWithImpl<$Res, FeedConsultantModel>; @useResult - $Res call({ - String slug, - String name, - @JsonKey(name: 'additional_info') String description, - @JsonKey(name: 'rating_place') int? ratingPlace, - @JsonKey(name: 'total_scores') int totalScores, - @JsonKey(name: 'profile_photo_url') String photo, - List badges, - }); + $Res call( + {String slug, + String name, + @JsonKey(name: 'additional_info') String description, + @JsonKey(name: 'rating_place') int? ratingPlace, + @JsonKey(name: 'total_scores') int totalScores, + @JsonKey(name: 'profile_photo_url') String photo, + List badges}); } /// @nodoc @@ -338,77 +317,64 @@ class _$FeedConsultantModelCopyWithImpl<$Res, $Val extends FeedConsultantModel> Object? photo = null, Object? badges = null, }) { - return _then( - _value.copyWith( - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - ratingPlace: - freezed == ratingPlace - ? _value.ratingPlace - : ratingPlace // ignore: cast_nullable_to_non_nullable - as int?, - totalScores: - null == totalScores - ? _value.totalScores - : totalScores // ignore: cast_nullable_to_non_nullable - as int, - photo: - null == photo - ? _value.photo - : photo // ignore: cast_nullable_to_non_nullable - as String, - badges: - null == badges - ? _value.badges - : badges // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + return _then(_value.copyWith( + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + ratingPlace: freezed == ratingPlace + ? _value.ratingPlace + : ratingPlace // ignore: cast_nullable_to_non_nullable + as int?, + totalScores: null == totalScores + ? _value.totalScores + : totalScores // ignore: cast_nullable_to_non_nullable + as int, + photo: null == photo + ? _value.photo + : photo // ignore: cast_nullable_to_non_nullable + as String, + badges: null == badges + ? _value.badges + : badges // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } } /// @nodoc abstract class _$$FeedConsultantModelImplCopyWith<$Res> implements $FeedConsultantModelCopyWith<$Res> { - factory _$$FeedConsultantModelImplCopyWith( - _$FeedConsultantModelImpl value, - $Res Function(_$FeedConsultantModelImpl) then, - ) = __$$FeedConsultantModelImplCopyWithImpl<$Res>; + factory _$$FeedConsultantModelImplCopyWith(_$FeedConsultantModelImpl value, + $Res Function(_$FeedConsultantModelImpl) then) = + __$$FeedConsultantModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String slug, - String name, - @JsonKey(name: 'additional_info') String description, - @JsonKey(name: 'rating_place') int? ratingPlace, - @JsonKey(name: 'total_scores') int totalScores, - @JsonKey(name: 'profile_photo_url') String photo, - List badges, - }); + $Res call( + {String slug, + String name, + @JsonKey(name: 'additional_info') String description, + @JsonKey(name: 'rating_place') int? ratingPlace, + @JsonKey(name: 'total_scores') int totalScores, + @JsonKey(name: 'profile_photo_url') String photo, + List badges}); } /// @nodoc class __$$FeedConsultantModelImplCopyWithImpl<$Res> extends _$FeedConsultantModelCopyWithImpl<$Res, _$FeedConsultantModelImpl> implements _$$FeedConsultantModelImplCopyWith<$Res> { - __$$FeedConsultantModelImplCopyWithImpl( - _$FeedConsultantModelImpl _value, - $Res Function(_$FeedConsultantModelImpl) _then, - ) : super(_value, _then); + __$$FeedConsultantModelImplCopyWithImpl(_$FeedConsultantModelImpl _value, + $Res Function(_$FeedConsultantModelImpl) _then) + : super(_value, _then); /// Create a copy of FeedConsultantModel /// with the given fields replaced by the non-null parameter values. @@ -423,60 +389,51 @@ class __$$FeedConsultantModelImplCopyWithImpl<$Res> Object? photo = null, Object? badges = null, }) { - return _then( - _$FeedConsultantModelImpl( - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - ratingPlace: - freezed == ratingPlace - ? _value.ratingPlace - : ratingPlace // ignore: cast_nullable_to_non_nullable - as int?, - totalScores: - null == totalScores - ? _value.totalScores - : totalScores // ignore: cast_nullable_to_non_nullable - as int, - photo: - null == photo - ? _value.photo - : photo // ignore: cast_nullable_to_non_nullable - as String, - badges: - null == badges - ? _value._badges - : badges // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + return _then(_$FeedConsultantModelImpl( + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + ratingPlace: freezed == ratingPlace + ? _value.ratingPlace + : ratingPlace // ignore: cast_nullable_to_non_nullable + as int?, + totalScores: null == totalScores + ? _value.totalScores + : totalScores // ignore: cast_nullable_to_non_nullable + as int, + photo: null == photo + ? _value.photo + : photo // ignore: cast_nullable_to_non_nullable + as String, + badges: null == badges + ? _value._badges + : badges // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc @JsonSerializable() class _$FeedConsultantModelImpl implements _FeedConsultantModel { - const _$FeedConsultantModelImpl({ - required this.slug, - required this.name, - @JsonKey(name: 'additional_info') required this.description, - @JsonKey(name: 'rating_place') this.ratingPlace, - @JsonKey(name: 'total_scores') required this.totalScores, - @JsonKey(name: 'profile_photo_url') required this.photo, - required final List badges, - }) : _badges = badges; + const _$FeedConsultantModelImpl( + {required this.slug, + required this.name, + @JsonKey(name: 'additional_info') required this.description, + @JsonKey(name: 'rating_place') this.ratingPlace, + @JsonKey(name: 'total_scores') required this.totalScores, + @JsonKey(name: 'profile_photo_url') required this.photo, + required final List badges}) + : _badges = badges; factory _$FeedConsultantModelImpl.fromJson(Map json) => _$$FeedConsultantModelImplFromJson(json); @@ -530,15 +487,14 @@ class _$FeedConsultantModelImpl implements _FeedConsultantModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - slug, - name, - description, - ratingPlace, - totalScores, - photo, - const DeepCollectionEquality().hash(_badges), - ); + runtimeType, + slug, + name, + description, + ratingPlace, + totalScores, + photo, + const DeepCollectionEquality().hash(_badges)); /// Create a copy of FeedConsultantModel /// with the given fields replaced by the non-null parameter values. @@ -547,26 +503,25 @@ class _$FeedConsultantModelImpl implements _FeedConsultantModel { @pragma('vm:prefer-inline') _$$FeedConsultantModelImplCopyWith<_$FeedConsultantModelImpl> get copyWith => __$$FeedConsultantModelImplCopyWithImpl<_$FeedConsultantModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$FeedConsultantModelImplToJson(this); + return _$$FeedConsultantModelImplToJson( + this, + ); } } abstract class _FeedConsultantModel implements FeedConsultantModel { - const factory _FeedConsultantModel({ - required final String slug, - required final String name, - @JsonKey(name: 'additional_info') required final String description, - @JsonKey(name: 'rating_place') final int? ratingPlace, - @JsonKey(name: 'total_scores') required final int totalScores, - @JsonKey(name: 'profile_photo_url') required final String photo, - required final List badges, - }) = _$FeedConsultantModelImpl; + const factory _FeedConsultantModel( + {required final String slug, + required final String name, + @JsonKey(name: 'additional_info') required final String description, + @JsonKey(name: 'rating_place') final int? ratingPlace, + @JsonKey(name: 'total_scores') required final int totalScores, + @JsonKey(name: 'profile_photo_url') required final String photo, + required final List badges}) = _$FeedConsultantModelImpl; factory _FeedConsultantModel.fromJson(Map json) = _$FeedConsultantModelImpl.fromJson; diff --git a/lib/features/feed/models/feed_consultant_model.g.dart b/lib/features/feed/models/feed_consultant_model.g.dart index d4c901bf..71985b37 100644 --- a/lib/features/feed/models/feed_consultant_model.g.dart +++ b/lib/features/feed/models/feed_consultant_model.g.dart @@ -7,49 +7,46 @@ part of 'feed_consultant_model.dart'; // ************************************************************************** _$FeedConsultantPaginationModelImpl -_$$FeedConsultantPaginationModelImplFromJson(Map json) => - _$FeedConsultantPaginationModelImpl( - data: - (json['data'] as List) - .map( - (e) => FeedConsultantModel.fromJson(e as Map), - ) + _$$FeedConsultantPaginationModelImplFromJson(Map json) => + _$FeedConsultantPaginationModelImpl( + data: (json['data'] as List) + .map((e) => + FeedConsultantModel.fromJson(e as Map)) .toList(), - links: Links.fromJson(json['links'] as Map), - meta: Meta.fromJson(json['meta'] as Map), - ); + links: Links.fromJson(json['links'] as Map), + meta: Meta.fromJson(json['meta'] as Map), + ); Map _$$FeedConsultantPaginationModelImplToJson( - _$FeedConsultantPaginationModelImpl instance, -) => { - 'data': instance.data, - 'links': instance.links, - 'meta': instance.meta, -}; + _$FeedConsultantPaginationModelImpl instance) => + { + 'data': instance.data, + 'links': instance.links, + 'meta': instance.meta, + }; _$FeedConsultantModelImpl _$$FeedConsultantModelImplFromJson( - Map json, -) => _$FeedConsultantModelImpl( - slug: json['slug'] as String, - name: json['name'] as String, - description: json['additional_info'] as String, - ratingPlace: (json['rating_place'] as num?)?.toInt(), - totalScores: (json['total_scores'] as num).toInt(), - photo: json['profile_photo_url'] as String, - badges: - (json['badges'] as List) + Map json) => + _$FeedConsultantModelImpl( + slug: json['slug'] as String, + name: json['name'] as String, + description: json['additional_info'] as String, + ratingPlace: (json['rating_place'] as num?)?.toInt(), + totalScores: (json['total_scores'] as num).toInt(), + photo: json['profile_photo_url'] as String, + badges: (json['badges'] as List) .map((e) => BadgeModel.fromJson(e as Map)) .toList(), -); + ); Map _$$FeedConsultantModelImplToJson( - _$FeedConsultantModelImpl instance, -) => { - 'slug': instance.slug, - 'name': instance.name, - 'additional_info': instance.description, - 'rating_place': instance.ratingPlace, - 'total_scores': instance.totalScores, - 'profile_photo_url': instance.photo, - 'badges': instance.badges, -}; + _$FeedConsultantModelImpl instance) => + { + 'slug': instance.slug, + 'name': instance.name, + 'additional_info': instance.description, + 'rating_place': instance.ratingPlace, + 'total_scores': instance.totalScores, + 'profile_photo_url': instance.photo, + 'badges': instance.badges, + }; diff --git a/lib/features/feed/models/plan_pagination_model.dart b/lib/features/feed/models/plan_pagination_model.dart index c4eeb71b..b835effc 100644 --- a/lib/features/feed/models/plan_pagination_model.dart +++ b/lib/features/feed/models/plan_pagination_model.dart @@ -47,7 +47,7 @@ class PlanModel with _$PlanModel { PlanType planTypeFromJson(dynamic json) { if (json is List) { - return PlanType(fit: false, slim: false, behavior: false, wellness: false); + return const PlanType(fit: false, slim: false, behavior: false, wellness: false); } return PlanType.fromJson(json); } @@ -63,7 +63,7 @@ class PacketOptions with _$PacketOptions { factory PacketOptions.fromJson(Map json) => _$PacketOptionsFromJson(json); - factory PacketOptions.empty() => PacketOptions(items: [], price: 1200, short: '', description: ''); + factory PacketOptions.empty() => const PacketOptions(items: [], price: 1200, short: '', description: ''); } @freezed diff --git a/lib/features/feed/models/plan_pagination_model.freezed.dart b/lib/features/feed/models/plan_pagination_model.freezed.dart index 0ed900bb..ddcbb715 100644 --- a/lib/features/feed/models/plan_pagination_model.freezed.dart +++ b/lib/features/feed/models/plan_pagination_model.freezed.dart @@ -12,8 +12,7 @@ part of 'plan_pagination_model.dart'; 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', -); + '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'); PlanPaginationModel _$PlanPaginationModelFromJson(Map json) { return _PlanPaginationModel.fromJson(json); @@ -41,15 +40,13 @@ mixin _$PlanPaginationModel { /// @nodoc abstract class $PlanPaginationModelCopyWith<$Res> { factory $PlanPaginationModelCopyWith( - PlanPaginationModel value, - $Res Function(PlanPaginationModel) then, - ) = _$PlanPaginationModelCopyWithImpl<$Res, PlanPaginationModel>; + PlanPaginationModel value, $Res Function(PlanPaginationModel) then) = + _$PlanPaginationModelCopyWithImpl<$Res, PlanPaginationModel>; @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "links") Links links, - @JsonKey(name: "meta") Meta meta, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); $LinksCopyWith<$Res> get links; $MetaCopyWith<$Res> get meta; @@ -69,27 +66,25 @@ class _$PlanPaginationModelCopyWithImpl<$Res, $Val extends PlanPaginationModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _value.copyWith( - data: - null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ) - as $Val, - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_value.copyWith( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + ) as $Val); } /// Create a copy of PlanPaginationModel @@ -116,17 +111,15 @@ class _$PlanPaginationModelCopyWithImpl<$Res, $Val extends PlanPaginationModel> /// @nodoc abstract class _$$PlanPaginationModelImplCopyWith<$Res> implements $PlanPaginationModelCopyWith<$Res> { - factory _$$PlanPaginationModelImplCopyWith( - _$PlanPaginationModelImpl value, - $Res Function(_$PlanPaginationModelImpl) then, - ) = __$$PlanPaginationModelImplCopyWithImpl<$Res>; + factory _$$PlanPaginationModelImplCopyWith(_$PlanPaginationModelImpl value, + $Res Function(_$PlanPaginationModelImpl) then) = + __$$PlanPaginationModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "data") List data, - @JsonKey(name: "links") Links links, - @JsonKey(name: "meta") Meta meta, - }); + $Res call( + {@JsonKey(name: "data") List data, + @JsonKey(name: "links") Links links, + @JsonKey(name: "meta") Meta meta}); @override $LinksCopyWith<$Res> get links; @@ -138,46 +131,44 @@ abstract class _$$PlanPaginationModelImplCopyWith<$Res> class __$$PlanPaginationModelImplCopyWithImpl<$Res> extends _$PlanPaginationModelCopyWithImpl<$Res, _$PlanPaginationModelImpl> implements _$$PlanPaginationModelImplCopyWith<$Res> { - __$$PlanPaginationModelImplCopyWithImpl( - _$PlanPaginationModelImpl _value, - $Res Function(_$PlanPaginationModelImpl) _then, - ) : super(_value, _then); + __$$PlanPaginationModelImplCopyWithImpl(_$PlanPaginationModelImpl _value, + $Res Function(_$PlanPaginationModelImpl) _then) + : super(_value, _then); /// Create a copy of PlanPaginationModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _$PlanPaginationModelImpl( - data: - null == data - ? _value._data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ), - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_$PlanPaginationModelImpl( + data: null == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + )); } } /// @nodoc @JsonSerializable() class _$PlanPaginationModelImpl implements _PlanPaginationModel { - const _$PlanPaginationModelImpl({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "links") required this.links, - @JsonKey(name: "meta") required this.meta, - }) : _data = data; + const _$PlanPaginationModelImpl( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "links") required this.links, + @JsonKey(name: "meta") required this.meta}) + : _data = data; factory _$PlanPaginationModelImpl.fromJson(Map json) => _$$PlanPaginationModelImplFromJson(json); @@ -216,11 +207,7 @@ class _$PlanPaginationModelImpl implements _PlanPaginationModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_data), - links, - meta, - ); + runtimeType, const DeepCollectionEquality().hash(_data), links, meta); /// Create a copy of PlanPaginationModel /// with the given fields replaced by the non-null parameter values. @@ -229,22 +216,22 @@ class _$PlanPaginationModelImpl implements _PlanPaginationModel { @pragma('vm:prefer-inline') _$$PlanPaginationModelImplCopyWith<_$PlanPaginationModelImpl> get copyWith => __$$PlanPaginationModelImplCopyWithImpl<_$PlanPaginationModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$PlanPaginationModelImplToJson(this); + return _$$PlanPaginationModelImplToJson( + this, + ); } } abstract class _PlanPaginationModel implements PlanPaginationModel { - const factory _PlanPaginationModel({ - @JsonKey(name: "data") required final List data, - @JsonKey(name: "links") required final Links links, - @JsonKey(name: "meta") required final Meta meta, - }) = _$PlanPaginationModelImpl; + const factory _PlanPaginationModel( + {@JsonKey(name: "data") required final List data, + @JsonKey(name: "links") required final Links links, + @JsonKey(name: "meta") required final Meta meta}) = + _$PlanPaginationModelImpl; factory _PlanPaginationModel.fromJson(Map json) = _$PlanPaginationModelImpl.fromJson; @@ -329,28 +316,27 @@ abstract class $PlanModelCopyWith<$Res> { factory $PlanModelCopyWith(PlanModel value, $Res Function(PlanModel) then) = _$PlanModelCopyWithImpl<$Res, PlanModel>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "slug") String slug, - @JsonKey(name: "name") String name, - @JsonKey(name: "image") String image, - @JsonKey(name: "duration") int duration, - @JsonKey(name: "state") String state, - @JsonKey(name: "type", fromJson: planTypeFromJson) PlanType type, - @JsonKey(name: "description_md") String details, - @JsonKey(name: "packets_count") int packetsCount, - @JsonKey(name: "packet1_options") PacketOptions? packet1Options, - @JsonKey(name: "packet2_options") PacketOptions? packet2Options, - @JsonKey(name: "packet3_options") PacketOptions? packet3Options, - @JsonKey(name: "author") Author author, - @JsonKey(name: "total_likes") int totalLikes, - @JsonKey(name: "total_views") int totalViews, - @JsonKey(name: "total_comments") int totalComments, - @JsonKey(name: "is_favorite") bool isFavorite, - @JsonKey(name: "min_price_of_options") double minPriceOfOptions, - @JsonKey(name: "max_price_of_options") double maxPriceOfOptions, - @JsonKey(name: "was_liked_by_me") bool wasLikedByMe, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "slug") String slug, + @JsonKey(name: "name") String name, + @JsonKey(name: "image") String image, + @JsonKey(name: "duration") int duration, + @JsonKey(name: "state") String state, + @JsonKey(name: "type", fromJson: planTypeFromJson) PlanType type, + @JsonKey(name: "description_md") String details, + @JsonKey(name: "packets_count") int packetsCount, + @JsonKey(name: "packet1_options") PacketOptions? packet1Options, + @JsonKey(name: "packet2_options") PacketOptions? packet2Options, + @JsonKey(name: "packet3_options") PacketOptions? packet3Options, + @JsonKey(name: "author") Author author, + @JsonKey(name: "total_likes") int totalLikes, + @JsonKey(name: "total_views") int totalViews, + @JsonKey(name: "total_comments") int totalComments, + @JsonKey(name: "is_favorite") bool isFavorite, + @JsonKey(name: "min_price_of_options") double minPriceOfOptions, + @JsonKey(name: "max_price_of_options") double maxPriceOfOptions, + @JsonKey(name: "was_liked_by_me") bool wasLikedByMe}); $PlanTypeCopyWith<$Res> get type; $PacketOptionsCopyWith<$Res>? get packet1Options; @@ -395,111 +381,88 @@ class _$PlanModelCopyWithImpl<$Res, $Val extends PlanModel> Object? maxPriceOfOptions = null, Object? wasLikedByMe = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - duration: - null == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as PlanType, - details: - null == details - ? _value.details - : details // ignore: cast_nullable_to_non_nullable - as String, - packetsCount: - null == packetsCount - ? _value.packetsCount - : packetsCount // ignore: cast_nullable_to_non_nullable - as int, - packet1Options: - freezed == packet1Options - ? _value.packet1Options - : packet1Options // ignore: cast_nullable_to_non_nullable - as PacketOptions?, - packet2Options: - freezed == packet2Options - ? _value.packet2Options - : packet2Options // ignore: cast_nullable_to_non_nullable - as PacketOptions?, - packet3Options: - freezed == packet3Options - ? _value.packet3Options - : packet3Options // ignore: cast_nullable_to_non_nullable - as PacketOptions?, - author: - null == author - ? _value.author - : author // ignore: cast_nullable_to_non_nullable - as Author, - totalLikes: - null == totalLikes - ? _value.totalLikes - : totalLikes // ignore: cast_nullable_to_non_nullable - as int, - totalViews: - null == totalViews - ? _value.totalViews - : totalViews // ignore: cast_nullable_to_non_nullable - as int, - totalComments: - null == totalComments - ? _value.totalComments - : totalComments // ignore: cast_nullable_to_non_nullable - as int, - isFavorite: - null == isFavorite - ? _value.isFavorite - : isFavorite // ignore: cast_nullable_to_non_nullable - as bool, - minPriceOfOptions: - null == minPriceOfOptions - ? _value.minPriceOfOptions - : minPriceOfOptions // ignore: cast_nullable_to_non_nullable - as double, - maxPriceOfOptions: - null == maxPriceOfOptions - ? _value.maxPriceOfOptions - : maxPriceOfOptions // ignore: cast_nullable_to_non_nullable - as double, - wasLikedByMe: - null == wasLikedByMe - ? _value.wasLikedByMe - : wasLikedByMe // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + duration: null == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as int, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as PlanType, + details: null == details + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as String, + packetsCount: null == packetsCount + ? _value.packetsCount + : packetsCount // ignore: cast_nullable_to_non_nullable + as int, + packet1Options: freezed == packet1Options + ? _value.packet1Options + : packet1Options // ignore: cast_nullable_to_non_nullable + as PacketOptions?, + packet2Options: freezed == packet2Options + ? _value.packet2Options + : packet2Options // ignore: cast_nullable_to_non_nullable + as PacketOptions?, + packet3Options: freezed == packet3Options + ? _value.packet3Options + : packet3Options // ignore: cast_nullable_to_non_nullable + as PacketOptions?, + author: null == author + ? _value.author + : author // ignore: cast_nullable_to_non_nullable + as Author, + totalLikes: null == totalLikes + ? _value.totalLikes + : totalLikes // ignore: cast_nullable_to_non_nullable + as int, + totalViews: null == totalViews + ? _value.totalViews + : totalViews // ignore: cast_nullable_to_non_nullable + as int, + totalComments: null == totalComments + ? _value.totalComments + : totalComments // ignore: cast_nullable_to_non_nullable + as int, + isFavorite: null == isFavorite + ? _value.isFavorite + : isFavorite // ignore: cast_nullable_to_non_nullable + as bool, + minPriceOfOptions: null == minPriceOfOptions + ? _value.minPriceOfOptions + : minPriceOfOptions // ignore: cast_nullable_to_non_nullable + as double, + maxPriceOfOptions: null == maxPriceOfOptions + ? _value.maxPriceOfOptions + : maxPriceOfOptions // ignore: cast_nullable_to_non_nullable + as double, + wasLikedByMe: null == wasLikedByMe + ? _value.wasLikedByMe + : wasLikedByMe // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } /// Create a copy of PlanModel @@ -569,33 +532,31 @@ class _$PlanModelCopyWithImpl<$Res, $Val extends PlanModel> abstract class _$$PlanModelImplCopyWith<$Res> implements $PlanModelCopyWith<$Res> { factory _$$PlanModelImplCopyWith( - _$PlanModelImpl value, - $Res Function(_$PlanModelImpl) then, - ) = __$$PlanModelImplCopyWithImpl<$Res>; + _$PlanModelImpl value, $Res Function(_$PlanModelImpl) then) = + __$$PlanModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "slug") String slug, - @JsonKey(name: "name") String name, - @JsonKey(name: "image") String image, - @JsonKey(name: "duration") int duration, - @JsonKey(name: "state") String state, - @JsonKey(name: "type", fromJson: planTypeFromJson) PlanType type, - @JsonKey(name: "description_md") String details, - @JsonKey(name: "packets_count") int packetsCount, - @JsonKey(name: "packet1_options") PacketOptions? packet1Options, - @JsonKey(name: "packet2_options") PacketOptions? packet2Options, - @JsonKey(name: "packet3_options") PacketOptions? packet3Options, - @JsonKey(name: "author") Author author, - @JsonKey(name: "total_likes") int totalLikes, - @JsonKey(name: "total_views") int totalViews, - @JsonKey(name: "total_comments") int totalComments, - @JsonKey(name: "is_favorite") bool isFavorite, - @JsonKey(name: "min_price_of_options") double minPriceOfOptions, - @JsonKey(name: "max_price_of_options") double maxPriceOfOptions, - @JsonKey(name: "was_liked_by_me") bool wasLikedByMe, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "slug") String slug, + @JsonKey(name: "name") String name, + @JsonKey(name: "image") String image, + @JsonKey(name: "duration") int duration, + @JsonKey(name: "state") String state, + @JsonKey(name: "type", fromJson: planTypeFromJson) PlanType type, + @JsonKey(name: "description_md") String details, + @JsonKey(name: "packets_count") int packetsCount, + @JsonKey(name: "packet1_options") PacketOptions? packet1Options, + @JsonKey(name: "packet2_options") PacketOptions? packet2Options, + @JsonKey(name: "packet3_options") PacketOptions? packet3Options, + @JsonKey(name: "author") Author author, + @JsonKey(name: "total_likes") int totalLikes, + @JsonKey(name: "total_views") int totalViews, + @JsonKey(name: "total_comments") int totalComments, + @JsonKey(name: "is_favorite") bool isFavorite, + @JsonKey(name: "min_price_of_options") double minPriceOfOptions, + @JsonKey(name: "max_price_of_options") double maxPriceOfOptions, + @JsonKey(name: "was_liked_by_me") bool wasLikedByMe}); @override $PlanTypeCopyWith<$Res> get type; @@ -614,9 +575,8 @@ class __$$PlanModelImplCopyWithImpl<$Res> extends _$PlanModelCopyWithImpl<$Res, _$PlanModelImpl> implements _$$PlanModelImplCopyWith<$Res> { __$$PlanModelImplCopyWithImpl( - _$PlanModelImpl _value, - $Res Function(_$PlanModelImpl) _then, - ) : super(_value, _then); + _$PlanModelImpl _value, $Res Function(_$PlanModelImpl) _then) + : super(_value, _then); /// Create a copy of PlanModel /// with the given fields replaced by the non-null parameter values. @@ -644,138 +604,115 @@ class __$$PlanModelImplCopyWithImpl<$Res> Object? maxPriceOfOptions = null, Object? wasLikedByMe = null, }) { - return _then( - _$PlanModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - duration: - null == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as PlanType, - details: - null == details - ? _value.details - : details // ignore: cast_nullable_to_non_nullable - as String, - packetsCount: - null == packetsCount - ? _value.packetsCount - : packetsCount // ignore: cast_nullable_to_non_nullable - as int, - packet1Options: - freezed == packet1Options - ? _value.packet1Options - : packet1Options // ignore: cast_nullable_to_non_nullable - as PacketOptions?, - packet2Options: - freezed == packet2Options - ? _value.packet2Options - : packet2Options // ignore: cast_nullable_to_non_nullable - as PacketOptions?, - packet3Options: - freezed == packet3Options - ? _value.packet3Options - : packet3Options // ignore: cast_nullable_to_non_nullable - as PacketOptions?, - author: - null == author - ? _value.author - : author // ignore: cast_nullable_to_non_nullable - as Author, - totalLikes: - null == totalLikes - ? _value.totalLikes - : totalLikes // ignore: cast_nullable_to_non_nullable - as int, - totalViews: - null == totalViews - ? _value.totalViews - : totalViews // ignore: cast_nullable_to_non_nullable - as int, - totalComments: - null == totalComments - ? _value.totalComments - : totalComments // ignore: cast_nullable_to_non_nullable - as int, - isFavorite: - null == isFavorite - ? _value.isFavorite - : isFavorite // ignore: cast_nullable_to_non_nullable - as bool, - minPriceOfOptions: - null == minPriceOfOptions - ? _value.minPriceOfOptions - : minPriceOfOptions // ignore: cast_nullable_to_non_nullable - as double, - maxPriceOfOptions: - null == maxPriceOfOptions - ? _value.maxPriceOfOptions - : maxPriceOfOptions // ignore: cast_nullable_to_non_nullable - as double, - wasLikedByMe: - null == wasLikedByMe - ? _value.wasLikedByMe - : wasLikedByMe // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + return _then(_$PlanModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + duration: null == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as int, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as PlanType, + details: null == details + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as String, + packetsCount: null == packetsCount + ? _value.packetsCount + : packetsCount // ignore: cast_nullable_to_non_nullable + as int, + packet1Options: freezed == packet1Options + ? _value.packet1Options + : packet1Options // ignore: cast_nullable_to_non_nullable + as PacketOptions?, + packet2Options: freezed == packet2Options + ? _value.packet2Options + : packet2Options // ignore: cast_nullable_to_non_nullable + as PacketOptions?, + packet3Options: freezed == packet3Options + ? _value.packet3Options + : packet3Options // ignore: cast_nullable_to_non_nullable + as PacketOptions?, + author: null == author + ? _value.author + : author // ignore: cast_nullable_to_non_nullable + as Author, + totalLikes: null == totalLikes + ? _value.totalLikes + : totalLikes // ignore: cast_nullable_to_non_nullable + as int, + totalViews: null == totalViews + ? _value.totalViews + : totalViews // ignore: cast_nullable_to_non_nullable + as int, + totalComments: null == totalComments + ? _value.totalComments + : totalComments // ignore: cast_nullable_to_non_nullable + as int, + isFavorite: null == isFavorite + ? _value.isFavorite + : isFavorite // ignore: cast_nullable_to_non_nullable + as bool, + minPriceOfOptions: null == minPriceOfOptions + ? _value.minPriceOfOptions + : minPriceOfOptions // ignore: cast_nullable_to_non_nullable + as double, + maxPriceOfOptions: null == maxPriceOfOptions + ? _value.maxPriceOfOptions + : maxPriceOfOptions // ignore: cast_nullable_to_non_nullable + as double, + wasLikedByMe: null == wasLikedByMe + ? _value.wasLikedByMe + : wasLikedByMe // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc @JsonSerializable() class _$PlanModelImpl implements _PlanModel { - const _$PlanModelImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "slug") required this.slug, - @JsonKey(name: "name") required this.name, - @JsonKey(name: "image") required this.image, - @JsonKey(name: "duration") required this.duration, - @JsonKey(name: "state") required this.state, - @JsonKey(name: "type", fromJson: planTypeFromJson) required this.type, - @JsonKey(name: "description_md") required this.details, - @JsonKey(name: "packets_count") required this.packetsCount, - @JsonKey(name: "packet1_options") this.packet1Options, - @JsonKey(name: "packet2_options") this.packet2Options, - @JsonKey(name: "packet3_options") this.packet3Options, - @JsonKey(name: "author") required this.author, - @JsonKey(name: "total_likes") required this.totalLikes, - @JsonKey(name: "total_views") required this.totalViews, - @JsonKey(name: "total_comments") required this.totalComments, - @JsonKey(name: "is_favorite") required this.isFavorite, - @JsonKey(name: "min_price_of_options") required this.minPriceOfOptions, - @JsonKey(name: "max_price_of_options") required this.maxPriceOfOptions, - @JsonKey(name: "was_liked_by_me") required this.wasLikedByMe, - }); + const _$PlanModelImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "slug") required this.slug, + @JsonKey(name: "name") required this.name, + @JsonKey(name: "image") required this.image, + @JsonKey(name: "duration") required this.duration, + @JsonKey(name: "state") required this.state, + @JsonKey(name: "type", fromJson: planTypeFromJson) required this.type, + @JsonKey(name: "description_md") required this.details, + @JsonKey(name: "packets_count") required this.packetsCount, + @JsonKey(name: "packet1_options") this.packet1Options, + @JsonKey(name: "packet2_options") this.packet2Options, + @JsonKey(name: "packet3_options") this.packet3Options, + @JsonKey(name: "author") required this.author, + @JsonKey(name: "total_likes") required this.totalLikes, + @JsonKey(name: "total_views") required this.totalViews, + @JsonKey(name: "total_comments") required this.totalComments, + @JsonKey(name: "is_favorite") required this.isFavorite, + @JsonKey(name: "min_price_of_options") required this.minPriceOfOptions, + @JsonKey(name: "max_price_of_options") required this.maxPriceOfOptions, + @JsonKey(name: "was_liked_by_me") required this.wasLikedByMe}); factory _$PlanModelImpl.fromJson(Map json) => _$$PlanModelImplFromJson(json); @@ -888,28 +825,28 @@ class _$PlanModelImpl implements _PlanModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hashAll([ - runtimeType, - id, - slug, - name, - image, - duration, - state, - type, - details, - packetsCount, - packet1Options, - packet2Options, - packet3Options, - author, - totalLikes, - totalViews, - totalComments, - isFavorite, - minPriceOfOptions, - maxPriceOfOptions, - wasLikedByMe, - ]); + runtimeType, + id, + slug, + name, + image, + duration, + state, + type, + details, + packetsCount, + packet1Options, + packet2Options, + packet3Options, + author, + totalLikes, + totalViews, + totalComments, + isFavorite, + minPriceOfOptions, + maxPriceOfOptions, + wasLikedByMe + ]); /// Create a copy of PlanModel /// with the given fields replaced by the non-null parameter values. @@ -921,36 +858,38 @@ class _$PlanModelImpl implements _PlanModel { @override Map toJson() { - return _$$PlanModelImplToJson(this); + return _$$PlanModelImplToJson( + this, + ); } } abstract class _PlanModel implements PlanModel { - const factory _PlanModel({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "slug") required final String slug, - @JsonKey(name: "name") required final String name, - @JsonKey(name: "image") required final String image, - @JsonKey(name: "duration") required final int duration, - @JsonKey(name: "state") required final String state, - @JsonKey(name: "type", fromJson: planTypeFromJson) - required final PlanType type, - @JsonKey(name: "description_md") required final String details, - @JsonKey(name: "packets_count") required final int packetsCount, - @JsonKey(name: "packet1_options") final PacketOptions? packet1Options, - @JsonKey(name: "packet2_options") final PacketOptions? packet2Options, - @JsonKey(name: "packet3_options") final PacketOptions? packet3Options, - @JsonKey(name: "author") required final Author author, - @JsonKey(name: "total_likes") required final int totalLikes, - @JsonKey(name: "total_views") required final int totalViews, - @JsonKey(name: "total_comments") required final int totalComments, - @JsonKey(name: "is_favorite") required final bool isFavorite, - @JsonKey(name: "min_price_of_options") - required final double minPriceOfOptions, - @JsonKey(name: "max_price_of_options") - required final double maxPriceOfOptions, - @JsonKey(name: "was_liked_by_me") required final bool wasLikedByMe, - }) = _$PlanModelImpl; + const factory _PlanModel( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "slug") required final String slug, + @JsonKey(name: "name") required final String name, + @JsonKey(name: "image") required final String image, + @JsonKey(name: "duration") required final int duration, + @JsonKey(name: "state") required final String state, + @JsonKey(name: "type", fromJson: planTypeFromJson) + required final PlanType type, + @JsonKey(name: "description_md") required final String details, + @JsonKey(name: "packets_count") required final int packetsCount, + @JsonKey(name: "packet1_options") final PacketOptions? packet1Options, + @JsonKey(name: "packet2_options") final PacketOptions? packet2Options, + @JsonKey(name: "packet3_options") final PacketOptions? packet3Options, + @JsonKey(name: "author") required final Author author, + @JsonKey(name: "total_likes") required final int totalLikes, + @JsonKey(name: "total_views") required final int totalViews, + @JsonKey(name: "total_comments") required final int totalComments, + @JsonKey(name: "is_favorite") required final bool isFavorite, + @JsonKey(name: "min_price_of_options") + required final double minPriceOfOptions, + @JsonKey(name: "max_price_of_options") + required final double maxPriceOfOptions, + @JsonKey(name: "was_liked_by_me") required final bool wasLikedByMe}) = + _$PlanModelImpl; factory _PlanModel.fromJson(Map json) = _$PlanModelImpl.fromJson; @@ -1052,16 +991,14 @@ mixin _$PacketOptions { /// @nodoc abstract class $PacketOptionsCopyWith<$Res> { factory $PacketOptionsCopyWith( - PacketOptions value, - $Res Function(PacketOptions) then, - ) = _$PacketOptionsCopyWithImpl<$Res, PacketOptions>; + PacketOptions value, $Res Function(PacketOptions) then) = + _$PacketOptionsCopyWithImpl<$Res, PacketOptions>; @useResult - $Res call({ - @JsonKey(name: "items") List items, - @JsonKey(name: "price") dynamic price, - @JsonKey(name: "short") String short, - @JsonKey(name: "description_md") String description, - }); + $Res call( + {@JsonKey(name: "items") List items, + @JsonKey(name: "price") dynamic price, + @JsonKey(name: "short") String short, + @JsonKey(name: "description_md") String description}); } /// @nodoc @@ -1084,31 +1021,24 @@ class _$PacketOptionsCopyWithImpl<$Res, $Val extends PacketOptions> Object? short = null, Object? description = null, }) { - return _then( - _value.copyWith( - items: - null == items - ? _value.items - : items // ignore: cast_nullable_to_non_nullable - as List, - price: - freezed == price - ? _value.price - : price // ignore: cast_nullable_to_non_nullable - as dynamic, - short: - null == short - ? _value.short - : short // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + return _then(_value.copyWith( + items: null == items + ? _value.items + : items // ignore: cast_nullable_to_non_nullable + as List, + price: freezed == price + ? _value.price + : price // ignore: cast_nullable_to_non_nullable + as dynamic, + short: null == short + ? _value.short + : short // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -1116,17 +1046,15 @@ class _$PacketOptionsCopyWithImpl<$Res, $Val extends PacketOptions> abstract class _$$PacketOptionsImplCopyWith<$Res> implements $PacketOptionsCopyWith<$Res> { factory _$$PacketOptionsImplCopyWith( - _$PacketOptionsImpl value, - $Res Function(_$PacketOptionsImpl) then, - ) = __$$PacketOptionsImplCopyWithImpl<$Res>; + _$PacketOptionsImpl value, $Res Function(_$PacketOptionsImpl) then) = + __$$PacketOptionsImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "items") List items, - @JsonKey(name: "price") dynamic price, - @JsonKey(name: "short") String short, - @JsonKey(name: "description_md") String description, - }); + $Res call( + {@JsonKey(name: "items") List items, + @JsonKey(name: "price") dynamic price, + @JsonKey(name: "short") String short, + @JsonKey(name: "description_md") String description}); } /// @nodoc @@ -1134,9 +1062,8 @@ class __$$PacketOptionsImplCopyWithImpl<$Res> extends _$PacketOptionsCopyWithImpl<$Res, _$PacketOptionsImpl> implements _$$PacketOptionsImplCopyWith<$Res> { __$$PacketOptionsImplCopyWithImpl( - _$PacketOptionsImpl _value, - $Res Function(_$PacketOptionsImpl) _then, - ) : super(_value, _then); + _$PacketOptionsImpl _value, $Res Function(_$PacketOptionsImpl) _then) + : super(_value, _then); /// Create a copy of PacketOptions /// with the given fields replaced by the non-null parameter values. @@ -1148,42 +1075,36 @@ class __$$PacketOptionsImplCopyWithImpl<$Res> Object? short = null, Object? description = null, }) { - return _then( - _$PacketOptionsImpl( - items: - null == items - ? _value._items - : items // ignore: cast_nullable_to_non_nullable - as List, - price: - freezed == price - ? _value.price - : price // ignore: cast_nullable_to_non_nullable - as dynamic, - short: - null == short - ? _value.short - : short // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + return _then(_$PacketOptionsImpl( + items: null == items + ? _value._items + : items // ignore: cast_nullable_to_non_nullable + as List, + price: freezed == price + ? _value.price + : price // ignore: cast_nullable_to_non_nullable + as dynamic, + short: null == short + ? _value.short + : short // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + )); } } /// @nodoc @JsonSerializable() class _$PacketOptionsImpl implements _PacketOptions { - const _$PacketOptionsImpl({ - @JsonKey(name: "items") required final List items, - @JsonKey(name: "price") required this.price, - @JsonKey(name: "short") required this.short, - @JsonKey(name: "description_md") required this.description, - }) : _items = items; + const _$PacketOptionsImpl( + {@JsonKey(name: "items") required final List items, + @JsonKey(name: "price") required this.price, + @JsonKey(name: "short") required this.short, + @JsonKey(name: "description_md") required this.description}) + : _items = items; factory _$PacketOptionsImpl.fromJson(Map json) => _$$PacketOptionsImplFromJson(json); @@ -1227,12 +1148,11 @@ class _$PacketOptionsImpl implements _PacketOptions { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_items), - const DeepCollectionEquality().hash(price), - short, - description, - ); + runtimeType, + const DeepCollectionEquality().hash(_items), + const DeepCollectionEquality().hash(price), + short, + description); /// Create a copy of PacketOptions /// with the given fields replaced by the non-null parameter values. @@ -1244,17 +1164,19 @@ class _$PacketOptionsImpl implements _PacketOptions { @override Map toJson() { - return _$$PacketOptionsImplToJson(this); + return _$$PacketOptionsImplToJson( + this, + ); } } abstract class _PacketOptions implements PacketOptions { - const factory _PacketOptions({ - @JsonKey(name: "items") required final List items, - @JsonKey(name: "price") required final dynamic price, - @JsonKey(name: "short") required final String short, - @JsonKey(name: "description_md") required final String description, - }) = _$PacketOptionsImpl; + const factory _PacketOptions( + {@JsonKey(name: "items") required final List items, + @JsonKey(name: "price") required final dynamic price, + @JsonKey(name: "short") required final String short, + @JsonKey(name: "description_md") required final String description}) = + _$PacketOptionsImpl; factory _PacketOptions.fromJson(Map json) = _$PacketOptionsImpl.fromJson; @@ -1310,12 +1232,11 @@ abstract class $PlanTypeCopyWith<$Res> { factory $PlanTypeCopyWith(PlanType value, $Res Function(PlanType) then) = _$PlanTypeCopyWithImpl<$Res, PlanType>; @useResult - $Res call({ - @JsonKey(name: "fit") bool? fit, - @JsonKey(name: "slim") bool? slim, - @JsonKey(name: "behavior") bool? behavior, - @JsonKey(name: "wellness") bool? wellness, - }); + $Res call( + {@JsonKey(name: "fit") bool? fit, + @JsonKey(name: "slim") bool? slim, + @JsonKey(name: "behavior") bool? behavior, + @JsonKey(name: "wellness") bool? wellness}); } /// @nodoc @@ -1338,31 +1259,24 @@ class _$PlanTypeCopyWithImpl<$Res, $Val extends PlanType> Object? behavior = freezed, Object? wellness = freezed, }) { - return _then( - _value.copyWith( - fit: - freezed == fit - ? _value.fit - : fit // ignore: cast_nullable_to_non_nullable - as bool?, - slim: - freezed == slim - ? _value.slim - : slim // ignore: cast_nullable_to_non_nullable - as bool?, - behavior: - freezed == behavior - ? _value.behavior - : behavior // ignore: cast_nullable_to_non_nullable - as bool?, - wellness: - freezed == wellness - ? _value.wellness - : wellness // ignore: cast_nullable_to_non_nullable - as bool?, - ) - as $Val, - ); + return _then(_value.copyWith( + fit: freezed == fit + ? _value.fit + : fit // ignore: cast_nullable_to_non_nullable + as bool?, + slim: freezed == slim + ? _value.slim + : slim // ignore: cast_nullable_to_non_nullable + as bool?, + behavior: freezed == behavior + ? _value.behavior + : behavior // ignore: cast_nullable_to_non_nullable + as bool?, + wellness: freezed == wellness + ? _value.wellness + : wellness // ignore: cast_nullable_to_non_nullable + as bool?, + ) as $Val); } } @@ -1370,17 +1284,15 @@ class _$PlanTypeCopyWithImpl<$Res, $Val extends PlanType> abstract class _$$PlanTypeImplCopyWith<$Res> implements $PlanTypeCopyWith<$Res> { factory _$$PlanTypeImplCopyWith( - _$PlanTypeImpl value, - $Res Function(_$PlanTypeImpl) then, - ) = __$$PlanTypeImplCopyWithImpl<$Res>; + _$PlanTypeImpl value, $Res Function(_$PlanTypeImpl) then) = + __$$PlanTypeImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "fit") bool? fit, - @JsonKey(name: "slim") bool? slim, - @JsonKey(name: "behavior") bool? behavior, - @JsonKey(name: "wellness") bool? wellness, - }); + $Res call( + {@JsonKey(name: "fit") bool? fit, + @JsonKey(name: "slim") bool? slim, + @JsonKey(name: "behavior") bool? behavior, + @JsonKey(name: "wellness") bool? wellness}); } /// @nodoc @@ -1388,9 +1300,8 @@ class __$$PlanTypeImplCopyWithImpl<$Res> extends _$PlanTypeCopyWithImpl<$Res, _$PlanTypeImpl> implements _$$PlanTypeImplCopyWith<$Res> { __$$PlanTypeImplCopyWithImpl( - _$PlanTypeImpl _value, - $Res Function(_$PlanTypeImpl) _then, - ) : super(_value, _then); + _$PlanTypeImpl _value, $Res Function(_$PlanTypeImpl) _then) + : super(_value, _then); /// Create a copy of PlanType /// with the given fields replaced by the non-null parameter values. @@ -1402,42 +1313,36 @@ class __$$PlanTypeImplCopyWithImpl<$Res> Object? behavior = freezed, Object? wellness = freezed, }) { - return _then( - _$PlanTypeImpl( - fit: - freezed == fit - ? _value.fit - : fit // ignore: cast_nullable_to_non_nullable - as bool?, - slim: - freezed == slim - ? _value.slim - : slim // ignore: cast_nullable_to_non_nullable - as bool?, - behavior: - freezed == behavior - ? _value.behavior - : behavior // ignore: cast_nullable_to_non_nullable - as bool?, - wellness: - freezed == wellness - ? _value.wellness - : wellness // ignore: cast_nullable_to_non_nullable - as bool?, - ), - ); + return _then(_$PlanTypeImpl( + fit: freezed == fit + ? _value.fit + : fit // ignore: cast_nullable_to_non_nullable + as bool?, + slim: freezed == slim + ? _value.slim + : slim // ignore: cast_nullable_to_non_nullable + as bool?, + behavior: freezed == behavior + ? _value.behavior + : behavior // ignore: cast_nullable_to_non_nullable + as bool?, + wellness: freezed == wellness + ? _value.wellness + : wellness // ignore: cast_nullable_to_non_nullable + as bool?, + )); } } /// @nodoc @JsonSerializable() class _$PlanTypeImpl extends _PlanType { - const _$PlanTypeImpl({ - @JsonKey(name: "fit") required this.fit, - @JsonKey(name: "slim") required this.slim, - @JsonKey(name: "behavior") required this.behavior, - @JsonKey(name: "wellness") required this.wellness, - }) : super._(); + const _$PlanTypeImpl( + {@JsonKey(name: "fit") required this.fit, + @JsonKey(name: "slim") required this.slim, + @JsonKey(name: "behavior") required this.behavior, + @JsonKey(name: "wellness") required this.wellness}) + : super._(); factory _$PlanTypeImpl.fromJson(Map json) => _$$PlanTypeImplFromJson(json); @@ -1487,17 +1392,19 @@ class _$PlanTypeImpl extends _PlanType { @override Map toJson() { - return _$$PlanTypeImplToJson(this); + return _$$PlanTypeImplToJson( + this, + ); } } abstract class _PlanType extends PlanType { - const factory _PlanType({ - @JsonKey(name: "fit") required final bool? fit, - @JsonKey(name: "slim") required final bool? slim, - @JsonKey(name: "behavior") required final bool? behavior, - @JsonKey(name: "wellness") required final bool? wellness, - }) = _$PlanTypeImpl; + const factory _PlanType( + {@JsonKey(name: "fit") required final bool? fit, + @JsonKey(name: "slim") required final bool? slim, + @JsonKey(name: "behavior") required final bool? behavior, + @JsonKey(name: "wellness") required final bool? wellness}) = + _$PlanTypeImpl; const _PlanType._() : super._(); factory _PlanType.fromJson(Map json) = diff --git a/lib/features/feed/models/plan_pagination_model.g.dart b/lib/features/feed/models/plan_pagination_model.g.dart index 08771efc..0c076097 100644 --- a/lib/features/feed/models/plan_pagination_model.g.dart +++ b/lib/features/feed/models/plan_pagination_model.g.dart @@ -7,23 +7,22 @@ part of 'plan_pagination_model.dart'; // ************************************************************************** _$PlanPaginationModelImpl _$$PlanPaginationModelImplFromJson( - Map json, -) => _$PlanPaginationModelImpl( - data: - (json['data'] as List) + Map json) => + _$PlanPaginationModelImpl( + data: (json['data'] as List) .map((e) => PlanModel.fromJson(e as Map)) .toList(), - links: Links.fromJson(json['links'] as Map), - meta: Meta.fromJson(json['meta'] as Map), -); + links: Links.fromJson(json['links'] as Map), + meta: Meta.fromJson(json['meta'] as Map), + ); Map _$$PlanPaginationModelImplToJson( - _$PlanPaginationModelImpl instance, -) => { - 'data': instance.data, - 'links': instance.links, - 'meta': instance.meta, -}; + _$PlanPaginationModelImpl instance) => + { + 'data': instance.data, + 'links': instance.links, + 'meta': instance.meta, + }; _$PlanModelImpl _$$PlanModelImplFromJson(Map json) => _$PlanModelImpl( @@ -36,24 +35,18 @@ _$PlanModelImpl _$$PlanModelImplFromJson(Map json) => type: planTypeFromJson(json['type']), details: json['description_md'] as String, packetsCount: (json['packets_count'] as num).toInt(), - packet1Options: - json['packet1_options'] == null - ? null - : PacketOptions.fromJson( - json['packet1_options'] as Map, - ), - packet2Options: - json['packet2_options'] == null - ? null - : PacketOptions.fromJson( - json['packet2_options'] as Map, - ), - packet3Options: - json['packet3_options'] == null - ? null - : PacketOptions.fromJson( - json['packet3_options'] as Map, - ), + packet1Options: json['packet1_options'] == null + ? null + : PacketOptions.fromJson( + json['packet1_options'] as Map), + packet2Options: json['packet2_options'] == null + ? null + : PacketOptions.fromJson( + json['packet2_options'] as Map), + packet3Options: json['packet3_options'] == null + ? null + : PacketOptions.fromJson( + json['packet3_options'] as Map), author: Author.fromJson(json['author'] as Map), totalLikes: (json['total_likes'] as num).toInt(), totalViews: (json['total_views'] as num).toInt(), diff --git a/lib/features/feed/models/recipes_model.freezed.dart b/lib/features/feed/models/recipes_model.freezed.dart index ed3d6d3e..79720ef5 100644 --- a/lib/features/feed/models/recipes_model.freezed.dart +++ b/lib/features/feed/models/recipes_model.freezed.dart @@ -12,8 +12,7 @@ part of 'recipes_model.dart'; 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', -); + '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'); Recipe _$RecipeFromJson(Map json) { return _Recipes.fromJson(json); @@ -69,29 +68,28 @@ abstract class $RecipeCopyWith<$Res> { factory $RecipeCopyWith(Recipe value, $Res Function(Recipe) then) = _$RecipeCopyWithImpl<$Res, Recipe>; @useResult - $Res call({ - int id, - String image, - String state, - @JsonKey(name: 'cooking_time') int cookingTime, - @JsonKey(name: 'active_time') int activeCookingTime, - List? ingredients, - @JsonKey(name: 'description_md') String description, - List? steps, - @JsonKey(name: 'video_url') String? videoUrl, - @JsonKey(name: 'created_at') DateTime createdAt, - @JsonKey(name: 'updated_at') DateTime updatedAt, - String? title, - String? type, - String slug, - @JsonKey(name: 'total_comments') int commentsCount, - @JsonKey(name: 'was_liked_by_me') bool wasLikedByMe, - @JsonKey(name: 'is_favorite') bool isFavorite, - @JsonKey(name: 'energy_per_serving') double calories, - @JsonKey(name: 'total_likes') int likesCount, - @JsonKey(name: 'total_views') int viewsCount, - Author author, - }); + $Res call( + {int id, + String image, + String state, + @JsonKey(name: 'cooking_time') int cookingTime, + @JsonKey(name: 'active_time') int activeCookingTime, + List? ingredients, + @JsonKey(name: 'description_md') String description, + List? steps, + @JsonKey(name: 'video_url') String? videoUrl, + @JsonKey(name: 'created_at') DateTime createdAt, + @JsonKey(name: 'updated_at') DateTime updatedAt, + String? title, + String? type, + String slug, + @JsonKey(name: 'total_comments') int commentsCount, + @JsonKey(name: 'was_liked_by_me') bool wasLikedByMe, + @JsonKey(name: 'is_favorite') bool isFavorite, + @JsonKey(name: 'energy_per_serving') double calories, + @JsonKey(name: 'total_likes') int likesCount, + @JsonKey(name: 'total_views') int viewsCount, + Author author}); $AuthorCopyWith<$Res> get author; } @@ -133,116 +131,92 @@ class _$RecipeCopyWithImpl<$Res, $Val extends Recipe> Object? viewsCount = null, Object? author = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - cookingTime: - null == cookingTime - ? _value.cookingTime - : cookingTime // ignore: cast_nullable_to_non_nullable - as int, - activeCookingTime: - null == activeCookingTime - ? _value.activeCookingTime - : activeCookingTime // ignore: cast_nullable_to_non_nullable - as int, - ingredients: - freezed == ingredients - ? _value.ingredients - : ingredients // ignore: cast_nullable_to_non_nullable - as List?, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - steps: - freezed == steps - ? _value.steps - : steps // ignore: cast_nullable_to_non_nullable - as List?, - videoUrl: - freezed == videoUrl - ? _value.videoUrl - : videoUrl // ignore: cast_nullable_to_non_nullable - as String?, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - title: - freezed == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String?, - type: - freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - commentsCount: - null == commentsCount - ? _value.commentsCount - : commentsCount // ignore: cast_nullable_to_non_nullable - as int, - wasLikedByMe: - null == wasLikedByMe - ? _value.wasLikedByMe - : wasLikedByMe // ignore: cast_nullable_to_non_nullable - as bool, - isFavorite: - null == isFavorite - ? _value.isFavorite - : isFavorite // ignore: cast_nullable_to_non_nullable - as bool, - calories: - null == calories - ? _value.calories - : calories // ignore: cast_nullable_to_non_nullable - as double, - likesCount: - null == likesCount - ? _value.likesCount - : likesCount // ignore: cast_nullable_to_non_nullable - as int, - viewsCount: - null == viewsCount - ? _value.viewsCount - : viewsCount // ignore: cast_nullable_to_non_nullable - as int, - author: - null == author - ? _value.author - : author // ignore: cast_nullable_to_non_nullable - as Author, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + cookingTime: null == cookingTime + ? _value.cookingTime + : cookingTime // ignore: cast_nullable_to_non_nullable + as int, + activeCookingTime: null == activeCookingTime + ? _value.activeCookingTime + : activeCookingTime // ignore: cast_nullable_to_non_nullable + as int, + ingredients: freezed == ingredients + ? _value.ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List?, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + steps: freezed == steps + ? _value.steps + : steps // ignore: cast_nullable_to_non_nullable + as List?, + videoUrl: freezed == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + title: freezed == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + commentsCount: null == commentsCount + ? _value.commentsCount + : commentsCount // ignore: cast_nullable_to_non_nullable + as int, + wasLikedByMe: null == wasLikedByMe + ? _value.wasLikedByMe + : wasLikedByMe // ignore: cast_nullable_to_non_nullable + as bool, + isFavorite: null == isFavorite + ? _value.isFavorite + : isFavorite // ignore: cast_nullable_to_non_nullable + as bool, + calories: null == calories + ? _value.calories + : calories // ignore: cast_nullable_to_non_nullable + as double, + likesCount: null == likesCount + ? _value.likesCount + : likesCount // ignore: cast_nullable_to_non_nullable + as int, + viewsCount: null == viewsCount + ? _value.viewsCount + : viewsCount // ignore: cast_nullable_to_non_nullable + as int, + author: null == author + ? _value.author + : author // ignore: cast_nullable_to_non_nullable + as Author, + ) as $Val); } /// Create a copy of Recipe @@ -259,34 +233,32 @@ class _$RecipeCopyWithImpl<$Res, $Val extends Recipe> /// @nodoc abstract class _$$RecipesImplCopyWith<$Res> implements $RecipeCopyWith<$Res> { factory _$$RecipesImplCopyWith( - _$RecipesImpl value, - $Res Function(_$RecipesImpl) then, - ) = __$$RecipesImplCopyWithImpl<$Res>; + _$RecipesImpl value, $Res Function(_$RecipesImpl) then) = + __$$RecipesImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - int id, - String image, - String state, - @JsonKey(name: 'cooking_time') int cookingTime, - @JsonKey(name: 'active_time') int activeCookingTime, - List? ingredients, - @JsonKey(name: 'description_md') String description, - List? steps, - @JsonKey(name: 'video_url') String? videoUrl, - @JsonKey(name: 'created_at') DateTime createdAt, - @JsonKey(name: 'updated_at') DateTime updatedAt, - String? title, - String? type, - String slug, - @JsonKey(name: 'total_comments') int commentsCount, - @JsonKey(name: 'was_liked_by_me') bool wasLikedByMe, - @JsonKey(name: 'is_favorite') bool isFavorite, - @JsonKey(name: 'energy_per_serving') double calories, - @JsonKey(name: 'total_likes') int likesCount, - @JsonKey(name: 'total_views') int viewsCount, - Author author, - }); + $Res call( + {int id, + String image, + String state, + @JsonKey(name: 'cooking_time') int cookingTime, + @JsonKey(name: 'active_time') int activeCookingTime, + List? ingredients, + @JsonKey(name: 'description_md') String description, + List? steps, + @JsonKey(name: 'video_url') String? videoUrl, + @JsonKey(name: 'created_at') DateTime createdAt, + @JsonKey(name: 'updated_at') DateTime updatedAt, + String? title, + String? type, + String slug, + @JsonKey(name: 'total_comments') int commentsCount, + @JsonKey(name: 'was_liked_by_me') bool wasLikedByMe, + @JsonKey(name: 'is_favorite') bool isFavorite, + @JsonKey(name: 'energy_per_serving') double calories, + @JsonKey(name: 'total_likes') int likesCount, + @JsonKey(name: 'total_views') int viewsCount, + Author author}); @override $AuthorCopyWith<$Res> get author; @@ -297,9 +269,8 @@ class __$$RecipesImplCopyWithImpl<$Res> extends _$RecipeCopyWithImpl<$Res, _$RecipesImpl> implements _$$RecipesImplCopyWith<$Res> { __$$RecipesImplCopyWithImpl( - _$RecipesImpl _value, - $Res Function(_$RecipesImpl) _then, - ) : super(_value, _then); + _$RecipesImpl _value, $Res Function(_$RecipesImpl) _then) + : super(_value, _then); /// Create a copy of Recipe /// with the given fields replaced by the non-null parameter values. @@ -328,145 +299,122 @@ class __$$RecipesImplCopyWithImpl<$Res> Object? viewsCount = null, Object? author = null, }) { - return _then( - _$RecipesImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - cookingTime: - null == cookingTime - ? _value.cookingTime - : cookingTime // ignore: cast_nullable_to_non_nullable - as int, - activeCookingTime: - null == activeCookingTime - ? _value.activeCookingTime - : activeCookingTime // ignore: cast_nullable_to_non_nullable - as int, - ingredients: - freezed == ingredients - ? _value._ingredients - : ingredients // ignore: cast_nullable_to_non_nullable - as List?, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - steps: - freezed == steps - ? _value._steps - : steps // ignore: cast_nullable_to_non_nullable - as List?, - videoUrl: - freezed == videoUrl - ? _value.videoUrl - : videoUrl // ignore: cast_nullable_to_non_nullable - as String?, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - title: - freezed == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String?, - type: - freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - commentsCount: - null == commentsCount - ? _value.commentsCount - : commentsCount // ignore: cast_nullable_to_non_nullable - as int, - wasLikedByMe: - null == wasLikedByMe - ? _value.wasLikedByMe - : wasLikedByMe // ignore: cast_nullable_to_non_nullable - as bool, - isFavorite: - null == isFavorite - ? _value.isFavorite - : isFavorite // ignore: cast_nullable_to_non_nullable - as bool, - calories: - null == calories - ? _value.calories - : calories // ignore: cast_nullable_to_non_nullable - as double, - likesCount: - null == likesCount - ? _value.likesCount - : likesCount // ignore: cast_nullable_to_non_nullable - as int, - viewsCount: - null == viewsCount - ? _value.viewsCount - : viewsCount // ignore: cast_nullable_to_non_nullable - as int, - author: - null == author - ? _value.author - : author // ignore: cast_nullable_to_non_nullable - as Author, - ), - ); + return _then(_$RecipesImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + cookingTime: null == cookingTime + ? _value.cookingTime + : cookingTime // ignore: cast_nullable_to_non_nullable + as int, + activeCookingTime: null == activeCookingTime + ? _value.activeCookingTime + : activeCookingTime // ignore: cast_nullable_to_non_nullable + as int, + ingredients: freezed == ingredients + ? _value._ingredients + : ingredients // ignore: cast_nullable_to_non_nullable + as List?, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + steps: freezed == steps + ? _value._steps + : steps // ignore: cast_nullable_to_non_nullable + as List?, + videoUrl: freezed == videoUrl + ? _value.videoUrl + : videoUrl // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + title: freezed == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + commentsCount: null == commentsCount + ? _value.commentsCount + : commentsCount // ignore: cast_nullable_to_non_nullable + as int, + wasLikedByMe: null == wasLikedByMe + ? _value.wasLikedByMe + : wasLikedByMe // ignore: cast_nullable_to_non_nullable + as bool, + isFavorite: null == isFavorite + ? _value.isFavorite + : isFavorite // ignore: cast_nullable_to_non_nullable + as bool, + calories: null == calories + ? _value.calories + : calories // ignore: cast_nullable_to_non_nullable + as double, + likesCount: null == likesCount + ? _value.likesCount + : likesCount // ignore: cast_nullable_to_non_nullable + as int, + viewsCount: null == viewsCount + ? _value.viewsCount + : viewsCount // ignore: cast_nullable_to_non_nullable + as int, + author: null == author + ? _value.author + : author // ignore: cast_nullable_to_non_nullable + as Author, + )); } } /// @nodoc @JsonSerializable() class _$RecipesImpl implements _Recipes { - const _$RecipesImpl({ - required this.id, - required this.image, - required this.state, - @JsonKey(name: 'cooking_time') required this.cookingTime, - @JsonKey(name: 'active_time') required this.activeCookingTime, - required final List? ingredients, - @JsonKey(name: 'description_md') required this.description, - required final List? steps, - @JsonKey(name: 'video_url') required this.videoUrl, - @JsonKey(name: 'created_at') required this.createdAt, - @JsonKey(name: 'updated_at') required this.updatedAt, - required this.title, - required this.type, - required this.slug, - @JsonKey(name: 'total_comments') required this.commentsCount, - @JsonKey(name: 'was_liked_by_me') required this.wasLikedByMe, - @JsonKey(name: 'is_favorite') required this.isFavorite, - @JsonKey(name: 'energy_per_serving') required this.calories, - @JsonKey(name: 'total_likes') required this.likesCount, - @JsonKey(name: 'total_views') required this.viewsCount, - required this.author, - }) : _ingredients = ingredients, - _steps = steps; + const _$RecipesImpl( + {required this.id, + required this.image, + required this.state, + @JsonKey(name: 'cooking_time') required this.cookingTime, + @JsonKey(name: 'active_time') required this.activeCookingTime, + required final List? ingredients, + @JsonKey(name: 'description_md') required this.description, + required final List? steps, + @JsonKey(name: 'video_url') required this.videoUrl, + @JsonKey(name: 'created_at') required this.createdAt, + @JsonKey(name: 'updated_at') required this.updatedAt, + required this.title, + required this.type, + required this.slug, + @JsonKey(name: 'total_comments') required this.commentsCount, + @JsonKey(name: 'was_liked_by_me') required this.wasLikedByMe, + @JsonKey(name: 'is_favorite') required this.isFavorite, + @JsonKey(name: 'energy_per_serving') required this.calories, + @JsonKey(name: 'total_likes') required this.likesCount, + @JsonKey(name: 'total_views') required this.viewsCount, + required this.author}) + : _ingredients = ingredients, + _steps = steps; factory _$RecipesImpl.fromJson(Map json) => _$$RecipesImplFromJson(json); @@ -559,10 +507,8 @@ class _$RecipesImpl implements _Recipes { other.cookingTime == cookingTime) && (identical(other.activeCookingTime, activeCookingTime) || other.activeCookingTime == activeCookingTime) && - const DeepCollectionEquality().equals( - other._ingredients, - _ingredients, - ) && + const DeepCollectionEquality() + .equals(other._ingredients, _ingredients) && (identical(other.description, description) || other.description == description) && const DeepCollectionEquality().equals(other._steps, _steps) && @@ -593,29 +539,29 @@ class _$RecipesImpl implements _Recipes { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hashAll([ - runtimeType, - id, - image, - state, - cookingTime, - activeCookingTime, - const DeepCollectionEquality().hash(_ingredients), - description, - const DeepCollectionEquality().hash(_steps), - videoUrl, - createdAt, - updatedAt, - title, - type, - slug, - commentsCount, - wasLikedByMe, - isFavorite, - calories, - likesCount, - viewsCount, - author, - ]); + runtimeType, + id, + image, + state, + cookingTime, + activeCookingTime, + const DeepCollectionEquality().hash(_ingredients), + description, + const DeepCollectionEquality().hash(_steps), + videoUrl, + createdAt, + updatedAt, + title, + type, + slug, + commentsCount, + wasLikedByMe, + isFavorite, + calories, + likesCount, + viewsCount, + author + ]); /// Create a copy of Recipe /// with the given fields replaced by the non-null parameter values. @@ -627,34 +573,35 @@ class _$RecipesImpl implements _Recipes { @override Map toJson() { - return _$$RecipesImplToJson(this); + return _$$RecipesImplToJson( + this, + ); } } abstract class _Recipes implements Recipe { - const factory _Recipes({ - required final int id, - required final String image, - required final String state, - @JsonKey(name: 'cooking_time') required final int cookingTime, - @JsonKey(name: 'active_time') required final int activeCookingTime, - required final List? ingredients, - @JsonKey(name: 'description_md') required final String description, - required final List? steps, - @JsonKey(name: 'video_url') required final String? videoUrl, - @JsonKey(name: 'created_at') required final DateTime createdAt, - @JsonKey(name: 'updated_at') required final DateTime updatedAt, - required final String? title, - required final String? type, - required final String slug, - @JsonKey(name: 'total_comments') required final int commentsCount, - @JsonKey(name: 'was_liked_by_me') required final bool wasLikedByMe, - @JsonKey(name: 'is_favorite') required final bool isFavorite, - @JsonKey(name: 'energy_per_serving') required final double calories, - @JsonKey(name: 'total_likes') required final int likesCount, - @JsonKey(name: 'total_views') required final int viewsCount, - required final Author author, - }) = _$RecipesImpl; + const factory _Recipes( + {required final int id, + required final String image, + required final String state, + @JsonKey(name: 'cooking_time') required final int cookingTime, + @JsonKey(name: 'active_time') required final int activeCookingTime, + required final List? ingredients, + @JsonKey(name: 'description_md') required final String description, + required final List? steps, + @JsonKey(name: 'video_url') required final String? videoUrl, + @JsonKey(name: 'created_at') required final DateTime createdAt, + @JsonKey(name: 'updated_at') required final DateTime updatedAt, + required final String? title, + required final String? type, + required final String slug, + @JsonKey(name: 'total_comments') required final int commentsCount, + @JsonKey(name: 'was_liked_by_me') required final bool wasLikedByMe, + @JsonKey(name: 'is_favorite') required final bool isFavorite, + @JsonKey(name: 'energy_per_serving') required final double calories, + @JsonKey(name: 'total_likes') required final int likesCount, + @JsonKey(name: 'total_views') required final int viewsCount, + required final Author author}) = _$RecipesImpl; factory _Recipes.fromJson(Map json) = _$RecipesImpl.fromJson; @@ -744,9 +691,8 @@ mixin _$Ingredient { /// @nodoc abstract class $IngredientCopyWith<$Res> { factory $IngredientCopyWith( - Ingredient value, - $Res Function(Ingredient) then, - ) = _$IngredientCopyWithImpl<$Res, Ingredient>; + Ingredient value, $Res Function(Ingredient) then) = + _$IngredientCopyWithImpl<$Res, Ingredient>; @useResult $Res call({String name, String? unit, String portion}); } @@ -770,26 +716,20 @@ class _$IngredientCopyWithImpl<$Res, $Val extends Ingredient> Object? unit = freezed, Object? portion = null, }) { - return _then( - _value.copyWith( - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - unit: - freezed == unit - ? _value.unit - : unit // ignore: cast_nullable_to_non_nullable - as String?, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + unit: freezed == unit + ? _value.unit + : unit // ignore: cast_nullable_to_non_nullable + as String?, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -797,9 +737,8 @@ class _$IngredientCopyWithImpl<$Res, $Val extends Ingredient> abstract class _$$IngredientImplCopyWith<$Res> implements $IngredientCopyWith<$Res> { factory _$$IngredientImplCopyWith( - _$IngredientImpl value, - $Res Function(_$IngredientImpl) then, - ) = __$$IngredientImplCopyWithImpl<$Res>; + _$IngredientImpl value, $Res Function(_$IngredientImpl) then) = + __$$IngredientImplCopyWithImpl<$Res>; @override @useResult $Res call({String name, String? unit, String portion}); @@ -810,9 +749,8 @@ class __$$IngredientImplCopyWithImpl<$Res> extends _$IngredientCopyWithImpl<$Res, _$IngredientImpl> implements _$$IngredientImplCopyWith<$Res> { __$$IngredientImplCopyWithImpl( - _$IngredientImpl _value, - $Res Function(_$IngredientImpl) _then, - ) : super(_value, _then); + _$IngredientImpl _value, $Res Function(_$IngredientImpl) _then) + : super(_value, _then); /// Create a copy of Ingredient /// with the given fields replaced by the non-null parameter values. @@ -823,36 +761,28 @@ class __$$IngredientImplCopyWithImpl<$Res> Object? unit = freezed, Object? portion = null, }) { - return _then( - _$IngredientImpl( - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - unit: - freezed == unit - ? _value.unit - : unit // ignore: cast_nullable_to_non_nullable - as String?, - portion: - null == portion - ? _value.portion - : portion // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + return _then(_$IngredientImpl( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + unit: freezed == unit + ? _value.unit + : unit // ignore: cast_nullable_to_non_nullable + as String?, + portion: null == portion + ? _value.portion + : portion // ignore: cast_nullable_to_non_nullable + as String, + )); } } /// @nodoc @JsonSerializable() class _$IngredientImpl implements _Ingredient { - const _$IngredientImpl({ - required this.name, - this.unit, - required this.portion, - }); + const _$IngredientImpl( + {required this.name, this.unit, required this.portion}); factory _$IngredientImpl.fromJson(Map json) => _$$IngredientImplFromJson(json); @@ -893,16 +823,17 @@ class _$IngredientImpl implements _Ingredient { @override Map toJson() { - return _$$IngredientImplToJson(this); + return _$$IngredientImplToJson( + this, + ); } } abstract class _Ingredient implements Ingredient { - const factory _Ingredient({ - required final String name, - final String? unit, - required final String portion, - }) = _$IngredientImpl; + const factory _Ingredient( + {required final String name, + final String? unit, + required final String portion}) = _$IngredientImpl; factory _Ingredient.fromJson(Map json) = _$IngredientImpl.fromJson; @@ -946,10 +877,8 @@ abstract class $StepCopyWith<$Res> { factory $StepCopyWith(Step value, $Res Function(Step) then) = _$StepCopyWithImpl<$Res, Step>; @useResult - $Res call({ - String image, - @JsonKey(name: 'description_md') String description, - }); + $Res call( + {String image, @JsonKey(name: 'description_md') String description}); } /// @nodoc @@ -966,37 +895,32 @@ class _$StepCopyWithImpl<$Res, $Val extends Step> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? image = null, Object? description = null}) { - return _then( - _value.copyWith( - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? image = null, + Object? description = null, + }) { + return _then(_value.copyWith( + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } /// @nodoc abstract class _$$StepImplCopyWith<$Res> implements $StepCopyWith<$Res> { factory _$$StepImplCopyWith( - _$StepImpl value, - $Res Function(_$StepImpl) then, - ) = __$$StepImplCopyWithImpl<$Res>; + _$StepImpl value, $Res Function(_$StepImpl) then) = + __$$StepImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - String image, - @JsonKey(name: 'description_md') String description, - }); + $Res call( + {String image, @JsonKey(name: 'description_md') String description}); } /// @nodoc @@ -1004,37 +928,35 @@ class __$$StepImplCopyWithImpl<$Res> extends _$StepCopyWithImpl<$Res, _$StepImpl> implements _$$StepImplCopyWith<$Res> { __$$StepImplCopyWithImpl(_$StepImpl _value, $Res Function(_$StepImpl) _then) - : super(_value, _then); + : super(_value, _then); /// Create a copy of Step /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? image = null, Object? description = null}) { - return _then( - _$StepImpl( - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? image = null, + Object? description = null, + }) { + return _then(_$StepImpl( + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + )); } } /// @nodoc @JsonSerializable() class _$StepImpl implements _Step { - const _$StepImpl({ - required this.image, - @JsonKey(name: 'description_md') required this.description, - }); + const _$StepImpl( + {required this.image, + @JsonKey(name: 'description_md') required this.description}); factory _$StepImpl.fromJson(Map json) => _$$StepImplFromJson(json); @@ -1074,15 +996,17 @@ class _$StepImpl implements _Step { @override Map toJson() { - return _$$StepImplToJson(this); + return _$$StepImplToJson( + this, + ); } } abstract class _Step implements Step { - const factory _Step({ - required final String image, - @JsonKey(name: 'description_md') required final String description, - }) = _$StepImpl; + const factory _Step( + {required final String image, + @JsonKey(name: 'description_md') required final String description}) = + _$StepImpl; factory _Step.fromJson(Map json) = _$StepImpl.fromJson; diff --git a/lib/features/feed/models/recipes_model.g.dart b/lib/features/feed/models/recipes_model.g.dart index ff44c0e2..ba740231 100644 --- a/lib/features/feed/models/recipes_model.g.dart +++ b/lib/features/feed/models/recipes_model.g.dart @@ -13,15 +13,13 @@ _$RecipesImpl _$$RecipesImplFromJson(Map json) => state: json['state'] as String, cookingTime: (json['cooking_time'] as num).toInt(), activeCookingTime: (json['active_time'] as num).toInt(), - ingredients: - (json['ingredients'] as List?) - ?.map((e) => Ingredient.fromJson(e as Map)) - .toList(), + ingredients: (json['ingredients'] as List?) + ?.map((e) => Ingredient.fromJson(e as Map)) + .toList(), description: json['description_md'] as String, - steps: - (json['steps'] as List?) - ?.map((e) => Step.fromJson(e as Map)) - .toList(), + steps: (json['steps'] as List?) + ?.map((e) => Step.fromJson(e as Map)) + .toList(), videoUrl: json['video_url'] as String?, createdAt: DateTime.parse(json['created_at'] as String), updatedAt: DateTime.parse(json['updated_at'] as String), @@ -77,9 +75,9 @@ Map _$$IngredientImplToJson(_$IngredientImpl instance) => }; _$StepImpl _$$StepImplFromJson(Map json) => _$StepImpl( - image: json['image'] as String, - description: json['description_md'] as String, -); + image: json['image'] as String, + description: json['description_md'] as String, + ); Map _$$StepImplToJson(_$StepImpl instance) => { diff --git a/lib/features/feed/models/recipes_pagination_model.freezed.dart b/lib/features/feed/models/recipes_pagination_model.freezed.dart index e2bbcf43..4e05ed5a 100644 --- a/lib/features/feed/models/recipes_pagination_model.freezed.dart +++ b/lib/features/feed/models/recipes_pagination_model.freezed.dart @@ -12,8 +12,7 @@ part of 'recipes_pagination_model.dart'; 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', -); + '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'); RecipesPagination _$RecipesPaginationFromJson(Map json) { return _RecipesPagination.fromJson(json); @@ -37,9 +36,8 @@ mixin _$RecipesPagination { /// @nodoc abstract class $RecipesPaginationCopyWith<$Res> { factory $RecipesPaginationCopyWith( - RecipesPagination value, - $Res Function(RecipesPagination) then, - ) = _$RecipesPaginationCopyWithImpl<$Res, RecipesPagination>; + RecipesPagination value, $Res Function(RecipesPagination) then) = + _$RecipesPaginationCopyWithImpl<$Res, RecipesPagination>; @useResult $Res call({@JsonKey(name: 'data') List recipesList}); } @@ -58,27 +56,24 @@ class _$RecipesPaginationCopyWithImpl<$Res, $Val extends RecipesPagination> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? recipesList = null}) { - return _then( - _value.copyWith( - recipesList: - null == recipesList - ? _value.recipesList - : recipesList // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + $Res call({ + Object? recipesList = null, + }) { + return _then(_value.copyWith( + recipesList: null == recipesList + ? _value.recipesList + : recipesList // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } } /// @nodoc abstract class _$$RecipesPaginationImplCopyWith<$Res> implements $RecipesPaginationCopyWith<$Res> { - factory _$$RecipesPaginationImplCopyWith( - _$RecipesPaginationImpl value, - $Res Function(_$RecipesPaginationImpl) then, - ) = __$$RecipesPaginationImplCopyWithImpl<$Res>; + factory _$$RecipesPaginationImplCopyWith(_$RecipesPaginationImpl value, + $Res Function(_$RecipesPaginationImpl) then) = + __$$RecipesPaginationImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: 'data') List recipesList}); @@ -88,34 +83,32 @@ abstract class _$$RecipesPaginationImplCopyWith<$Res> class __$$RecipesPaginationImplCopyWithImpl<$Res> extends _$RecipesPaginationCopyWithImpl<$Res, _$RecipesPaginationImpl> implements _$$RecipesPaginationImplCopyWith<$Res> { - __$$RecipesPaginationImplCopyWithImpl( - _$RecipesPaginationImpl _value, - $Res Function(_$RecipesPaginationImpl) _then, - ) : super(_value, _then); + __$$RecipesPaginationImplCopyWithImpl(_$RecipesPaginationImpl _value, + $Res Function(_$RecipesPaginationImpl) _then) + : super(_value, _then); /// Create a copy of RecipesPagination /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? recipesList = null}) { - return _then( - _$RecipesPaginationImpl( - recipesList: - null == recipesList - ? _value._recipesList - : recipesList // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + $Res call({ + Object? recipesList = null, + }) { + return _then(_$RecipesPaginationImpl( + recipesList: null == recipesList + ? _value._recipesList + : recipesList // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc @JsonSerializable() class _$RecipesPaginationImpl implements _RecipesPagination { - const _$RecipesPaginationImpl({ - @JsonKey(name: 'data') required final List recipesList, - }) : _recipesList = recipesList; + const _$RecipesPaginationImpl( + {@JsonKey(name: 'data') required final List recipesList}) + : _recipesList = recipesList; factory _$RecipesPaginationImpl.fromJson(Map json) => _$$RecipesPaginationImplFromJson(json); @@ -139,18 +132,14 @@ class _$RecipesPaginationImpl implements _RecipesPagination { return identical(this, other) || (other.runtimeType == runtimeType && other is _$RecipesPaginationImpl && - const DeepCollectionEquality().equals( - other._recipesList, - _recipesList, - )); + const DeepCollectionEquality() + .equals(other._recipesList, _recipesList)); } @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_recipesList), - ); + runtimeType, const DeepCollectionEquality().hash(_recipesList)); /// Create a copy of RecipesPagination /// with the given fields replaced by the non-null parameter values. @@ -159,20 +148,20 @@ class _$RecipesPaginationImpl implements _RecipesPagination { @pragma('vm:prefer-inline') _$$RecipesPaginationImplCopyWith<_$RecipesPaginationImpl> get copyWith => __$$RecipesPaginationImplCopyWithImpl<_$RecipesPaginationImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$RecipesPaginationImplToJson(this); + return _$$RecipesPaginationImplToJson( + this, + ); } } abstract class _RecipesPagination implements RecipesPagination { - const factory _RecipesPagination({ - @JsonKey(name: 'data') required final List recipesList, - }) = _$RecipesPaginationImpl; + const factory _RecipesPagination( + {@JsonKey(name: 'data') required final List recipesList}) = + _$RecipesPaginationImpl; factory _RecipesPagination.fromJson(Map json) = _$RecipesPaginationImpl.fromJson; diff --git a/lib/features/feed/models/recipes_pagination_model.g.dart b/lib/features/feed/models/recipes_pagination_model.g.dart index bdbe05a7..ab5e7326 100644 --- a/lib/features/feed/models/recipes_pagination_model.g.dart +++ b/lib/features/feed/models/recipes_pagination_model.g.dart @@ -7,14 +7,15 @@ part of 'recipes_pagination_model.dart'; // ************************************************************************** _$RecipesPaginationImpl _$$RecipesPaginationImplFromJson( - Map json, -) => _$RecipesPaginationImpl( - recipesList: - (json['data'] as List) + Map json) => + _$RecipesPaginationImpl( + recipesList: (json['data'] as List) .map((e) => Recipe.fromJson(e as Map)) .toList(), -); + ); Map _$$RecipesPaginationImplToJson( - _$RecipesPaginationImpl instance, -) => {'data': instance.recipesList}; + _$RecipesPaginationImpl instance) => + { + 'data': instance.recipesList, + }; diff --git a/lib/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart b/lib/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart index 3553c27d..106521e9 100644 --- a/lib/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart +++ b/lib/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart @@ -8,14 +8,14 @@ class CommentsCubit extends Cubit { CommentsCubit({ required this.feedRepository, - }) : super(CommentsState()); + }) : super(const CommentsState()); setReplyId(int? replyId) { emit((state as CommentsStateLoaded).copyWith(replyId: replyId)); } getComments(String id, CommentSourceType commentSourceType, [bool isFirstFetch = false]) async { - if (isFirstFetch) emit(CommentsState.loading()); + if (isFirstFetch) emit(const CommentsState.loading()); try { switch (commentSourceType) { case CommentSourceType.blogPost: diff --git a/lib/features/feed/presentation/bloc/comments_cubit/comments_state.freezed.dart b/lib/features/feed/presentation/bloc/comments_cubit/comments_state.freezed.dart index 908be3fd..c3b582ce 100644 --- a/lib/features/feed/presentation/bloc/comments_cubit/comments_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/comments_cubit/comments_state.freezed.dart @@ -12,8 +12,7 @@ part of 'comments_state.dart'; 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', -); + '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'); /// @nodoc mixin _$CommentsState { @@ -23,14 +22,16 @@ mixin _$CommentsState { required TResult Function() loading, required TResult Function(CommentModel comment, int? replyId) loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(CommentModel comment, int? replyId)? loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -38,21 +39,24 @@ mixin _$CommentsState { TResult Function(CommentModel comment, int? replyId)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_CommentsState value) $default, { required TResult Function(CommentsStateLoading value) loading, required TResult Function(CommentsStateLoaded value) loaded, required TResult Function(CommentsStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_CommentsState value)? $default, { TResult? Function(CommentsStateLoading value)? loading, TResult? Function(CommentsStateLoaded value)? loaded, TResult? Function(CommentsStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_CommentsState value)? $default, { @@ -60,15 +64,15 @@ mixin _$CommentsState { TResult Function(CommentsStateLoaded value)? loaded, TResult Function(CommentsStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $CommentsStateCopyWith<$Res> { factory $CommentsStateCopyWith( - CommentsState value, - $Res Function(CommentsState) then, - ) = _$CommentsStateCopyWithImpl<$Res, CommentsState>; + CommentsState value, $Res Function(CommentsState) then) = + _$CommentsStateCopyWithImpl<$Res, CommentsState>; } /// @nodoc @@ -88,9 +92,8 @@ class _$CommentsStateCopyWithImpl<$Res, $Val extends CommentsState> /// @nodoc abstract class _$$CommentsStateImplCopyWith<$Res> { factory _$$CommentsStateImplCopyWith( - _$CommentsStateImpl value, - $Res Function(_$CommentsStateImpl) then, - ) = __$$CommentsStateImplCopyWithImpl<$Res>; + _$CommentsStateImpl value, $Res Function(_$CommentsStateImpl) then) = + __$$CommentsStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -98,9 +101,8 @@ class __$$CommentsStateImplCopyWithImpl<$Res> extends _$CommentsStateCopyWithImpl<$Res, _$CommentsStateImpl> implements _$$CommentsStateImplCopyWith<$Res> { __$$CommentsStateImplCopyWithImpl( - _$CommentsStateImpl _value, - $Res Function(_$CommentsStateImpl) _then, - ) : super(_value, _then); + _$CommentsStateImpl _value, $Res Function(_$CommentsStateImpl) _then) + : super(_value, _then); /// Create a copy of CommentsState /// with the given fields replaced by the non-null parameter values. @@ -206,20 +208,18 @@ abstract class _CommentsState implements CommentsState { /// @nodoc abstract class _$$CommentsStateLoadingImplCopyWith<$Res> { - factory _$$CommentsStateLoadingImplCopyWith( - _$CommentsStateLoadingImpl value, - $Res Function(_$CommentsStateLoadingImpl) then, - ) = __$$CommentsStateLoadingImplCopyWithImpl<$Res>; + factory _$$CommentsStateLoadingImplCopyWith(_$CommentsStateLoadingImpl value, + $Res Function(_$CommentsStateLoadingImpl) then) = + __$$CommentsStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$CommentsStateLoadingImplCopyWithImpl<$Res> extends _$CommentsStateCopyWithImpl<$Res, _$CommentsStateLoadingImpl> implements _$$CommentsStateLoadingImplCopyWith<$Res> { - __$$CommentsStateLoadingImplCopyWithImpl( - _$CommentsStateLoadingImpl _value, - $Res Function(_$CommentsStateLoadingImpl) _then, - ) : super(_value, _then); + __$$CommentsStateLoadingImplCopyWithImpl(_$CommentsStateLoadingImpl _value, + $Res Function(_$CommentsStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of CommentsState /// with the given fields replaced by the non-null parameter values. @@ -326,10 +326,9 @@ abstract class CommentsStateLoading implements CommentsState { /// @nodoc abstract class _$$CommentsStateLoadedImplCopyWith<$Res> { - factory _$$CommentsStateLoadedImplCopyWith( - _$CommentsStateLoadedImpl value, - $Res Function(_$CommentsStateLoadedImpl) then, - ) = __$$CommentsStateLoadedImplCopyWithImpl<$Res>; + factory _$$CommentsStateLoadedImplCopyWith(_$CommentsStateLoadedImpl value, + $Res Function(_$CommentsStateLoadedImpl) then) = + __$$CommentsStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({CommentModel comment, int? replyId}); @@ -340,30 +339,28 @@ abstract class _$$CommentsStateLoadedImplCopyWith<$Res> { class __$$CommentsStateLoadedImplCopyWithImpl<$Res> extends _$CommentsStateCopyWithImpl<$Res, _$CommentsStateLoadedImpl> implements _$$CommentsStateLoadedImplCopyWith<$Res> { - __$$CommentsStateLoadedImplCopyWithImpl( - _$CommentsStateLoadedImpl _value, - $Res Function(_$CommentsStateLoadedImpl) _then, - ) : super(_value, _then); + __$$CommentsStateLoadedImplCopyWithImpl(_$CommentsStateLoadedImpl _value, + $Res Function(_$CommentsStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of CommentsState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? comment = null, Object? replyId = freezed}) { - return _then( - _$CommentsStateLoadedImpl( - comment: - null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as CommentModel, - replyId: - freezed == replyId - ? _value.replyId - : replyId // ignore: cast_nullable_to_non_nullable - as int?, - ), - ); + $Res call({ + Object? comment = null, + Object? replyId = freezed, + }) { + return _then(_$CommentsStateLoadedImpl( + comment: null == comment + ? _value.comment + : comment // ignore: cast_nullable_to_non_nullable + as CommentModel, + replyId: freezed == replyId + ? _value.replyId + : replyId // ignore: cast_nullable_to_non_nullable + as int?, + )); } /// Create a copy of CommentsState @@ -411,9 +408,7 @@ class _$CommentsStateLoadedImpl implements CommentsStateLoaded { @pragma('vm:prefer-inline') _$$CommentsStateLoadedImplCopyWith<_$CommentsStateLoadedImpl> get copyWith => __$$CommentsStateLoadedImplCopyWithImpl<_$CommentsStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -491,10 +486,9 @@ class _$CommentsStateLoadedImpl implements CommentsStateLoaded { } abstract class CommentsStateLoaded implements CommentsState { - const factory CommentsStateLoaded({ - required final CommentModel comment, - final int? replyId, - }) = _$CommentsStateLoadedImpl; + const factory CommentsStateLoaded( + {required final CommentModel comment, + final int? replyId}) = _$CommentsStateLoadedImpl; CommentModel get comment; int? get replyId; @@ -508,10 +502,9 @@ abstract class CommentsStateLoaded implements CommentsState { /// @nodoc abstract class _$$CommentsStateErrorImplCopyWith<$Res> { - factory _$$CommentsStateErrorImplCopyWith( - _$CommentsStateErrorImpl value, - $Res Function(_$CommentsStateErrorImpl) then, - ) = __$$CommentsStateErrorImplCopyWithImpl<$Res>; + factory _$$CommentsStateErrorImplCopyWith(_$CommentsStateErrorImpl value, + $Res Function(_$CommentsStateErrorImpl) then) = + __$$CommentsStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -520,25 +513,23 @@ abstract class _$$CommentsStateErrorImplCopyWith<$Res> { class __$$CommentsStateErrorImplCopyWithImpl<$Res> extends _$CommentsStateCopyWithImpl<$Res, _$CommentsStateErrorImpl> implements _$$CommentsStateErrorImplCopyWith<$Res> { - __$$CommentsStateErrorImplCopyWithImpl( - _$CommentsStateErrorImpl _value, - $Res Function(_$CommentsStateErrorImpl) _then, - ) : super(_value, _then); + __$$CommentsStateErrorImplCopyWithImpl(_$CommentsStateErrorImpl _value, + $Res Function(_$CommentsStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of CommentsState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$CommentsStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$CommentsStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -574,9 +565,7 @@ class _$CommentsStateErrorImpl implements CommentsStateError { @pragma('vm:prefer-inline') _$$CommentsStateErrorImplCopyWith<_$CommentsStateErrorImpl> get copyWith => __$$CommentsStateErrorImplCopyWithImpl<_$CommentsStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs diff --git a/lib/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart b/lib/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart index cf96b2a6..660c7560 100644 --- a/lib/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart +++ b/lib/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart @@ -9,10 +9,10 @@ class ConsultantsCubit extends Cubit { ConsultantsCubit({ required this.feedRepository, - }) : super(ConsultantsState()); + }) : super(const ConsultantsState()); getConsultants() async { - emit(ConsultantsState.loading()); + emit(const ConsultantsState.loading()); try { emit( ConsultantsState.loaded( diff --git a/lib/features/feed/presentation/bloc/consultants_cubit/consultants_state.freezed.dart b/lib/features/feed/presentation/bloc/consultants_cubit/consultants_state.freezed.dart index 4cf56ef7..5dd8aa15 100644 --- a/lib/features/feed/presentation/bloc/consultants_cubit/consultants_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/consultants_cubit/consultants_state.freezed.dart @@ -12,8 +12,7 @@ part of 'consultants_state.dart'; 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', -); + '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'); /// @nodoc mixin _$ConsultantsState { @@ -22,46 +21,47 @@ mixin _$ConsultantsState { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List consultantsList, - bool isLoading, - ) - loaded, + List consultantsList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - List consultantsList, - bool isLoading, - )? - loaded, + List consultantsList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, TResult Function(List consultantsList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_ConsultantsState value) $default, { required TResult Function(ConsultantsStateLoading value) loading, required TResult Function(ConsultantsStateLoaded value) loaded, required TResult Function(ConsultantsStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_ConsultantsState value)? $default, { TResult? Function(ConsultantsStateLoading value)? loading, TResult? Function(ConsultantsStateLoaded value)? loaded, TResult? Function(ConsultantsStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_ConsultantsState value)? $default, { @@ -69,15 +69,15 @@ mixin _$ConsultantsState { TResult Function(ConsultantsStateLoaded value)? loaded, TResult Function(ConsultantsStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ConsultantsStateCopyWith<$Res> { factory $ConsultantsStateCopyWith( - ConsultantsState value, - $Res Function(ConsultantsState) then, - ) = _$ConsultantsStateCopyWithImpl<$Res, ConsultantsState>; + ConsultantsState value, $Res Function(ConsultantsState) then) = + _$ConsultantsStateCopyWithImpl<$Res, ConsultantsState>; } /// @nodoc @@ -96,20 +96,18 @@ class _$ConsultantsStateCopyWithImpl<$Res, $Val extends ConsultantsState> /// @nodoc abstract class _$$ConsultantsStateImplCopyWith<$Res> { - factory _$$ConsultantsStateImplCopyWith( - _$ConsultantsStateImpl value, - $Res Function(_$ConsultantsStateImpl) then, - ) = __$$ConsultantsStateImplCopyWithImpl<$Res>; + factory _$$ConsultantsStateImplCopyWith(_$ConsultantsStateImpl value, + $Res Function(_$ConsultantsStateImpl) then) = + __$$ConsultantsStateImplCopyWithImpl<$Res>; } /// @nodoc class __$$ConsultantsStateImplCopyWithImpl<$Res> extends _$ConsultantsStateCopyWithImpl<$Res, _$ConsultantsStateImpl> implements _$$ConsultantsStateImplCopyWith<$Res> { - __$$ConsultantsStateImplCopyWithImpl( - _$ConsultantsStateImpl _value, - $Res Function(_$ConsultantsStateImpl) _then, - ) : super(_value, _then); + __$$ConsultantsStateImplCopyWithImpl(_$ConsultantsStateImpl _value, + $Res Function(_$ConsultantsStateImpl) _then) + : super(_value, _then); /// Create a copy of ConsultantsState /// with the given fields replaced by the non-null parameter values. @@ -140,10 +138,8 @@ class _$ConsultantsStateImpl implements _ConsultantsState { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List consultantsList, - bool isLoading, - ) - loaded, + List consultantsList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -155,10 +151,8 @@ class _$ConsultantsStateImpl implements _ConsultantsState { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - List consultantsList, - bool isLoading, - )? - loaded, + List consultantsList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -170,7 +164,7 @@ class _$ConsultantsStateImpl implements _ConsultantsState { TResult Function()? $default, { TResult Function()? loading, TResult Function(List consultantsList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -225,9 +219,9 @@ abstract class _ConsultantsState implements ConsultantsState { /// @nodoc abstract class _$$ConsultantsStateLoadingImplCopyWith<$Res> { factory _$$ConsultantsStateLoadingImplCopyWith( - _$ConsultantsStateLoadingImpl value, - $Res Function(_$ConsultantsStateLoadingImpl) then, - ) = __$$ConsultantsStateLoadingImplCopyWithImpl<$Res>; + _$ConsultantsStateLoadingImpl value, + $Res Function(_$ConsultantsStateLoadingImpl) then) = + __$$ConsultantsStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc @@ -235,9 +229,9 @@ class __$$ConsultantsStateLoadingImplCopyWithImpl<$Res> extends _$ConsultantsStateCopyWithImpl<$Res, _$ConsultantsStateLoadingImpl> implements _$$ConsultantsStateLoadingImplCopyWith<$Res> { __$$ConsultantsStateLoadingImplCopyWithImpl( - _$ConsultantsStateLoadingImpl _value, - $Res Function(_$ConsultantsStateLoadingImpl) _then, - ) : super(_value, _then); + _$ConsultantsStateLoadingImpl _value, + $Res Function(_$ConsultantsStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of ConsultantsState /// with the given fields replaced by the non-null parameter values. @@ -269,10 +263,8 @@ class _$ConsultantsStateLoadingImpl implements ConsultantsStateLoading { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List consultantsList, - bool isLoading, - ) - loaded, + List consultantsList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loading(); @@ -284,10 +276,8 @@ class _$ConsultantsStateLoadingImpl implements ConsultantsStateLoading { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - List consultantsList, - bool isLoading, - )? - loaded, + List consultantsList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return loading?.call(); @@ -299,7 +289,7 @@ class _$ConsultantsStateLoadingImpl implements ConsultantsStateLoading { TResult Function()? $default, { TResult Function()? loading, TResult Function(List consultantsList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -354,9 +344,9 @@ abstract class ConsultantsStateLoading implements ConsultantsState { /// @nodoc abstract class _$$ConsultantsStateLoadedImplCopyWith<$Res> { factory _$$ConsultantsStateLoadedImplCopyWith( - _$ConsultantsStateLoadedImpl value, - $Res Function(_$ConsultantsStateLoadedImpl) then, - ) = __$$ConsultantsStateLoadedImplCopyWithImpl<$Res>; + _$ConsultantsStateLoadedImpl value, + $Res Function(_$ConsultantsStateLoadedImpl) then) = + __$$ConsultantsStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({List consultantsList, bool isLoading}); } @@ -366,39 +356,38 @@ class __$$ConsultantsStateLoadedImplCopyWithImpl<$Res> extends _$ConsultantsStateCopyWithImpl<$Res, _$ConsultantsStateLoadedImpl> implements _$$ConsultantsStateLoadedImplCopyWith<$Res> { __$$ConsultantsStateLoadedImplCopyWithImpl( - _$ConsultantsStateLoadedImpl _value, - $Res Function(_$ConsultantsStateLoadedImpl) _then, - ) : super(_value, _then); + _$ConsultantsStateLoadedImpl _value, + $Res Function(_$ConsultantsStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of ConsultantsState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? consultantsList = null, Object? isLoading = null}) { - return _then( - _$ConsultantsStateLoadedImpl( - consultantsList: - null == consultantsList - ? _value._consultantsList - : consultantsList // ignore: cast_nullable_to_non_nullable - as List, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + $Res call({ + Object? consultantsList = null, + Object? isLoading = null, + }) { + return _then(_$ConsultantsStateLoadedImpl( + consultantsList: null == consultantsList + ? _value._consultantsList + : consultantsList // ignore: cast_nullable_to_non_nullable + as List, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc class _$ConsultantsStateLoadedImpl implements ConsultantsStateLoaded { - const _$ConsultantsStateLoadedImpl({ - required final List consultantsList, - required this.isLoading, - }) : _consultantsList = consultantsList; + const _$ConsultantsStateLoadedImpl( + {required final List consultantsList, + required this.isLoading}) + : _consultantsList = consultantsList; final List _consultantsList; @override @@ -421,20 +410,15 @@ class _$ConsultantsStateLoadedImpl implements ConsultantsStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConsultantsStateLoadedImpl && - const DeepCollectionEquality().equals( - other._consultantsList, - _consultantsList, - ) && + const DeepCollectionEquality() + .equals(other._consultantsList, _consultantsList) && (identical(other.isLoading, isLoading) || other.isLoading == isLoading)); } @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_consultantsList), - isLoading, - ); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_consultantsList), isLoading); /// Create a copy of ConsultantsState /// with the given fields replaced by the non-null parameter values. @@ -442,11 +426,8 @@ class _$ConsultantsStateLoadedImpl implements ConsultantsStateLoaded { @override @pragma('vm:prefer-inline') _$$ConsultantsStateLoadedImplCopyWith<_$ConsultantsStateLoadedImpl> - get copyWith => - __$$ConsultantsStateLoadedImplCopyWithImpl<_$ConsultantsStateLoadedImpl>( - this, - _$identity, - ); + get copyWith => __$$ConsultantsStateLoadedImplCopyWithImpl< + _$ConsultantsStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -454,10 +435,8 @@ class _$ConsultantsStateLoadedImpl implements ConsultantsStateLoaded { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List consultantsList, - bool isLoading, - ) - loaded, + List consultantsList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loaded(consultantsList, isLoading); @@ -469,10 +448,8 @@ class _$ConsultantsStateLoadedImpl implements ConsultantsStateLoaded { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - List consultantsList, - bool isLoading, - )? - loaded, + List consultantsList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return loaded?.call(consultantsList, isLoading); @@ -484,7 +461,7 @@ class _$ConsultantsStateLoadedImpl implements ConsultantsStateLoaded { TResult Function()? $default, { TResult Function()? loading, TResult Function(List consultantsList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -533,10 +510,9 @@ class _$ConsultantsStateLoadedImpl implements ConsultantsStateLoaded { } abstract class ConsultantsStateLoaded implements ConsultantsState { - const factory ConsultantsStateLoaded({ - required final List consultantsList, - required final bool isLoading, - }) = _$ConsultantsStateLoadedImpl; + const factory ConsultantsStateLoaded( + {required final List consultantsList, + required final bool isLoading}) = _$ConsultantsStateLoadedImpl; List get consultantsList; bool get isLoading; @@ -545,15 +521,15 @@ abstract class ConsultantsStateLoaded implements ConsultantsState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$ConsultantsStateLoadedImplCopyWith<_$ConsultantsStateLoadedImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$ConsultantsStateErrorImplCopyWith<$Res> { factory _$$ConsultantsStateErrorImplCopyWith( - _$ConsultantsStateErrorImpl value, - $Res Function(_$ConsultantsStateErrorImpl) then, - ) = __$$ConsultantsStateErrorImplCopyWithImpl<$Res>; + _$ConsultantsStateErrorImpl value, + $Res Function(_$ConsultantsStateErrorImpl) then) = + __$$ConsultantsStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -562,25 +538,23 @@ abstract class _$$ConsultantsStateErrorImplCopyWith<$Res> { class __$$ConsultantsStateErrorImplCopyWithImpl<$Res> extends _$ConsultantsStateCopyWithImpl<$Res, _$ConsultantsStateErrorImpl> implements _$$ConsultantsStateErrorImplCopyWith<$Res> { - __$$ConsultantsStateErrorImplCopyWithImpl( - _$ConsultantsStateErrorImpl _value, - $Res Function(_$ConsultantsStateErrorImpl) _then, - ) : super(_value, _then); + __$$ConsultantsStateErrorImplCopyWithImpl(_$ConsultantsStateErrorImpl _value, + $Res Function(_$ConsultantsStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of ConsultantsState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$ConsultantsStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$ConsultantsStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -615,11 +589,8 @@ class _$ConsultantsStateErrorImpl implements ConsultantsStateError { @override @pragma('vm:prefer-inline') _$$ConsultantsStateErrorImplCopyWith<_$ConsultantsStateErrorImpl> - get copyWith => - __$$ConsultantsStateErrorImplCopyWithImpl<_$ConsultantsStateErrorImpl>( - this, - _$identity, - ); + get copyWith => __$$ConsultantsStateErrorImplCopyWithImpl< + _$ConsultantsStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -627,10 +598,8 @@ class _$ConsultantsStateErrorImpl implements ConsultantsStateError { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List consultantsList, - bool isLoading, - ) - loaded, + List consultantsList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -642,10 +611,8 @@ class _$ConsultantsStateErrorImpl implements ConsultantsStateError { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - List consultantsList, - bool isLoading, - )? - loaded, + List consultantsList, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -657,7 +624,7 @@ class _$ConsultantsStateErrorImpl implements ConsultantsStateError { TResult Function()? $default, { TResult Function()? loading, TResult Function(List consultantsList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -715,5 +682,5 @@ abstract class ConsultantsStateError implements ConsultantsState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$ConsultantsStateErrorImplCopyWith<_$ConsultantsStateErrorImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart b/lib/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart index 84da2f34..23c7ae37 100644 --- a/lib/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart +++ b/lib/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart @@ -56,7 +56,7 @@ class DietsCubit extends Cubit { emit(state.copyWith(filterState: state.filterState.copyWith(typeIndex: index), errorMessage: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadDiets( query: _query, ), @@ -67,7 +67,7 @@ class DietsCubit extends Cubit { emit(state.copyWith(filterState: state.filterState.copyWith(sortingIndex: index), errorMessage: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadDiets( query: _query, ), @@ -78,7 +78,7 @@ class DietsCubit extends Cubit { emit(state.copyWith(filterState: state.filterState.copyWith(durationIndex: index), errorMessage: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadDiets( query: _query, ), @@ -186,7 +186,7 @@ class DietsCubit extends Cubit { } EasyDebounce.debounce( 'like_diet', - Duration(milliseconds: 200), + const Duration(milliseconds: 200), () async { try { await dietsRepository.likeDiet(id); @@ -282,7 +282,7 @@ class DietsCubit extends Cubit { ); EasyDebounce.debounce( 'add_or_remove_diet_from_favorite', - Duration(milliseconds: 200), + const Duration(milliseconds: 200), () async { try { await dietsRepository.addToFavorite(id); @@ -322,7 +322,7 @@ class DietsCubit extends Cubit { ); EasyDebounce.debounce( 'add_or_remove_diet_from_favorite', - Duration(milliseconds: 200), + const Duration(milliseconds: 200), () async { try { await dietsRepository.removeFromFavorite(id); 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 8f3888de..5057b86d 100644 --- a/lib/features/feed/presentation/bloc/diets_cubit/diets_state.dart +++ b/lib/features/feed/presentation/bloc/diets_cubit/diets_state.dart @@ -12,7 +12,7 @@ class DietsState with _$DietsState { required String? errorMessage, }) = _DietsState; - factory DietsState.initial() => DietsState( + factory DietsState.initial() => const DietsState( filterState: DietsFilterState( durationIndex: 0, sortingIndex: 0, diff --git a/lib/features/feed/presentation/bloc/diets_cubit/diets_state.freezed.dart b/lib/features/feed/presentation/bloc/diets_cubit/diets_state.freezed.dart index d6fc0b9f..aea14d0b 100644 --- a/lib/features/feed/presentation/bloc/diets_cubit/diets_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/diets_cubit/diets_state.freezed.dart @@ -12,8 +12,7 @@ part of 'diets_state.dart'; 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', -); + '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'); /// @nodoc mixin _$DietsState { @@ -32,16 +31,14 @@ mixin _$DietsState { /// @nodoc abstract class $DietsStateCopyWith<$Res> { factory $DietsStateCopyWith( - DietsState value, - $Res Function(DietsState) then, - ) = _$DietsStateCopyWithImpl<$Res, DietsState>; + DietsState value, $Res Function(DietsState) then) = + _$DietsStateCopyWithImpl<$Res, DietsState>; @useResult - $Res call({ - DietsFilterState filterState, - List dietsList, - bool isLoading, - String? errorMessage, - }); + $Res call( + {DietsFilterState filterState, + List dietsList, + bool isLoading, + String? errorMessage}); $DietsFilterStateCopyWith<$Res> get filterState; } @@ -66,31 +63,24 @@ class _$DietsStateCopyWithImpl<$Res, $Val extends DietsState> Object? isLoading = null, Object? errorMessage = freezed, }) { - return _then( - _value.copyWith( - filterState: - null == filterState - ? _value.filterState - : filterState // ignore: cast_nullable_to_non_nullable - as DietsFilterState, - dietsList: - null == dietsList - ? _value.dietsList - : dietsList // ignore: cast_nullable_to_non_nullable - as List, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + filterState: null == filterState + ? _value.filterState + : filterState // ignore: cast_nullable_to_non_nullable + as DietsFilterState, + dietsList: null == dietsList + ? _value.dietsList + : dietsList // ignore: cast_nullable_to_non_nullable + as List, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } /// Create a copy of DietsState @@ -108,17 +98,15 @@ class _$DietsStateCopyWithImpl<$Res, $Val extends DietsState> abstract class _$$DietsStateImplCopyWith<$Res> implements $DietsStateCopyWith<$Res> { factory _$$DietsStateImplCopyWith( - _$DietsStateImpl value, - $Res Function(_$DietsStateImpl) then, - ) = __$$DietsStateImplCopyWithImpl<$Res>; + _$DietsStateImpl value, $Res Function(_$DietsStateImpl) then) = + __$$DietsStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - DietsFilterState filterState, - List dietsList, - bool isLoading, - String? errorMessage, - }); + $Res call( + {DietsFilterState filterState, + List dietsList, + bool isLoading, + String? errorMessage}); @override $DietsFilterStateCopyWith<$Res> get filterState; @@ -129,9 +117,8 @@ class __$$DietsStateImplCopyWithImpl<$Res> extends _$DietsStateCopyWithImpl<$Res, _$DietsStateImpl> implements _$$DietsStateImplCopyWith<$Res> { __$$DietsStateImplCopyWithImpl( - _$DietsStateImpl _value, - $Res Function(_$DietsStateImpl) _then, - ) : super(_value, _then); + _$DietsStateImpl _value, $Res Function(_$DietsStateImpl) _then) + : super(_value, _then); /// Create a copy of DietsState /// with the given fields replaced by the non-null parameter values. @@ -143,42 +130,36 @@ class __$$DietsStateImplCopyWithImpl<$Res> Object? isLoading = null, Object? errorMessage = freezed, }) { - return _then( - _$DietsStateImpl( - filterState: - null == filterState - ? _value.filterState - : filterState // ignore: cast_nullable_to_non_nullable - as DietsFilterState, - dietsList: - null == dietsList - ? _value._dietsList - : dietsList // ignore: cast_nullable_to_non_nullable - as List, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$DietsStateImpl( + filterState: null == filterState + ? _value.filterState + : filterState // ignore: cast_nullable_to_non_nullable + as DietsFilterState, + dietsList: null == dietsList + ? _value._dietsList + : dietsList // ignore: cast_nullable_to_non_nullable + as List, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc class _$DietsStateImpl implements _DietsState { - const _$DietsStateImpl({ - required this.filterState, - required final List dietsList, - required this.isLoading, - required this.errorMessage, - }) : _dietsList = dietsList; + const _$DietsStateImpl( + {required this.filterState, + required final List dietsList, + required this.isLoading, + required this.errorMessage}) + : _dietsList = dietsList; @override final DietsFilterState filterState; @@ -207,10 +188,8 @@ class _$DietsStateImpl implements _DietsState { other is _$DietsStateImpl && (identical(other.filterState, filterState) || other.filterState == filterState) && - const DeepCollectionEquality().equals( - other._dietsList, - _dietsList, - ) && + const DeepCollectionEquality() + .equals(other._dietsList, _dietsList) && (identical(other.isLoading, isLoading) || other.isLoading == isLoading) && (identical(other.errorMessage, errorMessage) || @@ -218,13 +197,8 @@ class _$DietsStateImpl implements _DietsState { } @override - int get hashCode => Object.hash( - runtimeType, - filterState, - const DeepCollectionEquality().hash(_dietsList), - isLoading, - errorMessage, - ); + int get hashCode => Object.hash(runtimeType, filterState, + const DeepCollectionEquality().hash(_dietsList), isLoading, errorMessage); /// Create a copy of DietsState /// with the given fields replaced by the non-null parameter values. @@ -236,12 +210,11 @@ class _$DietsStateImpl implements _DietsState { } abstract class _DietsState implements DietsState { - const factory _DietsState({ - required final DietsFilterState filterState, - required final List dietsList, - required final bool isLoading, - required final String? errorMessage, - }) = _$DietsStateImpl; + const factory _DietsState( + {required final DietsFilterState filterState, + required final List dietsList, + required final bool isLoading, + required final String? errorMessage}) = _$DietsStateImpl; @override DietsFilterState get filterState; @@ -276,9 +249,8 @@ mixin _$DietsFilterState { /// @nodoc abstract class $DietsFilterStateCopyWith<$Res> { factory $DietsFilterStateCopyWith( - DietsFilterState value, - $Res Function(DietsFilterState) then, - ) = _$DietsFilterStateCopyWithImpl<$Res, DietsFilterState>; + DietsFilterState value, $Res Function(DietsFilterState) then) = + _$DietsFilterStateCopyWithImpl<$Res, DietsFilterState>; @useResult $Res call({int sortingIndex, int durationIndex, int typeIndex}); } @@ -302,36 +274,29 @@ class _$DietsFilterStateCopyWithImpl<$Res, $Val extends DietsFilterState> Object? durationIndex = null, Object? typeIndex = null, }) { - return _then( - _value.copyWith( - sortingIndex: - null == sortingIndex - ? _value.sortingIndex - : sortingIndex // ignore: cast_nullable_to_non_nullable - as int, - durationIndex: - null == durationIndex - ? _value.durationIndex - : durationIndex // ignore: cast_nullable_to_non_nullable - as int, - typeIndex: - null == typeIndex - ? _value.typeIndex - : typeIndex // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + return _then(_value.copyWith( + sortingIndex: null == sortingIndex + ? _value.sortingIndex + : sortingIndex // ignore: cast_nullable_to_non_nullable + as int, + durationIndex: null == durationIndex + ? _value.durationIndex + : durationIndex // ignore: cast_nullable_to_non_nullable + as int, + typeIndex: null == typeIndex + ? _value.typeIndex + : typeIndex // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } /// @nodoc abstract class _$$DietsFilterStateImplCopyWith<$Res> implements $DietsFilterStateCopyWith<$Res> { - factory _$$DietsFilterStateImplCopyWith( - _$DietsFilterStateImpl value, - $Res Function(_$DietsFilterStateImpl) then, - ) = __$$DietsFilterStateImplCopyWithImpl<$Res>; + factory _$$DietsFilterStateImplCopyWith(_$DietsFilterStateImpl value, + $Res Function(_$DietsFilterStateImpl) then) = + __$$DietsFilterStateImplCopyWithImpl<$Res>; @override @useResult $Res call({int sortingIndex, int durationIndex, int typeIndex}); @@ -341,10 +306,9 @@ abstract class _$$DietsFilterStateImplCopyWith<$Res> class __$$DietsFilterStateImplCopyWithImpl<$Res> extends _$DietsFilterStateCopyWithImpl<$Res, _$DietsFilterStateImpl> implements _$$DietsFilterStateImplCopyWith<$Res> { - __$$DietsFilterStateImplCopyWithImpl( - _$DietsFilterStateImpl _value, - $Res Function(_$DietsFilterStateImpl) _then, - ) : super(_value, _then); + __$$DietsFilterStateImplCopyWithImpl(_$DietsFilterStateImpl _value, + $Res Function(_$DietsFilterStateImpl) _then) + : super(_value, _then); /// Create a copy of DietsFilterState /// with the given fields replaced by the non-null parameter values. @@ -355,36 +319,30 @@ class __$$DietsFilterStateImplCopyWithImpl<$Res> Object? durationIndex = null, Object? typeIndex = null, }) { - return _then( - _$DietsFilterStateImpl( - sortingIndex: - null == sortingIndex - ? _value.sortingIndex - : sortingIndex // ignore: cast_nullable_to_non_nullable - as int, - durationIndex: - null == durationIndex - ? _value.durationIndex - : durationIndex // ignore: cast_nullable_to_non_nullable - as int, - typeIndex: - null == typeIndex - ? _value.typeIndex - : typeIndex // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$DietsFilterStateImpl( + sortingIndex: null == sortingIndex + ? _value.sortingIndex + : sortingIndex // ignore: cast_nullable_to_non_nullable + as int, + durationIndex: null == durationIndex + ? _value.durationIndex + : durationIndex // ignore: cast_nullable_to_non_nullable + as int, + typeIndex: null == typeIndex + ? _value.typeIndex + : typeIndex // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc class _$DietsFilterStateImpl implements _DietsFilterState { - const _$DietsFilterStateImpl({ - required this.sortingIndex, - required this.durationIndex, - required this.typeIndex, - }); + const _$DietsFilterStateImpl( + {required this.sortingIndex, + required this.durationIndex, + required this.typeIndex}); @override final int sortingIndex; @@ -422,17 +380,14 @@ class _$DietsFilterStateImpl implements _DietsFilterState { @pragma('vm:prefer-inline') _$$DietsFilterStateImplCopyWith<_$DietsFilterStateImpl> get copyWith => __$$DietsFilterStateImplCopyWithImpl<_$DietsFilterStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _DietsFilterState implements DietsFilterState { - const factory _DietsFilterState({ - required final int sortingIndex, - required final int durationIndex, - required final int typeIndex, - }) = _$DietsFilterStateImpl; + const factory _DietsFilterState( + {required final int sortingIndex, + required final int durationIndex, + required final int typeIndex}) = _$DietsFilterStateImpl; @override int get sortingIndex; diff --git a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart index 280779d7..70cb30d4 100644 --- a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart @@ -12,8 +12,7 @@ part of 'feed_state.dart'; 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', -); + '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'); /// @nodoc mixin _$FeedState { @@ -22,43 +21,46 @@ mixin _$FeedState { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List feedBlogPostList, - bool isLoading, - ) - loaded, + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, TResult Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_FeedState value) $default, { required TResult Function(FeedStateLoading value) loading, required TResult Function(FeedStateLoaded value) loaded, required TResult Function(FeedStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_FeedState value)? $default, { TResult? Function(FeedStateLoading value)? loading, TResult? Function(FeedStateLoaded value)? loaded, TResult? Function(FeedStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_FeedState value)? $default, { @@ -66,7 +68,8 @@ mixin _$FeedState { TResult Function(FeedStateLoaded value)? loaded, TResult Function(FeedStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc @@ -92,9 +95,8 @@ class _$FeedStateCopyWithImpl<$Res, $Val extends FeedState> /// @nodoc abstract class _$$FeedStateImplCopyWith<$Res> { factory _$$FeedStateImplCopyWith( - _$FeedStateImpl value, - $Res Function(_$FeedStateImpl) then, - ) = __$$FeedStateImplCopyWithImpl<$Res>; + _$FeedStateImpl value, $Res Function(_$FeedStateImpl) then) = + __$$FeedStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -102,9 +104,8 @@ class __$$FeedStateImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateImpl> implements _$$FeedStateImplCopyWith<$Res> { __$$FeedStateImplCopyWithImpl( - _$FeedStateImpl _value, - $Res Function(_$FeedStateImpl) _then, - ) : super(_value, _then); + _$FeedStateImpl _value, $Res Function(_$FeedStateImpl) _then) + : super(_value, _then); /// Create a copy of FeedState /// with the given fields replaced by the non-null parameter values. @@ -135,10 +136,8 @@ class _$FeedStateImpl implements _FeedState { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List feedBlogPostList, - bool isLoading, - ) - loaded, + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -150,7 +149,7 @@ class _$FeedStateImpl implements _FeedState { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -162,7 +161,7 @@ class _$FeedStateImpl implements _FeedState { TResult Function()? $default, { TResult Function()? loading, TResult Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -216,20 +215,18 @@ abstract class _FeedState implements FeedState { /// @nodoc abstract class _$$FeedStateLoadingImplCopyWith<$Res> { - factory _$$FeedStateLoadingImplCopyWith( - _$FeedStateLoadingImpl value, - $Res Function(_$FeedStateLoadingImpl) then, - ) = __$$FeedStateLoadingImplCopyWithImpl<$Res>; + factory _$$FeedStateLoadingImplCopyWith(_$FeedStateLoadingImpl value, + $Res Function(_$FeedStateLoadingImpl) then) = + __$$FeedStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$FeedStateLoadingImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadingImpl> implements _$$FeedStateLoadingImplCopyWith<$Res> { - __$$FeedStateLoadingImplCopyWithImpl( - _$FeedStateLoadingImpl _value, - $Res Function(_$FeedStateLoadingImpl) _then, - ) : super(_value, _then); + __$$FeedStateLoadingImplCopyWithImpl(_$FeedStateLoadingImpl _value, + $Res Function(_$FeedStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of FeedState /// with the given fields replaced by the non-null parameter values. @@ -260,10 +257,8 @@ class _$FeedStateLoadingImpl implements FeedStateLoading { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List feedBlogPostList, - bool isLoading, - ) - loaded, + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loading(); @@ -275,7 +270,7 @@ class _$FeedStateLoadingImpl implements FeedStateLoading { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult? Function(String errorMessage)? error, }) { return loading?.call(); @@ -287,7 +282,7 @@ class _$FeedStateLoadingImpl implements FeedStateLoading { TResult Function()? $default, { TResult Function()? loading, TResult Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -341,10 +336,9 @@ abstract class FeedStateLoading implements FeedState { /// @nodoc abstract class _$$FeedStateLoadedImplCopyWith<$Res> { - factory _$$FeedStateLoadedImplCopyWith( - _$FeedStateLoadedImpl value, - $Res Function(_$FeedStateLoadedImpl) then, - ) = __$$FeedStateLoadedImplCopyWithImpl<$Res>; + factory _$$FeedStateLoadedImplCopyWith(_$FeedStateLoadedImpl value, + $Res Function(_$FeedStateLoadedImpl) then) = + __$$FeedStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({List feedBlogPostList, bool isLoading}); } @@ -354,39 +348,37 @@ class __$$FeedStateLoadedImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadedImpl> implements _$$FeedStateLoadedImplCopyWith<$Res> { __$$FeedStateLoadedImplCopyWithImpl( - _$FeedStateLoadedImpl _value, - $Res Function(_$FeedStateLoadedImpl) _then, - ) : super(_value, _then); + _$FeedStateLoadedImpl _value, $Res Function(_$FeedStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of FeedState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? feedBlogPostList = null, Object? isLoading = null}) { - return _then( - _$FeedStateLoadedImpl( - feedBlogPostList: - null == feedBlogPostList - ? _value._feedBlogPostList - : feedBlogPostList // ignore: cast_nullable_to_non_nullable - as List, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + $Res call({ + Object? feedBlogPostList = null, + Object? isLoading = null, + }) { + return _then(_$FeedStateLoadedImpl( + feedBlogPostList: null == feedBlogPostList + ? _value._feedBlogPostList + : feedBlogPostList // ignore: cast_nullable_to_non_nullable + as List, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc class _$FeedStateLoadedImpl implements FeedStateLoaded { - const _$FeedStateLoadedImpl({ - required final List feedBlogPostList, - required this.isLoading, - }) : _feedBlogPostList = feedBlogPostList; + const _$FeedStateLoadedImpl( + {required final List feedBlogPostList, + required this.isLoading}) + : _feedBlogPostList = feedBlogPostList; final List _feedBlogPostList; @override @@ -410,20 +402,15 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedStateLoadedImpl && - const DeepCollectionEquality().equals( - other._feedBlogPostList, - _feedBlogPostList, - ) && + const DeepCollectionEquality() + .equals(other._feedBlogPostList, _feedBlogPostList) && (identical(other.isLoading, isLoading) || other.isLoading == isLoading)); } @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_feedBlogPostList), - isLoading, - ); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_feedBlogPostList), isLoading); /// Create a copy of FeedState /// with the given fields replaced by the non-null parameter values. @@ -432,9 +419,7 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { @pragma('vm:prefer-inline') _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => __$$FeedStateLoadedImplCopyWithImpl<_$FeedStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -442,10 +427,8 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List feedBlogPostList, - bool isLoading, - ) - loaded, + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loaded(feedBlogPostList, isLoading); @@ -457,7 +440,7 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult? Function(String errorMessage)? error, }) { return loaded?.call(feedBlogPostList, isLoading); @@ -469,7 +452,7 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { TResult Function()? $default, { TResult Function()? loading, TResult Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -518,10 +501,9 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { } abstract class FeedStateLoaded implements FeedState { - const factory FeedStateLoaded({ - required final List feedBlogPostList, - required final bool isLoading, - }) = _$FeedStateLoadedImpl; + const factory FeedStateLoaded( + {required final List feedBlogPostList, + required final bool isLoading}) = _$FeedStateLoadedImpl; List get feedBlogPostList; bool get isLoading; @@ -535,10 +517,9 @@ abstract class FeedStateLoaded implements FeedState { /// @nodoc abstract class _$$FeedStateErrorImplCopyWith<$Res> { - factory _$$FeedStateErrorImplCopyWith( - _$FeedStateErrorImpl value, - $Res Function(_$FeedStateErrorImpl) then, - ) = __$$FeedStateErrorImplCopyWithImpl<$Res>; + factory _$$FeedStateErrorImplCopyWith(_$FeedStateErrorImpl value, + $Res Function(_$FeedStateErrorImpl) then) = + __$$FeedStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -548,24 +529,22 @@ class __$$FeedStateErrorImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateErrorImpl> implements _$$FeedStateErrorImplCopyWith<$Res> { __$$FeedStateErrorImplCopyWithImpl( - _$FeedStateErrorImpl _value, - $Res Function(_$FeedStateErrorImpl) _then, - ) : super(_value, _then); + _$FeedStateErrorImpl _value, $Res Function(_$FeedStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of FeedState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$FeedStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$FeedStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -601,9 +580,7 @@ class _$FeedStateErrorImpl implements FeedStateError { @pragma('vm:prefer-inline') _$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith => __$$FeedStateErrorImplCopyWithImpl<_$FeedStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -611,10 +588,8 @@ class _$FeedStateErrorImpl implements FeedStateError { TResult Function() $default, { required TResult Function() loading, required TResult Function( - List feedBlogPostList, - bool isLoading, - ) - loaded, + List feedBlogPostList, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -626,7 +601,7 @@ class _$FeedStateErrorImpl implements FeedStateError { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -638,7 +613,7 @@ class _$FeedStateErrorImpl implements FeedStateError { TResult Function()? $default, { TResult Function()? loading, TResult Function(List feedBlogPostList, bool isLoading)? - loaded, + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { diff --git a/lib/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart b/lib/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart index 10d6addb..356c832b 100644 --- a/lib/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart +++ b/lib/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart @@ -45,7 +45,7 @@ class PlansCubit extends Cubit { emit(state.copyWith(filterState: state.filterState.copyWith(durationIndex: index), errorMessage: null)); EasyDebounce.debounce( 'loadPlans', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadPlans( query: _query, ), @@ -56,7 +56,7 @@ class PlansCubit extends Cubit { emit(state.copyWith(filterState: state.filterState.copyWith(typeIndex: index), errorMessage: null)); EasyDebounce.debounce( 'loadPlans', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadPlans( query: _query, ), @@ -224,7 +224,7 @@ class PlansCubit extends Cubit { ); EasyDebounce.debounce( 'add_or_remove_plan_from_favorite', - Duration(milliseconds: 200), + const Duration(milliseconds: 200), () async { try { await planRepository.addToFavorite(slug); @@ -264,7 +264,7 @@ class PlansCubit extends Cubit { ); EasyDebounce.debounce( 'add_or_remove_plan_from_favorite', - Duration(milliseconds: 200), + const Duration(milliseconds: 200), () async { try { await planRepository.removeFromFavorite(slug); @@ -320,7 +320,7 @@ class PlansCubit extends Cubit { } EasyDebounce.debounce( 'like_plan', - Duration(milliseconds: 200), + const Duration(milliseconds: 200), () async { try { await planRepository.likePlan(slug); diff --git a/lib/features/feed/presentation/bloc/plans_cubit/plans_state.freezed.dart b/lib/features/feed/presentation/bloc/plans_cubit/plans_state.freezed.dart index 729157a8..03d3ab67 100644 --- a/lib/features/feed/presentation/bloc/plans_cubit/plans_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/plans_cubit/plans_state.freezed.dart @@ -12,8 +12,7 @@ part of 'plans_state.dart'; 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', -); + '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'); /// @nodoc mixin _$PlansState { @@ -34,18 +33,16 @@ mixin _$PlansState { /// @nodoc abstract class $PlansStateCopyWith<$Res> { factory $PlansStateCopyWith( - PlansState value, - $Res Function(PlansState) then, - ) = _$PlansStateCopyWithImpl<$Res, PlansState>; + PlansState value, $Res Function(PlansState) then) = + _$PlansStateCopyWithImpl<$Res, PlansState>; @useResult - $Res call({ - bool isLoading, - List plans, - String? errorMessage, - PlansFilterState filterState, - int minPlanPrice, - int maxPlanPrice, - }); + $Res call( + {bool isLoading, + List plans, + String? errorMessage, + PlansFilterState filterState, + int minPlanPrice, + int maxPlanPrice}); $PlansFilterStateCopyWith<$Res> get filterState; } @@ -72,41 +69,32 @@ class _$PlansStateCopyWithImpl<$Res, $Val extends PlansState> Object? minPlanPrice = null, Object? maxPlanPrice = null, }) { - return _then( - _value.copyWith( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - plans: - null == plans - ? _value.plans - : plans // ignore: cast_nullable_to_non_nullable - as List, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - filterState: - null == filterState - ? _value.filterState - : filterState // ignore: cast_nullable_to_non_nullable - as PlansFilterState, - minPlanPrice: - null == minPlanPrice - ? _value.minPlanPrice - : minPlanPrice // ignore: cast_nullable_to_non_nullable - as int, - maxPlanPrice: - null == maxPlanPrice - ? _value.maxPlanPrice - : maxPlanPrice // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + return _then(_value.copyWith( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + plans: null == plans + ? _value.plans + : plans // ignore: cast_nullable_to_non_nullable + as List, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + filterState: null == filterState + ? _value.filterState + : filterState // ignore: cast_nullable_to_non_nullable + as PlansFilterState, + minPlanPrice: null == minPlanPrice + ? _value.minPlanPrice + : minPlanPrice // ignore: cast_nullable_to_non_nullable + as int, + maxPlanPrice: null == maxPlanPrice + ? _value.maxPlanPrice + : maxPlanPrice // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } /// Create a copy of PlansState @@ -124,19 +112,17 @@ class _$PlansStateCopyWithImpl<$Res, $Val extends PlansState> abstract class _$$PlansStateImplCopyWith<$Res> implements $PlansStateCopyWith<$Res> { factory _$$PlansStateImplCopyWith( - _$PlansStateImpl value, - $Res Function(_$PlansStateImpl) then, - ) = __$$PlansStateImplCopyWithImpl<$Res>; + _$PlansStateImpl value, $Res Function(_$PlansStateImpl) then) = + __$$PlansStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - bool isLoading, - List plans, - String? errorMessage, - PlansFilterState filterState, - int minPlanPrice, - int maxPlanPrice, - }); + $Res call( + {bool isLoading, + List plans, + String? errorMessage, + PlansFilterState filterState, + int minPlanPrice, + int maxPlanPrice}); @override $PlansFilterStateCopyWith<$Res> get filterState; @@ -147,9 +133,8 @@ class __$$PlansStateImplCopyWithImpl<$Res> extends _$PlansStateCopyWithImpl<$Res, _$PlansStateImpl> implements _$$PlansStateImplCopyWith<$Res> { __$$PlansStateImplCopyWithImpl( - _$PlansStateImpl _value, - $Res Function(_$PlansStateImpl) _then, - ) : super(_value, _then); + _$PlansStateImpl _value, $Res Function(_$PlansStateImpl) _then) + : super(_value, _then); /// Create a copy of PlansState /// with the given fields replaced by the non-null parameter values. @@ -163,54 +148,46 @@ class __$$PlansStateImplCopyWithImpl<$Res> Object? minPlanPrice = null, Object? maxPlanPrice = null, }) { - return _then( - _$PlansStateImpl( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - plans: - null == plans - ? _value._plans - : plans // ignore: cast_nullable_to_non_nullable - as List, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - filterState: - null == filterState - ? _value.filterState - : filterState // ignore: cast_nullable_to_non_nullable - as PlansFilterState, - minPlanPrice: - null == minPlanPrice - ? _value.minPlanPrice - : minPlanPrice // ignore: cast_nullable_to_non_nullable - as int, - maxPlanPrice: - null == maxPlanPrice - ? _value.maxPlanPrice - : maxPlanPrice // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$PlansStateImpl( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + plans: null == plans + ? _value._plans + : plans // ignore: cast_nullable_to_non_nullable + as List, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + filterState: null == filterState + ? _value.filterState + : filterState // ignore: cast_nullable_to_non_nullable + as PlansFilterState, + minPlanPrice: null == minPlanPrice + ? _value.minPlanPrice + : minPlanPrice // ignore: cast_nullable_to_non_nullable + as int, + maxPlanPrice: null == maxPlanPrice + ? _value.maxPlanPrice + : maxPlanPrice // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc class _$PlansStateImpl implements _PlansState { - const _$PlansStateImpl({ - required this.isLoading, - required final List plans, - required this.errorMessage, - required this.filterState, - this.minPlanPrice = 0, - this.maxPlanPrice = 0, - }) : _plans = plans; + const _$PlansStateImpl( + {required this.isLoading, + required final List plans, + required this.errorMessage, + required this.filterState, + this.minPlanPrice = 0, + this.maxPlanPrice = 0}) + : _plans = plans; @override final bool isLoading; @@ -258,14 +235,13 @@ class _$PlansStateImpl implements _PlansState { @override int get hashCode => Object.hash( - runtimeType, - isLoading, - const DeepCollectionEquality().hash(_plans), - errorMessage, - filterState, - minPlanPrice, - maxPlanPrice, - ); + runtimeType, + isLoading, + const DeepCollectionEquality().hash(_plans), + errorMessage, + filterState, + minPlanPrice, + maxPlanPrice); /// Create a copy of PlansState /// with the given fields replaced by the non-null parameter values. @@ -277,14 +253,13 @@ class _$PlansStateImpl implements _PlansState { } abstract class _PlansState implements PlansState { - const factory _PlansState({ - required final bool isLoading, - required final List plans, - required final String? errorMessage, - required final PlansFilterState filterState, - final int minPlanPrice, - final int maxPlanPrice, - }) = _$PlansStateImpl; + const factory _PlansState( + {required final bool isLoading, + required final List plans, + required final String? errorMessage, + required final PlansFilterState filterState, + final int minPlanPrice, + final int maxPlanPrice}) = _$PlansStateImpl; @override bool get isLoading; @@ -323,9 +298,8 @@ mixin _$PlansFilterState { /// @nodoc abstract class $PlansFilterStateCopyWith<$Res> { factory $PlansFilterStateCopyWith( - PlansFilterState value, - $Res Function(PlansFilterState) then, - ) = _$PlansFilterStateCopyWithImpl<$Res, PlansFilterState>; + PlansFilterState value, $Res Function(PlansFilterState) then) = + _$PlansFilterStateCopyWithImpl<$Res, PlansFilterState>; @useResult $Res call({(int?, int?) priceFilter, int durationIndex, int typeIndex}); } @@ -349,36 +323,29 @@ class _$PlansFilterStateCopyWithImpl<$Res, $Val extends PlansFilterState> Object? durationIndex = null, Object? typeIndex = null, }) { - return _then( - _value.copyWith( - priceFilter: - null == priceFilter - ? _value.priceFilter - : priceFilter // ignore: cast_nullable_to_non_nullable - as (int?, int?), - durationIndex: - null == durationIndex - ? _value.durationIndex - : durationIndex // ignore: cast_nullable_to_non_nullable - as int, - typeIndex: - null == typeIndex - ? _value.typeIndex - : typeIndex // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + return _then(_value.copyWith( + priceFilter: null == priceFilter + ? _value.priceFilter + : priceFilter // ignore: cast_nullable_to_non_nullable + as (int?, int?), + durationIndex: null == durationIndex + ? _value.durationIndex + : durationIndex // ignore: cast_nullable_to_non_nullable + as int, + typeIndex: null == typeIndex + ? _value.typeIndex + : typeIndex // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } } /// @nodoc abstract class _$$PlansFilterStateImplCopyWith<$Res> implements $PlansFilterStateCopyWith<$Res> { - factory _$$PlansFilterStateImplCopyWith( - _$PlansFilterStateImpl value, - $Res Function(_$PlansFilterStateImpl) then, - ) = __$$PlansFilterStateImplCopyWithImpl<$Res>; + factory _$$PlansFilterStateImplCopyWith(_$PlansFilterStateImpl value, + $Res Function(_$PlansFilterStateImpl) then) = + __$$PlansFilterStateImplCopyWithImpl<$Res>; @override @useResult $Res call({(int?, int?) priceFilter, int durationIndex, int typeIndex}); @@ -388,10 +355,9 @@ abstract class _$$PlansFilterStateImplCopyWith<$Res> class __$$PlansFilterStateImplCopyWithImpl<$Res> extends _$PlansFilterStateCopyWithImpl<$Res, _$PlansFilterStateImpl> implements _$$PlansFilterStateImplCopyWith<$Res> { - __$$PlansFilterStateImplCopyWithImpl( - _$PlansFilterStateImpl _value, - $Res Function(_$PlansFilterStateImpl) _then, - ) : super(_value, _then); + __$$PlansFilterStateImplCopyWithImpl(_$PlansFilterStateImpl _value, + $Res Function(_$PlansFilterStateImpl) _then) + : super(_value, _then); /// Create a copy of PlansFilterState /// with the given fields replaced by the non-null parameter values. @@ -402,36 +368,30 @@ class __$$PlansFilterStateImplCopyWithImpl<$Res> Object? durationIndex = null, Object? typeIndex = null, }) { - return _then( - _$PlansFilterStateImpl( - priceFilter: - null == priceFilter - ? _value.priceFilter - : priceFilter // ignore: cast_nullable_to_non_nullable - as (int?, int?), - durationIndex: - null == durationIndex - ? _value.durationIndex - : durationIndex // ignore: cast_nullable_to_non_nullable - as int, - typeIndex: - null == typeIndex - ? _value.typeIndex - : typeIndex // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$PlansFilterStateImpl( + priceFilter: null == priceFilter + ? _value.priceFilter + : priceFilter // ignore: cast_nullable_to_non_nullable + as (int?, int?), + durationIndex: null == durationIndex + ? _value.durationIndex + : durationIndex // ignore: cast_nullable_to_non_nullable + as int, + typeIndex: null == typeIndex + ? _value.typeIndex + : typeIndex // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc class _$PlansFilterStateImpl implements _PlansFilterState { - const _$PlansFilterStateImpl({ - required this.priceFilter, - required this.durationIndex, - required this.typeIndex, - }); + const _$PlansFilterStateImpl( + {required this.priceFilter, + required this.durationIndex, + required this.typeIndex}); @override final (int?, int?) priceFilter; @@ -469,17 +429,14 @@ class _$PlansFilterStateImpl implements _PlansFilterState { @pragma('vm:prefer-inline') _$$PlansFilterStateImplCopyWith<_$PlansFilterStateImpl> get copyWith => __$$PlansFilterStateImplCopyWithImpl<_$PlansFilterStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _PlansFilterState implements PlansFilterState { - const factory _PlansFilterState({ - required final (int?, int?) priceFilter, - required final int durationIndex, - required final int typeIndex, - }) = _$PlansFilterStateImpl; + const factory _PlansFilterState( + {required final (int?, int?) priceFilter, + required final int durationIndex, + required final int typeIndex}) = _$PlansFilterStateImpl; @override (int?, int?) get priceFilter; diff --git a/lib/features/feed/presentation/bloc/profile_cubit/profile_state.freezed.dart b/lib/features/feed/presentation/bloc/profile_cubit/profile_state.freezed.dart index ee9fc6b4..05007d71 100644 --- a/lib/features/feed/presentation/bloc/profile_cubit/profile_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/profile_cubit/profile_state.freezed.dart @@ -12,8 +12,7 @@ part of 'profile_state.dart'; 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', -); + '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'); /// @nodoc mixin _$ProfileState { @@ -29,9 +28,8 @@ mixin _$ProfileState { /// @nodoc abstract class $ProfileStateCopyWith<$Res> { factory $ProfileStateCopyWith( - ProfileState value, - $Res Function(ProfileState) then, - ) = _$ProfileStateCopyWithImpl<$Res, ProfileState>; + ProfileState value, $Res Function(ProfileState) then) = + _$ProfileStateCopyWithImpl<$Res, ProfileState>; @useResult $Res call({ProfileModel? profile}); @@ -52,17 +50,15 @@ class _$ProfileStateCopyWithImpl<$Res, $Val extends ProfileState> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? profile = freezed}) { - return _then( - _value.copyWith( - profile: - freezed == profile - ? _value.profile - : profile // ignore: cast_nullable_to_non_nullable - as ProfileModel?, - ) - as $Val, - ); + $Res call({ + Object? profile = freezed, + }) { + return _then(_value.copyWith( + profile: freezed == profile + ? _value.profile + : profile // ignore: cast_nullable_to_non_nullable + as ProfileModel?, + ) as $Val); } /// Create a copy of ProfileState @@ -84,9 +80,8 @@ class _$ProfileStateCopyWithImpl<$Res, $Val extends ProfileState> abstract class _$$ProfileStateImplCopyWith<$Res> implements $ProfileStateCopyWith<$Res> { factory _$$ProfileStateImplCopyWith( - _$ProfileStateImpl value, - $Res Function(_$ProfileStateImpl) then, - ) = __$$ProfileStateImplCopyWithImpl<$Res>; + _$ProfileStateImpl value, $Res Function(_$ProfileStateImpl) then) = + __$$ProfileStateImplCopyWithImpl<$Res>; @override @useResult $Res call({ProfileModel? profile}); @@ -100,24 +95,22 @@ class __$$ProfileStateImplCopyWithImpl<$Res> extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateImpl> implements _$$ProfileStateImplCopyWith<$Res> { __$$ProfileStateImplCopyWithImpl( - _$ProfileStateImpl _value, - $Res Function(_$ProfileStateImpl) _then, - ) : super(_value, _then); + _$ProfileStateImpl _value, $Res Function(_$ProfileStateImpl) _then) + : super(_value, _then); /// Create a copy of ProfileState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? profile = freezed}) { - return _then( - _$ProfileStateImpl( - profile: - freezed == profile - ? _value.profile - : profile // ignore: cast_nullable_to_non_nullable - as ProfileModel?, - ), - ); + $Res call({ + Object? profile = freezed, + }) { + return _then(_$ProfileStateImpl( + profile: freezed == profile + ? _value.profile + : profile // ignore: cast_nullable_to_non_nullable + as ProfileModel?, + )); } } diff --git a/lib/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart b/lib/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart index 312a27c3..18c7ebb8 100644 --- a/lib/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart +++ b/lib/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart @@ -15,7 +15,7 @@ class RecipesCubit extends Cubit { final FeedRepository feedRepository; final RecipeRepository recipeRepository; final AboutRecipeRepository aboutRecipeRepository; - Set _selectedTags = {}; + final Set _selectedTags = {}; int currentPage = 1; late int lastPage; bool isLoading = false; @@ -128,7 +128,7 @@ class RecipesCubit extends Cubit { ); EasyDebounce.debounce( 'add_or_remove_plan_from_favorite', - Duration(milliseconds: 200), + const Duration(milliseconds: 200), () async { try { await aboutRecipeRepository.addToFavorite(slug); @@ -168,7 +168,7 @@ class RecipesCubit extends Cubit { ); EasyDebounce.debounce( 'add_or_remove_plan_from_favorite', - Duration(milliseconds: 200), + const Duration(milliseconds: 200), () async { try { await aboutRecipeRepository.removeFromFavorite(slug); @@ -224,7 +224,7 @@ class RecipesCubit extends Cubit { } EasyDebounce.debounce( 'like_plan', - Duration(milliseconds: 200), + const Duration(milliseconds: 200), () async { try { await aboutRecipeRepository.likeRecipe(slug); diff --git a/lib/features/feed/presentation/bloc/recipes_cubit/recipes_state.dart b/lib/features/feed/presentation/bloc/recipes_cubit/recipes_state.dart index 74db94f7..4efb79de 100644 --- a/lib/features/feed/presentation/bloc/recipes_cubit/recipes_state.dart +++ b/lib/features/feed/presentation/bloc/recipes_cubit/recipes_state.dart @@ -15,7 +15,7 @@ abstract class RecipesState with _$RecipesState { String? errorMessage, }) = _RecipesState; - factory RecipesState.initial() => RecipesState( + factory RecipesState.initial() => const RecipesState( recipesList: [], recipesTags: [], selectedTags: {}, diff --git a/lib/features/feed/presentation/bloc/recipes_cubit/recipes_state.freezed.dart b/lib/features/feed/presentation/bloc/recipes_cubit/recipes_state.freezed.dart index c61f7253..b5afc8b1 100644 --- a/lib/features/feed/presentation/bloc/recipes_cubit/recipes_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/recipes_cubit/recipes_state.freezed.dart @@ -12,8 +12,7 @@ part of 'recipes_state.dart'; 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', -); + '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'); /// @nodoc mixin _$RecipesState { @@ -34,18 +33,16 @@ mixin _$RecipesState { /// @nodoc abstract class $RecipesStateCopyWith<$Res> { factory $RecipesStateCopyWith( - RecipesState value, - $Res Function(RecipesState) then, - ) = _$RecipesStateCopyWithImpl<$Res, RecipesState>; + RecipesState value, $Res Function(RecipesState) then) = + _$RecipesStateCopyWithImpl<$Res, RecipesState>; @useResult - $Res call({ - List recipesList, - List recipesTags, - Set selectedTags, - int selectedTagsCounter, - bool isLoading, - String? errorMessage, - }); + $Res call( + {List recipesList, + List recipesTags, + Set selectedTags, + int selectedTagsCounter, + bool isLoading, + String? errorMessage}); } /// @nodoc @@ -70,41 +67,32 @@ class _$RecipesStateCopyWithImpl<$Res, $Val extends RecipesState> Object? isLoading = null, Object? errorMessage = freezed, }) { - return _then( - _value.copyWith( - recipesList: - null == recipesList - ? _value.recipesList - : recipesList // ignore: cast_nullable_to_non_nullable - as List, - recipesTags: - null == recipesTags - ? _value.recipesTags - : recipesTags // ignore: cast_nullable_to_non_nullable - as List, - selectedTags: - null == selectedTags - ? _value.selectedTags - : selectedTags // ignore: cast_nullable_to_non_nullable - as Set, - selectedTagsCounter: - null == selectedTagsCounter - ? _value.selectedTagsCounter - : selectedTagsCounter // ignore: cast_nullable_to_non_nullable - as int, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + recipesList: null == recipesList + ? _value.recipesList + : recipesList // ignore: cast_nullable_to_non_nullable + as List, + recipesTags: null == recipesTags + ? _value.recipesTags + : recipesTags // ignore: cast_nullable_to_non_nullable + as List, + selectedTags: null == selectedTags + ? _value.selectedTags + : selectedTags // ignore: cast_nullable_to_non_nullable + as Set, + selectedTagsCounter: null == selectedTagsCounter + ? _value.selectedTagsCounter + : selectedTagsCounter // ignore: cast_nullable_to_non_nullable + as int, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } } @@ -112,19 +100,17 @@ class _$RecipesStateCopyWithImpl<$Res, $Val extends RecipesState> abstract class _$$RecipesStateImplCopyWith<$Res> implements $RecipesStateCopyWith<$Res> { factory _$$RecipesStateImplCopyWith( - _$RecipesStateImpl value, - $Res Function(_$RecipesStateImpl) then, - ) = __$$RecipesStateImplCopyWithImpl<$Res>; + _$RecipesStateImpl value, $Res Function(_$RecipesStateImpl) then) = + __$$RecipesStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - List recipesList, - List recipesTags, - Set selectedTags, - int selectedTagsCounter, - bool isLoading, - String? errorMessage, - }); + $Res call( + {List recipesList, + List recipesTags, + Set selectedTags, + int selectedTagsCounter, + bool isLoading, + String? errorMessage}); } /// @nodoc @@ -132,9 +118,8 @@ class __$$RecipesStateImplCopyWithImpl<$Res> extends _$RecipesStateCopyWithImpl<$Res, _$RecipesStateImpl> implements _$$RecipesStateImplCopyWith<$Res> { __$$RecipesStateImplCopyWithImpl( - _$RecipesStateImpl _value, - $Res Function(_$RecipesStateImpl) _then, - ) : super(_value, _then); + _$RecipesStateImpl _value, $Res Function(_$RecipesStateImpl) _then) + : super(_value, _then); /// Create a copy of RecipesState /// with the given fields replaced by the non-null parameter values. @@ -148,56 +133,48 @@ class __$$RecipesStateImplCopyWithImpl<$Res> Object? isLoading = null, Object? errorMessage = freezed, }) { - return _then( - _$RecipesStateImpl( - recipesList: - null == recipesList - ? _value._recipesList - : recipesList // ignore: cast_nullable_to_non_nullable - as List, - recipesTags: - null == recipesTags - ? _value._recipesTags - : recipesTags // ignore: cast_nullable_to_non_nullable - as List, - selectedTags: - null == selectedTags - ? _value._selectedTags - : selectedTags // ignore: cast_nullable_to_non_nullable - as Set, - selectedTagsCounter: - null == selectedTagsCounter - ? _value.selectedTagsCounter - : selectedTagsCounter // ignore: cast_nullable_to_non_nullable - as int, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - errorMessage: - freezed == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$RecipesStateImpl( + recipesList: null == recipesList + ? _value._recipesList + : recipesList // ignore: cast_nullable_to_non_nullable + as List, + recipesTags: null == recipesTags + ? _value._recipesTags + : recipesTags // ignore: cast_nullable_to_non_nullable + as List, + selectedTags: null == selectedTags + ? _value._selectedTags + : selectedTags // ignore: cast_nullable_to_non_nullable + as Set, + selectedTagsCounter: null == selectedTagsCounter + ? _value.selectedTagsCounter + : selectedTagsCounter // ignore: cast_nullable_to_non_nullable + as int, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc class _$RecipesStateImpl implements _RecipesState { - const _$RecipesStateImpl({ - required final List recipesList, - required final List recipesTags, - required final Set selectedTags, - required this.selectedTagsCounter, - required this.isLoading, - this.errorMessage, - }) : _recipesList = recipesList, - _recipesTags = recipesTags, - _selectedTags = selectedTags; + const _$RecipesStateImpl( + {required final List recipesList, + required final List recipesTags, + required final Set selectedTags, + required this.selectedTagsCounter, + required this.isLoading, + this.errorMessage}) + : _recipesList = recipesList, + _recipesTags = recipesTags, + _selectedTags = selectedTags; final List _recipesList; @override @@ -240,18 +217,12 @@ class _$RecipesStateImpl implements _RecipesState { return identical(this, other) || (other.runtimeType == runtimeType && other is _$RecipesStateImpl && - const DeepCollectionEquality().equals( - other._recipesList, - _recipesList, - ) && - const DeepCollectionEquality().equals( - other._recipesTags, - _recipesTags, - ) && - const DeepCollectionEquality().equals( - other._selectedTags, - _selectedTags, - ) && + const DeepCollectionEquality() + .equals(other._recipesList, _recipesList) && + const DeepCollectionEquality() + .equals(other._recipesTags, _recipesTags) && + const DeepCollectionEquality() + .equals(other._selectedTags, _selectedTags) && (identical(other.selectedTagsCounter, selectedTagsCounter) || other.selectedTagsCounter == selectedTagsCounter) && (identical(other.isLoading, isLoading) || @@ -262,14 +233,13 @@ class _$RecipesStateImpl implements _RecipesState { @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_recipesList), - const DeepCollectionEquality().hash(_recipesTags), - const DeepCollectionEquality().hash(_selectedTags), - selectedTagsCounter, - isLoading, - errorMessage, - ); + runtimeType, + const DeepCollectionEquality().hash(_recipesList), + const DeepCollectionEquality().hash(_recipesTags), + const DeepCollectionEquality().hash(_selectedTags), + selectedTagsCounter, + isLoading, + errorMessage); /// Create a copy of RecipesState /// with the given fields replaced by the non-null parameter values. @@ -281,14 +251,13 @@ class _$RecipesStateImpl implements _RecipesState { } abstract class _RecipesState implements RecipesState { - const factory _RecipesState({ - required final List recipesList, - required final List recipesTags, - required final Set selectedTags, - required final int selectedTagsCounter, - required final bool isLoading, - final String? errorMessage, - }) = _$RecipesStateImpl; + const factory _RecipesState( + {required final List recipesList, + required final List recipesTags, + required final Set selectedTags, + required final int selectedTagsCounter, + required final bool isLoading, + final String? errorMessage}) = _$RecipesStateImpl; @override List get recipesList; diff --git a/lib/features/feed/presentation/pages/feed_screen.dart b/lib/features/feed/presentation/pages/feed_screen.dart index e139da56..0fb3cc3d 100644 --- a/lib/features/feed/presentation/pages/feed_screen.dart +++ b/lib/features/feed/presentation/pages/feed_screen.dart @@ -105,8 +105,8 @@ class _FeedScreenContentState extends State { ? FloatingActionButton.small( heroTag: 'recipesTagsFilter', backgroundColor: appTheme.blueA400, - shape: CircleBorder(), - child: Icon( + shape: const CircleBorder(), + child: const Icon( Icons.filter_list_rounded, color: Colors.white, ), @@ -142,7 +142,7 @@ class _FeedScreenContentState extends State { BlocBuilder( builder: (context, state) { return SliverAppBar( - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(bottom: Radius.circular(12)), ), backgroundColor: Colors.white, @@ -178,7 +178,7 @@ class _FeedScreenContentState extends State { if (query.length > 2) { EasyDebounce.debounce( 'searchFeed', - Duration(milliseconds: 500), + const Duration(milliseconds: 500), () { switch (_selectedChipIndex) { case 0: @@ -202,7 +202,7 @@ class _FeedScreenContentState extends State { } else { EasyDebounce.debounce( 'searchFeed', - Duration(milliseconds: 500), + const Duration(milliseconds: 500), () { switch (_selectedChipIndex) { case 0: @@ -226,7 +226,7 @@ class _FeedScreenContentState extends State { } }, ), - SizedBox(width: 12), + const SizedBox(width: 12), switch (_selectedChipIndex) { 1 => AddItemButton( onTap: () => GoRouter.of(context).pushNamed(RecipeCreateScreen.name), @@ -241,7 +241,7 @@ class _FeedScreenContentState extends State { 3 => AddItemButton( onTap: state.profile?.roles.contains('consultant') ?? false ? () => GoRouter.of(context).pushNamed(CreatePlanScreen.name) : null, ), - _ => AddItemButton() + _ => const AddItemButton() }, ], ), @@ -251,11 +251,11 @@ class _FeedScreenContentState extends State { ]; }, body: switch (_selectedChipIndex) { - 0 => BlogPosts(), - 1 => Recipes(), - 2 => Diets(), - 3 => Plans(), - 4 => Consultants(), + 0 => const BlogPosts(), + 1 => const Recipes(), + 2 => const Diets(), + 3 => const Plans(), + 4 => const Consultants(), _ => Center(child: Text(chipsLabelList[_selectedChipIndex])), }, ), diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index 915b3fa0..d670a7c9 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -54,7 +54,7 @@ class _BlogPostWidgetState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Row( @@ -80,13 +80,13 @@ class _BlogPostWidgetState extends State { state.feedBlogPostList[widget.index].author.authorProfileIcon, ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( state.feedBlogPostList[widget.index].author.authorName, - style: TextStyle( + style: const TextStyle( height: 1, color: Colors.black87, fontWeight: FontWeight.w500, @@ -96,7 +96,7 @@ class _BlogPostWidgetState extends State { const SizedBox(height: 4), Text( '${calculateDifference(state.feedBlogPostList[widget.index].createdAt)} в ${state.feedBlogPostList[widget.index].createdAt.hour.toString().padLeft(2, '0')}:${state.feedBlogPostList[widget.index].createdAt.minute.toString().padLeft(2, '0')}', - style: TextStyle( + style: const TextStyle( height: 1, color: Colors.black45, fontSize: 14, @@ -117,19 +117,19 @@ class _BlogPostWidgetState extends State { ), ), if (state.feedBlogPostList[widget.index].title.isNotEmpty || state.feedBlogPostList[widget.index].description.isNotEmpty) - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Text( state.feedBlogPostList[widget.index].title, - style: TextStyle( + style: const TextStyle( fontSize: 18, fontWeight: FontWeight.w600, color: Colors.black87, ), ), ), - if (state.feedBlogPostList[widget.index].title.isNotEmpty && state.feedBlogPostList[widget.index].description.isNotEmpty) SizedBox(height: 8), + if (state.feedBlogPostList[widget.index].title.isNotEmpty && state.feedBlogPostList[widget.index].description.isNotEmpty) const SizedBox(height: 8), if (state.feedBlogPostList[widget.index].description.isNotEmpty) Padding( padding: const EdgeInsets.symmetric(horizontal: 4), @@ -157,28 +157,28 @@ class _BlogPostWidgetState extends State { ), ), ), - if (state.feedBlogPostList[widget.index].title.isNotEmpty || state.feedBlogPostList[widget.index].description.isNotEmpty) SizedBox(height: 8), + if (state.feedBlogPostList[widget.index].title.isNotEmpty || state.feedBlogPostList[widget.index].description.isNotEmpty) const SizedBox(height: 8), GestureDetector( onTap: () { context.pushTransparentRoute( rootNavigator: true, PhotoViewScreen( - imageUrls: [baseUrl + '/storage/' + state.feedBlogPostList[widget.index].image], + imageUrls: ['$baseUrl/storage/${state.feedBlogPostList[widget.index].image}'], index: 0, ), ); }, child: Hero( - tag: baseUrl + '/storage/' + state.feedBlogPostList[widget.index].image, + tag: '$baseUrl/storage/${state.feedBlogPostList[widget.index].image}', child: CachedNetworkImage( fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width, - imageUrl: baseUrl + '/storage/' + state.feedBlogPostList[widget.index].image, - errorWidget: (context, str, object) => SizedBox.shrink(), + imageUrl: '$baseUrl/storage/${state.feedBlogPostList[widget.index].image}', + errorWidget: (context, str, object) => const SizedBox.shrink(), ), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Row( @@ -197,10 +197,11 @@ class _BlogPostWidgetState extends State { isLiked ? await context.read().likePost(state.feedBlogPostList[widget.index].id) : await context.read().unlikedPost(state.feedBlogPostList[widget.index].id); + if (!context.mounted) return; await context.read().loadFeedBlogPostList(); }, ), - SizedBox(width: 8), + const SizedBox(width: 8), FeedIconButton( svgIcon: SvgPicture.asset( 'assets/icons/comment.svg', @@ -217,7 +218,7 @@ class _BlogPostWidgetState extends State { extra: state.feedBlogPostList[widget.index], ), ), - SizedBox(width: 8), + const SizedBox(width: 8), FeedIconButton( svgIcon: SvgPicture.asset( height: 20, @@ -229,19 +230,19 @@ class _BlogPostWidgetState extends State { final box = context.findRenderObject() as RenderBox?; Share.shareUri( Uri.parse( - baseUrl + '/ru/blog_post/' + state.feedBlogPostList[widget.index].id.toString(), + '$baseUrl/ru/blog_post/${state.feedBlogPostList[widget.index].id}', ), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, ), - Spacer(), + const Spacer(), Icon( Icons.visibility_rounded, size: 16, color: appTheme.gray500, ), - SizedBox(width: 4), + const SizedBox(width: 4), Text( state.feedBlogPostList[widget.index].totalViews.toString(), style: TextStyle( @@ -253,7 +254,7 @@ class _BlogPostWidgetState extends State { ], ), ), - SizedBox(height: 8), + const SizedBox(height: 8), ], ), ), diff --git a/lib/features/feed/presentation/widgets/blog_posts.dart b/lib/features/feed/presentation/widgets/blog_posts.dart index fa77dcf9..76c89a7e 100644 --- a/lib/features/feed/presentation/widgets/blog_posts.dart +++ b/lib/features/feed/presentation/widgets/blog_posts.dart @@ -23,9 +23,9 @@ class BlogPosts extends StatelessWidget { return false; }, child: ListView.separated( - padding: EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric(vertical: 8), shrinkWrap: true, - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemBuilder: (context, index) { if (index == state.feedBlogPostList.length) { return const Loader(); @@ -33,7 +33,7 @@ class BlogPosts extends StatelessWidget { return BlogPostWidget(index: index); }, separatorBuilder: (context, index) { - return SizedBox(height: 8); + return const SizedBox(height: 8); }, itemCount: state.isLoading ? state.feedBlogPostList.length + 1 : state.feedBlogPostList.length, ), diff --git a/lib/features/feed/presentation/widgets/chip_group.dart b/lib/features/feed/presentation/widgets/chip_group.dart index 44f8b241..a8d88da1 100644 --- a/lib/features/feed/presentation/widgets/chip_group.dart +++ b/lib/features/feed/presentation/widgets/chip_group.dart @@ -17,21 +17,21 @@ class ChipGroup extends StatelessWidget { return Align( alignment: Alignment.centerLeft, child: SingleChildScrollView( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), scrollDirection: Axis.horizontal, child: Row( children: [ ...List.generate( 5, (index) => Padding( - padding: EdgeInsets.only(right: 8.0), + padding: const EdgeInsets.only(right: 8.0), child: ChoiceChipWidget( index: index, selectedChipIndex: selectedChipIndex, chipsLabelList: chipsLabelList, onSelected: (bool selected) { setSelectedChipIndex(index); - FocusScope.of(context).requestFocus(new FocusNode()); + FocusScope.of(context).requestFocus(FocusNode()); }, ), ), diff --git a/lib/features/feed/presentation/widgets/comments_widget.dart b/lib/features/feed/presentation/widgets/comments_widget.dart index d9e44fb3..109bfb91 100644 --- a/lib/features/feed/presentation/widgets/comments_widget.dart +++ b/lib/features/feed/presentation/widgets/comments_widget.dart @@ -34,13 +34,13 @@ class _CommentsWidgetState extends State { children: [ for (int i = 0; i < widget.comment.data.length; i++) ...[ _comment(s, widget.comment.data[i]), - if (widget.comment.data[i].childrenComments.isNotEmpty) SizedBox(height: 8), + if (widget.comment.data[i].childrenComments.isNotEmpty) const SizedBox(height: 8), for (int j = 0; j < widget.comment.data[i].childrenComments.length; j++) Padding( - padding: EdgeInsets.only(left: 40), + padding: const EdgeInsets.only(left: 40), child: _comment(s, widget.comment.data[i].childrenComments[j], 16, true), ), - SizedBox(height: 8), + const SizedBox(height: 8), ], ], ); @@ -62,7 +62,7 @@ class _CommentsWidgetState extends State { foregroundImage: NetworkImage(comment.authorProfileIcon), radius: radius, ), - SizedBox(width: 8), + const SizedBox(width: 8), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, @@ -76,7 +76,7 @@ class _CommentsWidgetState extends State { fontWeight: FontWeight.w500, ), ), - SizedBox(height: 4), + const SizedBox(height: 4), SizedBox( width: isChild ? MediaQuery.of(context).size.width * 0.72 : MediaQuery.of(context).size.width * 0.8, child: Text( @@ -89,7 +89,7 @@ class _CommentsWidgetState extends State { ), ), ), - SizedBox(height: 4), + const SizedBox(height: 4), Row( children: [ Text( @@ -101,7 +101,7 @@ class _CommentsWidgetState extends State { fontWeight: FontWeight.w500, ), ), - SizedBox(width: 16), + const SizedBox(width: 16), if (!isChild) GestureDetector( onTap: () { diff --git a/lib/features/feed/presentation/widgets/consultant_widget.dart b/lib/features/feed/presentation/widgets/consultant_widget.dart index 033633c6..f7dfd5a9 100644 --- a/lib/features/feed/presentation/widgets/consultant_widget.dart +++ b/lib/features/feed/presentation/widgets/consultant_widget.dart @@ -32,10 +32,10 @@ class ConsultantWidget extends StatelessWidget { }, borderRadius: BorderRadius.circular(20), child: Ink( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -47,7 +47,7 @@ class ConsultantWidget extends StatelessWidget { Row( children: [ Ink( - padding: EdgeInsets.symmetric(vertical: 4, horizontal: 8), + padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), @@ -71,7 +71,7 @@ class ConsultantWidget extends StatelessWidget { children: [ Text( consultant.name, - style: TextStyle( + style: const TextStyle( height: 1, fontWeight: FontWeight.w500, fontSize: 15, @@ -93,7 +93,7 @@ class ConsultantWidget extends StatelessWidget { ], ), Ink( - padding: EdgeInsets.all(6), + padding: const EdgeInsets.all(6), decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: Colors.white, @@ -105,7 +105,7 @@ class ConsultantWidget extends StatelessWidget { ], ), const SizedBox(height: 8), - Text('description'), + const Text('description'), if (consultant.badges.isNotEmpty) const SizedBox(height: 8), _badges(consultant.badges, context), ], @@ -122,12 +122,12 @@ class ConsultantWidget extends StatelessWidget { for (int i = 0; i < badges.length; i++) ...[ badges[i].image.contains('svg') ? SvgPicture.network( - baseUrl + '/storage/' + badges[i].image, + '$baseUrl/storage/${badges[i].image}', width: 28, height: 28, ) : CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + badges[i].image, + imageUrl: '$baseUrl/storage/${badges[i].image}', ), i < badges.length - 1 ? const SizedBox(width: 8) : const SizedBox.shrink(), ], diff --git a/lib/features/feed/presentation/widgets/consultants.dart b/lib/features/feed/presentation/widgets/consultants.dart index 4e505e40..4aed497c 100644 --- a/lib/features/feed/presentation/widgets/consultants.dart +++ b/lib/features/feed/presentation/widgets/consultants.dart @@ -24,14 +24,14 @@ class Consultants extends StatelessWidget { child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: ListView.separated( - padding: EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 16), shrinkWrap: true, - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemBuilder: (context, index) { return ConsultantWidget(consultant: state.consultantsList[index]); }, separatorBuilder: (context, index) { - return SizedBox(height: 12); + return const SizedBox(height: 12); }, itemCount: state.consultantsList.length, ), diff --git a/lib/features/feed/presentation/widgets/diet_filter_bottom_sheet.dart b/lib/features/feed/presentation/widgets/diet_filter_bottom_sheet.dart index e055ea4f..2a7c17a8 100644 --- a/lib/features/feed/presentation/widgets/diet_filter_bottom_sheet.dart +++ b/lib/features/feed/presentation/widgets/diet_filter_bottom_sheet.dart @@ -25,55 +25,55 @@ class DietFilterBottomSheet extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 12), - Center(child: BottomSheetHandlerBar()), - SizedBox(height: 16), + const SizedBox(height: 12), + const Center(child: BottomSheetHandlerBar()), + const SizedBox(height: 16), Text( s.order, style: TextStyles.textMSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 12), + const SizedBox(height: 12), SortingDropDownFilter( dietsCubit: dietsCubit, myDietsCubit: myDietsCubit, ), - SizedBox( + const SizedBox( height: 16, ), - CustomDivider(), - SizedBox( + const CustomDivider(), + const SizedBox( height: 16, ), Text( s.diet_type, style: TextStyles.textMSemibold.copyWith(color: appTheme.black), ), - SizedBox( + const SizedBox( height: 12, ), TypeChoiceFilterWidget( dietsCubit: dietsCubit, myDietsCubit: myDietsCubit, ), - SizedBox( + const SizedBox( height: 16, ), - CustomDivider(), - SizedBox( + const CustomDivider(), + const SizedBox( height: 16, ), Text( s.time, style: TextStyles.textMSemibold.copyWith(color: appTheme.black), ), - SizedBox( + const SizedBox( height: 12, ), DurationChoiceFilterWidget( dietCubit: dietsCubit, myDietsCubit: myDietsCubit, ), - SizedBox( + const SizedBox( height: 24, ), ], diff --git a/lib/features/feed/presentation/widgets/diets.dart b/lib/features/feed/presentation/widgets/diets.dart index 405d6469..c08a82a6 100644 --- a/lib/features/feed/presentation/widgets/diets.dart +++ b/lib/features/feed/presentation/widgets/diets.dart @@ -28,21 +28,21 @@ class Diets extends StatelessWidget { } else { return Stack( children: [ - SizedBox.expand(), + const SizedBox.expand(), NotificationListener( onNotification: (notification) { loadNewContent(notification, context.read().loadNextPage); return false; }, child: ListView.separated( - padding: EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric(vertical: 8), shrinkWrap: true, - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemBuilder: (context, index) { return DietsWidget(diet: state.dietsList[index], index: index); }, separatorBuilder: (context, index) { - return SizedBox(height: 8); + return const SizedBox(height: 8); }, itemCount: state.dietsList.length, ), diff --git a/lib/features/feed/presentation/widgets/diets_widget.dart b/lib/features/feed/presentation/widgets/diets_widget.dart index 46b93d18..4d1344eb 100644 --- a/lib/features/feed/presentation/widgets/diets_widget.dart +++ b/lib/features/feed/presentation/widgets/diets_widget.dart @@ -52,9 +52,9 @@ class _DietsWidgetState extends State { Stack( children: [ ClipRRect( - borderRadius: BorderRadius.vertical(top: Radius.circular(12)), + borderRadius: const BorderRadius.vertical(top: Radius.circular(12)), child: CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + widget.diet.image, + imageUrl: '$baseUrl/storage/${widget.diet.image}', fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width, ), @@ -71,7 +71,7 @@ class _DietsWidgetState extends State { }, color: appTheme.whiteA700, isFavorite: widget.diet.isFavorite, - borderRadius: BorderRadius.vertical(bottom: Radius.circular(12)), + borderRadius: const BorderRadius.vertical(bottom: Radius.circular(12)), width: 40, height: 44, size: 19, @@ -91,7 +91,7 @@ class _DietsWidgetState extends State { ), ], ), - SizedBox(height: 12), + const SizedBox(height: 12), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -103,13 +103,13 @@ class _DietsWidgetState extends State { ), ), if (widget.diet.details.isNotEmpty) ...[ - SizedBox( + const SizedBox( height: 12, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Html( - data: widget.diet.details.length > 200 ? widget.diet.details.substring(0, 200) + '...' : widget.diet.details, + data: widget.diet.details.length > 200 ? '${widget.diet.details.substring(0, 200)}...' : widget.diet.details, style: { "*": Style( margin: Margins.zero, @@ -136,7 +136,7 @@ class _DietsWidgetState extends State { await context.read().likeDiet(widget.diet.id, widget.index); }, ), - SizedBox( + const SizedBox( width: 12, ), FeedIconButton( @@ -145,7 +145,7 @@ class _DietsWidgetState extends State { onTap: () => GoRouter.of(context).pushNamed('aboutDietScreen', extra: {'diet': widget.diet, 'index': widget.index, 'navigateToComments': true}), ), - SizedBox( + const SizedBox( width: 12, ), FeedIconButton( @@ -154,7 +154,7 @@ class _DietsWidgetState extends State { final box = context.findRenderObject() as RenderBox?; final result = await Share.shareUri( Uri.parse( - baseUrl + '/ru/diet/' + widget.diet.id.toString(), + '$baseUrl/ru/diet/${widget.diet.id}', ), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); @@ -165,7 +165,7 @@ class _DietsWidgetState extends State { } }, ), - Spacer(), + const Spacer(), FeedIconButton( svgIcon: SvgPicture.asset('assets/icons/eye2.svg'), text: widget.diet.totalViews.toString(), @@ -174,7 +174,7 @@ class _DietsWidgetState extends State { ], ), ), - SizedBox(height: 12), + const SizedBox(height: 12), ], ), ), diff --git a/lib/features/feed/presentation/widgets/duration_choice_filter_widget.dart b/lib/features/feed/presentation/widgets/duration_choice_filter_widget.dart index 45c966d8..b8fd09b9 100644 --- a/lib/features/feed/presentation/widgets/duration_choice_filter_widget.dart +++ b/lib/features/feed/presentation/widgets/duration_choice_filter_widget.dart @@ -31,9 +31,9 @@ class _DurationChoiceFilterWidgetState extends State super.didChangeDependencies(); if (chipsLabelList.isEmpty) { chipsLabelList.add(s.all); - durationValues.forEach((element) { - chipsLabelList.add('${element} ${getDayForm(element, s)}'); - }); + for (var element in durationValues) { + chipsLabelList.add('$element ${getDayForm(element, s)}'); + } } } diff --git a/lib/features/feed/presentation/widgets/filter_badge.dart b/lib/features/feed/presentation/widgets/filter_badge.dart index 687d326a..5778dfe6 100644 --- a/lib/features/feed/presentation/widgets/filter_badge.dart +++ b/lib/features/feed/presentation/widgets/filter_badge.dart @@ -19,11 +19,11 @@ class FilterBadge extends StatelessWidget { ); }, child: Container( - padding: EdgeInsets.only(left: 20, top: 12, bottom: 12, right: 24), + padding: const EdgeInsets.only(left: 20, top: 12, bottom: 12, right: 24), width: 70, decoration: BoxDecoration( color: appTheme.blueA400, - borderRadius: BorderRadius.horizontal(left: Radius.circular(100)), + borderRadius: const BorderRadius.horizontal(left: Radius.circular(100)), ), child: SvgPicture.asset( 'assets/icons/filter2.svg', diff --git a/lib/features/feed/presentation/widgets/plan_widget.dart b/lib/features/feed/presentation/widgets/plan_widget.dart index 12ab8ec7..e1f26bed 100644 --- a/lib/features/feed/presentation/widgets/plan_widget.dart +++ b/lib/features/feed/presentation/widgets/plan_widget.dart @@ -56,9 +56,9 @@ class _PlanWidgetState extends State { Stack( children: [ ClipRRect( - borderRadius: BorderRadius.vertical(top: Radius.circular(12)), + borderRadius: const BorderRadius.vertical(top: Radius.circular(12)), child: CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + widget.plan.image, + imageUrl: '$baseUrl/storage/${widget.plan.image}', fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width, ), @@ -75,7 +75,7 @@ class _PlanWidgetState extends State { }, color: appTheme.whiteA700, isFavorite: widget.plan.isFavorite, - borderRadius: BorderRadius.vertical(bottom: Radius.circular(12)), + borderRadius: const BorderRadius.vertical(bottom: Radius.circular(12)), width: 40, height: 44, size: 19, @@ -95,7 +95,7 @@ class _PlanWidgetState extends State { ), ], ), - SizedBox(height: 12), + const SizedBox(height: 12), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -107,13 +107,13 @@ class _PlanWidgetState extends State { ), ), if (widget.plan.details.isNotEmpty) ...[ - SizedBox( + const SizedBox( height: 12, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Html( - data: widget.plan.details.length > 200 ? widget.plan.details.substring(0, 200) + '...' : widget.plan.details, + data: widget.plan.details.length > 200 ? '${widget.plan.details.substring(0, 200)}...' : widget.plan.details, style: { "*": Style( margin: Margins.zero, @@ -127,7 +127,7 @@ class _PlanWidgetState extends State { ], ], ), - SizedBox(height: 16), + const SizedBox(height: 16), GestureDetector( onTap: () { GoRouter.of(context).pushNamed( @@ -160,7 +160,7 @@ class _PlanWidgetState extends State { InfoBouble( radius: 12, backgroundColor: appTheme.gray50, - padding: EdgeInsets.symmetric(vertical: 4, horizontal: 10), + padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 10), children: [ Text( '${widget.plan.author.authorPlaceInRating}-й в рейтинге', @@ -170,12 +170,12 @@ class _PlanWidgetState extends State { ), ], ), - Spacer(), + const Spacer(), Text( '${widget.plan.packetsCount == 1 ? widget.plan.packet1Options?.price : '${s.from} ${widget.plan.minPriceOfOptions.toStringAsFixed(0)}'}₽', style: TextStyles.headingXLSemibold.copyWith(color: appTheme.greenA700), ), - SizedBox(width: 16), + const SizedBox(width: 16), ], ), title: Padding( @@ -190,7 +190,7 @@ class _PlanWidgetState extends State { ), ), ), - SizedBox(height: 16), + const SizedBox(height: 16), Padding( padding: const EdgeInsets.only( left: 16, @@ -206,7 +206,7 @@ class _PlanWidgetState extends State { await context.read().likePlan(widget.plan.slug, widget.index); }, ), - SizedBox( + const SizedBox( width: 12, ), FeedIconButton( @@ -215,7 +215,7 @@ class _PlanWidgetState extends State { onTap: () => GoRouter.of(context).pushNamed('aboutPlanScreen', extra: {'plan': widget.plan, 'index': widget.index, 'navigateToComments': true}), ), - SizedBox( + const SizedBox( width: 12, ), FeedIconButton( @@ -224,7 +224,7 @@ class _PlanWidgetState extends State { final box = context.findRenderObject() as RenderBox?; final result = await Share.shareUri( Uri.parse( - baseUrl + '/ru/diet/' + widget.plan.id.toString(), + '$baseUrl/ru/diet/${widget.plan.id}', ), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); @@ -235,7 +235,7 @@ class _PlanWidgetState extends State { } }, ), - Spacer(), + const Spacer(), FeedIconButton( svgIcon: SvgPicture.asset('assets/icons/eye2.svg'), text: widget.plan.totalViews.toString(), @@ -244,7 +244,7 @@ class _PlanWidgetState extends State { ], ), ), - SizedBox(height: 12), + const SizedBox(height: 12), ], ), ), diff --git a/lib/features/feed/presentation/widgets/plans.dart b/lib/features/feed/presentation/widgets/plans.dart index e8d894a3..005c9ee9 100644 --- a/lib/features/feed/presentation/widgets/plans.dart +++ b/lib/features/feed/presentation/widgets/plans.dart @@ -28,16 +28,16 @@ class Plans extends StatelessWidget { } return Stack( children: [ - SizedBox.expand(), + const SizedBox.expand(), NotificationListener( onNotification: (notification) { loadNewContent(notification, context.read().loadNextPage); return false; }, child: ListView.separated( - padding: EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric(vertical: 8), shrinkWrap: true, - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemBuilder: (context, index) { return PlanWidget( plan: state.plans[index], @@ -45,7 +45,7 @@ class Plans extends StatelessWidget { ); }, separatorBuilder: (context, index) { - return SizedBox(height: 8); + return const SizedBox(height: 8); }, itemCount: state.plans.length, ), diff --git a/lib/features/feed/presentation/widgets/plans_filter_bottom_sheet.dart b/lib/features/feed/presentation/widgets/plans_filter_bottom_sheet.dart index 9bc794ee..c5ab32ba 100644 --- a/lib/features/feed/presentation/widgets/plans_filter_bottom_sheet.dart +++ b/lib/features/feed/presentation/widgets/plans_filter_bottom_sheet.dart @@ -24,50 +24,50 @@ class PlansFilterBottomSheet extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 12), - Center(child: BottomSheetHandlerBar()), - SizedBox(height: 12), + const SizedBox(height: 12), + const Center(child: BottomSheetHandlerBar()), + const SizedBox(height: 12), Text( s.price, style: TextStyles.textMSemibold.copyWith(color: appTheme.black), ), - SizedBox(height: 12), + const SizedBox(height: 12), PriceChoiceFilterWidget(plansCubit: plansCubit, myPlansCubit: myPlansCubit,), - SizedBox(height: 16), - CustomDivider(), - SizedBox( + const SizedBox(height: 16), + const CustomDivider(), + const SizedBox( height: 16, ), Text( s.time, style: TextStyles.textMSemibold.copyWith(color: appTheme.black), ), - SizedBox( + const SizedBox( height: 12, ), DurationChoiceFilterWidget( plansCubit: plansCubit, myPlansCubit: myPlansCubit, ), - SizedBox( + const SizedBox( height: 16, ), - CustomDivider(), - SizedBox( + const CustomDivider(), + const SizedBox( height: 16, ), Text( s.plan_type, style: TextStyles.textMSemibold.copyWith(color: appTheme.black), ), - SizedBox( + const SizedBox( height: 12, ), TypeChoiceFilterWidget( plansCubit: plansCubit, myPlansCubit: myPlansCubit, ), - SizedBox( + const SizedBox( height: 24, ), ], diff --git a/lib/features/feed/presentation/widgets/price_choice_filter_widget.dart b/lib/features/feed/presentation/widgets/price_choice_filter_widget.dart index b01a5bbd..ce7e43cf 100644 --- a/lib/features/feed/presentation/widgets/price_choice_filter_widget.dart +++ b/lib/features/feed/presentation/widgets/price_choice_filter_widget.dart @@ -9,7 +9,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class PriceChoiceFilterWidget extends StatefulWidget { - PriceChoiceFilterWidget({ + const PriceChoiceFilterWidget({ super.key, required this.plansCubit, this.myPlansCubit, @@ -94,7 +94,7 @@ class _PriceChoiceFilterWidgetState extends State { final price = int.tryParse(value.replaceAll('₽', '')); if (price == null) { EasyDebounce.cancel('changeMinPriceFilter'); - minPriceController.value = TextEditingValue( + minPriceController.value = const TextEditingValue( text: '₽', selection: TextSelection.collapsed(offset: 0), ); @@ -122,7 +122,7 @@ class _PriceChoiceFilterWidgetState extends State { prevMinPrice = price; EasyDebounce.debounce( 'changeMinPriceFilter', - Duration(seconds: 2), + const Duration(seconds: 2), () => widget.myPlansCubit?.changePriceFilter( price, maxPriceFilter ?? maxPlanPrice, @@ -132,14 +132,14 @@ class _PriceChoiceFilterWidgetState extends State { }, ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: CustomTextFormField( onChanged: (value) { final price = int.tryParse(value.replaceAll('₽', '')); if (price == null) { EasyDebounce.cancel('changeMaxPriceFilter'); - maxPriceController.value = TextEditingValue( + maxPriceController.value = const TextEditingValue( text: '₽', selection: TextSelection.collapsed(offset: 0), ); @@ -167,7 +167,7 @@ class _PriceChoiceFilterWidgetState extends State { prevMaxPrice = price; EasyDebounce.debounce( 'changeMaxPriceFilter', - Duration(seconds: 2), + const Duration(seconds: 2), () => widget.myPlansCubit?.changePriceFilter( minPriceFilter ?? minPlanPrice, price, @@ -181,7 +181,7 @@ class _PriceChoiceFilterWidgetState extends State { ), ], ), - SizedBox(height: 12), + const SizedBox(height: 12), Theme( data: Theme.of(context).copyWith( sliderTheme: SliderThemeData( @@ -230,7 +230,7 @@ class _PriceChoiceFilterWidgetState extends State { final price = int.tryParse(value.replaceAll('₽', '')); if (price == null) { EasyDebounce.cancel('changeMinPriceFilter'); - minPriceController.value = TextEditingValue( + minPriceController.value = const TextEditingValue( text: '₽', selection: TextSelection.collapsed(offset: 0), ); @@ -258,7 +258,7 @@ class _PriceChoiceFilterWidgetState extends State { prevMinPrice = price; EasyDebounce.debounce( 'changeMinPriceFilter', - Duration(seconds: 2), + const Duration(seconds: 2), () => widget.plansCubit?.changePriceFilter( price, state.filterState.priceFilter.$2 ?? state.maxPlanPrice, @@ -268,14 +268,14 @@ class _PriceChoiceFilterWidgetState extends State { }, ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: CustomTextFormField( onChanged: (value) { final price = int.tryParse(value.replaceAll('₽', '')); if (price == null) { EasyDebounce.cancel('changeMaxPriceFilter'); - maxPriceController.value = TextEditingValue( + maxPriceController.value = const TextEditingValue( text: '₽', selection: TextSelection.collapsed(offset: 0), ); @@ -303,7 +303,7 @@ class _PriceChoiceFilterWidgetState extends State { prevMaxPrice = price; EasyDebounce.debounce( 'changeMaxPriceFilter', - Duration(seconds: 2), + const Duration(seconds: 2), () => widget.plansCubit?.changePriceFilter( state.filterState.priceFilter.$1 ?? state.minPlanPrice, price, @@ -317,7 +317,7 @@ class _PriceChoiceFilterWidgetState extends State { ), ], ), - SizedBox(height: 12), + const SizedBox(height: 12), Theme( data: Theme.of(context).copyWith( sliderTheme: SliderThemeData( diff --git a/lib/features/feed/presentation/widgets/recipes.dart b/lib/features/feed/presentation/widgets/recipes.dart index d62f2320..914c31fe 100644 --- a/lib/features/feed/presentation/widgets/recipes.dart +++ b/lib/features/feed/presentation/widgets/recipes.dart @@ -36,9 +36,9 @@ class Recipes extends StatelessWidget { return false; }, child: ListView.separated( - padding: EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric(vertical: 8), shrinkWrap: true, - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemBuilder: (context, index) { return RecipesWidget( recipe: state.recipesList[index], @@ -46,7 +46,7 @@ class Recipes extends StatelessWidget { ); }, separatorBuilder: (context, index) { - return SizedBox(height: 8); + return const SizedBox(height: 8); }, itemCount: state.recipesList.length, ), diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart index 8e08c05a..be5701df 100644 --- a/lib/features/feed/presentation/widgets/recipes_widget.dart +++ b/lib/features/feed/presentation/widgets/recipes_widget.dart @@ -71,9 +71,9 @@ class _RecipesWidgetState extends State { Stack( children: [ ClipRRect( - borderRadius: BorderRadius.vertical(top: Radius.circular(12)), + borderRadius: const BorderRadius.vertical(top: Radius.circular(12)), child: CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + widget.recipe.image, + imageUrl: '$baseUrl/storage/${widget.recipe.image}', fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width, ), @@ -85,10 +85,10 @@ class _RecipesWidgetState extends State { runSpacing: 8, children: [ _iconButton('assets/icons/clock.svg', timeTitle), - SizedBox(width: 8), + const SizedBox(width: 8), _iconButton('assets/icons/steps.svg', '${widget.recipe.steps?.length ?? 0} ${getStepForm(widget.recipe.steps?.length ?? 0)}'), - SizedBox(width: 8), - _iconButton('assets/icons/calories.svg', widget.recipe.calories.toStringAsFixed(0) + ' ккал'), + const SizedBox(width: 8), + _iconButton('assets/icons/calories.svg', '${widget.recipe.calories.toStringAsFixed(0)} ккал'), ], ), ), @@ -104,7 +104,7 @@ class _RecipesWidgetState extends State { }, color: appTheme.whiteA700, isFavorite: isFavorite, - borderRadius: BorderRadius.vertical(bottom: Radius.circular(12)), + borderRadius: const BorderRadius.vertical(bottom: Radius.circular(12)), width: 40, height: 44, size: 19, @@ -112,7 +112,7 @@ class _RecipesWidgetState extends State { ), ], ), - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( @@ -121,13 +121,13 @@ class _RecipesWidgetState extends State { ), ), if (widget.recipe.videoUrl != null && widget.recipe.videoUrl!.isNotEmpty) ...[ - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.only(left: 15), child: Row( children: [ SvgPicture.asset('assets/icons/play_icon.svg', width: 16, height: 16), - SizedBox(width: 8), + const SizedBox(width: 8), Text( s.there_is_a_video, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), @@ -136,7 +136,7 @@ class _RecipesWidgetState extends State { ), ), ], - SizedBox(height: 12), + const SizedBox(height: 12), if (widget.recipe.description.isNotEmpty) Padding( padding: const EdgeInsets.symmetric(horizontal: 16), @@ -165,7 +165,7 @@ class _RecipesWidgetState extends State { ), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Row( @@ -180,7 +180,7 @@ class _RecipesWidgetState extends State { await context.read().likeRecipe(widget.recipe.slug, widget.index); }, ), - SizedBox(width: 8), + const SizedBox(width: 8), FeedIconButton( icon: Icons.chat_bubble_outline, text: widget.recipe.commentsCount.toString(), @@ -193,7 +193,7 @@ class _RecipesWidgetState extends State { }, ), ), - SizedBox(width: 8), + const SizedBox(width: 8), FeedIconButton( svgIcon: SvgPicture.asset( height: 15, @@ -205,19 +205,19 @@ class _RecipesWidgetState extends State { final box = context.findRenderObject() as RenderBox?; Share.shareUri( Uri.parse( - baseUrl + '/ru/blog_post/' + widget.recipe.id.toString(), + '$baseUrl/ru/blog_post/${widget.recipe.id}', ), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, ), - Spacer(), + const Spacer(), Icon( Icons.visibility_rounded, size: 16, color: appTheme.gray500, ), - SizedBox(width: 4), + const SizedBox(width: 4), Text( widget.recipe.viewsCount.toString(), style: TextStyle( @@ -229,7 +229,7 @@ class _RecipesWidgetState extends State { ], ), ), - SizedBox(height: 12), + const SizedBox(height: 12), ], ), ), @@ -240,7 +240,7 @@ class _RecipesWidgetState extends State { _iconButton(String iconPath, [String? text]) { return Container( - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration( color: appTheme.whiteA700, borderRadius: BorderRadius.circular(16), @@ -252,11 +252,11 @@ class _RecipesWidgetState extends State { SvgPicture.asset( iconPath, ), - if (text != null) SizedBox(width: 8), + if (text != null) const SizedBox(width: 8), if (text != null) Text( text, - style: TextStyle( + style: const TextStyle( fontSize: 12, color: Colors.black, fontWeight: FontWeight.w500, diff --git a/lib/features/feed/presentation/widgets/sorting_drop_down_filter.dart b/lib/features/feed/presentation/widgets/sorting_drop_down_filter.dart index f03605ef..f77a14c8 100644 --- a/lib/features/feed/presentation/widgets/sorting_drop_down_filter.dart +++ b/lib/features/feed/presentation/widgets/sorting_drop_down_filter.dart @@ -44,11 +44,11 @@ class _SortingDropDownFilterState extends State { items: sortingTypes .mapIndexed( (index, value) => DropdownMenuItem( + value: sortingTypes[index], child: Text( sortingTypes[index], style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), - value: sortingTypes[index], ), ) .toList(), @@ -74,11 +74,11 @@ class _SortingDropDownFilterState extends State { items: sortingTypes .mapIndexed( (index, value) => DropdownMenuItem( + value: sortingTypes[index], child: Text( sortingTypes[index], style: TextStyles.textMMedium.copyWith(color: appTheme.black), ), - value: sortingTypes[index], ), ) .toList(), diff --git a/lib/features/feed/presentation/widgets/subscribe_button_widget.dart b/lib/features/feed/presentation/widgets/subscribe_button_widget.dart index 90074bef..c927d810 100644 --- a/lib/features/feed/presentation/widgets/subscribe_button_widget.dart +++ b/lib/features/feed/presentation/widgets/subscribe_button_widget.dart @@ -22,7 +22,7 @@ class _SubscribeButtonWidgetState extends State { Widget build(BuildContext context) { return AnimatedOpacity( opacity: isSubscribe ? 0 : 1, - duration: Duration(milliseconds: 250), + duration: const Duration(milliseconds: 250), child: InkWell( onTap: () async { try { @@ -38,12 +38,12 @@ class _SubscribeButtonWidgetState extends State { }, borderRadius: BorderRadius.circular(8), child: Ink( - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: appTheme.gray200, ), - child: Text( + child: const Text( 'Подписаться', style: TextStyle( fontSize: 13, diff --git a/lib/features/feed/presentation/widgets/tags_modal_widget.dart b/lib/features/feed/presentation/widgets/tags_modal_widget.dart index f9382909..b81b17a0 100644 --- a/lib/features/feed/presentation/widgets/tags_modal_widget.dart +++ b/lib/features/feed/presentation/widgets/tags_modal_widget.dart @@ -24,7 +24,7 @@ class _TagsModalWidgetState extends State { bloc: widget.recipesCubit, builder: (BuildContext context, RecipesState state) { return Container( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), width: MediaQuery.of(context).size.width, child: Wrap( spacing: 8, diff --git a/lib/features/glossary/models/glossary_model.freezed.dart b/lib/features/glossary/models/glossary_model.freezed.dart index 67994490..ababa94f 100644 --- a/lib/features/glossary/models/glossary_model.freezed.dart +++ b/lib/features/glossary/models/glossary_model.freezed.dart @@ -12,12 +12,10 @@ part of 'glossary_model.dart'; 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', -); + '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'); GlossaryPaginationModel _$GlossaryPaginationModelFromJson( - Map json, -) { + Map json) { return _GlossaryPaginationModel.fromJson(json); } @@ -38,19 +36,16 @@ mixin _$GlossaryPaginationModel { /// @nodoc abstract class $GlossaryPaginationModelCopyWith<$Res> { - factory $GlossaryPaginationModelCopyWith( - GlossaryPaginationModel value, - $Res Function(GlossaryPaginationModel) then, - ) = _$GlossaryPaginationModelCopyWithImpl<$Res, GlossaryPaginationModel>; + factory $GlossaryPaginationModelCopyWith(GlossaryPaginationModel value, + $Res Function(GlossaryPaginationModel) then) = + _$GlossaryPaginationModelCopyWithImpl<$Res, GlossaryPaginationModel>; @useResult $Res call({@JsonKey(name: 'data') List glossariesList}); } /// @nodoc -class _$GlossaryPaginationModelCopyWithImpl< - $Res, - $Val extends GlossaryPaginationModel -> +class _$GlossaryPaginationModelCopyWithImpl<$Res, + $Val extends GlossaryPaginationModel> implements $GlossaryPaginationModelCopyWith<$Res> { _$GlossaryPaginationModelCopyWithImpl(this._value, this._then); @@ -63,17 +58,15 @@ class _$GlossaryPaginationModelCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? glossariesList = null}) { - return _then( - _value.copyWith( - glossariesList: - null == glossariesList - ? _value.glossariesList - : glossariesList // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + $Res call({ + Object? glossariesList = null, + }) { + return _then(_value.copyWith( + glossariesList: null == glossariesList + ? _value.glossariesList + : glossariesList // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } } @@ -81,9 +74,9 @@ class _$GlossaryPaginationModelCopyWithImpl< abstract class _$$GlossaryPaginationModelImplCopyWith<$Res> implements $GlossaryPaginationModelCopyWith<$Res> { factory _$$GlossaryPaginationModelImplCopyWith( - _$GlossaryPaginationModelImpl value, - $Res Function(_$GlossaryPaginationModelImpl) then, - ) = __$$GlossaryPaginationModelImplCopyWithImpl<$Res>; + _$GlossaryPaginationModelImpl value, + $Res Function(_$GlossaryPaginationModelImpl) then) = + __$$GlossaryPaginationModelImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: 'data') List glossariesList}); @@ -91,40 +84,37 @@ abstract class _$$GlossaryPaginationModelImplCopyWith<$Res> /// @nodoc class __$$GlossaryPaginationModelImplCopyWithImpl<$Res> - extends - _$GlossaryPaginationModelCopyWithImpl< - $Res, - _$GlossaryPaginationModelImpl - > + extends _$GlossaryPaginationModelCopyWithImpl<$Res, + _$GlossaryPaginationModelImpl> implements _$$GlossaryPaginationModelImplCopyWith<$Res> { __$$GlossaryPaginationModelImplCopyWithImpl( - _$GlossaryPaginationModelImpl _value, - $Res Function(_$GlossaryPaginationModelImpl) _then, - ) : super(_value, _then); + _$GlossaryPaginationModelImpl _value, + $Res Function(_$GlossaryPaginationModelImpl) _then) + : super(_value, _then); /// Create a copy of GlossaryPaginationModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? glossariesList = null}) { - return _then( - _$GlossaryPaginationModelImpl( - glossariesList: - null == glossariesList - ? _value._glossariesList - : glossariesList // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + $Res call({ + Object? glossariesList = null, + }) { + return _then(_$GlossaryPaginationModelImpl( + glossariesList: null == glossariesList + ? _value._glossariesList + : glossariesList // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc @JsonSerializable() class _$GlossaryPaginationModelImpl implements _GlossaryPaginationModel { - const _$GlossaryPaginationModelImpl({ - @JsonKey(name: 'data') required final List glossariesList, - }) : _glossariesList = glossariesList; + const _$GlossaryPaginationModelImpl( + {@JsonKey(name: 'data') + required final List glossariesList}) + : _glossariesList = glossariesList; factory _$GlossaryPaginationModelImpl.fromJson(Map json) => _$$GlossaryPaginationModelImplFromJson(json); @@ -148,18 +138,14 @@ class _$GlossaryPaginationModelImpl implements _GlossaryPaginationModel { return identical(this, other) || (other.runtimeType == runtimeType && other is _$GlossaryPaginationModelImpl && - const DeepCollectionEquality().equals( - other._glossariesList, - _glossariesList, - )); + const DeepCollectionEquality() + .equals(other._glossariesList, _glossariesList)); } @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_glossariesList), - ); + runtimeType, const DeepCollectionEquality().hash(_glossariesList)); /// Create a copy of GlossaryPaginationModel /// with the given fields replaced by the non-null parameter values. @@ -167,20 +153,22 @@ class _$GlossaryPaginationModelImpl implements _GlossaryPaginationModel { @override @pragma('vm:prefer-inline') _$$GlossaryPaginationModelImplCopyWith<_$GlossaryPaginationModelImpl> - get copyWith => __$$GlossaryPaginationModelImplCopyWithImpl< - _$GlossaryPaginationModelImpl - >(this, _$identity); + get copyWith => __$$GlossaryPaginationModelImplCopyWithImpl< + _$GlossaryPaginationModelImpl>(this, _$identity); @override Map toJson() { - return _$$GlossaryPaginationModelImplToJson(this); + return _$$GlossaryPaginationModelImplToJson( + this, + ); } } abstract class _GlossaryPaginationModel implements GlossaryPaginationModel { - const factory _GlossaryPaginationModel({ - @JsonKey(name: 'data') required final List glossariesList, - }) = _$GlossaryPaginationModelImpl; + const factory _GlossaryPaginationModel( + {@JsonKey(name: 'data') + required final List glossariesList}) = + _$GlossaryPaginationModelImpl; factory _GlossaryPaginationModel.fromJson(Map json) = _$GlossaryPaginationModelImpl.fromJson; @@ -194,12 +182,11 @@ abstract class _GlossaryPaginationModel implements GlossaryPaginationModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$GlossaryPaginationModelImplCopyWith<_$GlossaryPaginationModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } GlossaryModerationModel _$GlossaryModerationModelFromJson( - Map json, -) { + Map json) { return _GlossaryModerationModel.fromJson(json); } @@ -220,23 +207,19 @@ mixin _$GlossaryModerationModel { /// @nodoc abstract class $GlossaryModerationModelCopyWith<$Res> { - factory $GlossaryModerationModelCopyWith( - GlossaryModerationModel value, - $Res Function(GlossaryModerationModel) then, - ) = _$GlossaryModerationModelCopyWithImpl<$Res, GlossaryModerationModel>; + factory $GlossaryModerationModelCopyWith(GlossaryModerationModel value, + $Res Function(GlossaryModerationModel) then) = + _$GlossaryModerationModelCopyWithImpl<$Res, GlossaryModerationModel>; @useResult - $Res call({ - @JsonKey(name: 'product_nutritional_value') GlossaryModel glossary, - }); + $Res call( + {@JsonKey(name: 'product_nutritional_value') GlossaryModel glossary}); $GlossaryModelCopyWith<$Res> get glossary; } /// @nodoc -class _$GlossaryModerationModelCopyWithImpl< - $Res, - $Val extends GlossaryModerationModel -> +class _$GlossaryModerationModelCopyWithImpl<$Res, + $Val extends GlossaryModerationModel> implements $GlossaryModerationModelCopyWith<$Res> { _$GlossaryModerationModelCopyWithImpl(this._value, this._then); @@ -249,17 +232,15 @@ class _$GlossaryModerationModelCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? glossary = null}) { - return _then( - _value.copyWith( - glossary: - null == glossary - ? _value.glossary - : glossary // ignore: cast_nullable_to_non_nullable - as GlossaryModel, - ) - as $Val, - ); + $Res call({ + Object? glossary = null, + }) { + return _then(_value.copyWith( + glossary: null == glossary + ? _value.glossary + : glossary // ignore: cast_nullable_to_non_nullable + as GlossaryModel, + ) as $Val); } /// Create a copy of GlossaryModerationModel @@ -277,14 +258,13 @@ class _$GlossaryModerationModelCopyWithImpl< abstract class _$$GlossaryModerationModelImplCopyWith<$Res> implements $GlossaryModerationModelCopyWith<$Res> { factory _$$GlossaryModerationModelImplCopyWith( - _$GlossaryModerationModelImpl value, - $Res Function(_$GlossaryModerationModelImpl) then, - ) = __$$GlossaryModerationModelImplCopyWithImpl<$Res>; + _$GlossaryModerationModelImpl value, + $Res Function(_$GlossaryModerationModelImpl) then) = + __$$GlossaryModerationModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'product_nutritional_value') GlossaryModel glossary, - }); + $Res call( + {@JsonKey(name: 'product_nutritional_value') GlossaryModel glossary}); @override $GlossaryModelCopyWith<$Res> get glossary; @@ -292,40 +272,35 @@ abstract class _$$GlossaryModerationModelImplCopyWith<$Res> /// @nodoc class __$$GlossaryModerationModelImplCopyWithImpl<$Res> - extends - _$GlossaryModerationModelCopyWithImpl< - $Res, - _$GlossaryModerationModelImpl - > + extends _$GlossaryModerationModelCopyWithImpl<$Res, + _$GlossaryModerationModelImpl> implements _$$GlossaryModerationModelImplCopyWith<$Res> { __$$GlossaryModerationModelImplCopyWithImpl( - _$GlossaryModerationModelImpl _value, - $Res Function(_$GlossaryModerationModelImpl) _then, - ) : super(_value, _then); + _$GlossaryModerationModelImpl _value, + $Res Function(_$GlossaryModerationModelImpl) _then) + : super(_value, _then); /// Create a copy of GlossaryModerationModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? glossary = null}) { - return _then( - _$GlossaryModerationModelImpl( - glossary: - null == glossary - ? _value.glossary - : glossary // ignore: cast_nullable_to_non_nullable - as GlossaryModel, - ), - ); + $Res call({ + Object? glossary = null, + }) { + return _then(_$GlossaryModerationModelImpl( + glossary: null == glossary + ? _value.glossary + : glossary // ignore: cast_nullable_to_non_nullable + as GlossaryModel, + )); } } /// @nodoc @JsonSerializable() class _$GlossaryModerationModelImpl implements _GlossaryModerationModel { - const _$GlossaryModerationModelImpl({ - @JsonKey(name: 'product_nutritional_value') required this.glossary, - }); + const _$GlossaryModerationModelImpl( + {@JsonKey(name: 'product_nutritional_value') required this.glossary}); factory _$GlossaryModerationModelImpl.fromJson(Map json) => _$$GlossaryModerationModelImplFromJson(json); @@ -358,21 +333,21 @@ class _$GlossaryModerationModelImpl implements _GlossaryModerationModel { @override @pragma('vm:prefer-inline') _$$GlossaryModerationModelImplCopyWith<_$GlossaryModerationModelImpl> - get copyWith => __$$GlossaryModerationModelImplCopyWithImpl< - _$GlossaryModerationModelImpl - >(this, _$identity); + get copyWith => __$$GlossaryModerationModelImplCopyWithImpl< + _$GlossaryModerationModelImpl>(this, _$identity); @override Map toJson() { - return _$$GlossaryModerationModelImplToJson(this); + return _$$GlossaryModerationModelImplToJson( + this, + ); } } abstract class _GlossaryModerationModel implements GlossaryModerationModel { - const factory _GlossaryModerationModel({ - @JsonKey(name: 'product_nutritional_value') - required final GlossaryModel glossary, - }) = _$GlossaryModerationModelImpl; + const factory _GlossaryModerationModel( + {@JsonKey(name: 'product_nutritional_value') + required final GlossaryModel glossary}) = _$GlossaryModerationModelImpl; factory _GlossaryModerationModel.fromJson(Map json) = _$GlossaryModerationModelImpl.fromJson; @@ -386,7 +361,7 @@ abstract class _GlossaryModerationModel implements GlossaryModerationModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$GlossaryModerationModelImplCopyWith<_$GlossaryModerationModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } GlossaryModel _$GlossaryModelFromJson(Map json) { @@ -429,23 +404,22 @@ mixin _$GlossaryModel { /// @nodoc abstract class $GlossaryModelCopyWith<$Res> { factory $GlossaryModelCopyWith( - GlossaryModel value, - $Res Function(GlossaryModel) then, - ) = _$GlossaryModelCopyWithImpl<$Res, GlossaryModel>; + GlossaryModel value, $Res Function(GlossaryModel) then) = + _$GlossaryModelCopyWithImpl<$Res, GlossaryModel>; @useResult - $Res call({ - int id, - String name, - @JsonKey(name: 'portion_mass_gr') int grInPortion, - @JsonKey(name: 'energy_on_100gr') double energyOn100Gr, - @JsonKey(name: 'proteins_on_100gr') double proteinsOn100Gr, - @JsonKey(name: 'fats_on_100gr') double fatsOn100Gr, - @JsonKey(name: 'carbohydrates_on_100gr') double carbohydratesOn100Gr, - @JsonKey(name: 'energy_on_portion') double energyOnPortion, - @JsonKey(name: 'proteins_on_portion') double proteinsOnPortion, - @JsonKey(name: 'fats_on_portion') double fatsOnPortion, - @JsonKey(name: 'carbohydrates_on_portion') double carbohydratesOnPortion, - }); + $Res call( + {int id, + String name, + @JsonKey(name: 'portion_mass_gr') int grInPortion, + @JsonKey(name: 'energy_on_100gr') double energyOn100Gr, + @JsonKey(name: 'proteins_on_100gr') double proteinsOn100Gr, + @JsonKey(name: 'fats_on_100gr') double fatsOn100Gr, + @JsonKey(name: 'carbohydrates_on_100gr') double carbohydratesOn100Gr, + @JsonKey(name: 'energy_on_portion') double energyOnPortion, + @JsonKey(name: 'proteins_on_portion') double proteinsOnPortion, + @JsonKey(name: 'fats_on_portion') double fatsOnPortion, + @JsonKey(name: 'carbohydrates_on_portion') + double carbohydratesOnPortion}); } /// @nodoc @@ -475,66 +449,52 @@ class _$GlossaryModelCopyWithImpl<$Res, $Val extends GlossaryModel> Object? fatsOnPortion = null, Object? carbohydratesOnPortion = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - grInPortion: - null == grInPortion - ? _value.grInPortion - : grInPortion // ignore: cast_nullable_to_non_nullable - as int, - energyOn100Gr: - null == energyOn100Gr - ? _value.energyOn100Gr - : energyOn100Gr // ignore: cast_nullable_to_non_nullable - as double, - proteinsOn100Gr: - null == proteinsOn100Gr - ? _value.proteinsOn100Gr - : proteinsOn100Gr // ignore: cast_nullable_to_non_nullable - as double, - fatsOn100Gr: - null == fatsOn100Gr - ? _value.fatsOn100Gr - : fatsOn100Gr // ignore: cast_nullable_to_non_nullable - as double, - carbohydratesOn100Gr: - null == carbohydratesOn100Gr - ? _value.carbohydratesOn100Gr - : carbohydratesOn100Gr // ignore: cast_nullable_to_non_nullable - as double, - energyOnPortion: - null == energyOnPortion - ? _value.energyOnPortion - : energyOnPortion // ignore: cast_nullable_to_non_nullable - as double, - proteinsOnPortion: - null == proteinsOnPortion - ? _value.proteinsOnPortion - : proteinsOnPortion // ignore: cast_nullable_to_non_nullable - as double, - fatsOnPortion: - null == fatsOnPortion - ? _value.fatsOnPortion - : fatsOnPortion // ignore: cast_nullable_to_non_nullable - as double, - carbohydratesOnPortion: - null == carbohydratesOnPortion - ? _value.carbohydratesOnPortion - : carbohydratesOnPortion // ignore: cast_nullable_to_non_nullable - as double, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + grInPortion: null == grInPortion + ? _value.grInPortion + : grInPortion // ignore: cast_nullable_to_non_nullable + as int, + energyOn100Gr: null == energyOn100Gr + ? _value.energyOn100Gr + : energyOn100Gr // ignore: cast_nullable_to_non_nullable + as double, + proteinsOn100Gr: null == proteinsOn100Gr + ? _value.proteinsOn100Gr + : proteinsOn100Gr // ignore: cast_nullable_to_non_nullable + as double, + fatsOn100Gr: null == fatsOn100Gr + ? _value.fatsOn100Gr + : fatsOn100Gr // ignore: cast_nullable_to_non_nullable + as double, + carbohydratesOn100Gr: null == carbohydratesOn100Gr + ? _value.carbohydratesOn100Gr + : carbohydratesOn100Gr // ignore: cast_nullable_to_non_nullable + as double, + energyOnPortion: null == energyOnPortion + ? _value.energyOnPortion + : energyOnPortion // ignore: cast_nullable_to_non_nullable + as double, + proteinsOnPortion: null == proteinsOnPortion + ? _value.proteinsOnPortion + : proteinsOnPortion // ignore: cast_nullable_to_non_nullable + as double, + fatsOnPortion: null == fatsOnPortion + ? _value.fatsOnPortion + : fatsOnPortion // ignore: cast_nullable_to_non_nullable + as double, + carbohydratesOnPortion: null == carbohydratesOnPortion + ? _value.carbohydratesOnPortion + : carbohydratesOnPortion // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); } } @@ -542,24 +502,23 @@ class _$GlossaryModelCopyWithImpl<$Res, $Val extends GlossaryModel> abstract class _$$GlossaryModelImplCopyWith<$Res> implements $GlossaryModelCopyWith<$Res> { factory _$$GlossaryModelImplCopyWith( - _$GlossaryModelImpl value, - $Res Function(_$GlossaryModelImpl) then, - ) = __$$GlossaryModelImplCopyWithImpl<$Res>; + _$GlossaryModelImpl value, $Res Function(_$GlossaryModelImpl) then) = + __$$GlossaryModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - int id, - String name, - @JsonKey(name: 'portion_mass_gr') int grInPortion, - @JsonKey(name: 'energy_on_100gr') double energyOn100Gr, - @JsonKey(name: 'proteins_on_100gr') double proteinsOn100Gr, - @JsonKey(name: 'fats_on_100gr') double fatsOn100Gr, - @JsonKey(name: 'carbohydrates_on_100gr') double carbohydratesOn100Gr, - @JsonKey(name: 'energy_on_portion') double energyOnPortion, - @JsonKey(name: 'proteins_on_portion') double proteinsOnPortion, - @JsonKey(name: 'fats_on_portion') double fatsOnPortion, - @JsonKey(name: 'carbohydrates_on_portion') double carbohydratesOnPortion, - }); + $Res call( + {int id, + String name, + @JsonKey(name: 'portion_mass_gr') int grInPortion, + @JsonKey(name: 'energy_on_100gr') double energyOn100Gr, + @JsonKey(name: 'proteins_on_100gr') double proteinsOn100Gr, + @JsonKey(name: 'fats_on_100gr') double fatsOn100Gr, + @JsonKey(name: 'carbohydrates_on_100gr') double carbohydratesOn100Gr, + @JsonKey(name: 'energy_on_portion') double energyOnPortion, + @JsonKey(name: 'proteins_on_portion') double proteinsOnPortion, + @JsonKey(name: 'fats_on_portion') double fatsOnPortion, + @JsonKey(name: 'carbohydrates_on_portion') + double carbohydratesOnPortion}); } /// @nodoc @@ -567,9 +526,8 @@ class __$$GlossaryModelImplCopyWithImpl<$Res> extends _$GlossaryModelCopyWithImpl<$Res, _$GlossaryModelImpl> implements _$$GlossaryModelImplCopyWith<$Res> { __$$GlossaryModelImplCopyWithImpl( - _$GlossaryModelImpl _value, - $Res Function(_$GlossaryModelImpl) _then, - ) : super(_value, _then); + _$GlossaryModelImpl _value, $Res Function(_$GlossaryModelImpl) _then) + : super(_value, _then); /// Create a copy of GlossaryModel /// with the given fields replaced by the non-null parameter values. @@ -588,85 +546,72 @@ class __$$GlossaryModelImplCopyWithImpl<$Res> Object? fatsOnPortion = null, Object? carbohydratesOnPortion = null, }) { - return _then( - _$GlossaryModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - grInPortion: - null == grInPortion - ? _value.grInPortion - : grInPortion // ignore: cast_nullable_to_non_nullable - as int, - energyOn100Gr: - null == energyOn100Gr - ? _value.energyOn100Gr - : energyOn100Gr // ignore: cast_nullable_to_non_nullable - as double, - proteinsOn100Gr: - null == proteinsOn100Gr - ? _value.proteinsOn100Gr - : proteinsOn100Gr // ignore: cast_nullable_to_non_nullable - as double, - fatsOn100Gr: - null == fatsOn100Gr - ? _value.fatsOn100Gr - : fatsOn100Gr // ignore: cast_nullable_to_non_nullable - as double, - carbohydratesOn100Gr: - null == carbohydratesOn100Gr - ? _value.carbohydratesOn100Gr - : carbohydratesOn100Gr // ignore: cast_nullable_to_non_nullable - as double, - energyOnPortion: - null == energyOnPortion - ? _value.energyOnPortion - : energyOnPortion // ignore: cast_nullable_to_non_nullable - as double, - proteinsOnPortion: - null == proteinsOnPortion - ? _value.proteinsOnPortion - : proteinsOnPortion // ignore: cast_nullable_to_non_nullable - as double, - fatsOnPortion: - null == fatsOnPortion - ? _value.fatsOnPortion - : fatsOnPortion // ignore: cast_nullable_to_non_nullable - as double, - carbohydratesOnPortion: - null == carbohydratesOnPortion - ? _value.carbohydratesOnPortion - : carbohydratesOnPortion // ignore: cast_nullable_to_non_nullable - as double, - ), - ); + return _then(_$GlossaryModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + grInPortion: null == grInPortion + ? _value.grInPortion + : grInPortion // ignore: cast_nullable_to_non_nullable + as int, + energyOn100Gr: null == energyOn100Gr + ? _value.energyOn100Gr + : energyOn100Gr // ignore: cast_nullable_to_non_nullable + as double, + proteinsOn100Gr: null == proteinsOn100Gr + ? _value.proteinsOn100Gr + : proteinsOn100Gr // ignore: cast_nullable_to_non_nullable + as double, + fatsOn100Gr: null == fatsOn100Gr + ? _value.fatsOn100Gr + : fatsOn100Gr // ignore: cast_nullable_to_non_nullable + as double, + carbohydratesOn100Gr: null == carbohydratesOn100Gr + ? _value.carbohydratesOn100Gr + : carbohydratesOn100Gr // ignore: cast_nullable_to_non_nullable + as double, + energyOnPortion: null == energyOnPortion + ? _value.energyOnPortion + : energyOnPortion // ignore: cast_nullable_to_non_nullable + as double, + proteinsOnPortion: null == proteinsOnPortion + ? _value.proteinsOnPortion + : proteinsOnPortion // ignore: cast_nullable_to_non_nullable + as double, + fatsOnPortion: null == fatsOnPortion + ? _value.fatsOnPortion + : fatsOnPortion // ignore: cast_nullable_to_non_nullable + as double, + carbohydratesOnPortion: null == carbohydratesOnPortion + ? _value.carbohydratesOnPortion + : carbohydratesOnPortion // ignore: cast_nullable_to_non_nullable + as double, + )); } } /// @nodoc @JsonSerializable() class _$GlossaryModelImpl implements _GlossaryModel { - const _$GlossaryModelImpl({ - required this.id, - required this.name, - @JsonKey(name: 'portion_mass_gr') required this.grInPortion, - @JsonKey(name: 'energy_on_100gr') required this.energyOn100Gr, - @JsonKey(name: 'proteins_on_100gr') required this.proteinsOn100Gr, - @JsonKey(name: 'fats_on_100gr') required this.fatsOn100Gr, - @JsonKey(name: 'carbohydrates_on_100gr') required this.carbohydratesOn100Gr, - @JsonKey(name: 'energy_on_portion') required this.energyOnPortion, - @JsonKey(name: 'proteins_on_portion') required this.proteinsOnPortion, - @JsonKey(name: 'fats_on_portion') required this.fatsOnPortion, - @JsonKey(name: 'carbohydrates_on_portion') - required this.carbohydratesOnPortion, - }); + const _$GlossaryModelImpl( + {required this.id, + required this.name, + @JsonKey(name: 'portion_mass_gr') required this.grInPortion, + @JsonKey(name: 'energy_on_100gr') required this.energyOn100Gr, + @JsonKey(name: 'proteins_on_100gr') required this.proteinsOn100Gr, + @JsonKey(name: 'fats_on_100gr') required this.fatsOn100Gr, + @JsonKey(name: 'carbohydrates_on_100gr') + required this.carbohydratesOn100Gr, + @JsonKey(name: 'energy_on_portion') required this.energyOnPortion, + @JsonKey(name: 'proteins_on_portion') required this.proteinsOnPortion, + @JsonKey(name: 'fats_on_portion') required this.fatsOnPortion, + @JsonKey(name: 'carbohydrates_on_portion') + required this.carbohydratesOnPortion}); factory _$GlossaryModelImpl.fromJson(Map json) => _$$GlossaryModelImplFromJson(json); @@ -738,19 +683,18 @@ class _$GlossaryModelImpl implements _GlossaryModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - id, - name, - grInPortion, - energyOn100Gr, - proteinsOn100Gr, - fatsOn100Gr, - carbohydratesOn100Gr, - energyOnPortion, - proteinsOnPortion, - fatsOnPortion, - carbohydratesOnPortion, - ); + runtimeType, + id, + name, + grInPortion, + energyOn100Gr, + proteinsOn100Gr, + fatsOn100Gr, + carbohydratesOn100Gr, + energyOnPortion, + proteinsOnPortion, + fatsOnPortion, + carbohydratesOnPortion); /// Create a copy of GlossaryModel /// with the given fields replaced by the non-null parameter values. @@ -762,27 +706,28 @@ class _$GlossaryModelImpl implements _GlossaryModel { @override Map toJson() { - return _$$GlossaryModelImplToJson(this); + return _$$GlossaryModelImplToJson( + this, + ); } } abstract class _GlossaryModel implements GlossaryModel { - const factory _GlossaryModel({ - required final int id, - required final String name, - @JsonKey(name: 'portion_mass_gr') required final int grInPortion, - @JsonKey(name: 'energy_on_100gr') required final double energyOn100Gr, - @JsonKey(name: 'proteins_on_100gr') required final double proteinsOn100Gr, - @JsonKey(name: 'fats_on_100gr') required final double fatsOn100Gr, - @JsonKey(name: 'carbohydrates_on_100gr') - required final double carbohydratesOn100Gr, - @JsonKey(name: 'energy_on_portion') required final double energyOnPortion, - @JsonKey(name: 'proteins_on_portion') - required final double proteinsOnPortion, - @JsonKey(name: 'fats_on_portion') required final double fatsOnPortion, - @JsonKey(name: 'carbohydrates_on_portion') - required final double carbohydratesOnPortion, - }) = _$GlossaryModelImpl; + const factory _GlossaryModel( + {required final int id, + required final String name, + @JsonKey(name: 'portion_mass_gr') required final int grInPortion, + @JsonKey(name: 'energy_on_100gr') required final double energyOn100Gr, + @JsonKey(name: 'proteins_on_100gr') required final double proteinsOn100Gr, + @JsonKey(name: 'fats_on_100gr') required final double fatsOn100Gr, + @JsonKey(name: 'carbohydrates_on_100gr') + required final double carbohydratesOn100Gr, + @JsonKey(name: 'energy_on_portion') required final double energyOnPortion, + @JsonKey(name: 'proteins_on_portion') + required final double proteinsOnPortion, + @JsonKey(name: 'fats_on_portion') required final double fatsOnPortion, + @JsonKey(name: 'carbohydrates_on_portion') + required final double carbohydratesOnPortion}) = _$GlossaryModelImpl; factory _GlossaryModel.fromJson(Map json) = _$GlossaryModelImpl.fromJson; diff --git a/lib/features/glossary/models/glossary_model.g.dart b/lib/features/glossary/models/glossary_model.g.dart index f76fd71c..cd3214b4 100644 --- a/lib/features/glossary/models/glossary_model.g.dart +++ b/lib/features/glossary/models/glossary_model.g.dart @@ -7,29 +7,31 @@ part of 'glossary_model.dart'; // ************************************************************************** _$GlossaryPaginationModelImpl _$$GlossaryPaginationModelImplFromJson( - Map json, -) => _$GlossaryPaginationModelImpl( - glossariesList: - (json['data'] as List) + Map json) => + _$GlossaryPaginationModelImpl( + glossariesList: (json['data'] as List) .map((e) => GlossaryModel.fromJson(e as Map)) .toList(), -); + ); Map _$$GlossaryPaginationModelImplToJson( - _$GlossaryPaginationModelImpl instance, -) => {'data': instance.glossariesList}; + _$GlossaryPaginationModelImpl instance) => + { + 'data': instance.glossariesList, + }; _$GlossaryModerationModelImpl _$$GlossaryModerationModelImplFromJson( - Map json, -) => _$GlossaryModerationModelImpl( - glossary: GlossaryModel.fromJson( - json['product_nutritional_value'] as Map, - ), -); + Map json) => + _$GlossaryModerationModelImpl( + glossary: GlossaryModel.fromJson( + json['product_nutritional_value'] as Map), + ); Map _$$GlossaryModerationModelImplToJson( - _$GlossaryModerationModelImpl instance, -) => {'product_nutritional_value': instance.glossary}; + _$GlossaryModerationModelImpl instance) => + { + 'product_nutritional_value': instance.glossary, + }; _$GlossaryModelImpl _$$GlossaryModelImplFromJson(Map json) => _$GlossaryModelImpl( diff --git a/lib/features/glossary/presentation/pages/glossary_screen.dart b/lib/features/glossary/presentation/pages/glossary_screen.dart index 97d59810..7205b3d3 100644 --- a/lib/features/glossary/presentation/pages/glossary_screen.dart +++ b/lib/features/glossary/presentation/pages/glossary_screen.dart @@ -18,14 +18,14 @@ class _GlossaryScreenState extends State { _controller = WebViewController() ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..loadRequest(Uri.parse(baseUrl + '/product_nutritional_value')); + ..loadRequest(Uri.parse('$baseUrl/product_nutritional_value')); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Глоссарий'), + title: const Text('Глоссарий'), ), body: WebViewWidget(controller: _controller), ); diff --git a/lib/features/internet_connection_checker/internet_connection_checker_screen.dart b/lib/features/internet_connection_checker/internet_connection_checker_screen.dart index 4256518e..a8e65420 100644 --- a/lib/features/internet_connection_checker/internet_connection_checker_screen.dart +++ b/lib/features/internet_connection_checker/internet_connection_checker_screen.dart @@ -1,7 +1,5 @@ import 'dart:async'; import 'dart:developer'; -import 'dart:io'; - import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:easy_debounce/easy_debounce.dart'; import 'package:eatvio_app/core/theme/custom_text_style.dart'; @@ -66,29 +64,22 @@ class _InternetConnectionCheckerScreenState extends State= 100 && response.statusCode < 600; - } on SocketException catch (_) { - return false; - } on TimeoutException catch (_) { - return false; - } on HandshakeException catch (_) { - return false; - } on CertificateException catch (_) { - return false; - } on http.ClientException catch (_) { - return false; - } catch (e, st) { - log(e.toString(), stackTrace: st); - return false; + final uris = [ + Uri.parse('https://google.com'), + Uri.parse('https://yandex.ru'), + Uri.parse('https://dev2.eatvqqwewqeio.com'), + Uri.parse('https://eatvio.ru'), + ]; + for (final uri in uris) { + try { + final response = await http.get(uri).timeout(const Duration(seconds: 3)); + return response.statusCode >= 100 && response.statusCode < 600; + } catch (e) { + continue; + } } + return false; } @override @@ -108,7 +99,7 @@ class _InternetConnectionCheckerScreenState extends State CupertinoAlertDialog( - title: Text("Выход"), - actions: [ - CupertinoDialogAction( - onPressed: () async { - try { - await sl().post(baseUrl + '/api/profile/logout'); - } catch (e) { - } finally { - await TokenStorage.removeTokenInStorage(); - GoRouter.of(context).go('/auth-screen', extra: true); - } - }, - child: Text("Выйти"), - isDestructiveAction: true, - ), - CupertinoDialogAction( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text("Отмена"), - ), - ], - content: Text("Вы уверены что хотите выйти из аккаунта?"), + builder: (context) => CupertinoAlertDialog( + title: const Text("Выход"), + actions: [ + CupertinoDialogAction( + onPressed: () async { + try { + await sl().post('$baseUrl/api/profile/logout'); + } finally { + await TokenStorage.removeTokenInStorage(); + if (context.mounted) { + GoRouter.of(context).go('/auth-screen', extra: true); + } + } + }, + isDestructiveAction: true, + child: const Text("Выйти"), ), + CupertinoDialogAction( + onPressed: () { + Navigator.of(context).pop(); + }, + child: const Text("Отмена"), + ), + ], + content: const Text("Вы уверены что хотите выйти из аккаунта?"), + ), ); }; } diff --git a/lib/features/my_diets/presentation/cubit/my_diets_cubit.dart b/lib/features/my_diets/presentation/cubit/my_diets_cubit.dart index 73f3459a..8a93ec17 100644 --- a/lib/features/my_diets/presentation/cubit/my_diets_cubit.dart +++ b/lib/features/my_diets/presentation/cubit/my_diets_cubit.dart @@ -47,7 +47,7 @@ class MyDietsCubit extends Cubit { emit(state.copyWith(activeFilterState: state.activeFilterState.copyWith(typeIndex: index), error: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _activeQuery, ), @@ -56,7 +56,7 @@ class MyDietsCubit extends Cubit { emit(state.copyWith(draftFilterState: state.draftFilterState.copyWith(typeIndex: index), error: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _draftQuery, ), @@ -65,7 +65,7 @@ class MyDietsCubit extends Cubit { emit(state.copyWith(personalFilterState: state.personalFilterState.copyWith(typeIndex: index), error: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _personalQuery, ), @@ -78,7 +78,7 @@ class MyDietsCubit extends Cubit { emit(state.copyWith(activeFilterState: state.activeFilterState.copyWith(sortingIndex: index), error: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _activeQuery, ), @@ -87,7 +87,7 @@ class MyDietsCubit extends Cubit { emit(state.copyWith(draftFilterState: state.draftFilterState.copyWith(sortingIndex: index), error: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _draftQuery, ), @@ -96,7 +96,7 @@ class MyDietsCubit extends Cubit { emit(state.copyWith(personalFilterState: state.personalFilterState.copyWith(sortingIndex: index), error: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _personalQuery, ), @@ -109,7 +109,7 @@ class MyDietsCubit extends Cubit { emit(state.copyWith(activeFilterState: state.activeFilterState.copyWith(durationIndex: index), error: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _activeQuery, ), @@ -118,7 +118,7 @@ class MyDietsCubit extends Cubit { emit(state.copyWith(draftFilterState: state.draftFilterState.copyWith(durationIndex: index), error: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _draftQuery, ), @@ -127,7 +127,7 @@ class MyDietsCubit extends Cubit { emit(state.copyWith(personalFilterState: state.personalFilterState.copyWith(durationIndex: index), error: null)); EasyDebounce.debounce( 'loadDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _personalQuery, ), @@ -140,7 +140,7 @@ class MyDietsCubit extends Cubit { if (state.activeDiets.isEmpty) { EasyDebounce.debounce( 'loadActiveDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _activeQuery, ), @@ -148,7 +148,7 @@ class MyDietsCubit extends Cubit { } else if (state.draftDiets.isEmpty) { EasyDebounce.debounce( 'loadDraftDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _draftQuery, ), @@ -156,7 +156,7 @@ class MyDietsCubit extends Cubit { } else if (state.personalDiets.isEmpty) { EasyDebounce.debounce( 'loadPersonalDiets', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadCurrentDiets( query: _personalQuery, ), @@ -194,7 +194,7 @@ class MyDietsCubit extends Cubit { final type = _types[state.activeFilterState.typeIndex]; final duration = _durationValues[state.activeFilterState.durationIndex]; final sorting = _sortingValues[state.activeFilterState.sortingIndex]; - final dietState = DietState.active; + const dietState = DietState.active; final dietsPagination = await myDietsRepository.getDiets( query: query, types: type, @@ -225,7 +225,7 @@ class MyDietsCubit extends Cubit { final type = _types[state.draftFilterState.typeIndex]; final duration = _durationValues[state.draftFilterState.durationIndex]; final sorting = _sortingValues[state.draftFilterState.sortingIndex]; - final dietState = DietState.draft; + const dietState = DietState.draft; final dietsPagination = await myDietsRepository.getDiets( query: query, types: type, @@ -255,7 +255,7 @@ class MyDietsCubit extends Cubit { final type = _types[state.personalFilterState.typeIndex]; final duration = _durationValues[state.personalFilterState.durationIndex]; final sorting = _sortingValues[state.personalFilterState.sortingIndex]; - final dietState = DietState.personal; + const dietState = DietState.personal; final dietsPagination = await myDietsRepository.getDiets( query: query, types: type, 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 b4cf5492..3a8e9a3b 100644 --- a/lib/features/my_diets/presentation/cubit/my_diets_state.dart +++ b/lib/features/my_diets/presentation/cubit/my_diets_state.dart @@ -17,7 +17,7 @@ class MyDietsState with _$MyDietsState { @Default(null) String? error, @Default(0) int selectedStateIndex, @Default( - const DietsFilterState( + DietsFilterState( durationIndex: 0, sortingIndex: 0, typeIndex: 0, @@ -25,7 +25,7 @@ class MyDietsState with _$MyDietsState { ) DietsFilterState activeFilterState, @Default( - const DietsFilterState( + DietsFilterState( durationIndex: 0, sortingIndex: 0, typeIndex: 0, @@ -33,7 +33,7 @@ class MyDietsState with _$MyDietsState { ) DietsFilterState draftFilterState, @Default( - const DietsFilterState( + DietsFilterState( durationIndex: 0, sortingIndex: 0, typeIndex: 0, diff --git a/lib/features/my_diets/presentation/cubit/my_diets_state.freezed.dart b/lib/features/my_diets/presentation/cubit/my_diets_state.freezed.dart index c4de0cdf..91782100 100644 --- a/lib/features/my_diets/presentation/cubit/my_diets_state.freezed.dart +++ b/lib/features/my_diets/presentation/cubit/my_diets_state.freezed.dart @@ -12,8 +12,7 @@ part of 'my_diets_state.dart'; 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', -); + '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'); /// @nodoc mixin _$MyDietsState { @@ -41,24 +40,22 @@ mixin _$MyDietsState { /// @nodoc abstract class $MyDietsStateCopyWith<$Res> { factory $MyDietsStateCopyWith( - MyDietsState value, - $Res Function(MyDietsState) then, - ) = _$MyDietsStateCopyWithImpl<$Res, MyDietsState>; + MyDietsState value, $Res Function(MyDietsState) then) = + _$MyDietsStateCopyWithImpl<$Res, MyDietsState>; @useResult - $Res call({ - List activeDiets, - List draftDiets, - List personalDiets, - bool isLoading, - String? activeDietsError, - String? draftDietsError, - String? personalDietsError, - String? error, - int selectedStateIndex, - DietsFilterState activeFilterState, - DietsFilterState draftFilterState, - DietsFilterState personalFilterState, - }); + $Res call( + {List activeDiets, + List draftDiets, + List personalDiets, + bool isLoading, + String? activeDietsError, + String? draftDietsError, + String? personalDietsError, + String? error, + int selectedStateIndex, + DietsFilterState activeFilterState, + DietsFilterState draftFilterState, + DietsFilterState personalFilterState}); $DietsFilterStateCopyWith<$Res> get activeFilterState; $DietsFilterStateCopyWith<$Res> get draftFilterState; @@ -93,71 +90,56 @@ class _$MyDietsStateCopyWithImpl<$Res, $Val extends MyDietsState> Object? draftFilterState = null, Object? personalFilterState = null, }) { - return _then( - _value.copyWith( - activeDiets: - null == activeDiets - ? _value.activeDiets - : activeDiets // ignore: cast_nullable_to_non_nullable - as List, - draftDiets: - null == draftDiets - ? _value.draftDiets - : draftDiets // ignore: cast_nullable_to_non_nullable - as List, - personalDiets: - null == personalDiets - ? _value.personalDiets - : personalDiets // ignore: cast_nullable_to_non_nullable - as List, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - activeDietsError: - freezed == activeDietsError - ? _value.activeDietsError - : activeDietsError // ignore: cast_nullable_to_non_nullable - as String?, - draftDietsError: - freezed == draftDietsError - ? _value.draftDietsError - : draftDietsError // ignore: cast_nullable_to_non_nullable - as String?, - personalDietsError: - freezed == personalDietsError - ? _value.personalDietsError - : personalDietsError // ignore: cast_nullable_to_non_nullable - as String?, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - selectedStateIndex: - null == selectedStateIndex - ? _value.selectedStateIndex - : selectedStateIndex // ignore: cast_nullable_to_non_nullable - as int, - activeFilterState: - null == activeFilterState - ? _value.activeFilterState - : activeFilterState // ignore: cast_nullable_to_non_nullable - as DietsFilterState, - draftFilterState: - null == draftFilterState - ? _value.draftFilterState - : draftFilterState // ignore: cast_nullable_to_non_nullable - as DietsFilterState, - personalFilterState: - null == personalFilterState - ? _value.personalFilterState - : personalFilterState // ignore: cast_nullable_to_non_nullable - as DietsFilterState, - ) - as $Val, - ); + return _then(_value.copyWith( + activeDiets: null == activeDiets + ? _value.activeDiets + : activeDiets // ignore: cast_nullable_to_non_nullable + as List, + draftDiets: null == draftDiets + ? _value.draftDiets + : draftDiets // ignore: cast_nullable_to_non_nullable + as List, + personalDiets: null == personalDiets + ? _value.personalDiets + : personalDiets // ignore: cast_nullable_to_non_nullable + as List, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + activeDietsError: freezed == activeDietsError + ? _value.activeDietsError + : activeDietsError // ignore: cast_nullable_to_non_nullable + as String?, + draftDietsError: freezed == draftDietsError + ? _value.draftDietsError + : draftDietsError // ignore: cast_nullable_to_non_nullable + as String?, + personalDietsError: freezed == personalDietsError + ? _value.personalDietsError + : personalDietsError // ignore: cast_nullable_to_non_nullable + as String?, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + selectedStateIndex: null == selectedStateIndex + ? _value.selectedStateIndex + : selectedStateIndex // ignore: cast_nullable_to_non_nullable + as int, + activeFilterState: null == activeFilterState + ? _value.activeFilterState + : activeFilterState // ignore: cast_nullable_to_non_nullable + as DietsFilterState, + draftFilterState: null == draftFilterState + ? _value.draftFilterState + : draftFilterState // ignore: cast_nullable_to_non_nullable + as DietsFilterState, + personalFilterState: null == personalFilterState + ? _value.personalFilterState + : personalFilterState // ignore: cast_nullable_to_non_nullable + as DietsFilterState, + ) as $Val); } /// Create a copy of MyDietsState @@ -195,25 +177,23 @@ class _$MyDietsStateCopyWithImpl<$Res, $Val extends MyDietsState> abstract class _$$MyDietsStateImplCopyWith<$Res> implements $MyDietsStateCopyWith<$Res> { factory _$$MyDietsStateImplCopyWith( - _$MyDietsStateImpl value, - $Res Function(_$MyDietsStateImpl) then, - ) = __$$MyDietsStateImplCopyWithImpl<$Res>; + _$MyDietsStateImpl value, $Res Function(_$MyDietsStateImpl) then) = + __$$MyDietsStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - List activeDiets, - List draftDiets, - List personalDiets, - bool isLoading, - String? activeDietsError, - String? draftDietsError, - String? personalDietsError, - String? error, - int selectedStateIndex, - DietsFilterState activeFilterState, - DietsFilterState draftFilterState, - DietsFilterState personalFilterState, - }); + $Res call( + {List activeDiets, + List draftDiets, + List personalDiets, + bool isLoading, + String? activeDietsError, + String? draftDietsError, + String? personalDietsError, + String? error, + int selectedStateIndex, + DietsFilterState activeFilterState, + DietsFilterState draftFilterState, + DietsFilterState personalFilterState}); @override $DietsFilterStateCopyWith<$Res> get activeFilterState; @@ -228,9 +208,8 @@ class __$$MyDietsStateImplCopyWithImpl<$Res> extends _$MyDietsStateCopyWithImpl<$Res, _$MyDietsStateImpl> implements _$$MyDietsStateImplCopyWith<$Res> { __$$MyDietsStateImplCopyWithImpl( - _$MyDietsStateImpl _value, - $Res Function(_$MyDietsStateImpl) _then, - ) : super(_value, _then); + _$MyDietsStateImpl _value, $Res Function(_$MyDietsStateImpl) _then) + : super(_value, _then); /// Create a copy of MyDietsState /// with the given fields replaced by the non-null parameter values. @@ -250,104 +229,81 @@ class __$$MyDietsStateImplCopyWithImpl<$Res> Object? draftFilterState = null, Object? personalFilterState = null, }) { - return _then( - _$MyDietsStateImpl( - activeDiets: - null == activeDiets - ? _value._activeDiets - : activeDiets // ignore: cast_nullable_to_non_nullable - as List, - draftDiets: - null == draftDiets - ? _value._draftDiets - : draftDiets // ignore: cast_nullable_to_non_nullable - as List, - personalDiets: - null == personalDiets - ? _value._personalDiets - : personalDiets // ignore: cast_nullable_to_non_nullable - as List, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - activeDietsError: - freezed == activeDietsError - ? _value.activeDietsError - : activeDietsError // ignore: cast_nullable_to_non_nullable - as String?, - draftDietsError: - freezed == draftDietsError - ? _value.draftDietsError - : draftDietsError // ignore: cast_nullable_to_non_nullable - as String?, - personalDietsError: - freezed == personalDietsError - ? _value.personalDietsError - : personalDietsError // ignore: cast_nullable_to_non_nullable - as String?, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - selectedStateIndex: - null == selectedStateIndex - ? _value.selectedStateIndex - : selectedStateIndex // ignore: cast_nullable_to_non_nullable - as int, - activeFilterState: - null == activeFilterState - ? _value.activeFilterState - : activeFilterState // ignore: cast_nullable_to_non_nullable - as DietsFilterState, - draftFilterState: - null == draftFilterState - ? _value.draftFilterState - : draftFilterState // ignore: cast_nullable_to_non_nullable - as DietsFilterState, - personalFilterState: - null == personalFilterState - ? _value.personalFilterState - : personalFilterState // ignore: cast_nullable_to_non_nullable - as DietsFilterState, - ), - ); + return _then(_$MyDietsStateImpl( + activeDiets: null == activeDiets + ? _value._activeDiets + : activeDiets // ignore: cast_nullable_to_non_nullable + as List, + draftDiets: null == draftDiets + ? _value._draftDiets + : draftDiets // ignore: cast_nullable_to_non_nullable + as List, + personalDiets: null == personalDiets + ? _value._personalDiets + : personalDiets // ignore: cast_nullable_to_non_nullable + as List, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + activeDietsError: freezed == activeDietsError + ? _value.activeDietsError + : activeDietsError // ignore: cast_nullable_to_non_nullable + as String?, + draftDietsError: freezed == draftDietsError + ? _value.draftDietsError + : draftDietsError // ignore: cast_nullable_to_non_nullable + as String?, + personalDietsError: freezed == personalDietsError + ? _value.personalDietsError + : personalDietsError // ignore: cast_nullable_to_non_nullable + as String?, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + selectedStateIndex: null == selectedStateIndex + ? _value.selectedStateIndex + : selectedStateIndex // ignore: cast_nullable_to_non_nullable + as int, + activeFilterState: null == activeFilterState + ? _value.activeFilterState + : activeFilterState // ignore: cast_nullable_to_non_nullable + as DietsFilterState, + draftFilterState: null == draftFilterState + ? _value.draftFilterState + : draftFilterState // ignore: cast_nullable_to_non_nullable + as DietsFilterState, + personalFilterState: null == personalFilterState + ? _value.personalFilterState + : personalFilterState // ignore: cast_nullable_to_non_nullable + as DietsFilterState, + )); } } /// @nodoc class _$MyDietsStateImpl implements _MyDietsState { - _$MyDietsStateImpl({ - final List activeDiets = const [], - final List draftDiets = const [], - final List personalDiets = const [], - this.isLoading = false, - this.activeDietsError = null, - this.draftDietsError = null, - this.personalDietsError = null, - this.error = null, - this.selectedStateIndex = 0, - this.activeFilterState = const DietsFilterState( - durationIndex: 0, - sortingIndex: 0, - typeIndex: 0, - ), - this.draftFilterState = const DietsFilterState( - durationIndex: 0, - sortingIndex: 0, - typeIndex: 0, - ), - this.personalFilterState = const DietsFilterState( - durationIndex: 0, - sortingIndex: 0, - typeIndex: 0, - ), - }) : _activeDiets = activeDiets, - _draftDiets = draftDiets, - _personalDiets = personalDiets; + _$MyDietsStateImpl( + {final List activeDiets = const [], + final List draftDiets = const [], + final List personalDiets = const [], + this.isLoading = false, + this.activeDietsError = null, + this.draftDietsError = null, + this.personalDietsError = null, + this.error = null, + this.selectedStateIndex = 0, + this.activeFilterState = const DietsFilterState( + durationIndex: 0, sortingIndex: 0, typeIndex: 0), + this.draftFilterState = const DietsFilterState( + durationIndex: 0, sortingIndex: 0, typeIndex: 0), + this.personalFilterState = const DietsFilterState( + durationIndex: 0, sortingIndex: 0, typeIndex: 0)}) + : _activeDiets = activeDiets, + _draftDiets = draftDiets, + _personalDiets = personalDiets; final List _activeDiets; @override @@ -414,18 +370,12 @@ class _$MyDietsStateImpl implements _MyDietsState { return identical(this, other) || (other.runtimeType == runtimeType && other is _$MyDietsStateImpl && - const DeepCollectionEquality().equals( - other._activeDiets, - _activeDiets, - ) && - const DeepCollectionEquality().equals( - other._draftDiets, - _draftDiets, - ) && - const DeepCollectionEquality().equals( - other._personalDiets, - _personalDiets, - ) && + const DeepCollectionEquality() + .equals(other._activeDiets, _activeDiets) && + const DeepCollectionEquality() + .equals(other._draftDiets, _draftDiets) && + const DeepCollectionEquality() + .equals(other._personalDiets, _personalDiets) && (identical(other.isLoading, isLoading) || other.isLoading == isLoading) && (identical(other.activeDietsError, activeDietsError) || @@ -447,20 +397,19 @@ class _$MyDietsStateImpl implements _MyDietsState { @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_activeDiets), - const DeepCollectionEquality().hash(_draftDiets), - const DeepCollectionEquality().hash(_personalDiets), - isLoading, - activeDietsError, - draftDietsError, - personalDietsError, - error, - selectedStateIndex, - activeFilterState, - draftFilterState, - personalFilterState, - ); + runtimeType, + const DeepCollectionEquality().hash(_activeDiets), + const DeepCollectionEquality().hash(_draftDiets), + const DeepCollectionEquality().hash(_personalDiets), + isLoading, + activeDietsError, + draftDietsError, + personalDietsError, + error, + selectedStateIndex, + activeFilterState, + draftFilterState, + personalFilterState); /// Create a copy of MyDietsState /// with the given fields replaced by the non-null parameter values. @@ -472,20 +421,19 @@ class _$MyDietsStateImpl implements _MyDietsState { } abstract class _MyDietsState implements MyDietsState { - factory _MyDietsState({ - final List activeDiets, - final List draftDiets, - final List personalDiets, - final bool isLoading, - final String? activeDietsError, - final String? draftDietsError, - final String? personalDietsError, - final String? error, - final int selectedStateIndex, - final DietsFilterState activeFilterState, - final DietsFilterState draftFilterState, - final DietsFilterState personalFilterState, - }) = _$MyDietsStateImpl; + factory _MyDietsState( + {final List activeDiets, + final List draftDiets, + final List personalDiets, + final bool isLoading, + final String? activeDietsError, + final String? draftDietsError, + final String? personalDietsError, + final String? error, + final int selectedStateIndex, + final DietsFilterState activeFilterState, + final DietsFilterState draftFilterState, + final DietsFilterState personalFilterState}) = _$MyDietsStateImpl; @override List get activeDiets; diff --git a/lib/features/my_diets/presentation/my_diets_screen.dart b/lib/features/my_diets/presentation/my_diets_screen.dart index 36fe1d31..59c9dd09 100644 --- a/lib/features/my_diets/presentation/my_diets_screen.dart +++ b/lib/features/my_diets/presentation/my_diets_screen.dart @@ -67,7 +67,7 @@ class MyDietsScreenContent extends StatelessWidget { headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ SliverAppBar( - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(bottom: Radius.circular(12)), ), backgroundColor: appTheme.gray100, @@ -88,15 +88,15 @@ class MyDietsScreenContent extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4), + const SizedBox(height: 8), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 4), child: MyDietsTab(), ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( children: [ - SizedBox(width: 4), + const SizedBox(width: 4), Expanded( child: CustomSearchBar( enableIcon: false, @@ -110,7 +110,7 @@ class MyDietsScreenContent extends StatelessWidget { onChanged: (query) { EasyDebounce.debounce( 'searchDiets', - Duration(milliseconds: 500), + const Duration(milliseconds: 500), () { context.read().loadCurrentDiets(query: query == '' ? null : query); }, @@ -118,14 +118,14 @@ class MyDietsScreenContent extends StatelessWidget { }, ), ), - SizedBox(width: 12), + const SizedBox(width: 12), AddItemButton( onTap: () => GoRouter.of(context).pushNamed(CreateDietScreen.name), ), - SizedBox(width: 4), + const SizedBox(width: 4), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ), @@ -154,7 +154,7 @@ class MyDietsScreenContent extends StatelessWidget { } if (state.isLoading) { - return Loader(); + return const Loader(); } final diets = switch (state.selectedStateIndex) { @@ -165,10 +165,10 @@ class MyDietsScreenContent extends StatelessWidget { return Stack( children: [ - SizedBox.expand(), + const SizedBox.expand(), ListView.separated( shrinkWrap: true, - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemBuilder: (context, index) { return MyDietWidget( diet: diets[index], @@ -176,7 +176,7 @@ class MyDietsScreenContent extends StatelessWidget { ); }, separatorBuilder: (context, index) { - return SizedBox(height: 20); + return const SizedBox(height: 20); }, itemCount: diets.length, ), diff --git a/lib/features/my_diets/presentation/widgets/diet_deleted_bottom_sheet.dart b/lib/features/my_diets/presentation/widgets/diet_deleted_bottom_sheet.dart index e9561def..46fb0a57 100644 --- a/lib/features/my_diets/presentation/widgets/diet_deleted_bottom_sheet.dart +++ b/lib/features/my_diets/presentation/widgets/diet_deleted_bottom_sheet.dart @@ -15,11 +15,11 @@ class DietDeletedBottomSheet extends StatelessWidget { final s = S.of(context); return Column( children: [ - SizedBox( + const SizedBox( height: 20, ), - BottomSheetHandlerBar(), - SizedBox( + const BottomSheetHandlerBar(), + const SizedBox( height: 20, ), Text( @@ -30,7 +30,7 @@ class DietDeletedBottomSheet extends StatelessWidget { s.deleted, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox( + const SizedBox( height: 20, ), Padding( @@ -43,12 +43,12 @@ class DietDeletedBottomSheet extends StatelessWidget { height: 52, buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), ), ), - SizedBox( + const SizedBox( height: 20, ), ], diff --git a/lib/features/my_diets/presentation/widgets/diet_drafetd_bottom_sheet.dart b/lib/features/my_diets/presentation/widgets/diet_drafetd_bottom_sheet.dart index 4bcffd1c..a1bd11b3 100644 --- a/lib/features/my_diets/presentation/widgets/diet_drafetd_bottom_sheet.dart +++ b/lib/features/my_diets/presentation/widgets/diet_drafetd_bottom_sheet.dart @@ -16,11 +16,11 @@ class DietDraftedBottomSheet extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox( + const SizedBox( height: 20, ), - BottomSheetHandlerBar(), - SizedBox( + const BottomSheetHandlerBar(), + const SizedBox( height: 20, ), Text( @@ -32,7 +32,7 @@ class DietDraftedBottomSheet extends StatelessWidget { textAlign: TextAlign.center, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox( + const SizedBox( height: 20, ), Padding( @@ -45,12 +45,12 @@ class DietDraftedBottomSheet extends StatelessWidget { height: 52, buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), ), ), - SizedBox( + const SizedBox( height: 20, ), ], 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 ec36cc6b..e2a687fb 100644 --- a/lib/features/my_diets/presentation/widgets/my_diet_widget.dart +++ b/lib/features/my_diets/presentation/widgets/my_diet_widget.dart @@ -51,9 +51,9 @@ class _MyDietWidgetState extends State { InkWell( onTap: () => GoRouter.of(context).pushNamed('aboutDietScreen', extra: {'diet': widget.diet, 'navigateToComments': false}), child: ClipRRect( - borderRadius: BorderRadius.vertical(top: Radius.circular(12)), + borderRadius: const BorderRadius.vertical(top: Radius.circular(12)), child: CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + widget.diet.image, + imageUrl: '$baseUrl/storage/${widget.diet.image}', fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width, ), @@ -68,7 +68,7 @@ class _MyDietWidgetState extends State { ), ], ), - SizedBox(height: 12), + const SizedBox(height: 12), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -80,13 +80,13 @@ class _MyDietWidgetState extends State { ), ), if (widget.diet.details.isNotEmpty) ...[ - SizedBox( + const SizedBox( height: 12, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Html( - data: widget.diet.details.length > 200 ? widget.diet.details.substring(0, 200) + '...' : widget.diet.details, + data: widget.diet.details.length > 200 ? '${widget.diet.details.substring(0, 200)}...' : widget.diet.details, style: { "*": Style( margin: Margins.zero, @@ -100,7 +100,7 @@ class _MyDietWidgetState extends State { ], ], ), - SizedBox(height: 20), + const SizedBox(height: 20), BlocBuilder( builder: (context, state) { return Padding( @@ -115,9 +115,10 @@ class _MyDietWidgetState extends State { if (state.selectedStateIndex == 1) { final result = await context.read().publishDiet(widget.diet.id); if (result) { + if (!context.mounted) return; showBottomSheetWithBlur( context: context, - child: SuccessPublishedDietBottomSheet(title: '${widget.diet.name}'), + child: SuccessPublishedDietBottomSheet(title: widget.diet.name), ); await context.read().loadAllDiets(); } else { @@ -138,18 +139,18 @@ class _MyDietWidgetState extends State { buttonStyle: ButtonStyle( shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(20))), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), ), ), if (state.selectedStateIndex == 0) ...[ - SizedBox(width: 6), + const SizedBox(width: 6), CustomOutlinedButton( onPressed: () async { final box = context.findRenderObject() as RenderBox?; await Share.shareUri( Uri.parse( - baseUrl + '/ru/diet/' + widget.diet.id.toString(), + '$baseUrl/ru/diet/${widget.diet.id}', ), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); @@ -166,14 +167,14 @@ class _MyDietWidgetState extends State { buttonStyle: ButtonStyle( shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(20))), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), text: '', ), ], ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( children: [ Expanded( @@ -182,10 +183,11 @@ class _MyDietWidgetState extends State { if (state.selectedStateIndex == 0) { final result = await context.read().unpublishDiet(widget.diet.id); if (result) { + if (!context.mounted) return; showBottomSheetWithBlur( context: context, height: 250, - child: DietDraftedBottomSheet(title: '${widget.diet.name}'), + child: DietDraftedBottomSheet(title: widget.diet.name), ); await context.read().loadAllDiets(); } else { @@ -204,15 +206,16 @@ class _MyDietWidgetState extends State { buttonStyle: ButtonStyle( shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(20))), backgroundColor: WidgetStatePropertyAll(appTheme.lightGray0), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), ), ), - SizedBox(width: 6), + const SizedBox(width: 6), CustomOutlinedButton( onPressed: () async { final result = await context.read().deleteDiet(widget.diet.id); if (result) { + if (!context.mounted) return; showBottomSheetWithBlur( context: context, child: DietDeletedBottomSheet(title: widget.diet.name), @@ -231,13 +234,13 @@ class _MyDietWidgetState extends State { buttonStyle: ButtonStyle( shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(20))), backgroundColor: WidgetStatePropertyAll(appTheme.lightGray0), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), text: '', ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), ], ), ); diff --git a/lib/features/my_finance/entities/consultant_finance_entity.dart b/lib/features/my_finance/entities/consultant_finance_entity.dart index 48f0eceb..57ab8217 100644 --- a/lib/features/my_finance/entities/consultant_finance_entity.dart +++ b/lib/features/my_finance/entities/consultant_finance_entity.dart @@ -1,7 +1,7 @@ enum ConsultationStatus { - Completed, - Canceled, - CanceledByInitiator, + completed, + canceled, + canceledByInitiator, } class ConsultantFinanceEntity { @@ -49,32 +49,32 @@ final testConsultations = [ clientName: 'Alice', planDuration: 30, price: 100, - status: ConsultationStatus.Completed, + status: ConsultationStatus.completed, ), ConsultationFinanceCardEntity( id: '2', - date: DateTime.now().subtract(Duration(days: 1)), + date: DateTime.now().subtract(const Duration(days: 1)), title: 'Consultation B', clientName: 'Bob', planDuration: 45, price: 150, - status: ConsultationStatus.Canceled, + status: ConsultationStatus.canceled, ), ConsultationFinanceCardEntity( id: '3', - date: DateTime.now().subtract(Duration(days: 2)), + date: DateTime.now().subtract(const Duration(days: 2)), title: 'Consultation C', clientName: 'Charlie', planDuration: 60, price: 200, - status: ConsultationStatus.CanceledByInitiator, + status: ConsultationStatus.canceledByInitiator, ), ]; final testFinanceEntity = ConsultantFinanceEntity( totalConsultationsCount: testConsultations.length, - completedCount: testConsultations.where((c) => c.status == ConsultationStatus.Completed).length, - canceledCount: testConsultations.where((c) => c.status == ConsultationStatus.Canceled).length, - canceledByInitiatorCount: testConsultations.where((c) => c.status == ConsultationStatus.CanceledByInitiator).length, + completedCount: testConsultations.where((c) => c.status == ConsultationStatus.completed).length, + canceledCount: testConsultations.where((c) => c.status == ConsultationStatus.canceled).length, + canceledByInitiatorCount: testConsultations.where((c) => c.status == ConsultationStatus.canceledByInitiator).length, consultationsList: testConsultations, ); diff --git a/lib/features/my_finance/models/card_model.freezed.dart b/lib/features/my_finance/models/card_model.freezed.dart index 81179841..5beaba32 100644 --- a/lib/features/my_finance/models/card_model.freezed.dart +++ b/lib/features/my_finance/models/card_model.freezed.dart @@ -12,8 +12,7 @@ part of 'card_model.dart'; 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', -); + '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'); CardModel _$CardModelFromJson(Map json) { return _CardModel.fromJson(json); @@ -42,11 +41,10 @@ abstract class $CardModelCopyWith<$Res> { factory $CardModelCopyWith(CardModel value, $Res Function(CardModel) then) = _$CardModelCopyWithImpl<$Res, CardModel>; @useResult - $Res call({ - int id, - @JsonKey(name: 'bank_pan') String cardNumber, - @JsonKey(name: 'is_default', fromJson: parseBool) bool isDefault, - }); + $Res call( + {int id, + @JsonKey(name: 'bank_pan') String cardNumber, + @JsonKey(name: 'is_default', fromJson: parseBool) bool isDefault}); } /// @nodoc @@ -68,26 +66,20 @@ class _$CardModelCopyWithImpl<$Res, $Val extends CardModel> Object? cardNumber = null, Object? isDefault = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - cardNumber: - null == cardNumber - ? _value.cardNumber - : cardNumber // ignore: cast_nullable_to_non_nullable - as String, - isDefault: - null == isDefault - ? _value.isDefault - : isDefault // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + cardNumber: null == cardNumber + ? _value.cardNumber + : cardNumber // ignore: cast_nullable_to_non_nullable + as String, + isDefault: null == isDefault + ? _value.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } } @@ -95,16 +87,14 @@ class _$CardModelCopyWithImpl<$Res, $Val extends CardModel> abstract class _$$CardModelImplCopyWith<$Res> implements $CardModelCopyWith<$Res> { factory _$$CardModelImplCopyWith( - _$CardModelImpl value, - $Res Function(_$CardModelImpl) then, - ) = __$$CardModelImplCopyWithImpl<$Res>; + _$CardModelImpl value, $Res Function(_$CardModelImpl) then) = + __$$CardModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - int id, - @JsonKey(name: 'bank_pan') String cardNumber, - @JsonKey(name: 'is_default', fromJson: parseBool) bool isDefault, - }); + $Res call( + {int id, + @JsonKey(name: 'bank_pan') String cardNumber, + @JsonKey(name: 'is_default', fromJson: parseBool) bool isDefault}); } /// @nodoc @@ -112,9 +102,8 @@ class __$$CardModelImplCopyWithImpl<$Res> extends _$CardModelCopyWithImpl<$Res, _$CardModelImpl> implements _$$CardModelImplCopyWith<$Res> { __$$CardModelImplCopyWithImpl( - _$CardModelImpl _value, - $Res Function(_$CardModelImpl) _then, - ) : super(_value, _then); + _$CardModelImpl _value, $Res Function(_$CardModelImpl) _then) + : super(_value, _then); /// Create a copy of CardModel /// with the given fields replaced by the non-null parameter values. @@ -125,36 +114,31 @@ class __$$CardModelImplCopyWithImpl<$Res> Object? cardNumber = null, Object? isDefault = null, }) { - return _then( - _$CardModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - cardNumber: - null == cardNumber - ? _value.cardNumber - : cardNumber // ignore: cast_nullable_to_non_nullable - as String, - isDefault: - null == isDefault - ? _value.isDefault - : isDefault // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + return _then(_$CardModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + cardNumber: null == cardNumber + ? _value.cardNumber + : cardNumber // ignore: cast_nullable_to_non_nullable + as String, + isDefault: null == isDefault + ? _value.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc @JsonSerializable() class _$CardModelImpl implements _CardModel { - _$CardModelImpl({ - required this.id, - @JsonKey(name: 'bank_pan') required this.cardNumber, - @JsonKey(name: 'is_default', fromJson: parseBool) required this.isDefault, - }); + _$CardModelImpl( + {required this.id, + @JsonKey(name: 'bank_pan') required this.cardNumber, + @JsonKey(name: 'is_default', fromJson: parseBool) + required this.isDefault}); factory _$CardModelImpl.fromJson(Map json) => _$$CardModelImplFromJson(json); @@ -199,17 +183,18 @@ class _$CardModelImpl implements _CardModel { @override Map toJson() { - return _$$CardModelImplToJson(this); + return _$$CardModelImplToJson( + this, + ); } } abstract class _CardModel implements CardModel { - factory _CardModel({ - required final int id, - @JsonKey(name: 'bank_pan') required final String cardNumber, - @JsonKey(name: 'is_default', fromJson: parseBool) - required final bool isDefault, - }) = _$CardModelImpl; + factory _CardModel( + {required final int id, + @JsonKey(name: 'bank_pan') required final String cardNumber, + @JsonKey(name: 'is_default', fromJson: parseBool) + required final bool isDefault}) = _$CardModelImpl; factory _CardModel.fromJson(Map json) = _$CardModelImpl.fromJson; diff --git a/lib/features/my_finance/models/payment_url_model.freezed.dart b/lib/features/my_finance/models/payment_url_model.freezed.dart index 2200800c..53d04d93 100644 --- a/lib/features/my_finance/models/payment_url_model.freezed.dart +++ b/lib/features/my_finance/models/payment_url_model.freezed.dart @@ -12,8 +12,7 @@ part of 'payment_url_model.dart'; 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', -); + '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'); PaymentUrlModel _$PaymentUrlModelFromJson(Map json) { return _PaymentUrlModel.fromJson(json); @@ -36,9 +35,8 @@ mixin _$PaymentUrlModel { /// @nodoc abstract class $PaymentUrlModelCopyWith<$Res> { factory $PaymentUrlModelCopyWith( - PaymentUrlModel value, - $Res Function(PaymentUrlModel) then, - ) = _$PaymentUrlModelCopyWithImpl<$Res, PaymentUrlModel>; + PaymentUrlModel value, $Res Function(PaymentUrlModel) then) = + _$PaymentUrlModelCopyWithImpl<$Res, PaymentUrlModel>; @useResult $Res call({String paymentUrl}); } @@ -57,27 +55,24 @@ class _$PaymentUrlModelCopyWithImpl<$Res, $Val extends PaymentUrlModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? paymentUrl = null}) { - return _then( - _value.copyWith( - paymentUrl: - null == paymentUrl - ? _value.paymentUrl - : paymentUrl // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? paymentUrl = null, + }) { + return _then(_value.copyWith( + paymentUrl: null == paymentUrl + ? _value.paymentUrl + : paymentUrl // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } /// @nodoc abstract class _$$PaymentUrlModelImplCopyWith<$Res> implements $PaymentUrlModelCopyWith<$Res> { - factory _$$PaymentUrlModelImplCopyWith( - _$PaymentUrlModelImpl value, - $Res Function(_$PaymentUrlModelImpl) then, - ) = __$$PaymentUrlModelImplCopyWithImpl<$Res>; + factory _$$PaymentUrlModelImplCopyWith(_$PaymentUrlModelImpl value, + $Res Function(_$PaymentUrlModelImpl) then) = + __$$PaymentUrlModelImplCopyWithImpl<$Res>; @override @useResult $Res call({String paymentUrl}); @@ -88,24 +83,22 @@ class __$$PaymentUrlModelImplCopyWithImpl<$Res> extends _$PaymentUrlModelCopyWithImpl<$Res, _$PaymentUrlModelImpl> implements _$$PaymentUrlModelImplCopyWith<$Res> { __$$PaymentUrlModelImplCopyWithImpl( - _$PaymentUrlModelImpl _value, - $Res Function(_$PaymentUrlModelImpl) _then, - ) : super(_value, _then); + _$PaymentUrlModelImpl _value, $Res Function(_$PaymentUrlModelImpl) _then) + : super(_value, _then); /// Create a copy of PaymentUrlModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? paymentUrl = null}) { - return _then( - _$PaymentUrlModelImpl( - paymentUrl: - null == paymentUrl - ? _value.paymentUrl - : paymentUrl // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? paymentUrl = null, + }) { + return _then(_$PaymentUrlModelImpl( + paymentUrl: null == paymentUrl + ? _value.paymentUrl + : paymentUrl // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -145,13 +138,13 @@ class _$PaymentUrlModelImpl implements _PaymentUrlModel { @pragma('vm:prefer-inline') _$$PaymentUrlModelImplCopyWith<_$PaymentUrlModelImpl> get copyWith => __$$PaymentUrlModelImplCopyWithImpl<_$PaymentUrlModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$PaymentUrlModelImplToJson(this); + return _$$PaymentUrlModelImplToJson( + this, + ); } } diff --git a/lib/features/my_finance/models/payment_url_model.g.dart b/lib/features/my_finance/models/payment_url_model.g.dart index 9bef3b73..c0252b4c 100644 --- a/lib/features/my_finance/models/payment_url_model.g.dart +++ b/lib/features/my_finance/models/payment_url_model.g.dart @@ -7,9 +7,13 @@ part of 'payment_url_model.dart'; // ************************************************************************** _$PaymentUrlModelImpl _$$PaymentUrlModelImplFromJson( - Map json, -) => _$PaymentUrlModelImpl(paymentUrl: json['paymentUrl'] as String); + Map json) => + _$PaymentUrlModelImpl( + paymentUrl: json['paymentUrl'] as String, + ); Map _$$PaymentUrlModelImplToJson( - _$PaymentUrlModelImpl instance, -) => {'paymentUrl': instance.paymentUrl}; + _$PaymentUrlModelImpl instance) => + { + 'paymentUrl': instance.paymentUrl, + }; diff --git a/lib/features/my_finance/presentation/cubit/user_cards_cubit/user_cards_state.freezed.dart b/lib/features/my_finance/presentation/cubit/user_cards_cubit/user_cards_state.freezed.dart index b8b630e9..ceee45f5 100644 --- a/lib/features/my_finance/presentation/cubit/user_cards_cubit/user_cards_state.freezed.dart +++ b/lib/features/my_finance/presentation/cubit/user_cards_cubit/user_cards_state.freezed.dart @@ -12,8 +12,7 @@ part of 'user_cards_state.dart'; 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', -); + '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'); /// @nodoc mixin _$UserCardsState { @@ -31,9 +30,8 @@ mixin _$UserCardsState { /// @nodoc abstract class $UserCardsStateCopyWith<$Res> { factory $UserCardsStateCopyWith( - UserCardsState value, - $Res Function(UserCardsState) then, - ) = _$UserCardsStateCopyWithImpl<$Res, UserCardsState>; + UserCardsState value, $Res Function(UserCardsState) then) = + _$UserCardsStateCopyWithImpl<$Res, UserCardsState>; @useResult $Res call({List cards, String? error, BaseState state}); } @@ -57,36 +55,29 @@ class _$UserCardsStateCopyWithImpl<$Res, $Val extends UserCardsState> Object? error = freezed, Object? state = null, }) { - return _then( - _value.copyWith( - cards: - null == cards - ? _value.cards - : cards // ignore: cast_nullable_to_non_nullable - as List, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as BaseState, - ) - as $Val, - ); + return _then(_value.copyWith( + cards: null == cards + ? _value.cards + : cards // ignore: cast_nullable_to_non_nullable + as List, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as BaseState, + ) as $Val); } } /// @nodoc abstract class _$$UserCardsStateImplCopyWith<$Res> implements $UserCardsStateCopyWith<$Res> { - factory _$$UserCardsStateImplCopyWith( - _$UserCardsStateImpl value, - $Res Function(_$UserCardsStateImpl) then, - ) = __$$UserCardsStateImplCopyWithImpl<$Res>; + factory _$$UserCardsStateImplCopyWith(_$UserCardsStateImpl value, + $Res Function(_$UserCardsStateImpl) then) = + __$$UserCardsStateImplCopyWithImpl<$Res>; @override @useResult $Res call({List cards, String? error, BaseState state}); @@ -97,9 +88,8 @@ class __$$UserCardsStateImplCopyWithImpl<$Res> extends _$UserCardsStateCopyWithImpl<$Res, _$UserCardsStateImpl> implements _$$UserCardsStateImplCopyWith<$Res> { __$$UserCardsStateImplCopyWithImpl( - _$UserCardsStateImpl _value, - $Res Function(_$UserCardsStateImpl) _then, - ) : super(_value, _then); + _$UserCardsStateImpl _value, $Res Function(_$UserCardsStateImpl) _then) + : super(_value, _then); /// Create a copy of UserCardsState /// with the given fields replaced by the non-null parameter values. @@ -110,36 +100,31 @@ class __$$UserCardsStateImplCopyWithImpl<$Res> Object? error = freezed, Object? state = null, }) { - return _then( - _$UserCardsStateImpl( - cards: - null == cards - ? _value._cards - : cards // ignore: cast_nullable_to_non_nullable - as List, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as BaseState, - ), - ); + return _then(_$UserCardsStateImpl( + cards: null == cards + ? _value._cards + : cards // ignore: cast_nullable_to_non_nullable + as List, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as BaseState, + )); } } /// @nodoc class _$UserCardsStateImpl implements _UserCardsState { - _$UserCardsStateImpl({ - final List cards = const [], - this.error = null, - this.state = BaseState.initial, - }) : _cards = cards; + _$UserCardsStateImpl( + {final List cards = const [], + this.error = null, + this.state = BaseState.initial}) + : _cards = cards; final List _cards; @override @@ -174,11 +159,7 @@ class _$UserCardsStateImpl implements _UserCardsState { @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_cards), - error, - state, - ); + runtimeType, const DeepCollectionEquality().hash(_cards), error, state); /// Create a copy of UserCardsState /// with the given fields replaced by the non-null parameter values. @@ -187,17 +168,14 @@ class _$UserCardsStateImpl implements _UserCardsState { @pragma('vm:prefer-inline') _$$UserCardsStateImplCopyWith<_$UserCardsStateImpl> get copyWith => __$$UserCardsStateImplCopyWithImpl<_$UserCardsStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _UserCardsState implements UserCardsState { - factory _UserCardsState({ - final List cards, - final String? error, - final BaseState state, - }) = _$UserCardsStateImpl; + factory _UserCardsState( + {final List cards, + final String? error, + final BaseState state}) = _$UserCardsStateImpl; @override List get cards; diff --git a/lib/features/my_finance/presentation/pages/card_settings.dart b/lib/features/my_finance/presentation/pages/card_settings.dart index 36ef45e9..5d690995 100644 --- a/lib/features/my_finance/presentation/pages/card_settings.dart +++ b/lib/features/my_finance/presentation/pages/card_settings.dart @@ -19,19 +19,19 @@ class CardSettingsScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return BlocProvider(create: (context) => sl()..getCards(), child: CardsSettingsContent()); + return BlocProvider(create: (context) => sl()..getCards(), child: const CardsSettingsContent()); } } class CardsSettingsContent extends StatelessWidget { - CardsSettingsContent({super.key}); + const CardsSettingsContent({super.key}); @override Widget build(BuildContext context) { final s = S.of(context); return Scaffold( - backgroundColor: Color(0xFFF0F2F5), + backgroundColor: const Color(0xFFF0F2F5), appBar: AppBar( - shape: RoundedRectangleBorder(borderRadius: BorderRadius.vertical(bottom: Radius.circular(12))), + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(bottom: Radius.circular(12))), title: Text(s.my_cards), centerTitle: true, ), @@ -45,8 +45,8 @@ class CardsSettingsContent extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ const SizedBox(height: 16), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), child: Text('Привязанные карты', style: TextStyle(color: Color(0xFF323F4B), fontSize: 18, fontWeight: FontWeight.w600, height: 1)), ), const SizedBox(height: 8), @@ -58,7 +58,7 @@ class CardsSettingsContent extends StatelessWidget { if (defaultCardNumber != null) { return Text( 'Выплату будут производиться\nна карту ${defaultCardNumber.substring(defaultCardNumber.length - 7)}', - style: TextStyle(color: Color(0xFF323F4B), fontSize: 16, fontWeight: FontWeight.w500, height: 1), + style: const TextStyle(color: Color(0xFF323F4B), fontSize: 16, fontWeight: FontWeight.w500, height: 1), ); } return Text(s.no_default_cards, style: TextStyles.textMMedium.copyWith(color: appTheme.black)); @@ -84,7 +84,7 @@ class CardsSettingsContent extends StatelessWidget { ); case BaseState.success: return Padding( - padding: EdgeInsets.only(left: 12), + padding: const EdgeInsets.only(left: 12), child: Row( spacing: 12, children: List.generate(state.cards.length + 1, (index) { @@ -92,13 +92,13 @@ class CardsSettingsContent extends StatelessWidget { final cardsNumber = state.cards[index].cardNumber.substring(state.cards[index].cardNumber.length - 7); return CardWidget(isSelected: state.cards[index].isDefault, cardId: state.cards[index].id, cardNumber: cardsNumber); } - return CardWidget(enabledAddCard: true); + return const CardWidget(enabledAddCard: true); }), ), ); default: - return SizedBox(width: MediaQuery.sizeOf(context).width, height: 200, child: Center(child: Loader())); + return SizedBox(width: MediaQuery.sizeOf(context).width, height: 200, child: const Center(child: Loader())); } }, ), diff --git a/lib/features/my_finance/presentation/pages/consultant_finance_screen.dart b/lib/features/my_finance/presentation/pages/consultant_finance_screen.dart index ac0d32f8..39a7cbd7 100644 --- a/lib/features/my_finance/presentation/pages/consultant_finance_screen.dart +++ b/lib/features/my_finance/presentation/pages/consultant_finance_screen.dart @@ -10,14 +10,14 @@ class ConsultantFinanceScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Color(0xFFF0F2F5), + backgroundColor: const Color(0xFFF0F2F5), appBar: AppBar( - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.vertical( bottom: Radius.circular(12), ), ), - title: Text('Архив консультаций'), + title: const Text('Архив консультаций'), centerTitle: true, ), body: SingleChildScrollView( @@ -35,7 +35,7 @@ class ConsultantFinanceScreen extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( 'Всего консультаций: ${testFinanceEntity.totalConsultationsCount}', - style: TextStyle( + style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF6D6F71), @@ -50,13 +50,13 @@ class ConsultantFinanceScreen extends StatelessWidget { child: Row( children: [ Material( - color: Color(0xFF0BB450).withAlpha(11), + color: const Color(0xFF0BB450).withAlpha(11), borderRadius: BorderRadius.circular(8), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), child: Text( 'Завершено: ${testFinanceEntity.completedCount}', - style: TextStyle( + style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFF0BB450), @@ -67,13 +67,13 @@ class ConsultantFinanceScreen extends StatelessWidget { ), const SizedBox(width: 8), Material( - color: Color(0xFFD01717).withAlpha(11), + color: const Color(0xFFD01717).withAlpha(11), borderRadius: BorderRadius.circular(8), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), child: Text( 'Отменено: ${testFinanceEntity.canceledCount}', - style: TextStyle( + style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFFD01717), @@ -84,13 +84,13 @@ class ConsultantFinanceScreen extends StatelessWidget { ), const SizedBox(width: 8), Material( - color: Color(0xFFD07317).withAlpha(11), + color: const Color(0xFFD07317).withAlpha(11), borderRadius: BorderRadius.circular(8), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), child: Text( 'Отменено инициатором: ${testFinanceEntity.canceledByInitiatorCount}', - style: TextStyle( + style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFFD07317), @@ -117,12 +117,12 @@ class ConsultantFinanceScreen extends StatelessWidget { child: Column( children: [ CustomDropDownButton( - items: [], + items: const [], onChanged: (value) {}, ), const SizedBox(height: 12), CustomDropDownButton( - items: [], + items: const [], onChanged: (value) {}, ), const SizedBox(height: 12), @@ -130,7 +130,7 @@ class ConsultantFinanceScreen extends StatelessWidget { shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) => Material( - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), borderRadius: BorderRadius.circular(20), child: Padding( padding: const EdgeInsets.all(12), @@ -142,7 +142,7 @@ class ConsultantFinanceScreen extends StatelessWidget { children: [ Text( testFinanceEntity.consultationsList[index].id, - style: TextStyle( + style: const TextStyle( color: Color(0xFF323F4B), height: 1, fontWeight: FontWeight.w500, @@ -150,7 +150,7 @@ class ConsultantFinanceScreen extends StatelessWidget { ), Text( testFinanceEntity.consultationsList[index].date.format('dd.MM.yyy', 'RU'), - style: TextStyle( + style: const TextStyle( color: Color(0xFF6D6F71), height: 1, fontWeight: FontWeight.w500, @@ -170,8 +170,8 @@ class ConsultantFinanceScreen extends StatelessWidget { ), const SizedBox(height: 8), Text( - 'Покупатель: ' + testFinanceEntity.consultationsList[index].clientName, - style: TextStyle( + 'Покупатель: ${testFinanceEntity.consultationsList[index].clientName}', + style: const TextStyle( color: Color(0xFF323F4B), height: 1, fontSize: 14, @@ -180,8 +180,8 @@ class ConsultantFinanceScreen extends StatelessWidget { ), const SizedBox(height: 8), Text( - testFinanceEntity.consultationsList[index].planDuration.toString() + ' дней', - style: TextStyle( + '${testFinanceEntity.consultationsList[index].planDuration} дней', + style: const TextStyle( color: Color(0xFF323F4B), height: 1, fontSize: 14, @@ -193,8 +193,8 @@ class ConsultantFinanceScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - testFinanceEntity.consultationsList[index].price.toString() + ' ₽', - style: TextStyle( + '${testFinanceEntity.consultationsList[index].price} ₽', + style: const TextStyle( color: Color(0xFF323F4B), height: 1, fontSize: 18, @@ -202,13 +202,13 @@ class ConsultantFinanceScreen extends StatelessWidget { ), ), Material( - color: Color(0xFF0BB450).withAlpha(11), + color: const Color(0xFF0BB450).withAlpha(11), borderRadius: BorderRadius.circular(8), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), child: Text( testFinanceEntity.consultationsList[index].status.name, - style: TextStyle( + style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFF0BB450), diff --git a/lib/features/my_finance/presentation/pages/user_finance_screen.dart b/lib/features/my_finance/presentation/pages/user_finance_screen.dart index 5bca9c4d..7d80011d 100644 --- a/lib/features/my_finance/presentation/pages/user_finance_screen.dart +++ b/lib/features/my_finance/presentation/pages/user_finance_screen.dart @@ -12,10 +12,10 @@ class UserFinanceScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Color(0xFFF0F2F5), + backgroundColor: const Color(0xFFF0F2F5), appBar: AppBar( - shape: RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.vertical(bottom: Radius.circular(12))), - title: Text('История операций'), + shape: const RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.vertical(bottom: Radius.circular(12))), + title: const Text('История операций'), centerTitle: true, ), body: SingleChildScrollView( @@ -31,9 +31,9 @@ class UserFinanceScreen extends StatelessWidget { child: Ink( decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: appTheme.blueA400), width: MediaQuery.of(context).size.width - 32, - child: Center( + child: const Center( child: Padding( - padding: const EdgeInsets.all(16), + padding: EdgeInsets.all(16), child: Text('Управление картами', style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600)), ), ), @@ -49,14 +49,14 @@ class UserFinanceScreen extends StatelessWidget { physics: const NeverScrollableScrollPhysics(), child: Column( children: [ - CustomDropDownButton(items: [], onChanged: (value) {}), + CustomDropDownButton(items: const [], onChanged: (value) {}), const SizedBox(height: 12), ListView.separated( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) => Material( - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), borderRadius: BorderRadius.circular(20), child: Padding( padding: const EdgeInsets.all(12), @@ -68,11 +68,11 @@ class UserFinanceScreen extends StatelessWidget { children: [ Text( testFinanceEntity.consultationsList[index].id, - style: TextStyle(color: Color(0xFF323F4B), height: 1, fontWeight: FontWeight.w500), + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontWeight: FontWeight.w500), ), Text( testFinanceEntity.consultationsList[index].date.format('dd.MM.yyy', 'RU'), - style: TextStyle(color: Color(0xFF6D6F71), height: 1, fontWeight: FontWeight.w500), + style: const TextStyle(color: Color(0xFF6D6F71), height: 1, fontWeight: FontWeight.w500), ), ], ), @@ -83,30 +83,30 @@ class UserFinanceScreen extends StatelessWidget { ), const SizedBox(height: 8), Text( - 'Покупатель: ' + testFinanceEntity.consultationsList[index].clientName, - style: TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), + 'Покупатель: ${testFinanceEntity.consultationsList[index].clientName}', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), ), const SizedBox(height: 8), Text( - testFinanceEntity.consultationsList[index].planDuration.toString() + ' дней', - style: TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), + '${testFinanceEntity.consultationsList[index].planDuration} дней', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), ), const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - testFinanceEntity.consultationsList[index].price.toString() + ' ₽', - style: TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 18, fontWeight: FontWeight.w600), + '${testFinanceEntity.consultationsList[index].price} ₽', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 18, fontWeight: FontWeight.w600), ), Material( - color: Color(0xFF0BB450).withAlpha(11), + color: const Color(0xFF0BB450).withAlpha(11), borderRadius: BorderRadius.circular(8), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), child: Text( testFinanceEntity.consultationsList[index].status.name, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFF0BB450), height: 1), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFF0BB450), height: 1), ), ), ), diff --git a/lib/features/my_finance/presentation/widgets/card_widget.dart b/lib/features/my_finance/presentation/widgets/card_widget.dart index 7d26342f..58c4b1b8 100644 --- a/lib/features/my_finance/presentation/widgets/card_widget.dart +++ b/lib/features/my_finance/presentation/widgets/card_widget.dart @@ -35,17 +35,17 @@ class CardWidget extends StatelessWidget { context.read().markAsDefault(id: cardId); }, child: Container( - padding: EdgeInsets.all(4), + padding: const EdgeInsets.all(4), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - border: Border.all(color: isSelected ? appTheme.blueA400 : Color(0xFFF1F2F6), width: 2), + border: Border.all(color: isSelected ? appTheme.blueA400 : const Color(0xFFF1F2F6), width: 2), ), child: enabledAddCard ? Container( width: 148, - padding: EdgeInsets.all(10), - decoration: BoxDecoration(color: Color(0xFFF1F2F6), borderRadius: BorderRadius.circular(4)), + padding: const EdgeInsets.all(10), + decoration: BoxDecoration(color: const Color(0xFFF1F2F6), borderRadius: BorderRadius.circular(4)), child: Column( children: [ SvgPicture.asset('assets/icons/add_card.svg'), @@ -56,8 +56,8 @@ class CardWidget extends StatelessWidget { ) : Container( width: 148, - padding: EdgeInsets.all(10), - decoration: BoxDecoration(color: Color(0xFFF1F2F6), borderRadius: BorderRadius.circular(4)), + padding: const EdgeInsets.all(10), + decoration: BoxDecoration(color: const Color(0xFFF1F2F6), borderRadius: BorderRadius.circular(4)), child: Column( children: [ SvgPicture.asset('assets/icons/card.svg'), diff --git a/lib/features/my_finance/services/cards_service.g.dart b/lib/features/my_finance/services/cards_service.g.dart index 62b8d7ca..6f1051b5 100644 --- a/lib/features/my_finance/services/cards_service.g.dart +++ b/lib/features/my_finance/services/cards_service.g.dart @@ -36,10 +36,9 @@ class _CardsService implements CardsService { final _result = await _dio.fetch>(_options); late List _value; try { - _value = - _result.data! - .map((dynamic i) => CardModel.fromJson(i as Map)) - .toList(); + _value = _result.data! + .map((dynamic i) => CardModel.fromJson(i as Map)) + .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; diff --git a/lib/features/my_plans/presentation/cubit/my_plans_cubit.dart b/lib/features/my_plans/presentation/cubit/my_plans_cubit.dart index eb61d560..6c14003f 100644 --- a/lib/features/my_plans/presentation/cubit/my_plans_cubit.dart +++ b/lib/features/my_plans/presentation/cubit/my_plans_cubit.dart @@ -49,7 +49,7 @@ class MyPlansCubit extends Cubit { emit(state.copyWith(activeFilterState: state.activeFilterState.copyWith(typeIndex: index), error: null)); EasyDebounce.debounce( 'loadPlans', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadPlans( query: _activeQuery, ), @@ -58,7 +58,7 @@ class MyPlansCubit extends Cubit { emit(state.copyWith(draftFilterState: state.draftFilterState.copyWith(typeIndex: index), error: null)); EasyDebounce.debounce( 'loadPlans', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadPlans( query: _draftQuery, ), @@ -71,7 +71,7 @@ class MyPlansCubit extends Cubit { emit(state.copyWith(activeFilterState: state.activeFilterState.copyWith(durationIndex: index), error: null)); EasyDebounce.debounce( 'loadPlans', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadPlans( query: _activeQuery, ), @@ -80,7 +80,7 @@ class MyPlansCubit extends Cubit { emit(state.copyWith(draftFilterState: state.draftFilterState.copyWith(durationIndex: index), error: null)); EasyDebounce.debounce( 'loadPlans', - Duration(seconds: 1), + const Duration(seconds: 1), () => loadPlans( query: _draftQuery, ), 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 7434a8a9..d117a210 100644 --- a/lib/features/my_plans/presentation/cubit/my_plans_state.dart +++ b/lib/features/my_plans/presentation/cubit/my_plans_state.dart @@ -17,7 +17,7 @@ class MyPlansState with _$MyPlansState { @Default(0) int minDraftPlanPrice, @Default(0) int maxDraftPlanPrice, @Default( - const PlansFilterState( + PlansFilterState( priceFilter: (null, null), durationIndex: 0, typeIndex: 0, @@ -25,7 +25,7 @@ class MyPlansState with _$MyPlansState { ) PlansFilterState activeFilterState, @Default( - const PlansFilterState( + PlansFilterState( priceFilter: (null, null), durationIndex: 0, typeIndex: 0, diff --git a/lib/features/my_plans/presentation/cubit/my_plans_state.freezed.dart b/lib/features/my_plans/presentation/cubit/my_plans_state.freezed.dart index b7512af2..ea5d960b 100644 --- a/lib/features/my_plans/presentation/cubit/my_plans_state.freezed.dart +++ b/lib/features/my_plans/presentation/cubit/my_plans_state.freezed.dart @@ -12,8 +12,7 @@ part of 'my_plans_state.dart'; 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', -); + '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'); /// @nodoc mixin _$MyPlansState { @@ -39,23 +38,21 @@ mixin _$MyPlansState { /// @nodoc abstract class $MyPlansStateCopyWith<$Res> { factory $MyPlansStateCopyWith( - MyPlansState value, - $Res Function(MyPlansState) then, - ) = _$MyPlansStateCopyWithImpl<$Res, MyPlansState>; + MyPlansState value, $Res Function(MyPlansState) then) = + _$MyPlansStateCopyWithImpl<$Res, MyPlansState>; @useResult - $Res call({ - List activePlans, - List draftPlans, - bool isLoading, - String? error, - int selectedStateIndex, - int minActivePlanPrice, - int maxActivePlanPrice, - int minDraftPlanPrice, - int maxDraftPlanPrice, - PlansFilterState activeFilterState, - PlansFilterState draftFilterState, - }); + $Res call( + {List activePlans, + List draftPlans, + bool isLoading, + String? error, + int selectedStateIndex, + int minActivePlanPrice, + int maxActivePlanPrice, + int minDraftPlanPrice, + int maxDraftPlanPrice, + PlansFilterState activeFilterState, + PlansFilterState draftFilterState}); $PlansFilterStateCopyWith<$Res> get activeFilterState; $PlansFilterStateCopyWith<$Res> get draftFilterState; @@ -88,66 +85,52 @@ class _$MyPlansStateCopyWithImpl<$Res, $Val extends MyPlansState> Object? activeFilterState = null, Object? draftFilterState = null, }) { - return _then( - _value.copyWith( - activePlans: - null == activePlans - ? _value.activePlans - : activePlans // ignore: cast_nullable_to_non_nullable - as List, - draftPlans: - null == draftPlans - ? _value.draftPlans - : draftPlans // ignore: cast_nullable_to_non_nullable - as List, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - selectedStateIndex: - null == selectedStateIndex - ? _value.selectedStateIndex - : selectedStateIndex // ignore: cast_nullable_to_non_nullable - as int, - minActivePlanPrice: - null == minActivePlanPrice - ? _value.minActivePlanPrice - : minActivePlanPrice // ignore: cast_nullable_to_non_nullable - as int, - maxActivePlanPrice: - null == maxActivePlanPrice - ? _value.maxActivePlanPrice - : maxActivePlanPrice // ignore: cast_nullable_to_non_nullable - as int, - minDraftPlanPrice: - null == minDraftPlanPrice - ? _value.minDraftPlanPrice - : minDraftPlanPrice // ignore: cast_nullable_to_non_nullable - as int, - maxDraftPlanPrice: - null == maxDraftPlanPrice - ? _value.maxDraftPlanPrice - : maxDraftPlanPrice // ignore: cast_nullable_to_non_nullable - as int, - activeFilterState: - null == activeFilterState - ? _value.activeFilterState - : activeFilterState // ignore: cast_nullable_to_non_nullable - as PlansFilterState, - draftFilterState: - null == draftFilterState - ? _value.draftFilterState - : draftFilterState // ignore: cast_nullable_to_non_nullable - as PlansFilterState, - ) - as $Val, - ); + return _then(_value.copyWith( + activePlans: null == activePlans + ? _value.activePlans + : activePlans // ignore: cast_nullable_to_non_nullable + as List, + draftPlans: null == draftPlans + ? _value.draftPlans + : draftPlans // ignore: cast_nullable_to_non_nullable + as List, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + selectedStateIndex: null == selectedStateIndex + ? _value.selectedStateIndex + : selectedStateIndex // ignore: cast_nullable_to_non_nullable + as int, + minActivePlanPrice: null == minActivePlanPrice + ? _value.minActivePlanPrice + : minActivePlanPrice // ignore: cast_nullable_to_non_nullable + as int, + maxActivePlanPrice: null == maxActivePlanPrice + ? _value.maxActivePlanPrice + : maxActivePlanPrice // ignore: cast_nullable_to_non_nullable + as int, + minDraftPlanPrice: null == minDraftPlanPrice + ? _value.minDraftPlanPrice + : minDraftPlanPrice // ignore: cast_nullable_to_non_nullable + as int, + maxDraftPlanPrice: null == maxDraftPlanPrice + ? _value.maxDraftPlanPrice + : maxDraftPlanPrice // ignore: cast_nullable_to_non_nullable + as int, + activeFilterState: null == activeFilterState + ? _value.activeFilterState + : activeFilterState // ignore: cast_nullable_to_non_nullable + as PlansFilterState, + draftFilterState: null == draftFilterState + ? _value.draftFilterState + : draftFilterState // ignore: cast_nullable_to_non_nullable + as PlansFilterState, + ) as $Val); } /// Create a copy of MyPlansState @@ -175,24 +158,22 @@ class _$MyPlansStateCopyWithImpl<$Res, $Val extends MyPlansState> abstract class _$$MyPlansStateImplCopyWith<$Res> implements $MyPlansStateCopyWith<$Res> { factory _$$MyPlansStateImplCopyWith( - _$MyPlansStateImpl value, - $Res Function(_$MyPlansStateImpl) then, - ) = __$$MyPlansStateImplCopyWithImpl<$Res>; + _$MyPlansStateImpl value, $Res Function(_$MyPlansStateImpl) then) = + __$$MyPlansStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - List activePlans, - List draftPlans, - bool isLoading, - String? error, - int selectedStateIndex, - int minActivePlanPrice, - int maxActivePlanPrice, - int minDraftPlanPrice, - int maxDraftPlanPrice, - PlansFilterState activeFilterState, - PlansFilterState draftFilterState, - }); + $Res call( + {List activePlans, + List draftPlans, + bool isLoading, + String? error, + int selectedStateIndex, + int minActivePlanPrice, + int maxActivePlanPrice, + int minDraftPlanPrice, + int maxDraftPlanPrice, + PlansFilterState activeFilterState, + PlansFilterState draftFilterState}); @override $PlansFilterStateCopyWith<$Res> get activeFilterState; @@ -205,9 +186,8 @@ class __$$MyPlansStateImplCopyWithImpl<$Res> extends _$MyPlansStateCopyWithImpl<$Res, _$MyPlansStateImpl> implements _$$MyPlansStateImplCopyWith<$Res> { __$$MyPlansStateImplCopyWithImpl( - _$MyPlansStateImpl _value, - $Res Function(_$MyPlansStateImpl) _then, - ) : super(_value, _then); + _$MyPlansStateImpl _value, $Res Function(_$MyPlansStateImpl) _then) + : super(_value, _then); /// Create a copy of MyPlansState /// with the given fields replaced by the non-null parameter values. @@ -226,93 +206,74 @@ class __$$MyPlansStateImplCopyWithImpl<$Res> Object? activeFilterState = null, Object? draftFilterState = null, }) { - return _then( - _$MyPlansStateImpl( - activePlans: - null == activePlans - ? _value._activePlans - : activePlans // ignore: cast_nullable_to_non_nullable - as List, - draftPlans: - null == draftPlans - ? _value._draftPlans - : draftPlans // ignore: cast_nullable_to_non_nullable - as List, - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - selectedStateIndex: - null == selectedStateIndex - ? _value.selectedStateIndex - : selectedStateIndex // ignore: cast_nullable_to_non_nullable - as int, - minActivePlanPrice: - null == minActivePlanPrice - ? _value.minActivePlanPrice - : minActivePlanPrice // ignore: cast_nullable_to_non_nullable - as int, - maxActivePlanPrice: - null == maxActivePlanPrice - ? _value.maxActivePlanPrice - : maxActivePlanPrice // ignore: cast_nullable_to_non_nullable - as int, - minDraftPlanPrice: - null == minDraftPlanPrice - ? _value.minDraftPlanPrice - : minDraftPlanPrice // ignore: cast_nullable_to_non_nullable - as int, - maxDraftPlanPrice: - null == maxDraftPlanPrice - ? _value.maxDraftPlanPrice - : maxDraftPlanPrice // ignore: cast_nullable_to_non_nullable - as int, - activeFilterState: - null == activeFilterState - ? _value.activeFilterState - : activeFilterState // ignore: cast_nullable_to_non_nullable - as PlansFilterState, - draftFilterState: - null == draftFilterState - ? _value.draftFilterState - : draftFilterState // ignore: cast_nullable_to_non_nullable - as PlansFilterState, - ), - ); + return _then(_$MyPlansStateImpl( + activePlans: null == activePlans + ? _value._activePlans + : activePlans // ignore: cast_nullable_to_non_nullable + as List, + draftPlans: null == draftPlans + ? _value._draftPlans + : draftPlans // ignore: cast_nullable_to_non_nullable + as List, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + selectedStateIndex: null == selectedStateIndex + ? _value.selectedStateIndex + : selectedStateIndex // ignore: cast_nullable_to_non_nullable + as int, + minActivePlanPrice: null == minActivePlanPrice + ? _value.minActivePlanPrice + : minActivePlanPrice // ignore: cast_nullable_to_non_nullable + as int, + maxActivePlanPrice: null == maxActivePlanPrice + ? _value.maxActivePlanPrice + : maxActivePlanPrice // ignore: cast_nullable_to_non_nullable + as int, + minDraftPlanPrice: null == minDraftPlanPrice + ? _value.minDraftPlanPrice + : minDraftPlanPrice // ignore: cast_nullable_to_non_nullable + as int, + maxDraftPlanPrice: null == maxDraftPlanPrice + ? _value.maxDraftPlanPrice + : maxDraftPlanPrice // ignore: cast_nullable_to_non_nullable + as int, + activeFilterState: null == activeFilterState + ? _value.activeFilterState + : activeFilterState // ignore: cast_nullable_to_non_nullable + as PlansFilterState, + draftFilterState: null == draftFilterState + ? _value.draftFilterState + : draftFilterState // ignore: cast_nullable_to_non_nullable + as PlansFilterState, + )); } } /// @nodoc class _$MyPlansStateImpl implements _MyPlansState { - _$MyPlansStateImpl({ - final List activePlans = const [], - final List draftPlans = const [], - this.isLoading = false, - this.error = null, - this.selectedStateIndex = 0, - this.minActivePlanPrice = 0, - this.maxActivePlanPrice = 0, - this.minDraftPlanPrice = 0, - this.maxDraftPlanPrice = 0, - this.activeFilterState = const PlansFilterState( - priceFilter: (null, null), - durationIndex: 0, - typeIndex: 0, - ), - this.draftFilterState = const PlansFilterState( - priceFilter: (null, null), - durationIndex: 0, - typeIndex: 0, - ), - }) : _activePlans = activePlans, - _draftPlans = draftPlans; + _$MyPlansStateImpl( + {final List activePlans = const [], + final List draftPlans = const [], + this.isLoading = false, + this.error = null, + this.selectedStateIndex = 0, + this.minActivePlanPrice = 0, + this.maxActivePlanPrice = 0, + this.minDraftPlanPrice = 0, + this.maxDraftPlanPrice = 0, + this.activeFilterState = const PlansFilterState( + priceFilter: (null, null), durationIndex: 0, typeIndex: 0), + this.draftFilterState = const PlansFilterState( + priceFilter: (null, null), durationIndex: 0, typeIndex: 0)}) + : _activePlans = activePlans, + _draftPlans = draftPlans; final List _activePlans; @override @@ -370,14 +331,10 @@ class _$MyPlansStateImpl implements _MyPlansState { return identical(this, other) || (other.runtimeType == runtimeType && other is _$MyPlansStateImpl && - const DeepCollectionEquality().equals( - other._activePlans, - _activePlans, - ) && - const DeepCollectionEquality().equals( - other._draftPlans, - _draftPlans, - ) && + const DeepCollectionEquality() + .equals(other._activePlans, _activePlans) && + const DeepCollectionEquality() + .equals(other._draftPlans, _draftPlans) && (identical(other.isLoading, isLoading) || other.isLoading == isLoading) && (identical(other.error, error) || other.error == error) && @@ -399,19 +356,18 @@ class _$MyPlansStateImpl implements _MyPlansState { @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_activePlans), - const DeepCollectionEquality().hash(_draftPlans), - isLoading, - error, - selectedStateIndex, - minActivePlanPrice, - maxActivePlanPrice, - minDraftPlanPrice, - maxDraftPlanPrice, - activeFilterState, - draftFilterState, - ); + runtimeType, + const DeepCollectionEquality().hash(_activePlans), + const DeepCollectionEquality().hash(_draftPlans), + isLoading, + error, + selectedStateIndex, + minActivePlanPrice, + maxActivePlanPrice, + minDraftPlanPrice, + maxDraftPlanPrice, + activeFilterState, + draftFilterState); /// Create a copy of MyPlansState /// with the given fields replaced by the non-null parameter values. @@ -423,19 +379,18 @@ class _$MyPlansStateImpl implements _MyPlansState { } abstract class _MyPlansState implements MyPlansState { - factory _MyPlansState({ - final List activePlans, - final List draftPlans, - final bool isLoading, - final String? error, - final int selectedStateIndex, - final int minActivePlanPrice, - final int maxActivePlanPrice, - final int minDraftPlanPrice, - final int maxDraftPlanPrice, - final PlansFilterState activeFilterState, - final PlansFilterState draftFilterState, - }) = _$MyPlansStateImpl; + factory _MyPlansState( + {final List activePlans, + final List draftPlans, + final bool isLoading, + final String? error, + final int selectedStateIndex, + final int minActivePlanPrice, + final int maxActivePlanPrice, + final int minDraftPlanPrice, + final int maxDraftPlanPrice, + final PlansFilterState activeFilterState, + final PlansFilterState draftFilterState}) = _$MyPlansStateImpl; @override List get activePlans; diff --git a/lib/features/my_plans/presentation/my_plans_screen.dart b/lib/features/my_plans/presentation/my_plans_screen.dart index 29bf9587..3ca9ca3e 100644 --- a/lib/features/my_plans/presentation/my_plans_screen.dart +++ b/lib/features/my_plans/presentation/my_plans_screen.dart @@ -64,7 +64,7 @@ class MyPlansScreenContent extends StatelessWidget { headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ SliverAppBar( - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(bottom: Radius.circular(12)), ), backgroundColor: appTheme.gray100, @@ -85,15 +85,15 @@ class MyPlansScreenContent extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4), + const SizedBox(height: 8), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 4), child: MyPlansTab(), ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( children: [ - SizedBox(width: 4), + const SizedBox(width: 4), Expanded( child: CustomSearchBar( enableIcon: false, @@ -106,7 +106,7 @@ class MyPlansScreenContent extends StatelessWidget { onChanged: (query) { EasyDebounce.debounce( 'searchPlans', - Duration(milliseconds: 500), + const Duration(milliseconds: 500), () { context.read().loadPlans(query: query == '' ? null : query); }, @@ -114,14 +114,14 @@ class MyPlansScreenContent extends StatelessWidget { }, ), ), - SizedBox(width: 12), + const SizedBox(width: 12), AddItemButton( onTap: () => GoRouter.of(context).pushNamed(CreatePlanScreen.name), ), - SizedBox(width: 4), + const SizedBox(width: 4), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ), @@ -147,15 +147,15 @@ class MyPlansScreenContent extends StatelessWidget { }; return Stack( children: [ - SizedBox.expand(), + const SizedBox.expand(), ListView.separated( shrinkWrap: true, - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemBuilder: (context, index) { return MyPlanWidget(plan: plans[index]); }, separatorBuilder: (context, index) { - return SizedBox(height: 20); + return const SizedBox(height: 20); }, itemCount: plans.length, ), 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 5aa7e63a..f9594340 100644 --- a/lib/features/my_plans/presentation/widgets/my_plan_widget.dart +++ b/lib/features/my_plans/presentation/widgets/my_plan_widget.dart @@ -47,9 +47,9 @@ class _MyPlanWidgetState extends State { InkWell( onTap: () => GoRouter.of(context).pushNamed('aboutPlanScreen', extra: {'plan': widget.plan, 'navigateToComments': false}), child: ClipRRect( - borderRadius: BorderRadius.vertical(top: Radius.circular(12)), + borderRadius: const BorderRadius.vertical(top: Radius.circular(12)), child: CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + widget.plan.image, + imageUrl: '$baseUrl/storage/${widget.plan.image}', fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width, ), @@ -69,7 +69,7 @@ class _MyPlanWidgetState extends State { ), ], ), - SizedBox(height: 12), + const SizedBox(height: 12), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -81,13 +81,13 @@ class _MyPlanWidgetState extends State { ), ), if (widget.plan.details.isNotEmpty) ...[ - SizedBox( + const SizedBox( height: 12, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Html( - data: widget.plan.details.length > 200 ? widget.plan.details.substring(0, 200) + '...' : widget.plan.details, + data: widget.plan.details.length > 200 ? '${widget.plan.details.substring(0, 200)}...' : widget.plan.details, style: { "*": Style( margin: Margins.zero, @@ -101,15 +101,15 @@ class _MyPlanWidgetState extends State { ], ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Padding( - padding: EdgeInsets.only(left: 16), + padding: const EdgeInsets.only(left: 16), child: Text( '${widget.plan.packetsCount == 1 ? widget.plan.packet1Options?.price : '${s.from} ${widget.plan.minPriceOfOptions.toStringAsFixed(0)}'}₽', style: TextStyles.headingXLSemibold.copyWith(color: appTheme.greenA700), ), ), - SizedBox(height: 20), + const SizedBox(height: 20), BlocBuilder( builder: (context, state) { return Padding( @@ -129,18 +129,18 @@ class _MyPlanWidgetState extends State { buttonStyle: ButtonStyle( shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(20))), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), ), ), if (state.selectedStateIndex == 0) ...[ - SizedBox(width: 6), + const SizedBox(width: 6), CustomOutlinedButton( onPressed: () async { final box = context.findRenderObject() as RenderBox?; await Share.shareUri( Uri.parse( - baseUrl + '/ru/plan/' + widget.plan.id.toString(), + '$baseUrl/ru/plan/${widget.plan.id}', ), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); @@ -157,14 +157,14 @@ class _MyPlanWidgetState extends State { buttonStyle: ButtonStyle( shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(20))), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), text: '', ), ], ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( children: [ Expanded( @@ -178,36 +178,37 @@ class _MyPlanWidgetState extends State { buttonStyle: ButtonStyle( shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(20))), backgroundColor: WidgetStatePropertyAll(appTheme.lightGray0), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), ), ), - SizedBox(width: 6), + const SizedBox(width: 6), CustomOutlinedButton( onPressed: () async { final result = await context.read().deletePlan(widget.plan.slug); - if (result) - Future.delayed(Duration(seconds: 3), () { + if (result) { + Future.delayed(const Duration(seconds: 3), () { + if (!context.mounted) return; showBottomSheetWithBlur( context: context, child: Column( children: [ - SizedBox( + const SizedBox( height: 20, ), - BottomSheetHandlerBar(), - SizedBox( + const BottomSheetHandlerBar(), + const SizedBox( height: 20, ), Text( - '${widget.plan.name}', + widget.plan.name, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), Text( s.deleted, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), - SizedBox( + const SizedBox( height: 20, ), Padding( @@ -220,18 +221,19 @@ class _MyPlanWidgetState extends State { height: 52, buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700), buttonStyle: ButtonStyle( - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), ), ), ), - SizedBox( + const SizedBox( height: 20, ), ], ), ); }); + } }, height: 52, width: 52, @@ -244,13 +246,13 @@ class _MyPlanWidgetState extends State { buttonStyle: ButtonStyle( shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(20))), backgroundColor: WidgetStatePropertyAll(appTheme.lightGray0), - side: WidgetStatePropertyAll(BorderSide.none), + side: const WidgetStatePropertyAll(BorderSide.none), ), text: '', ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), ], ), ); diff --git a/lib/features/notifications/presentation/pages/notifications_screen.dart b/lib/features/notifications/presentation/pages/notifications_screen.dart index 69058bf0..c569dd37 100644 --- a/lib/features/notifications/presentation/pages/notifications_screen.dart +++ b/lib/features/notifications/presentation/pages/notifications_screen.dart @@ -12,10 +12,10 @@ class NotificationsScreen extends StatelessWidget { builder: (BuildContext context, NotificationsState state) { return Scaffold( appBar: AppBar( - title: Text('Уведомления'), + title: const Text('Уведомления'), ), body: SingleChildScrollView( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: Text( state is NotificationsStateLoaded ? state.notifications.toString() : 'Уведомлений нет', ), diff --git a/lib/features/order_info/presentation/info_by_order_screen.dart b/lib/features/order_info/presentation/info_by_order_screen.dart new file mode 100644 index 00000000..d077803c --- /dev/null +++ b/lib/features/order_info/presentation/info_by_order_screen.dart @@ -0,0 +1,80 @@ +import 'package:eatvio_app/core/theme/custom_text_style.dart'; +import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/features/diets/presentation/widgets/author_card.dart'; +import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart'; +import 'package:eatvio_app/features/order_info/presentation/widgets/plan_info.dart'; +import 'package:eatvio_app/features/order_info/presentation/widgets/plan_props.dart'; +import 'package:eatvio_app/features/order_info/presentation/widgets/plan_state.dart'; +import 'package:eatvio_app/features/order_info/presentation/widgets/plan_status_box.dart'; +import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart'; +import 'package:eatvio_app/core/widgets/option_widget.dart'; +import 'package:eatvio_app/generated/l10n.dart'; +import 'package:flutter/material.dart'; + +class InfoByOrderScreen extends StatefulWidget { + static const name = 'infoByOrderScreen'; + static const path = '/info-by-order-screen'; + final ChosenPlanModel plan; + const InfoByOrderScreen({ + super.key, + required this.plan, + }); + + @override + State createState() => _InfoByOrderScreenState(); +} + +class _InfoByOrderScreenState extends State { + @override + Widget build(BuildContext context) { + final s = S.of(context); + PacketOptions? chosenOption; + if (widget.plan.optionType == 'options1') { + chosenOption = widget.plan.plan.packet1Options; + } else if (widget.plan.optionType == 'options2') { + chosenOption = widget.plan.plan.packet2Options; + } else { + chosenOption = widget.plan.plan.packet3Options; + } + return Scaffold( + backgroundColor: appTheme.gray100, + appBar: AppBar( + title: Text( + s.infoAboutOrder, + style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), + ), + leading: IconButton(icon: const Icon(Icons.arrow_back), onPressed: () {}), + ), + body: SingleChildScrollView( + child: Column( + children: [ + const SizedBox(height: 8), + AuthorCard( + author: widget.plan.plan.author, + title: s.plan_seller, + titleStyle: TextStyles.textSSemibold.copyWith(color: appTheme.gray), + backgroundColor: appTheme.whiteA700, + ), + const SizedBox(height: 8), + PlanProps(planDuration: widget.plan.plan.duration, planPrice: chosenOption?.price.toDouble() ?? 0, planStatus: PlanStatusValues.paymentFailed), + const SizedBox(height: 8), + PlanInfo( + title: widget.plan.plan.name, + description: widget.plan.plan.details, + imagePath: widget.plan.plan.image, + ), + const SizedBox(height: 8), + OptionWidget( + option: chosenOption, + disableDuration: true, + ), + const SizedBox(height: 8), + PlanState( + state: widget.plan.chosenPlanState, + ), + const SizedBox(height: 30), + ], + ), + )); + } +} diff --git a/lib/features/order_info/presentation/widgets/plan_info.dart b/lib/features/order_info/presentation/widgets/plan_info.dart new file mode 100644 index 00000000..6c5e387d --- /dev/null +++ b/lib/features/order_info/presentation/widgets/plan_info.dart @@ -0,0 +1,45 @@ +import 'package:cached_network_image/cached_network_image.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'; +import 'package:eatvio_app/core/widgets/main_background_bouble.dart'; +import 'package:flutter/material.dart'; + +class PlanInfo extends StatelessWidget { + const PlanInfo({super.key, required this.title, required this.description, required this.imagePath}); + final String title; + final String description; + final String imagePath; + @override + Widget build(BuildContext context) { + return MainBackgroundBouble( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 16), + Text( + title, + style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), + ), + const SizedBox(height: 12), + Text( + description, + style: TextStyles.textSMedium.copyWith(color: appTheme.black), + ), + const SizedBox(height: 12), + ClipRRect( + borderRadius: BorderRadius.circular(8), + child: CachedNetworkImage( + imageUrl: '$baseUrl/storage/$imagePath', + height: 220, + width: MediaQuery.sizeOf(context).width, + fit: BoxFit.fill, + ), + ), + const SizedBox(height: 16), + ], + ), + ); + } +} diff --git a/lib/features/order_info/presentation/widgets/plan_props.dart b/lib/features/order_info/presentation/widgets/plan_props.dart new file mode 100644 index 00000000..05c5145e --- /dev/null +++ b/lib/features/order_info/presentation/widgets/plan_props.dart @@ -0,0 +1,76 @@ +// ignore_for_file: public_member_api_docs, sort_constructors_first +import 'package:eatvio_app/core/theme/custom_text_style.dart'; +import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/core/utils/localization_utils.dart'; +import 'package:eatvio_app/core/widgets/custom_divider.dart'; +import 'package:eatvio_app/generated/l10n.dart'; +import 'package:flutter/material.dart'; + +import 'package:eatvio_app/core/widgets/main_background_bouble.dart'; +import 'package:eatvio_app/features/order_info/presentation/widgets/plan_status_box.dart'; + +class PlanProps extends StatelessWidget { + const PlanProps({ + super.key, + required this.planDuration, + required this.planPrice, + required this.planStatus, + }); + final int planDuration; + final double planPrice; + final PlanStatusValues planStatus; + @override + Widget build(BuildContext context) { + final s = S.of(context); + return MainBackgroundBouble( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + children: [ + const SizedBox(height: 12), + Row( + children: [ + Text( + s.order_status, + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + const Spacer(), + PlanStatusBox(status: planStatus) + ], + ), + const SizedBox(height: 12), + const CustomDivider(), + const SizedBox(height: 12), + Row( + children: [ + Text( + s.order_price, + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + const Spacer(), + Text( + '${planPrice.toStringAsFixed(0)}₽', + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + ], + ), + const SizedBox(height: 12), + const CustomDivider(), + const SizedBox(height: 12), + Row( + children: [ + Text( + s.time_to_complete_plan, + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + const Spacer(), + Text( + '$planDuration ${getDayForm(planDuration, s)}', + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + ], + ), + const SizedBox(height: 12), + ], + )); + } +} diff --git a/lib/features/order_info/presentation/widgets/plan_state.dart b/lib/features/order_info/presentation/widgets/plan_state.dart new file mode 100644 index 00000000..c5c7c72a --- /dev/null +++ b/lib/features/order_info/presentation/widgets/plan_state.dart @@ -0,0 +1,83 @@ +import 'package:eatvio_app/core/theme/custom_text_style.dart'; +import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/core/widgets/main_background_bouble.dart'; +import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart'; +import 'package:eatvio_app/generated/l10n.dart'; +import 'package:flutter/material.dart'; + +class PlanState extends StatelessWidget { + PlanState({super.key, required this.state}); + final ChosenPlanStateEnum state; + final List> states = [ + [ + ChosenPlanStateEnum.stateInited, + ChosenPlanStateEnum.stateInCoordination, + ], + [ + ChosenPlanStateEnum.stateStartDateHasBeenSet, + ChosenPlanStateEnum.statePendingPayment, + ], + [ + ChosenPlanStateEnum.statePaid, + ], + [ + ChosenPlanStateEnum.stateStarted, + ChosenPlanStateEnum.stateInProgress, + ChosenPlanStateEnum.stateLastDayStarted, + ChosenPlanStateEnum.stateLastDayFinished, + ], + [ + ChosenPlanStateEnum.stateComplained, + ChosenPlanStateEnum.stateDone, + ChosenPlanStateEnum.stateChargeWasCollected, + ] + ]; + @override + Widget build(BuildContext context) { + final s = S.of(context); + final titles = [s.order_created, s.startDateHasBeenSet, s.order_paid, s.in_progress, s.done]; + return MainBackgroundBouble( + padding: const EdgeInsets.all(16), + child: Column( + children: List.generate(states.length, (index) { + final color = index <= states.indexWhere((element) => element.contains(state)) ? appTheme.greenA700 : appTheme.lightGray00; + final text = titles[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 24, + height: 24, + decoration: BoxDecoration(shape: BoxShape.circle, color: color), + child: Center( + child: Icon( + Icons.check, + color: appTheme.whiteA700, + size: 14, + ), + ), + ), + const SizedBox(width: 12), + Text( + text, + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 12), + child: Container( + height: 12, + width: 1, + color: color, + ), + ) + ], + ); + }), + ), + ); + } +} diff --git a/lib/features/order_info/presentation/widgets/plan_status_box.dart b/lib/features/order_info/presentation/widgets/plan_status_box.dart new file mode 100644 index 00000000..609f2b04 --- /dev/null +++ b/lib/features/order_info/presentation/widgets/plan_status_box.dart @@ -0,0 +1,38 @@ +import 'package:eatvio_app/core/theme/custom_text_style.dart'; +import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/generated/l10n.dart'; +import 'package:flutter/material.dart'; + +enum PlanStatusValues { + paid, + pendingPayment, + paymentFailed, +} + +class PlanStatusBox extends StatelessWidget { + const PlanStatusBox({super.key, required this.status}); + final PlanStatusValues status; + @override + Widget build(BuildContext context) { + final s = S.of(context); + final title = switch (status) { + PlanStatusValues.paid => s.order_paid, + PlanStatusValues.pendingPayment => s.payment_failed, + PlanStatusValues.paymentFailed => s.payment_failed, + }; + return Container( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: switch (status) { + PlanStatusValues.paid => appTheme.greenA700, + PlanStatusValues.pendingPayment => appTheme.gray, + PlanStatusValues.paymentFailed => appTheme.strongRed, + }), + child: Text( + title, + style: TextStyles.textMMedium.copyWith(color: appTheme.whiteA700), + ), + ); + } +} diff --git a/lib/features/plans/models/chosen_plan_model.freezed.dart b/lib/features/plans/models/chosen_plan_model.freezed.dart index f8e09287..859c9ad6 100644 --- a/lib/features/plans/models/chosen_plan_model.freezed.dart +++ b/lib/features/plans/models/chosen_plan_model.freezed.dart @@ -12,8 +12,7 @@ part of 'chosen_plan_model.dart'; 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', -); + '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'); ChosenPlanModel _$ChosenPlanModelFromJson(Map json) { return _ChosenPlanModel.fromJson(json); @@ -49,19 +48,17 @@ mixin _$ChosenPlanModel { /// @nodoc abstract class $ChosenPlanModelCopyWith<$Res> { factory $ChosenPlanModelCopyWith( - ChosenPlanModel value, - $Res Function(ChosenPlanModel) then, - ) = _$ChosenPlanModelCopyWithImpl<$Res, ChosenPlanModel>; + ChosenPlanModel value, $Res Function(ChosenPlanModel) then) = + _$ChosenPlanModelCopyWithImpl<$Res, ChosenPlanModel>; @useResult - $Res call({ - @JsonKey() int id, - @JsonKey(name: 'option_type') String optionType, - @JsonKey(name: 'start_date') DateTime startDate, - @JsonKey(name: 'last_state') ChosenPlanStateEnum chosenPlanState, - @JsonKey(name: 'chat_id') String chatId, - @JsonKey(name: 'consultant_id') int consultantId, - @JsonKey(name: 'plan') PlanModel plan, - }); + $Res call( + {@JsonKey() int id, + @JsonKey(name: 'option_type') String optionType, + @JsonKey(name: 'start_date') DateTime startDate, + @JsonKey(name: 'last_state') ChosenPlanStateEnum chosenPlanState, + @JsonKey(name: 'chat_id') String chatId, + @JsonKey(name: 'consultant_id') int consultantId, + @JsonKey(name: 'plan') PlanModel plan}); $PlanModelCopyWith<$Res> get plan; } @@ -89,46 +86,36 @@ class _$ChosenPlanModelCopyWithImpl<$Res, $Val extends ChosenPlanModel> Object? consultantId = null, Object? plan = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - optionType: - null == optionType - ? _value.optionType - : optionType // ignore: cast_nullable_to_non_nullable - as String, - startDate: - null == startDate - ? _value.startDate - : startDate // ignore: cast_nullable_to_non_nullable - as DateTime, - chosenPlanState: - null == chosenPlanState - ? _value.chosenPlanState - : chosenPlanState // ignore: cast_nullable_to_non_nullable - as ChosenPlanStateEnum, - chatId: - null == chatId - ? _value.chatId - : chatId // ignore: cast_nullable_to_non_nullable - as String, - consultantId: - null == consultantId - ? _value.consultantId - : consultantId // ignore: cast_nullable_to_non_nullable - as int, - plan: - null == plan - ? _value.plan - : plan // ignore: cast_nullable_to_non_nullable - as PlanModel, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + optionType: null == optionType + ? _value.optionType + : optionType // ignore: cast_nullable_to_non_nullable + as String, + startDate: null == startDate + ? _value.startDate + : startDate // ignore: cast_nullable_to_non_nullable + as DateTime, + chosenPlanState: null == chosenPlanState + ? _value.chosenPlanState + : chosenPlanState // ignore: cast_nullable_to_non_nullable + as ChosenPlanStateEnum, + chatId: null == chatId + ? _value.chatId + : chatId // ignore: cast_nullable_to_non_nullable + as String, + consultantId: null == consultantId + ? _value.consultantId + : consultantId // ignore: cast_nullable_to_non_nullable + as int, + plan: null == plan + ? _value.plan + : plan // ignore: cast_nullable_to_non_nullable + as PlanModel, + ) as $Val); } /// Create a copy of ChosenPlanModel @@ -145,21 +132,19 @@ class _$ChosenPlanModelCopyWithImpl<$Res, $Val extends ChosenPlanModel> /// @nodoc abstract class _$$ChosenPlanModelImplCopyWith<$Res> implements $ChosenPlanModelCopyWith<$Res> { - factory _$$ChosenPlanModelImplCopyWith( - _$ChosenPlanModelImpl value, - $Res Function(_$ChosenPlanModelImpl) then, - ) = __$$ChosenPlanModelImplCopyWithImpl<$Res>; + factory _$$ChosenPlanModelImplCopyWith(_$ChosenPlanModelImpl value, + $Res Function(_$ChosenPlanModelImpl) then) = + __$$ChosenPlanModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey() int id, - @JsonKey(name: 'option_type') String optionType, - @JsonKey(name: 'start_date') DateTime startDate, - @JsonKey(name: 'last_state') ChosenPlanStateEnum chosenPlanState, - @JsonKey(name: 'chat_id') String chatId, - @JsonKey(name: 'consultant_id') int consultantId, - @JsonKey(name: 'plan') PlanModel plan, - }); + $Res call( + {@JsonKey() int id, + @JsonKey(name: 'option_type') String optionType, + @JsonKey(name: 'start_date') DateTime startDate, + @JsonKey(name: 'last_state') ChosenPlanStateEnum chosenPlanState, + @JsonKey(name: 'chat_id') String chatId, + @JsonKey(name: 'consultant_id') int consultantId, + @JsonKey(name: 'plan') PlanModel plan}); @override $PlanModelCopyWith<$Res> get plan; @@ -170,9 +155,8 @@ class __$$ChosenPlanModelImplCopyWithImpl<$Res> extends _$ChosenPlanModelCopyWithImpl<$Res, _$ChosenPlanModelImpl> implements _$$ChosenPlanModelImplCopyWith<$Res> { __$$ChosenPlanModelImplCopyWithImpl( - _$ChosenPlanModelImpl _value, - $Res Function(_$ChosenPlanModelImpl) _then, - ) : super(_value, _then); + _$ChosenPlanModelImpl _value, $Res Function(_$ChosenPlanModelImpl) _then) + : super(_value, _then); /// Create a copy of ChosenPlanModel /// with the given fields replaced by the non-null parameter values. @@ -187,60 +171,50 @@ class __$$ChosenPlanModelImplCopyWithImpl<$Res> Object? consultantId = null, Object? plan = null, }) { - return _then( - _$ChosenPlanModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - optionType: - null == optionType - ? _value.optionType - : optionType // ignore: cast_nullable_to_non_nullable - as String, - startDate: - null == startDate - ? _value.startDate - : startDate // ignore: cast_nullable_to_non_nullable - as DateTime, - chosenPlanState: - null == chosenPlanState - ? _value.chosenPlanState - : chosenPlanState // ignore: cast_nullable_to_non_nullable - as ChosenPlanStateEnum, - chatId: - null == chatId - ? _value.chatId - : chatId // ignore: cast_nullable_to_non_nullable - as String, - consultantId: - null == consultantId - ? _value.consultantId - : consultantId // ignore: cast_nullable_to_non_nullable - as int, - plan: - null == plan - ? _value.plan - : plan // ignore: cast_nullable_to_non_nullable - as PlanModel, - ), - ); + return _then(_$ChosenPlanModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + optionType: null == optionType + ? _value.optionType + : optionType // ignore: cast_nullable_to_non_nullable + as String, + startDate: null == startDate + ? _value.startDate + : startDate // ignore: cast_nullable_to_non_nullable + as DateTime, + chosenPlanState: null == chosenPlanState + ? _value.chosenPlanState + : chosenPlanState // ignore: cast_nullable_to_non_nullable + as ChosenPlanStateEnum, + chatId: null == chatId + ? _value.chatId + : chatId // ignore: cast_nullable_to_non_nullable + as String, + consultantId: null == consultantId + ? _value.consultantId + : consultantId // ignore: cast_nullable_to_non_nullable + as int, + plan: null == plan + ? _value.plan + : plan // ignore: cast_nullable_to_non_nullable + as PlanModel, + )); } } /// @nodoc @JsonSerializable() class _$ChosenPlanModelImpl implements _ChosenPlanModel { - _$ChosenPlanModelImpl({ - @JsonKey() required this.id, - @JsonKey(name: 'option_type') required this.optionType, - @JsonKey(name: 'start_date') required this.startDate, - @JsonKey(name: 'last_state') required this.chosenPlanState, - @JsonKey(name: 'chat_id') required this.chatId, - @JsonKey(name: 'consultant_id') required this.consultantId, - @JsonKey(name: 'plan') required this.plan, - }); + _$ChosenPlanModelImpl( + {@JsonKey() required this.id, + @JsonKey(name: 'option_type') required this.optionType, + @JsonKey(name: 'start_date') required this.startDate, + @JsonKey(name: 'last_state') required this.chosenPlanState, + @JsonKey(name: 'chat_id') required this.chatId, + @JsonKey(name: 'consultant_id') required this.consultantId, + @JsonKey(name: 'plan') required this.plan}); factory _$ChosenPlanModelImpl.fromJson(Map json) => _$$ChosenPlanModelImplFromJson(json); @@ -292,16 +266,8 @@ class _$ChosenPlanModelImpl implements _ChosenPlanModel { @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - id, - optionType, - startDate, - chosenPlanState, - chatId, - consultantId, - plan, - ); + int get hashCode => Object.hash(runtimeType, id, optionType, startDate, + chosenPlanState, chatId, consultantId, plan); /// Create a copy of ChosenPlanModel /// with the given fields replaced by the non-null parameter values. @@ -310,27 +276,27 @@ class _$ChosenPlanModelImpl implements _ChosenPlanModel { @pragma('vm:prefer-inline') _$$ChosenPlanModelImplCopyWith<_$ChosenPlanModelImpl> get copyWith => __$$ChosenPlanModelImplCopyWithImpl<_$ChosenPlanModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$ChosenPlanModelImplToJson(this); + return _$$ChosenPlanModelImplToJson( + this, + ); } } abstract class _ChosenPlanModel implements ChosenPlanModel { - factory _ChosenPlanModel({ - @JsonKey() required final int id, - @JsonKey(name: 'option_type') required final String optionType, - @JsonKey(name: 'start_date') required final DateTime startDate, - @JsonKey(name: 'last_state') - required final ChosenPlanStateEnum chosenPlanState, - @JsonKey(name: 'chat_id') required final String chatId, - @JsonKey(name: 'consultant_id') required final int consultantId, - @JsonKey(name: 'plan') required final PlanModel plan, - }) = _$ChosenPlanModelImpl; + factory _ChosenPlanModel( + {@JsonKey() required final int id, + @JsonKey(name: 'option_type') required final String optionType, + @JsonKey(name: 'start_date') required final DateTime startDate, + @JsonKey(name: 'last_state') + required final ChosenPlanStateEnum chosenPlanState, + @JsonKey(name: 'chat_id') required final String chatId, + @JsonKey(name: 'consultant_id') required final int consultantId, + @JsonKey(name: 'plan') required final PlanModel plan}) = + _$ChosenPlanModelImpl; factory _ChosenPlanModel.fromJson(Map json) = _$ChosenPlanModelImpl.fromJson; diff --git a/lib/features/plans/models/chosen_plan_model.g.dart b/lib/features/plans/models/chosen_plan_model.g.dart index 6705fc9b..d3e8613c 100644 --- a/lib/features/plans/models/chosen_plan_model.g.dart +++ b/lib/features/plans/models/chosen_plan_model.g.dart @@ -7,31 +7,29 @@ part of 'chosen_plan_model.dart'; // ************************************************************************** _$ChosenPlanModelImpl _$$ChosenPlanModelImplFromJson( - Map json, -) => _$ChosenPlanModelImpl( - id: (json['id'] as num).toInt(), - optionType: json['option_type'] as String, - startDate: DateTime.parse(json['start_date'] as String), - chosenPlanState: $enumDecode( - _$ChosenPlanStateEnumEnumMap, - json['last_state'], - ), - chatId: json['chat_id'] as String, - consultantId: (json['consultant_id'] as num).toInt(), - plan: PlanModel.fromJson(json['plan'] as Map), -); + Map json) => + _$ChosenPlanModelImpl( + id: (json['id'] as num).toInt(), + optionType: json['option_type'] as String, + startDate: DateTime.parse(json['start_date'] as String), + chosenPlanState: + $enumDecode(_$ChosenPlanStateEnumEnumMap, json['last_state']), + chatId: json['chat_id'] as String, + consultantId: (json['consultant_id'] as num).toInt(), + plan: PlanModel.fromJson(json['plan'] as Map), + ); Map _$$ChosenPlanModelImplToJson( - _$ChosenPlanModelImpl instance, -) => { - 'id': instance.id, - 'option_type': instance.optionType, - 'start_date': instance.startDate.toIso8601String(), - 'last_state': _$ChosenPlanStateEnumEnumMap[instance.chosenPlanState]!, - 'chat_id': instance.chatId, - 'consultant_id': instance.consultantId, - 'plan': instance.plan, -}; + _$ChosenPlanModelImpl instance) => + { + 'id': instance.id, + 'option_type': instance.optionType, + 'start_date': instance.startDate.toIso8601String(), + 'last_state': _$ChosenPlanStateEnumEnumMap[instance.chosenPlanState]!, + 'chat_id': instance.chatId, + 'consultant_id': instance.consultantId, + 'plan': instance.plan, + }; const _$ChosenPlanStateEnumEnumMap = { ChosenPlanStateEnum.stateInited: 'initied', diff --git a/lib/features/plans/presentation/cubit/about_plan_cubit.dart b/lib/features/plans/presentation/cubit/about_plan_cubit.dart index 4cf93e12..87aed754 100644 --- a/lib/features/plans/presentation/cubit/about_plan_cubit.dart +++ b/lib/features/plans/presentation/cubit/about_plan_cubit.dart @@ -61,7 +61,7 @@ class AboutPlanCubit extends Cubit { EasyDebounce.debounce( 'like_plan_$slug', - Duration(seconds: 1), + const Duration(seconds: 1), () async { try { await planRepository.likePlan(slug); @@ -86,7 +86,7 @@ class AboutPlanCubit extends Cubit { } EasyDebounce.debounce( 'add_or_remove_plan_to_favorites', - Duration(seconds: 1), + const Duration(seconds: 1), () async { try { await planRepository.addToFavorite(slug); @@ -112,7 +112,7 @@ class AboutPlanCubit extends Cubit { } EasyDebounce.debounce( 'add_or_remove_plan_to_favorites', - Duration(seconds: 1), + const Duration(seconds: 1), () async { try { await planRepository.removeFromFavorite(slug); diff --git a/lib/features/plans/presentation/cubit/about_plan_state.freezed.dart b/lib/features/plans/presentation/cubit/about_plan_state.freezed.dart index 3533a506..fb0613ca 100644 --- a/lib/features/plans/presentation/cubit/about_plan_state.freezed.dart +++ b/lib/features/plans/presentation/cubit/about_plan_state.freezed.dart @@ -12,8 +12,7 @@ part of 'about_plan_state.dart'; 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', -); + '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'); /// @nodoc mixin _$AboutPlanState { @@ -32,16 +31,14 @@ mixin _$AboutPlanState { /// @nodoc abstract class $AboutPlanStateCopyWith<$Res> { factory $AboutPlanStateCopyWith( - AboutPlanState value, - $Res Function(AboutPlanState) then, - ) = _$AboutPlanStateCopyWithImpl<$Res, AboutPlanState>; + AboutPlanState value, $Res Function(AboutPlanState) then) = + _$AboutPlanStateCopyWithImpl<$Res, AboutPlanState>; @useResult - $Res call({ - bool isLoading, - String? error, - PlanModel? planModel, - int chosenOptionIndex, - }); + $Res call( + {bool isLoading, + String? error, + PlanModel? planModel, + int chosenOptionIndex}); $PlanModelCopyWith<$Res>? get planModel; } @@ -66,31 +63,24 @@ class _$AboutPlanStateCopyWithImpl<$Res, $Val extends AboutPlanState> Object? planModel = freezed, Object? chosenOptionIndex = null, }) { - return _then( - _value.copyWith( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - planModel: - freezed == planModel - ? _value.planModel - : planModel // ignore: cast_nullable_to_non_nullable - as PlanModel?, - chosenOptionIndex: - null == chosenOptionIndex - ? _value.chosenOptionIndex - : chosenOptionIndex // ignore: cast_nullable_to_non_nullable - as int, - ) - as $Val, - ); + return _then(_value.copyWith( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + planModel: freezed == planModel + ? _value.planModel + : planModel // ignore: cast_nullable_to_non_nullable + as PlanModel?, + chosenOptionIndex: null == chosenOptionIndex + ? _value.chosenOptionIndex + : chosenOptionIndex // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); } /// Create a copy of AboutPlanState @@ -111,18 +101,16 @@ class _$AboutPlanStateCopyWithImpl<$Res, $Val extends AboutPlanState> /// @nodoc abstract class _$$AboutPlanStateImplCopyWith<$Res> implements $AboutPlanStateCopyWith<$Res> { - factory _$$AboutPlanStateImplCopyWith( - _$AboutPlanStateImpl value, - $Res Function(_$AboutPlanStateImpl) then, - ) = __$$AboutPlanStateImplCopyWithImpl<$Res>; + factory _$$AboutPlanStateImplCopyWith(_$AboutPlanStateImpl value, + $Res Function(_$AboutPlanStateImpl) then) = + __$$AboutPlanStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - bool isLoading, - String? error, - PlanModel? planModel, - int chosenOptionIndex, - }); + $Res call( + {bool isLoading, + String? error, + PlanModel? planModel, + int chosenOptionIndex}); @override $PlanModelCopyWith<$Res>? get planModel; @@ -133,9 +121,8 @@ class __$$AboutPlanStateImplCopyWithImpl<$Res> extends _$AboutPlanStateCopyWithImpl<$Res, _$AboutPlanStateImpl> implements _$$AboutPlanStateImplCopyWith<$Res> { __$$AboutPlanStateImplCopyWithImpl( - _$AboutPlanStateImpl _value, - $Res Function(_$AboutPlanStateImpl) _then, - ) : super(_value, _then); + _$AboutPlanStateImpl _value, $Res Function(_$AboutPlanStateImpl) _then) + : super(_value, _then); /// Create a copy of AboutPlanState /// with the given fields replaced by the non-null parameter values. @@ -147,42 +134,35 @@ class __$$AboutPlanStateImplCopyWithImpl<$Res> Object? planModel = freezed, Object? chosenOptionIndex = null, }) { - return _then( - _$AboutPlanStateImpl( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - planModel: - freezed == planModel - ? _value.planModel - : planModel // ignore: cast_nullable_to_non_nullable - as PlanModel?, - chosenOptionIndex: - null == chosenOptionIndex - ? _value.chosenOptionIndex - : chosenOptionIndex // ignore: cast_nullable_to_non_nullable - as int, - ), - ); + return _then(_$AboutPlanStateImpl( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + planModel: freezed == planModel + ? _value.planModel + : planModel // ignore: cast_nullable_to_non_nullable + as PlanModel?, + chosenOptionIndex: null == chosenOptionIndex + ? _value.chosenOptionIndex + : chosenOptionIndex // ignore: cast_nullable_to_non_nullable + as int, + )); } } /// @nodoc class _$AboutPlanStateImpl implements _AboutPlanState { - const _$AboutPlanStateImpl({ - required this.isLoading, - required this.error, - required this.planModel, - required this.chosenOptionIndex, - }); + const _$AboutPlanStateImpl( + {required this.isLoading, + required this.error, + required this.planModel, + required this.chosenOptionIndex}); @override final bool isLoading; @@ -223,18 +203,15 @@ class _$AboutPlanStateImpl implements _AboutPlanState { @pragma('vm:prefer-inline') _$$AboutPlanStateImplCopyWith<_$AboutPlanStateImpl> get copyWith => __$$AboutPlanStateImplCopyWithImpl<_$AboutPlanStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _AboutPlanState implements AboutPlanState { - const factory _AboutPlanState({ - required final bool isLoading, - required final String? error, - required final PlanModel? planModel, - required final int chosenOptionIndex, - }) = _$AboutPlanStateImpl; + const factory _AboutPlanState( + {required final bool isLoading, + required final String? error, + required final PlanModel? planModel, + required final int chosenOptionIndex}) = _$AboutPlanStateImpl; @override bool get isLoading; diff --git a/lib/features/plans/presentation/pages/about_plan_screen.dart b/lib/features/plans/presentation/pages/about_plan_screen.dart index 4ec3a327..0590e1be 100644 --- a/lib/features/plans/presentation/pages/about_plan_screen.dart +++ b/lib/features/plans/presentation/pages/about_plan_screen.dart @@ -32,10 +32,10 @@ import 'package:flutter_portal/flutter_portal.dart'; import 'package:flutter_svg/svg.dart'; import 'package:go_router/go_router.dart'; -import '../widgets/option_widget.dart'; +import '../../../../core/widgets/option_widget.dart'; class AboutPlanScreen extends StatefulWidget { - AboutPlanScreen({super.key, required this.plan, required this.navigateToComments, required this.index}); + const AboutPlanScreen({super.key, required this.plan, required this.navigateToComments, required this.index}); final PlanModel plan; final bool navigateToComments; final int? index; @@ -97,7 +97,7 @@ class _AboutPlanScreenState extends State { builder: (BuildContext context, CommentsState commentsState) { return BlocBuilder( builder: (context, state) { - if (state.isLoading) + if (state.isLoading) { return Scaffold( appBar: AppBar( centerTitle: true, @@ -117,7 +117,7 @@ class _AboutPlanScreenState extends State { path: 'plan/${widget.plan.id}', slug: widget.plan.slug, ), - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight, @@ -137,8 +137,9 @@ class _AboutPlanScreenState extends State { ), ], ), - body: Loader(), + body: const Loader(), ); + } WidgetsBinding.instance.addPostFrameCallback((_) { if (widget.navigateToComments && !_jumped) { _scrollToBottom(); @@ -164,7 +165,7 @@ class _AboutPlanScreenState extends State { path: 'plan/${widget.plan.id}', slug: widget.plan.slug, ), - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight, @@ -191,7 +192,7 @@ class _AboutPlanScreenState extends State { backgroundColor: appTheme.gray100, resizeToAvoidBottomInset: true, bottomSheet: Container( - padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), + padding: const EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), decoration: BoxDecoration( color: Colors.white, border: Border( @@ -221,9 +222,11 @@ class _AboutPlanScreenState extends State { onPressed: () async { final chosenPlan = await context.read().chosePlan(); if (chosenPlan == null) { + if (!context.mounted) return; showErrorDialog(context, title: 'Не удалось заказать план'); return; } + if (!context.mounted) return; GoRouter.of(context).pushReplacementNamed( 'chatScreen', extra: { @@ -238,7 +241,7 @@ class _AboutPlanScreenState extends State { ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), BookmarkButton( isFavorite: state.planModel?.isFavorite ?? false, onTap: () { @@ -258,7 +261,7 @@ class _AboutPlanScreenState extends State { ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -279,17 +282,17 @@ class _AboutPlanScreenState extends State { ), height: 32, width: 32, - child: Icon( + child: const Icon( Icons.close_rounded, size: 18, color: Colors.white, ), ), ), - if (replyId != null) SizedBox(width: 8), + if (replyId != null) const SizedBox(width: 8), Expanded( child: ConstrainedBox( - constraints: BoxConstraints(minHeight: 52), + constraints: const BoxConstraints(minHeight: 52), child: TextFormField( textCapitalization: TextCapitalization.sentences, onChanged: (_) { @@ -299,7 +302,7 @@ class _AboutPlanScreenState extends State { maxLines: 5, minLines: 1, keyboardType: TextInputType.multiline, - style: TextStyle( + style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, @@ -307,9 +310,9 @@ class _AboutPlanScreenState extends State { ), decoration: InputDecoration( isDense: false, // убираем true, чтобы padding учитывался корректно - contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен hintText: 'Комментарий', - hintStyle: TextStyle( + hintStyle: const TextStyle( fontSize: 16, fontWeight: FontWeight.w400, height: 1.2, @@ -318,21 +321,21 @@ class _AboutPlanScreenState extends State { filled: true, border: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), ), ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), GestureDetector( onTap: () { if (textEditingController.text.length > 2) { @@ -348,8 +351,10 @@ class _AboutPlanScreenState extends State { replyId = null; }); - Future.delayed(Duration(milliseconds: 500), () { - context.read().getPlan(widget.plan.slug); + Future.delayed(const Duration(milliseconds: 500), () { + if (context.mounted) { + context.read().getPlan(widget.plan.slug); + } }); FocusManager.instance.primaryFocus?.unfocus(); } @@ -392,7 +397,7 @@ class _AboutPlanScreenState extends State { path: 'plan/${widget.plan.id}', slug: widget.plan.slug, ), - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight, @@ -414,11 +419,11 @@ class _AboutPlanScreenState extends State { ), body: SingleChildScrollView( controller: scrollController, - padding: EdgeInsets.only(bottom: 160), + padding: const EdgeInsets.only(bottom: 160), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 8), + const SizedBox(height: 8), MainBackgroundBouble( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -426,7 +431,7 @@ class _AboutPlanScreenState extends State { Stack( children: [ CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + widget.plan.image, + imageUrl: '$baseUrl/storage/${widget.plan.image}', height: 300, width: MediaQuery.sizeOf(context).width, fit: BoxFit.fill, @@ -439,22 +444,23 @@ class _AboutPlanScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset('assets/icons/eye.svg', width: 18, height: 12), - SizedBox(width: 8), + const SizedBox(width: 8), Text( widget.plan.totalViews.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), - SizedBox(width: 12), + const SizedBox(width: 12), GestureDetector( onTap: () { context.read().likePlan(slug: widget.plan.slug, index: widget.index); }, child: InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset( 'assets/icons/heart.svg', @@ -462,33 +468,32 @@ class _AboutPlanScreenState extends State { height: 12, colorFilter: state.planModel?.wasLikedByMe == true ? ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn) : null, ), - SizedBox(width: 8), + const SizedBox(width: 8), Text( state.planModel?.totalLikes.toString() ?? '0', style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), ), - SizedBox(width: 12), + const SizedBox(width: 12), InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset('assets/icons/comment2.svg', width: 13, height: 12), - SizedBox(width: 8), + const SizedBox(width: 8), Text( widget.plan.totalComments.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), ], ), ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( @@ -496,12 +501,12 @@ class _AboutPlanScreenState extends State { style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), InfoRow(plan: state.planModel, type: ProductType.plan), ExpandableText( text: widget.plan.details, ), - SizedBox(height: 20), + const SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: AuthorCard( @@ -509,11 +514,11 @@ class _AboutPlanScreenState extends State { title: s.plan_author, ), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ), - SizedBox(height: 16), + const SizedBox(height: 16), if (state.planModel?.packetsCount == 3) ...[ OptionsTab( cost: [ @@ -522,7 +527,7 @@ class _AboutPlanScreenState extends State { state.planModel?.packet3Options?.price ?? 0, ], ), - SizedBox(height: 12), + const SizedBox(height: 12), ], switch (state.chosenOptionIndex) { 1 => OptionWidget( @@ -535,15 +540,15 @@ class _AboutPlanScreenState extends State { option: state.planModel?.packet1Options, ), }, - SizedBox( + const SizedBox( height: 16, ), MainBackgroundBouble( - padding: EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 16), child: Column( children: [ Container( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), alignment: Alignment.centerLeft, child: Text( '${state.planModel?.totalComments ?? 0} ${getCommentForm(state.planModel?.totalComments ?? 0, s)}', @@ -552,7 +557,7 @@ class _AboutPlanScreenState extends State { ), ), ), - SizedBox(height: 16), + const SizedBox(height: 16), if (commentsState is CommentsStateLoading) const Loader(), if (commentsState is CommentsStateLoaded) CommentsWidget( diff --git a/lib/features/plans/presentation/widgets/option_duration_widget.dart b/lib/features/plans/presentation/widgets/option_duration_widget.dart deleted file mode 100644 index e31b37b4..00000000 --- a/lib/features/plans/presentation/widgets/option_duration_widget.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:eatvio_app/core/theme/custom_text_style.dart'; -import 'package:eatvio_app/core/theme/theme_helper.dart'; -import 'package:eatvio_app/core/utils/localization_utils.dart'; -import 'package:eatvio_app/generated/l10n.dart'; -import 'package:flutter/material.dart'; - -class OptionDurationWidget extends StatelessWidget { - const OptionDurationWidget({super.key, required this.duration}); - final int duration; - @override - Widget build(BuildContext context) { - final s = S.of(context); - return Container( - decoration: BoxDecoration(borderRadius: BorderRadius.circular(4), color: appTheme.cardBackground), - child: Row( - children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 4), - child: Container( - width: 4, - height: 20, - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.only( - topRight: Radius.circular(100), - bottomRight: Radius.circular(100), - ), - ), - ), - ), - SizedBox( - width: 12, - ), - Text( - '${s.option_duration} $duration ${getDayForm(duration, s)}', - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), - SizedBox( - width: 12, - ), - ], - ), - ); - } -} diff --git a/lib/features/plans/presentation/widgets/option_widget.dart b/lib/features/plans/presentation/widgets/option_widget.dart deleted file mode 100644 index 6251dbe4..00000000 --- a/lib/features/plans/presentation/widgets/option_widget.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:eatvio_app/core/theme/custom_text_style.dart'; -import 'package:eatvio_app/core/theme/theme_helper.dart'; -import 'package:eatvio_app/core/widgets/custom_divider.dart'; -import 'package:eatvio_app/core/widgets/main_background_bouble.dart'; -import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart'; -import 'package:eatvio_app/core/widgets/item_widget.dart'; -import 'package:eatvio_app/features/plans/presentation/widgets/option_duration_widget.dart'; -import 'package:flutter/material.dart'; - -class OptionWidget extends StatelessWidget { - const OptionWidget({super.key, required this.option}); - final PacketOptions? option; - @override - Widget build(BuildContext context) { - if (option == null) { - return SizedBox.shrink(); - } - return MainBackgroundBouble( - padding: EdgeInsets.symmetric(horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 16), - Text( - option?.short ?? '', - style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), - ), - SizedBox(height: 12), - Text( - option?.description ?? '', - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), - SizedBox(height: 12), - OptionDurationWidget(duration: 7), - SizedBox(height: 16), - CustomDivider(), - SizedBox(height: 16), - ListView.separated( - physics: NeverScrollableScrollPhysics(), - separatorBuilder: (context, index) => SizedBox(height: 12), - itemBuilder: (context, index) => ItemWidget(text: option?.items[index] ?? ''), - itemCount: option?.items.length ?? 0, - shrinkWrap: true, - ), - ], - ), - ); - } -} diff --git a/lib/features/plans/presentation/widgets/options_tab.dart b/lib/features/plans/presentation/widgets/options_tab.dart index 8f230b71..912183d7 100644 --- a/lib/features/plans/presentation/widgets/options_tab.dart +++ b/lib/features/plans/presentation/widgets/options_tab.dart @@ -14,7 +14,7 @@ class OptionsTab extends StatelessWidget { builder: (context, state) { final selectedOption = state.chosenOptionIndex; return Container( - margin: EdgeInsets.symmetric(horizontal: 4), + margin: const EdgeInsets.symmetric(horizontal: 4), decoration: BoxDecoration( color: appTheme.whiteA700, borderRadius: BorderRadius.circular(100), diff --git a/lib/features/profile/models/badge_model.freezed.dart b/lib/features/profile/models/badge_model.freezed.dart index 22dee85e..e71a7072 100644 --- a/lib/features/profile/models/badge_model.freezed.dart +++ b/lib/features/profile/models/badge_model.freezed.dart @@ -12,8 +12,7 @@ part of 'badge_model.dart'; 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', -); + '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'); BadgeModel _$BadgeModelFromJson(Map json) { return _BadgeModel.fromJson(json); @@ -40,17 +39,11 @@ mixin _$BadgeModel { /// @nodoc abstract class $BadgeModelCopyWith<$Res> { factory $BadgeModelCopyWith( - BadgeModel value, - $Res Function(BadgeModel) then, - ) = _$BadgeModelCopyWithImpl<$Res, BadgeModel>; + BadgeModel value, $Res Function(BadgeModel) then) = + _$BadgeModelCopyWithImpl<$Res, BadgeModel>; @useResult - $Res call({ - int id, - String title, - String description, - String image, - String type, - }); + $Res call( + {int id, String title, String description, String image, String type}); } /// @nodoc @@ -74,36 +67,28 @@ class _$BadgeModelCopyWithImpl<$Res, $Val extends BadgeModel> Object? image = null, Object? type = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -111,18 +96,12 @@ class _$BadgeModelCopyWithImpl<$Res, $Val extends BadgeModel> abstract class _$$BadgeModelImplCopyWith<$Res> implements $BadgeModelCopyWith<$Res> { factory _$$BadgeModelImplCopyWith( - _$BadgeModelImpl value, - $Res Function(_$BadgeModelImpl) then, - ) = __$$BadgeModelImplCopyWithImpl<$Res>; + _$BadgeModelImpl value, $Res Function(_$BadgeModelImpl) then) = + __$$BadgeModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - int id, - String title, - String description, - String image, - String type, - }); + $Res call( + {int id, String title, String description, String image, String type}); } /// @nodoc @@ -130,9 +109,8 @@ class __$$BadgeModelImplCopyWithImpl<$Res> extends _$BadgeModelCopyWithImpl<$Res, _$BadgeModelImpl> implements _$$BadgeModelImplCopyWith<$Res> { __$$BadgeModelImplCopyWithImpl( - _$BadgeModelImpl _value, - $Res Function(_$BadgeModelImpl) _then, - ) : super(_value, _then); + _$BadgeModelImpl _value, $Res Function(_$BadgeModelImpl) _then) + : super(_value, _then); /// Create a copy of BadgeModel /// with the given fields replaced by the non-null parameter values. @@ -145,48 +123,40 @@ class __$$BadgeModelImplCopyWithImpl<$Res> Object? image = null, Object? type = null, }) { - return _then( - _$BadgeModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - description: - null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - image: - null == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String, - type: - null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + return _then(_$BadgeModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + image: null == image + ? _value.image + : image // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); } } /// @nodoc @JsonSerializable() class _$BadgeModelImpl implements _BadgeModel { - const _$BadgeModelImpl({ - required this.id, - required this.title, - required this.description, - required this.image, - required this.type, - }); + const _$BadgeModelImpl( + {required this.id, + required this.title, + required this.description, + required this.image, + required this.type}); factory _$BadgeModelImpl.fromJson(Map json) => _$$BadgeModelImplFromJson(json); @@ -235,18 +205,19 @@ class _$BadgeModelImpl implements _BadgeModel { @override Map toJson() { - return _$$BadgeModelImplToJson(this); + return _$$BadgeModelImplToJson( + this, + ); } } abstract class _BadgeModel implements BadgeModel { - const factory _BadgeModel({ - required final int id, - required final String title, - required final String description, - required final String image, - required final String type, - }) = _$BadgeModelImpl; + const factory _BadgeModel( + {required final int id, + required final String title, + required final String description, + required final String image, + required final String type}) = _$BadgeModelImpl; factory _BadgeModel.fromJson(Map json) = _$BadgeModelImpl.fromJson; diff --git a/lib/features/profile/models/chosen_diets_pagination_model.freezed.dart b/lib/features/profile/models/chosen_diets_pagination_model.freezed.dart index 110934d1..3514c6a3 100644 --- a/lib/features/profile/models/chosen_diets_pagination_model.freezed.dart +++ b/lib/features/profile/models/chosen_diets_pagination_model.freezed.dart @@ -12,12 +12,10 @@ part of 'chosen_diets_pagination_model.dart'; 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', -); + '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'); ChosenDietsPaginationModel _$ChosenDietsPaginationModelFromJson( - Map json, -) { + Map json) { return _ChosenDietsPaginationModel.fromJson(json); } @@ -33,28 +31,22 @@ mixin _$ChosenDietsPaginationModel { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) $ChosenDietsPaginationModelCopyWith - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $ChosenDietsPaginationModelCopyWith<$Res> { - factory $ChosenDietsPaginationModelCopyWith( - ChosenDietsPaginationModel value, - $Res Function(ChosenDietsPaginationModel) then, - ) = - _$ChosenDietsPaginationModelCopyWithImpl< - $Res, - ChosenDietsPaginationModel - >; + factory $ChosenDietsPaginationModelCopyWith(ChosenDietsPaginationModel value, + $Res Function(ChosenDietsPaginationModel) then) = + _$ChosenDietsPaginationModelCopyWithImpl<$Res, + ChosenDietsPaginationModel>; @useResult $Res call({@JsonKey(name: 'data') List diets}); } /// @nodoc -class _$ChosenDietsPaginationModelCopyWithImpl< - $Res, - $Val extends ChosenDietsPaginationModel -> +class _$ChosenDietsPaginationModelCopyWithImpl<$Res, + $Val extends ChosenDietsPaginationModel> implements $ChosenDietsPaginationModelCopyWith<$Res> { _$ChosenDietsPaginationModelCopyWithImpl(this._value, this._then); @@ -67,17 +59,15 @@ class _$ChosenDietsPaginationModelCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? diets = null}) { - return _then( - _value.copyWith( - diets: - null == diets - ? _value.diets - : diets // ignore: cast_nullable_to_non_nullable - as List, - ) - as $Val, - ); + $Res call({ + Object? diets = null, + }) { + return _then(_value.copyWith( + diets: null == diets + ? _value.diets + : diets // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); } } @@ -85,9 +75,9 @@ class _$ChosenDietsPaginationModelCopyWithImpl< abstract class _$$ChosenDietsPaginationModelImplCopyWith<$Res> implements $ChosenDietsPaginationModelCopyWith<$Res> { factory _$$ChosenDietsPaginationModelImplCopyWith( - _$ChosenDietsPaginationModelImpl value, - $Res Function(_$ChosenDietsPaginationModelImpl) then, - ) = __$$ChosenDietsPaginationModelImplCopyWithImpl<$Res>; + _$ChosenDietsPaginationModelImpl value, + $Res Function(_$ChosenDietsPaginationModelImpl) then) = + __$$ChosenDietsPaginationModelImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: 'data') List diets}); @@ -95,44 +85,40 @@ abstract class _$$ChosenDietsPaginationModelImplCopyWith<$Res> /// @nodoc class __$$ChosenDietsPaginationModelImplCopyWithImpl<$Res> - extends - _$ChosenDietsPaginationModelCopyWithImpl< - $Res, - _$ChosenDietsPaginationModelImpl - > + extends _$ChosenDietsPaginationModelCopyWithImpl<$Res, + _$ChosenDietsPaginationModelImpl> implements _$$ChosenDietsPaginationModelImplCopyWith<$Res> { __$$ChosenDietsPaginationModelImplCopyWithImpl( - _$ChosenDietsPaginationModelImpl _value, - $Res Function(_$ChosenDietsPaginationModelImpl) _then, - ) : super(_value, _then); + _$ChosenDietsPaginationModelImpl _value, + $Res Function(_$ChosenDietsPaginationModelImpl) _then) + : super(_value, _then); /// Create a copy of ChosenDietsPaginationModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? diets = null}) { - return _then( - _$ChosenDietsPaginationModelImpl( - diets: - null == diets - ? _value._diets - : diets // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + $Res call({ + Object? diets = null, + }) { + return _then(_$ChosenDietsPaginationModelImpl( + diets: null == diets + ? _value._diets + : diets // ignore: cast_nullable_to_non_nullable + as List, + )); } } /// @nodoc @JsonSerializable() class _$ChosenDietsPaginationModelImpl implements _ChosenDietsPaginationModel { - _$ChosenDietsPaginationModelImpl({ - @JsonKey(name: 'data') required final List diets, - }) : _diets = diets; + _$ChosenDietsPaginationModelImpl( + {@JsonKey(name: 'data') required final List diets}) + : _diets = diets; factory _$ChosenDietsPaginationModelImpl.fromJson( - Map json, - ) => _$$ChosenDietsPaginationModelImplFromJson(json); + Map json) => + _$$ChosenDietsPaginationModelImplFromJson(json); final List _diets; @override @@ -167,21 +153,22 @@ class _$ChosenDietsPaginationModelImpl implements _ChosenDietsPaginationModel { @override @pragma('vm:prefer-inline') _$$ChosenDietsPaginationModelImplCopyWith<_$ChosenDietsPaginationModelImpl> - get copyWith => __$$ChosenDietsPaginationModelImplCopyWithImpl< - _$ChosenDietsPaginationModelImpl - >(this, _$identity); + get copyWith => __$$ChosenDietsPaginationModelImplCopyWithImpl< + _$ChosenDietsPaginationModelImpl>(this, _$identity); @override Map toJson() { - return _$$ChosenDietsPaginationModelImplToJson(this); + return _$$ChosenDietsPaginationModelImplToJson( + this, + ); } } abstract class _ChosenDietsPaginationModel implements ChosenDietsPaginationModel { - factory _ChosenDietsPaginationModel({ - @JsonKey(name: 'data') required final List diets, - }) = _$ChosenDietsPaginationModelImpl; + factory _ChosenDietsPaginationModel( + {@JsonKey(name: 'data') required final List diets}) = + _$ChosenDietsPaginationModelImpl; factory _ChosenDietsPaginationModel.fromJson(Map json) = _$ChosenDietsPaginationModelImpl.fromJson; @@ -195,7 +182,7 @@ abstract class _ChosenDietsPaginationModel @override @JsonKey(includeFromJson: false, includeToJson: false) _$$ChosenDietsPaginationModelImplCopyWith<_$ChosenDietsPaginationModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } ChosenDietModel _$ChosenDietModelFromJson(Map json) { @@ -228,17 +215,15 @@ mixin _$ChosenDietModel { /// @nodoc abstract class $ChosenDietModelCopyWith<$Res> { factory $ChosenDietModelCopyWith( - ChosenDietModel value, - $Res Function(ChosenDietModel) then, - ) = _$ChosenDietModelCopyWithImpl<$Res, ChosenDietModel>; + ChosenDietModel value, $Res Function(ChosenDietModel) then) = + _$ChosenDietModelCopyWithImpl<$Res, ChosenDietModel>; @useResult - $Res call({ - @JsonKey(name: 'id') int chosenDietID, - @JsonKey(name: 'chosen_plan_id') int chosenPlanId, - @JsonKey() String state, - @JsonKey(name: 'start_date', fromJson: parseDate) DateTime startDate, - @JsonKey(name: 'diet', fromJson: _parseDietId) int? dietId, - }); + $Res call( + {@JsonKey(name: 'id') int chosenDietID, + @JsonKey(name: 'chosen_plan_id') int chosenPlanId, + @JsonKey() String state, + @JsonKey(name: 'start_date', fromJson: parseDate) DateTime startDate, + @JsonKey(name: 'diet', fromJson: _parseDietId) int? dietId}); } /// @nodoc @@ -262,55 +247,45 @@ class _$ChosenDietModelCopyWithImpl<$Res, $Val extends ChosenDietModel> Object? startDate = null, Object? dietId = freezed, }) { - return _then( - _value.copyWith( - chosenDietID: - null == chosenDietID - ? _value.chosenDietID - : chosenDietID // ignore: cast_nullable_to_non_nullable - as int, - chosenPlanId: - null == chosenPlanId - ? _value.chosenPlanId - : chosenPlanId // ignore: cast_nullable_to_non_nullable - as int, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - startDate: - null == startDate - ? _value.startDate - : startDate // ignore: cast_nullable_to_non_nullable - as DateTime, - dietId: - freezed == dietId - ? _value.dietId - : dietId // ignore: cast_nullable_to_non_nullable - as int?, - ) - as $Val, - ); + return _then(_value.copyWith( + chosenDietID: null == chosenDietID + ? _value.chosenDietID + : chosenDietID // ignore: cast_nullable_to_non_nullable + as int, + chosenPlanId: null == chosenPlanId + ? _value.chosenPlanId + : chosenPlanId // ignore: cast_nullable_to_non_nullable + as int, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + startDate: null == startDate + ? _value.startDate + : startDate // ignore: cast_nullable_to_non_nullable + as DateTime, + dietId: freezed == dietId + ? _value.dietId + : dietId // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); } } /// @nodoc abstract class _$$ChosenDietModelImplCopyWith<$Res> implements $ChosenDietModelCopyWith<$Res> { - factory _$$ChosenDietModelImplCopyWith( - _$ChosenDietModelImpl value, - $Res Function(_$ChosenDietModelImpl) then, - ) = __$$ChosenDietModelImplCopyWithImpl<$Res>; + factory _$$ChosenDietModelImplCopyWith(_$ChosenDietModelImpl value, + $Res Function(_$ChosenDietModelImpl) then) = + __$$ChosenDietModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'id') int chosenDietID, - @JsonKey(name: 'chosen_plan_id') int chosenPlanId, - @JsonKey() String state, - @JsonKey(name: 'start_date', fromJson: parseDate) DateTime startDate, - @JsonKey(name: 'diet', fromJson: _parseDietId) int? dietId, - }); + $Res call( + {@JsonKey(name: 'id') int chosenDietID, + @JsonKey(name: 'chosen_plan_id') int chosenPlanId, + @JsonKey() String state, + @JsonKey(name: 'start_date', fromJson: parseDate) DateTime startDate, + @JsonKey(name: 'diet', fromJson: _parseDietId) int? dietId}); } /// @nodoc @@ -318,9 +293,8 @@ class __$$ChosenDietModelImplCopyWithImpl<$Res> extends _$ChosenDietModelCopyWithImpl<$Res, _$ChosenDietModelImpl> implements _$$ChosenDietModelImplCopyWith<$Res> { __$$ChosenDietModelImplCopyWithImpl( - _$ChosenDietModelImpl _value, - $Res Function(_$ChosenDietModelImpl) _then, - ) : super(_value, _then); + _$ChosenDietModelImpl _value, $Res Function(_$ChosenDietModelImpl) _then) + : super(_value, _then); /// Create a copy of ChosenDietModel /// with the given fields replaced by the non-null parameter values. @@ -333,48 +307,40 @@ class __$$ChosenDietModelImplCopyWithImpl<$Res> Object? startDate = null, Object? dietId = freezed, }) { - return _then( - _$ChosenDietModelImpl( - chosenDietID: - null == chosenDietID - ? _value.chosenDietID - : chosenDietID // ignore: cast_nullable_to_non_nullable - as int, - chosenPlanId: - null == chosenPlanId - ? _value.chosenPlanId - : chosenPlanId // ignore: cast_nullable_to_non_nullable - as int, - state: - null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as String, - startDate: - null == startDate - ? _value.startDate - : startDate // ignore: cast_nullable_to_non_nullable - as DateTime, - dietId: - freezed == dietId - ? _value.dietId - : dietId // ignore: cast_nullable_to_non_nullable - as int?, - ), - ); + return _then(_$ChosenDietModelImpl( + chosenDietID: null == chosenDietID + ? _value.chosenDietID + : chosenDietID // ignore: cast_nullable_to_non_nullable + as int, + chosenPlanId: null == chosenPlanId + ? _value.chosenPlanId + : chosenPlanId // ignore: cast_nullable_to_non_nullable + as int, + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as String, + startDate: null == startDate + ? _value.startDate + : startDate // ignore: cast_nullable_to_non_nullable + as DateTime, + dietId: freezed == dietId + ? _value.dietId + : dietId // ignore: cast_nullable_to_non_nullable + as int?, + )); } } /// @nodoc @JsonSerializable() class _$ChosenDietModelImpl implements _ChosenDietModel { - _$ChosenDietModelImpl({ - @JsonKey(name: 'id') required this.chosenDietID, - @JsonKey(name: 'chosen_plan_id') required this.chosenPlanId, - @JsonKey() required this.state, - @JsonKey(name: 'start_date', fromJson: parseDate) required this.startDate, - @JsonKey(name: 'diet', fromJson: _parseDietId) required this.dietId, - }); + _$ChosenDietModelImpl( + {@JsonKey(name: 'id') required this.chosenDietID, + @JsonKey(name: 'chosen_plan_id') required this.chosenPlanId, + @JsonKey() required this.state, + @JsonKey(name: 'start_date', fromJson: parseDate) required this.startDate, + @JsonKey(name: 'diet', fromJson: _parseDietId) required this.dietId}); factory _$ChosenDietModelImpl.fromJson(Map json) => _$$ChosenDietModelImplFromJson(json); @@ -418,13 +384,7 @@ class _$ChosenDietModelImpl implements _ChosenDietModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - chosenDietID, - chosenPlanId, - state, - startDate, - dietId, - ); + runtimeType, chosenDietID, chosenPlanId, state, startDate, dietId); /// Create a copy of ChosenDietModel /// with the given fields replaced by the non-null parameter values. @@ -433,25 +393,25 @@ class _$ChosenDietModelImpl implements _ChosenDietModel { @pragma('vm:prefer-inline') _$$ChosenDietModelImplCopyWith<_$ChosenDietModelImpl> get copyWith => __$$ChosenDietModelImplCopyWithImpl<_$ChosenDietModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$ChosenDietModelImplToJson(this); + return _$$ChosenDietModelImplToJson( + this, + ); } } abstract class _ChosenDietModel implements ChosenDietModel { - factory _ChosenDietModel({ - @JsonKey(name: 'id') required final int chosenDietID, - @JsonKey(name: 'chosen_plan_id') required final int chosenPlanId, - @JsonKey() required final String state, - @JsonKey(name: 'start_date', fromJson: parseDate) - required final DateTime startDate, - @JsonKey(name: 'diet', fromJson: _parseDietId) required final int? dietId, - }) = _$ChosenDietModelImpl; + factory _ChosenDietModel( + {@JsonKey(name: 'id') required final int chosenDietID, + @JsonKey(name: 'chosen_plan_id') required final int chosenPlanId, + @JsonKey() required final String state, + @JsonKey(name: 'start_date', fromJson: parseDate) + required final DateTime startDate, + @JsonKey(name: 'diet', fromJson: _parseDietId) + required final int? dietId}) = _$ChosenDietModelImpl; factory _ChosenDietModel.fromJson(Map json) = _$ChosenDietModelImpl.fromJson; diff --git a/lib/features/profile/models/chosen_diets_pagination_model.g.dart b/lib/features/profile/models/chosen_diets_pagination_model.g.dart index 8205bb38..75d8ffa1 100644 --- a/lib/features/profile/models/chosen_diets_pagination_model.g.dart +++ b/lib/features/profile/models/chosen_diets_pagination_model.g.dart @@ -7,34 +7,35 @@ part of 'chosen_diets_pagination_model.dart'; // ************************************************************************** _$ChosenDietsPaginationModelImpl _$$ChosenDietsPaginationModelImplFromJson( - Map json, -) => _$ChosenDietsPaginationModelImpl( - diets: - (json['data'] as List) + Map json) => + _$ChosenDietsPaginationModelImpl( + diets: (json['data'] as List) .map((e) => ChosenDietModel.fromJson(e as Map)) .toList(), -); + ); Map _$$ChosenDietsPaginationModelImplToJson( - _$ChosenDietsPaginationModelImpl instance, -) => {'data': instance.diets}; + _$ChosenDietsPaginationModelImpl instance) => + { + 'data': instance.diets, + }; _$ChosenDietModelImpl _$$ChosenDietModelImplFromJson( - Map json, -) => _$ChosenDietModelImpl( - chosenDietID: (json['id'] as num).toInt(), - chosenPlanId: (json['chosen_plan_id'] as num).toInt(), - state: json['state'] as String, - startDate: parseDate(json['start_date'] as String), - dietId: _parseDietId(json['diet']), -); + Map json) => + _$ChosenDietModelImpl( + chosenDietID: (json['id'] as num).toInt(), + chosenPlanId: (json['chosen_plan_id'] as num).toInt(), + state: json['state'] as String, + startDate: parseDate(json['start_date'] as String), + dietId: _parseDietId(json['diet']), + ); Map _$$ChosenDietModelImplToJson( - _$ChosenDietModelImpl instance, -) => { - 'id': instance.chosenDietID, - 'chosen_plan_id': instance.chosenPlanId, - 'state': instance.state, - 'start_date': instance.startDate.toIso8601String(), - 'diet': instance.dietId, -}; + _$ChosenDietModelImpl instance) => + { + 'id': instance.chosenDietID, + 'chosen_plan_id': instance.chosenPlanId, + 'state': instance.state, + 'start_date': instance.startDate.toIso8601String(), + 'diet': instance.dietId, + }; diff --git a/lib/features/profile/models/circumference_model.freezed.dart b/lib/features/profile/models/circumference_model.freezed.dart index f782ab75..870620f3 100644 --- a/lib/features/profile/models/circumference_model.freezed.dart +++ b/lib/features/profile/models/circumference_model.freezed.dart @@ -12,8 +12,7 @@ part of 'circumference_model.dart'; 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', -); + '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'); CircumferenceModel _$CircumferenceModelFromJson(Map json) { return _CircumferenceModel.fromJson(json); @@ -49,19 +48,17 @@ mixin _$CircumferenceModel { /// @nodoc abstract class $CircumferenceModelCopyWith<$Res> { factory $CircumferenceModelCopyWith( - CircumferenceModel value, - $Res Function(CircumferenceModel) then, - ) = _$CircumferenceModelCopyWithImpl<$Res, CircumferenceModel>; + CircumferenceModel value, $Res Function(CircumferenceModel) then) = + _$CircumferenceModelCopyWithImpl<$Res, CircumferenceModel>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "user_id") int userId, - @JsonKey(name: "chest_circumference") int chestCircumference, - @JsonKey(name: "waist_circumference") int waistCircumference, - @JsonKey(name: "hip_circumference") int hipCircumference, - @JsonKey(name: "created_at") DateTime createdAt, - @JsonKey(name: "updated_at") DateTime updatedAt, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "user_id") int userId, + @JsonKey(name: "chest_circumference") int chestCircumference, + @JsonKey(name: "waist_circumference") int waistCircumference, + @JsonKey(name: "hip_circumference") int hipCircumference, + @JsonKey(name: "created_at") DateTime createdAt, + @JsonKey(name: "updated_at") DateTime updatedAt}); } /// @nodoc @@ -87,77 +84,64 @@ class _$CircumferenceModelCopyWithImpl<$Res, $Val extends CircumferenceModel> Object? createdAt = null, Object? updatedAt = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - userId: - null == userId - ? _value.userId - : userId // ignore: cast_nullable_to_non_nullable - as int, - chestCircumference: - null == chestCircumference - ? _value.chestCircumference - : chestCircumference // ignore: cast_nullable_to_non_nullable - as int, - waistCircumference: - null == waistCircumference - ? _value.waistCircumference - : waistCircumference // ignore: cast_nullable_to_non_nullable - as int, - hipCircumference: - null == hipCircumference - ? _value.hipCircumference - : hipCircumference // ignore: cast_nullable_to_non_nullable - as int, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as int, + chestCircumference: null == chestCircumference + ? _value.chestCircumference + : chestCircumference // ignore: cast_nullable_to_non_nullable + as int, + waistCircumference: null == waistCircumference + ? _value.waistCircumference + : waistCircumference // ignore: cast_nullable_to_non_nullable + as int, + hipCircumference: null == hipCircumference + ? _value.hipCircumference + : hipCircumference // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ) as $Val); } } /// @nodoc abstract class _$$CircumferenceModelImplCopyWith<$Res> implements $CircumferenceModelCopyWith<$Res> { - factory _$$CircumferenceModelImplCopyWith( - _$CircumferenceModelImpl value, - $Res Function(_$CircumferenceModelImpl) then, - ) = __$$CircumferenceModelImplCopyWithImpl<$Res>; + factory _$$CircumferenceModelImplCopyWith(_$CircumferenceModelImpl value, + $Res Function(_$CircumferenceModelImpl) then) = + __$$CircumferenceModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "user_id") int userId, - @JsonKey(name: "chest_circumference") int chestCircumference, - @JsonKey(name: "waist_circumference") int waistCircumference, - @JsonKey(name: "hip_circumference") int hipCircumference, - @JsonKey(name: "created_at") DateTime createdAt, - @JsonKey(name: "updated_at") DateTime updatedAt, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "user_id") int userId, + @JsonKey(name: "chest_circumference") int chestCircumference, + @JsonKey(name: "waist_circumference") int waistCircumference, + @JsonKey(name: "hip_circumference") int hipCircumference, + @JsonKey(name: "created_at") DateTime createdAt, + @JsonKey(name: "updated_at") DateTime updatedAt}); } /// @nodoc class __$$CircumferenceModelImplCopyWithImpl<$Res> extends _$CircumferenceModelCopyWithImpl<$Res, _$CircumferenceModelImpl> implements _$$CircumferenceModelImplCopyWith<$Res> { - __$$CircumferenceModelImplCopyWithImpl( - _$CircumferenceModelImpl _value, - $Res Function(_$CircumferenceModelImpl) _then, - ) : super(_value, _then); + __$$CircumferenceModelImplCopyWithImpl(_$CircumferenceModelImpl _value, + $Res Function(_$CircumferenceModelImpl) _then) + : super(_value, _then); /// Create a copy of CircumferenceModel /// with the given fields replaced by the non-null parameter values. @@ -172,60 +156,50 @@ class __$$CircumferenceModelImplCopyWithImpl<$Res> Object? createdAt = null, Object? updatedAt = null, }) { - return _then( - _$CircumferenceModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - userId: - null == userId - ? _value.userId - : userId // ignore: cast_nullable_to_non_nullable - as int, - chestCircumference: - null == chestCircumference - ? _value.chestCircumference - : chestCircumference // ignore: cast_nullable_to_non_nullable - as int, - waistCircumference: - null == waistCircumference - ? _value.waistCircumference - : waistCircumference // ignore: cast_nullable_to_non_nullable - as int, - hipCircumference: - null == hipCircumference - ? _value.hipCircumference - : hipCircumference // ignore: cast_nullable_to_non_nullable - as int, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - ), - ); + return _then(_$CircumferenceModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as int, + chestCircumference: null == chestCircumference + ? _value.chestCircumference + : chestCircumference // ignore: cast_nullable_to_non_nullable + as int, + waistCircumference: null == waistCircumference + ? _value.waistCircumference + : waistCircumference // ignore: cast_nullable_to_non_nullable + as int, + hipCircumference: null == hipCircumference + ? _value.hipCircumference + : hipCircumference // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); } } /// @nodoc @JsonSerializable() class _$CircumferenceModelImpl implements _CircumferenceModel { - const _$CircumferenceModelImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "user_id") required this.userId, - @JsonKey(name: "chest_circumference") required this.chestCircumference, - @JsonKey(name: "waist_circumference") required this.waistCircumference, - @JsonKey(name: "hip_circumference") required this.hipCircumference, - @JsonKey(name: "created_at") required this.createdAt, - @JsonKey(name: "updated_at") required this.updatedAt, - }); + const _$CircumferenceModelImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "user_id") required this.userId, + @JsonKey(name: "chest_circumference") required this.chestCircumference, + @JsonKey(name: "waist_circumference") required this.waistCircumference, + @JsonKey(name: "hip_circumference") required this.hipCircumference, + @JsonKey(name: "created_at") required this.createdAt, + @JsonKey(name: "updated_at") required this.updatedAt}); factory _$CircumferenceModelImpl.fromJson(Map json) => _$$CircumferenceModelImplFromJson(json); @@ -278,16 +252,8 @@ class _$CircumferenceModelImpl implements _CircumferenceModel { @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - id, - userId, - chestCircumference, - waistCircumference, - hipCircumference, - createdAt, - updatedAt, - ); + int get hashCode => Object.hash(runtimeType, id, userId, chestCircumference, + waistCircumference, hipCircumference, createdAt, updatedAt); /// Create a copy of CircumferenceModel /// with the given fields replaced by the non-null parameter values. @@ -296,26 +262,28 @@ class _$CircumferenceModelImpl implements _CircumferenceModel { @pragma('vm:prefer-inline') _$$CircumferenceModelImplCopyWith<_$CircumferenceModelImpl> get copyWith => __$$CircumferenceModelImplCopyWithImpl<_$CircumferenceModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$CircumferenceModelImplToJson(this); + return _$$CircumferenceModelImplToJson( + this, + ); } } abstract class _CircumferenceModel implements CircumferenceModel { - const factory _CircumferenceModel({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "user_id") required final int userId, - @JsonKey(name: "chest_circumference") required final int chestCircumference, - @JsonKey(name: "waist_circumference") required final int waistCircumference, - @JsonKey(name: "hip_circumference") required final int hipCircumference, - @JsonKey(name: "created_at") required final DateTime createdAt, - @JsonKey(name: "updated_at") required final DateTime updatedAt, - }) = _$CircumferenceModelImpl; + const factory _CircumferenceModel( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "user_id") required final int userId, + @JsonKey(name: "chest_circumference") + required final int chestCircumference, + @JsonKey(name: "waist_circumference") + required final int waistCircumference, + @JsonKey(name: "hip_circumference") required final int hipCircumference, + @JsonKey(name: "created_at") required final DateTime createdAt, + @JsonKey(name: "updated_at") + required final DateTime updatedAt}) = _$CircumferenceModelImpl; factory _CircumferenceModel.fromJson(Map json) = _$CircumferenceModelImpl.fromJson; diff --git a/lib/features/profile/models/circumference_model.g.dart b/lib/features/profile/models/circumference_model.g.dart index 7ae8597b..07a10f71 100644 --- a/lib/features/profile/models/circumference_model.g.dart +++ b/lib/features/profile/models/circumference_model.g.dart @@ -7,25 +7,25 @@ part of 'circumference_model.dart'; // ************************************************************************** _$CircumferenceModelImpl _$$CircumferenceModelImplFromJson( - Map json, -) => _$CircumferenceModelImpl( - id: (json['id'] as num).toInt(), - userId: (json['user_id'] as num).toInt(), - chestCircumference: (json['chest_circumference'] as num).toInt(), - waistCircumference: (json['waist_circumference'] as num).toInt(), - hipCircumference: (json['hip_circumference'] as num).toInt(), - createdAt: DateTime.parse(json['created_at'] as String), - updatedAt: DateTime.parse(json['updated_at'] as String), -); + Map json) => + _$CircumferenceModelImpl( + id: (json['id'] as num).toInt(), + userId: (json['user_id'] as num).toInt(), + chestCircumference: (json['chest_circumference'] as num).toInt(), + waistCircumference: (json['waist_circumference'] as num).toInt(), + hipCircumference: (json['hip_circumference'] as num).toInt(), + createdAt: DateTime.parse(json['created_at'] as String), + updatedAt: DateTime.parse(json['updated_at'] as String), + ); Map _$$CircumferenceModelImplToJson( - _$CircumferenceModelImpl instance, -) => { - 'id': instance.id, - 'user_id': instance.userId, - 'chest_circumference': instance.chestCircumference, - 'waist_circumference': instance.waistCircumference, - 'hip_circumference': instance.hipCircumference, - 'created_at': instance.createdAt.toIso8601String(), - 'updated_at': instance.updatedAt.toIso8601String(), -}; + _$CircumferenceModelImpl instance) => + { + 'id': instance.id, + 'user_id': instance.userId, + 'chest_circumference': instance.chestCircumference, + 'waist_circumference': instance.waistCircumference, + 'hip_circumference': instance.hipCircumference, + 'created_at': instance.createdAt.toIso8601String(), + 'updated_at': instance.updatedAt.toIso8601String(), + }; diff --git a/lib/features/profile/models/profile_model.dart b/lib/features/profile/models/profile_model.dart index 93c61635..9d4e877f 100644 --- a/lib/features/profile/models/profile_model.dart +++ b/lib/features/profile/models/profile_model.dart @@ -1,3 +1,4 @@ +import 'package:eatvio_app/features/my_finance/models/card_model.dart'; import 'package:eatvio_app/features/profile/models/badge_model.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; @@ -14,7 +15,7 @@ class ProfileModel with _$ProfileModel { @JsonKey(name: "email_verified_at") DateTime? emailVerifiedAt, @JsonKey(name: "created_at") DateTime? createdAt, @JsonKey(name: "updated_at") DateTime? updatedAt, - @JsonKey(name: "is_public_profile") required bool isPublicProfile, + @JsonKey(name: "is_public_profile", fromJson: parseBool) required bool isPublicProfile, @JsonKey(name: 'is_entity_subscribed_by_me') required bool isEntitySubscribedByMe, @JsonKey(name: "slug") required String slug, @JsonKey(name: "profile_photo_url") required String profilePhotoUrl, diff --git a/lib/features/profile/models/profile_model.freezed.dart b/lib/features/profile/models/profile_model.freezed.dart index d459ad34..0905f357 100644 --- a/lib/features/profile/models/profile_model.freezed.dart +++ b/lib/features/profile/models/profile_model.freezed.dart @@ -12,8 +12,7 @@ part of 'profile_model.dart'; 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', -); + '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'); ProfileModel _$ProfileModelFromJson(Map json) { return _ProfileModel.fromJson(json); @@ -35,7 +34,7 @@ mixin _$ProfileModel { DateTime? get createdAt => throw _privateConstructorUsedError; @JsonKey(name: "updated_at") DateTime? get updatedAt => throw _privateConstructorUsedError; - @JsonKey(name: "is_public_profile") + @JsonKey(name: "is_public_profile", fromJson: parseBool) bool get isPublicProfile => throw _privateConstructorUsedError; @JsonKey(name: 'is_entity_subscribed_by_me') bool get isEntitySubscribedByMe => throw _privateConstructorUsedError; @@ -72,30 +71,29 @@ mixin _$ProfileModel { /// @nodoc abstract class $ProfileModelCopyWith<$Res> { factory $ProfileModelCopyWith( - ProfileModel value, - $Res Function(ProfileModel) then, - ) = _$ProfileModelCopyWithImpl<$Res, ProfileModel>; + ProfileModel value, $Res Function(ProfileModel) then) = + _$ProfileModelCopyWithImpl<$Res, ProfileModel>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "name") String name, - @JsonKey(name: "email") String email, - @JsonKey(name: "rating_place") int? ratingPlace, - @JsonKey(name: "email_verified_at") DateTime? emailVerifiedAt, - @JsonKey(name: "created_at") DateTime? createdAt, - @JsonKey(name: "updated_at") DateTime? updatedAt, - @JsonKey(name: "is_public_profile") bool isPublicProfile, - @JsonKey(name: 'is_entity_subscribed_by_me') bool isEntitySubscribedByMe, - @JsonKey(name: "slug") String slug, - @JsonKey(name: "profile_photo_url") String profilePhotoUrl, - @JsonKey(name: "roles") List roles, - @JsonKey(name: "badges") List badges, - @JsonKey(name: "subscriptions") List subscriptions, - @JsonKey(name: "subscribers") List subscribers, - @JsonKey(name: "education_resource") EducationModel? educationResource, - @JsonKey(name: "cert_photos") - List? diplomasAndCertificates, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "name") String name, + @JsonKey(name: "email") String email, + @JsonKey(name: "rating_place") int? ratingPlace, + @JsonKey(name: "email_verified_at") DateTime? emailVerifiedAt, + @JsonKey(name: "created_at") DateTime? createdAt, + @JsonKey(name: "updated_at") DateTime? updatedAt, + @JsonKey(name: "is_public_profile", fromJson: parseBool) + bool isPublicProfile, + @JsonKey(name: 'is_entity_subscribed_by_me') bool isEntitySubscribedByMe, + @JsonKey(name: "slug") String slug, + @JsonKey(name: "profile_photo_url") String profilePhotoUrl, + @JsonKey(name: "roles") List roles, + @JsonKey(name: "badges") List badges, + @JsonKey(name: "subscriptions") List subscriptions, + @JsonKey(name: "subscribers") List subscribers, + @JsonKey(name: "education_resource") EducationModel? educationResource, + @JsonKey(name: "cert_photos") + List? diplomasAndCertificates}); $EducationModelCopyWith<$Res>? get educationResource; } @@ -133,96 +131,76 @@ class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel> Object? educationResource = freezed, Object? diplomasAndCertificates = freezed, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - email: - null == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String, - ratingPlace: - freezed == ratingPlace - ? _value.ratingPlace - : ratingPlace // ignore: cast_nullable_to_non_nullable - as int?, - emailVerifiedAt: - freezed == emailVerifiedAt - ? _value.emailVerifiedAt - : emailVerifiedAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - createdAt: - freezed == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - updatedAt: - freezed == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - isPublicProfile: - null == isPublicProfile - ? _value.isPublicProfile - : isPublicProfile // ignore: cast_nullable_to_non_nullable - as bool, - isEntitySubscribedByMe: - null == isEntitySubscribedByMe - ? _value.isEntitySubscribedByMe - : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable - as bool, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - profilePhotoUrl: - null == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String, - roles: - null == roles - ? _value.roles - : roles // ignore: cast_nullable_to_non_nullable - as List, - badges: - null == badges - ? _value.badges - : badges // ignore: cast_nullable_to_non_nullable - as List, - subscriptions: - null == subscriptions - ? _value.subscriptions - : subscriptions // ignore: cast_nullable_to_non_nullable - as List, - subscribers: - null == subscribers - ? _value.subscribers - : subscribers // ignore: cast_nullable_to_non_nullable - as List, - educationResource: - freezed == educationResource - ? _value.educationResource - : educationResource // ignore: cast_nullable_to_non_nullable - as EducationModel?, - diplomasAndCertificates: - freezed == diplomasAndCertificates - ? _value.diplomasAndCertificates - : diplomasAndCertificates // ignore: cast_nullable_to_non_nullable - as List?, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + ratingPlace: freezed == ratingPlace + ? _value.ratingPlace + : ratingPlace // ignore: cast_nullable_to_non_nullable + as int?, + emailVerifiedAt: freezed == emailVerifiedAt + ? _value.emailVerifiedAt + : emailVerifiedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAt: freezed == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + updatedAt: freezed == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + isPublicProfile: null == isPublicProfile + ? _value.isPublicProfile + : isPublicProfile // ignore: cast_nullable_to_non_nullable + as bool, + isEntitySubscribedByMe: null == isEntitySubscribedByMe + ? _value.isEntitySubscribedByMe + : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable + as bool, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + profilePhotoUrl: null == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String, + roles: null == roles + ? _value.roles + : roles // ignore: cast_nullable_to_non_nullable + as List, + badges: null == badges + ? _value.badges + : badges // ignore: cast_nullable_to_non_nullable + as List, + subscriptions: null == subscriptions + ? _value.subscriptions + : subscriptions // ignore: cast_nullable_to_non_nullable + as List, + subscribers: null == subscribers + ? _value.subscribers + : subscribers // ignore: cast_nullable_to_non_nullable + as List, + educationResource: freezed == educationResource + ? _value.educationResource + : educationResource // ignore: cast_nullable_to_non_nullable + as EducationModel?, + diplomasAndCertificates: freezed == diplomasAndCertificates + ? _value.diplomasAndCertificates + : diplomasAndCertificates // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); } /// Create a copy of ProfileModel @@ -244,31 +222,30 @@ class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel> abstract class _$$ProfileModelImplCopyWith<$Res> implements $ProfileModelCopyWith<$Res> { factory _$$ProfileModelImplCopyWith( - _$ProfileModelImpl value, - $Res Function(_$ProfileModelImpl) then, - ) = __$$ProfileModelImplCopyWithImpl<$Res>; + _$ProfileModelImpl value, $Res Function(_$ProfileModelImpl) then) = + __$$ProfileModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "name") String name, - @JsonKey(name: "email") String email, - @JsonKey(name: "rating_place") int? ratingPlace, - @JsonKey(name: "email_verified_at") DateTime? emailVerifiedAt, - @JsonKey(name: "created_at") DateTime? createdAt, - @JsonKey(name: "updated_at") DateTime? updatedAt, - @JsonKey(name: "is_public_profile") bool isPublicProfile, - @JsonKey(name: 'is_entity_subscribed_by_me') bool isEntitySubscribedByMe, - @JsonKey(name: "slug") String slug, - @JsonKey(name: "profile_photo_url") String profilePhotoUrl, - @JsonKey(name: "roles") List roles, - @JsonKey(name: "badges") List badges, - @JsonKey(name: "subscriptions") List subscriptions, - @JsonKey(name: "subscribers") List subscribers, - @JsonKey(name: "education_resource") EducationModel? educationResource, - @JsonKey(name: "cert_photos") - List? diplomasAndCertificates, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "name") String name, + @JsonKey(name: "email") String email, + @JsonKey(name: "rating_place") int? ratingPlace, + @JsonKey(name: "email_verified_at") DateTime? emailVerifiedAt, + @JsonKey(name: "created_at") DateTime? createdAt, + @JsonKey(name: "updated_at") DateTime? updatedAt, + @JsonKey(name: "is_public_profile", fromJson: parseBool) + bool isPublicProfile, + @JsonKey(name: 'is_entity_subscribed_by_me') bool isEntitySubscribedByMe, + @JsonKey(name: "slug") String slug, + @JsonKey(name: "profile_photo_url") String profilePhotoUrl, + @JsonKey(name: "roles") List roles, + @JsonKey(name: "badges") List badges, + @JsonKey(name: "subscriptions") List subscriptions, + @JsonKey(name: "subscribers") List subscribers, + @JsonKey(name: "education_resource") EducationModel? educationResource, + @JsonKey(name: "cert_photos") + List? diplomasAndCertificates}); @override $EducationModelCopyWith<$Res>? get educationResource; @@ -279,9 +256,8 @@ class __$$ProfileModelImplCopyWithImpl<$Res> extends _$ProfileModelCopyWithImpl<$Res, _$ProfileModelImpl> implements _$$ProfileModelImplCopyWith<$Res> { __$$ProfileModelImplCopyWithImpl( - _$ProfileModelImpl _value, - $Res Function(_$ProfileModelImpl) _then, - ) : super(_value, _then); + _$ProfileModelImpl _value, $Res Function(_$ProfileModelImpl) _then) + : super(_value, _then); /// Create a copy of ProfileModel /// with the given fields replaced by the non-null parameter values. @@ -306,128 +282,110 @@ class __$$ProfileModelImplCopyWithImpl<$Res> Object? educationResource = freezed, Object? diplomasAndCertificates = freezed, }) { - return _then( - _$ProfileModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - email: - null == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String, - ratingPlace: - freezed == ratingPlace - ? _value.ratingPlace - : ratingPlace // ignore: cast_nullable_to_non_nullable - as int?, - emailVerifiedAt: - freezed == emailVerifiedAt - ? _value.emailVerifiedAt - : emailVerifiedAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - createdAt: - freezed == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - updatedAt: - freezed == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - isPublicProfile: - null == isPublicProfile - ? _value.isPublicProfile - : isPublicProfile // ignore: cast_nullable_to_non_nullable - as bool, - isEntitySubscribedByMe: - null == isEntitySubscribedByMe - ? _value.isEntitySubscribedByMe - : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable - as bool, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - profilePhotoUrl: - null == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String, - roles: - null == roles - ? _value._roles - : roles // ignore: cast_nullable_to_non_nullable - as List, - badges: - null == badges - ? _value._badges - : badges // ignore: cast_nullable_to_non_nullable - as List, - subscriptions: - null == subscriptions - ? _value._subscriptions - : subscriptions // ignore: cast_nullable_to_non_nullable - as List, - subscribers: - null == subscribers - ? _value._subscribers - : subscribers // ignore: cast_nullable_to_non_nullable - as List, - educationResource: - freezed == educationResource - ? _value.educationResource - : educationResource // ignore: cast_nullable_to_non_nullable - as EducationModel?, - diplomasAndCertificates: - freezed == diplomasAndCertificates - ? _value._diplomasAndCertificates - : diplomasAndCertificates // ignore: cast_nullable_to_non_nullable - as List?, - ), - ); + return _then(_$ProfileModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + ratingPlace: freezed == ratingPlace + ? _value.ratingPlace + : ratingPlace // ignore: cast_nullable_to_non_nullable + as int?, + emailVerifiedAt: freezed == emailVerifiedAt + ? _value.emailVerifiedAt + : emailVerifiedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAt: freezed == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + updatedAt: freezed == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + isPublicProfile: null == isPublicProfile + ? _value.isPublicProfile + : isPublicProfile // ignore: cast_nullable_to_non_nullable + as bool, + isEntitySubscribedByMe: null == isEntitySubscribedByMe + ? _value.isEntitySubscribedByMe + : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable + as bool, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + profilePhotoUrl: null == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String, + roles: null == roles + ? _value._roles + : roles // ignore: cast_nullable_to_non_nullable + as List, + badges: null == badges + ? _value._badges + : badges // ignore: cast_nullable_to_non_nullable + as List, + subscriptions: null == subscriptions + ? _value._subscriptions + : subscriptions // ignore: cast_nullable_to_non_nullable + as List, + subscribers: null == subscribers + ? _value._subscribers + : subscribers // ignore: cast_nullable_to_non_nullable + as List, + educationResource: freezed == educationResource + ? _value.educationResource + : educationResource // ignore: cast_nullable_to_non_nullable + as EducationModel?, + diplomasAndCertificates: freezed == diplomasAndCertificates + ? _value._diplomasAndCertificates + : diplomasAndCertificates // ignore: cast_nullable_to_non_nullable + as List?, + )); } } /// @nodoc @JsonSerializable() class _$ProfileModelImpl implements _ProfileModel { - const _$ProfileModelImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "name") required this.name, - @JsonKey(name: "email") required this.email, - @JsonKey(name: "rating_place") this.ratingPlace, - @JsonKey(name: "email_verified_at") this.emailVerifiedAt, - @JsonKey(name: "created_at") this.createdAt, - @JsonKey(name: "updated_at") this.updatedAt, - @JsonKey(name: "is_public_profile") required this.isPublicProfile, - @JsonKey(name: 'is_entity_subscribed_by_me') - required this.isEntitySubscribedByMe, - @JsonKey(name: "slug") required this.slug, - @JsonKey(name: "profile_photo_url") required this.profilePhotoUrl, - @JsonKey(name: "roles") required final List roles, - @JsonKey(name: "badges") required final List badges, - @JsonKey(name: "subscriptions") - required final List subscriptions, - @JsonKey(name: "subscribers") - required final List subscribers, - @JsonKey(name: "education_resource") this.educationResource, - @JsonKey(name: "cert_photos") - final List? diplomasAndCertificates, - }) : _roles = roles, - _badges = badges, - _subscriptions = subscriptions, - _subscribers = subscribers, - _diplomasAndCertificates = diplomasAndCertificates; + const _$ProfileModelImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "name") required this.name, + @JsonKey(name: "email") required this.email, + @JsonKey(name: "rating_place") this.ratingPlace, + @JsonKey(name: "email_verified_at") this.emailVerifiedAt, + @JsonKey(name: "created_at") this.createdAt, + @JsonKey(name: "updated_at") this.updatedAt, + @JsonKey(name: "is_public_profile", fromJson: parseBool) + required this.isPublicProfile, + @JsonKey(name: 'is_entity_subscribed_by_me') + required this.isEntitySubscribedByMe, + @JsonKey(name: "slug") required this.slug, + @JsonKey(name: "profile_photo_url") required this.profilePhotoUrl, + @JsonKey(name: "roles") required final List roles, + @JsonKey(name: "badges") required final List badges, + @JsonKey(name: "subscriptions") + required final List subscriptions, + @JsonKey(name: "subscribers") + required final List subscribers, + @JsonKey(name: "education_resource") this.educationResource, + @JsonKey(name: "cert_photos") + final List? diplomasAndCertificates}) + : _roles = roles, + _badges = badges, + _subscriptions = subscriptions, + _subscribers = subscribers, + _diplomasAndCertificates = diplomasAndCertificates; factory _$ProfileModelImpl.fromJson(Map json) => _$$ProfileModelImplFromJson(json); @@ -454,7 +412,7 @@ class _$ProfileModelImpl implements _ProfileModel { @JsonKey(name: "updated_at") final DateTime? updatedAt; @override - @JsonKey(name: "is_public_profile") + @JsonKey(name: "is_public_profile", fromJson: parseBool) final bool isPublicProfile; @override @JsonKey(name: 'is_entity_subscribed_by_me') @@ -546,44 +504,37 @@ class _$ProfileModelImpl implements _ProfileModel { other.profilePhotoUrl == profilePhotoUrl) && const DeepCollectionEquality().equals(other._roles, _roles) && const DeepCollectionEquality().equals(other._badges, _badges) && - const DeepCollectionEquality().equals( - other._subscriptions, - _subscriptions, - ) && - const DeepCollectionEquality().equals( - other._subscribers, - _subscribers, - ) && + const DeepCollectionEquality() + .equals(other._subscriptions, _subscriptions) && + const DeepCollectionEquality() + .equals(other._subscribers, _subscribers) && (identical(other.educationResource, educationResource) || other.educationResource == educationResource) && const DeepCollectionEquality().equals( - other._diplomasAndCertificates, - _diplomasAndCertificates, - )); + other._diplomasAndCertificates, _diplomasAndCertificates)); } @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - id, - name, - email, - ratingPlace, - emailVerifiedAt, - createdAt, - updatedAt, - isPublicProfile, - isEntitySubscribedByMe, - slug, - profilePhotoUrl, - const DeepCollectionEquality().hash(_roles), - const DeepCollectionEquality().hash(_badges), - const DeepCollectionEquality().hash(_subscriptions), - const DeepCollectionEquality().hash(_subscribers), - educationResource, - const DeepCollectionEquality().hash(_diplomasAndCertificates), - ); + runtimeType, + id, + name, + email, + ratingPlace, + emailVerifiedAt, + createdAt, + updatedAt, + isPublicProfile, + isEntitySubscribedByMe, + slug, + profilePhotoUrl, + const DeepCollectionEquality().hash(_roles), + const DeepCollectionEquality().hash(_badges), + const DeepCollectionEquality().hash(_subscriptions), + const DeepCollectionEquality().hash(_subscribers), + educationResource, + const DeepCollectionEquality().hash(_diplomasAndCertificates)); /// Create a copy of ProfileModel /// with the given fields replaced by the non-null parameter values. @@ -595,35 +546,38 @@ class _$ProfileModelImpl implements _ProfileModel { @override Map toJson() { - return _$$ProfileModelImplToJson(this); + return _$$ProfileModelImplToJson( + this, + ); } } abstract class _ProfileModel implements ProfileModel { - const factory _ProfileModel({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "name") required final String name, - @JsonKey(name: "email") required final String email, - @JsonKey(name: "rating_place") final int? ratingPlace, - @JsonKey(name: "email_verified_at") final DateTime? emailVerifiedAt, - @JsonKey(name: "created_at") final DateTime? createdAt, - @JsonKey(name: "updated_at") final DateTime? updatedAt, - @JsonKey(name: "is_public_profile") required final bool isPublicProfile, - @JsonKey(name: 'is_entity_subscribed_by_me') - required final bool isEntitySubscribedByMe, - @JsonKey(name: "slug") required final String slug, - @JsonKey(name: "profile_photo_url") required final String profilePhotoUrl, - @JsonKey(name: "roles") required final List roles, - @JsonKey(name: "badges") required final List badges, - @JsonKey(name: "subscriptions") - required final List subscriptions, - @JsonKey(name: "subscribers") - required final List subscribers, - @JsonKey(name: "education_resource") - final EducationModel? educationResource, - @JsonKey(name: "cert_photos") - final List? diplomasAndCertificates, - }) = _$ProfileModelImpl; + const factory _ProfileModel( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "name") required final String name, + @JsonKey(name: "email") required final String email, + @JsonKey(name: "rating_place") final int? ratingPlace, + @JsonKey(name: "email_verified_at") final DateTime? emailVerifiedAt, + @JsonKey(name: "created_at") final DateTime? createdAt, + @JsonKey(name: "updated_at") final DateTime? updatedAt, + @JsonKey(name: "is_public_profile", fromJson: parseBool) + required final bool isPublicProfile, + @JsonKey(name: 'is_entity_subscribed_by_me') + required final bool isEntitySubscribedByMe, + @JsonKey(name: "slug") required final String slug, + @JsonKey(name: "profile_photo_url") required final String profilePhotoUrl, + @JsonKey(name: "roles") required final List roles, + @JsonKey(name: "badges") required final List badges, + @JsonKey(name: "subscriptions") + required final List subscriptions, + @JsonKey(name: "subscribers") + required final List subscribers, + @JsonKey(name: "education_resource") + final EducationModel? educationResource, + @JsonKey(name: "cert_photos") + final List? + diplomasAndCertificates}) = _$ProfileModelImpl; factory _ProfileModel.fromJson(Map json) = _$ProfileModelImpl.fromJson; @@ -650,7 +604,7 @@ abstract class _ProfileModel implements ProfileModel { @JsonKey(name: "updated_at") DateTime? get updatedAt; @override - @JsonKey(name: "is_public_profile") + @JsonKey(name: "is_public_profile", fromJson: parseBool) bool get isPublicProfile; @override @JsonKey(name: 'is_entity_subscribed_by_me') @@ -689,8 +643,7 @@ abstract class _ProfileModel implements ProfileModel { } DiplomasAndCertificatesModel _$DiplomasAndCertificatesModelFromJson( - Map json, -) { + Map json) { return _DiplomasAndCertificatesModel.fromJson(json); } @@ -706,28 +659,23 @@ mixin _$DiplomasAndCertificatesModel { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) $DiplomasAndCertificatesModelCopyWith - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $DiplomasAndCertificatesModelCopyWith<$Res> { factory $DiplomasAndCertificatesModelCopyWith( - DiplomasAndCertificatesModel value, - $Res Function(DiplomasAndCertificatesModel) then, - ) = - _$DiplomasAndCertificatesModelCopyWithImpl< - $Res, - DiplomasAndCertificatesModel - >; + DiplomasAndCertificatesModel value, + $Res Function(DiplomasAndCertificatesModel) then) = + _$DiplomasAndCertificatesModelCopyWithImpl<$Res, + DiplomasAndCertificatesModel>; @useResult $Res call({int id, String path}); } /// @nodoc -class _$DiplomasAndCertificatesModelCopyWithImpl< - $Res, - $Val extends DiplomasAndCertificatesModel -> +class _$DiplomasAndCertificatesModelCopyWithImpl<$Res, + $Val extends DiplomasAndCertificatesModel> implements $DiplomasAndCertificatesModelCopyWith<$Res> { _$DiplomasAndCertificatesModelCopyWithImpl(this._value, this._then); @@ -740,22 +688,20 @@ class _$DiplomasAndCertificatesModelCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? id = null, Object? path = null}) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - path: - null == path - ? _value.path - : path // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? id = null, + Object? path = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -763,9 +709,9 @@ class _$DiplomasAndCertificatesModelCopyWithImpl< abstract class _$$DiplomasAndCertificatesModelImplCopyWith<$Res> implements $DiplomasAndCertificatesModelCopyWith<$Res> { factory _$$DiplomasAndCertificatesModelImplCopyWith( - _$DiplomasAndCertificatesModelImpl value, - $Res Function(_$DiplomasAndCertificatesModelImpl) then, - ) = __$$DiplomasAndCertificatesModelImplCopyWithImpl<$Res>; + _$DiplomasAndCertificatesModelImpl value, + $Res Function(_$DiplomasAndCertificatesModelImpl) then) = + __$$DiplomasAndCertificatesModelImplCopyWithImpl<$Res>; @override @useResult $Res call({int id, String path}); @@ -773,36 +719,32 @@ abstract class _$$DiplomasAndCertificatesModelImplCopyWith<$Res> /// @nodoc class __$$DiplomasAndCertificatesModelImplCopyWithImpl<$Res> - extends - _$DiplomasAndCertificatesModelCopyWithImpl< - $Res, - _$DiplomasAndCertificatesModelImpl - > + extends _$DiplomasAndCertificatesModelCopyWithImpl<$Res, + _$DiplomasAndCertificatesModelImpl> implements _$$DiplomasAndCertificatesModelImplCopyWith<$Res> { __$$DiplomasAndCertificatesModelImplCopyWithImpl( - _$DiplomasAndCertificatesModelImpl _value, - $Res Function(_$DiplomasAndCertificatesModelImpl) _then, - ) : super(_value, _then); + _$DiplomasAndCertificatesModelImpl _value, + $Res Function(_$DiplomasAndCertificatesModelImpl) _then) + : super(_value, _then); /// Create a copy of DiplomasAndCertificatesModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? id = null, Object? path = null}) { - return _then( - _$DiplomasAndCertificatesModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - path: - null == path - ? _value.path - : path // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? id = null, + Object? path = null, + }) { + return _then(_$DiplomasAndCertificatesModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -810,14 +752,12 @@ class __$$DiplomasAndCertificatesModelImplCopyWithImpl<$Res> @JsonSerializable() class _$DiplomasAndCertificatesModelImpl implements _DiplomasAndCertificatesModel { - const _$DiplomasAndCertificatesModelImpl({ - required this.id, - required this.path, - }); + const _$DiplomasAndCertificatesModelImpl( + {required this.id, required this.path}); factory _$DiplomasAndCertificatesModelImpl.fromJson( - Map json, - ) => _$$DiplomasAndCertificatesModelImplFromJson(json); + Map json) => + _$$DiplomasAndCertificatesModelImplFromJson(json); @override final int id; @@ -848,24 +788,23 @@ class _$DiplomasAndCertificatesModelImpl @override @pragma('vm:prefer-inline') _$$DiplomasAndCertificatesModelImplCopyWith< - _$DiplomasAndCertificatesModelImpl - > - get copyWith => __$$DiplomasAndCertificatesModelImplCopyWithImpl< - _$DiplomasAndCertificatesModelImpl - >(this, _$identity); + _$DiplomasAndCertificatesModelImpl> + get copyWith => __$$DiplomasAndCertificatesModelImplCopyWithImpl< + _$DiplomasAndCertificatesModelImpl>(this, _$identity); @override Map toJson() { - return _$$DiplomasAndCertificatesModelImplToJson(this); + return _$$DiplomasAndCertificatesModelImplToJson( + this, + ); } } abstract class _DiplomasAndCertificatesModel implements DiplomasAndCertificatesModel { - const factory _DiplomasAndCertificatesModel({ - required final int id, - required final String path, - }) = _$DiplomasAndCertificatesModelImpl; + const factory _DiplomasAndCertificatesModel( + {required final int id, + required final String path}) = _$DiplomasAndCertificatesModelImpl; factory _DiplomasAndCertificatesModel.fromJson(Map json) = _$DiplomasAndCertificatesModelImpl.fromJson; @@ -880,9 +819,8 @@ abstract class _DiplomasAndCertificatesModel @override @JsonKey(includeFromJson: false, includeToJson: false) _$$DiplomasAndCertificatesModelImplCopyWith< - _$DiplomasAndCertificatesModelImpl - > - get copyWith => throw _privateConstructorUsedError; + _$DiplomasAndCertificatesModelImpl> + get copyWith => throw _privateConstructorUsedError; } EducationModel _$EducationModelFromJson(Map json) { @@ -922,21 +860,19 @@ mixin _$EducationModel { /// @nodoc abstract class $EducationModelCopyWith<$Res> { factory $EducationModelCopyWith( - EducationModel value, - $Res Function(EducationModel) then, - ) = _$EducationModelCopyWithImpl<$Res, EducationModel>; + EducationModel value, $Res Function(EducationModel) then) = + _$EducationModelCopyWithImpl<$Res, EducationModel>; @useResult - $Res call({ - @JsonKey(name: "has_medical_education") int? hasMedicalEducation, - @JsonKey(name: "completed_cources") - List>? completedCourses, - @JsonKey(name: "vk_link") String? vkLink, - @JsonKey(name: "insta_link") String? instaLink, - @JsonKey(name: "fb_link") String? fbLink, - @JsonKey(name: "tg_link") String? tgLink, - @JsonKey(name: "personal_site_link") String? personalSiteLink, - @JsonKey(name: "request_state") String? requestState, - }); + $Res call( + {@JsonKey(name: "has_medical_education") int? hasMedicalEducation, + @JsonKey(name: "completed_cources") + List>? completedCourses, + @JsonKey(name: "vk_link") String? vkLink, + @JsonKey(name: "insta_link") String? instaLink, + @JsonKey(name: "fb_link") String? fbLink, + @JsonKey(name: "tg_link") String? tgLink, + @JsonKey(name: "personal_site_link") String? personalSiteLink, + @JsonKey(name: "request_state") String? requestState}); } /// @nodoc @@ -963,74 +899,61 @@ class _$EducationModelCopyWithImpl<$Res, $Val extends EducationModel> Object? personalSiteLink = freezed, Object? requestState = freezed, }) { - return _then( - _value.copyWith( - hasMedicalEducation: - freezed == hasMedicalEducation - ? _value.hasMedicalEducation - : hasMedicalEducation // ignore: cast_nullable_to_non_nullable - as int?, - completedCourses: - freezed == completedCourses - ? _value.completedCourses - : completedCourses // ignore: cast_nullable_to_non_nullable - as List>?, - vkLink: - freezed == vkLink - ? _value.vkLink - : vkLink // ignore: cast_nullable_to_non_nullable - as String?, - instaLink: - freezed == instaLink - ? _value.instaLink - : instaLink // ignore: cast_nullable_to_non_nullable - as String?, - fbLink: - freezed == fbLink - ? _value.fbLink - : fbLink // ignore: cast_nullable_to_non_nullable - as String?, - tgLink: - freezed == tgLink - ? _value.tgLink - : tgLink // ignore: cast_nullable_to_non_nullable - as String?, - personalSiteLink: - freezed == personalSiteLink - ? _value.personalSiteLink - : personalSiteLink // ignore: cast_nullable_to_non_nullable - as String?, - requestState: - freezed == requestState - ? _value.requestState - : requestState // ignore: cast_nullable_to_non_nullable - as String?, - ) - as $Val, - ); + return _then(_value.copyWith( + hasMedicalEducation: freezed == hasMedicalEducation + ? _value.hasMedicalEducation + : hasMedicalEducation // ignore: cast_nullable_to_non_nullable + as int?, + completedCourses: freezed == completedCourses + ? _value.completedCourses + : completedCourses // ignore: cast_nullable_to_non_nullable + as List>?, + vkLink: freezed == vkLink + ? _value.vkLink + : vkLink // ignore: cast_nullable_to_non_nullable + as String?, + instaLink: freezed == instaLink + ? _value.instaLink + : instaLink // ignore: cast_nullable_to_non_nullable + as String?, + fbLink: freezed == fbLink + ? _value.fbLink + : fbLink // ignore: cast_nullable_to_non_nullable + as String?, + tgLink: freezed == tgLink + ? _value.tgLink + : tgLink // ignore: cast_nullable_to_non_nullable + as String?, + personalSiteLink: freezed == personalSiteLink + ? _value.personalSiteLink + : personalSiteLink // ignore: cast_nullable_to_non_nullable + as String?, + requestState: freezed == requestState + ? _value.requestState + : requestState // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); } } /// @nodoc abstract class _$$EducationModelImplCopyWith<$Res> implements $EducationModelCopyWith<$Res> { - factory _$$EducationModelImplCopyWith( - _$EducationModelImpl value, - $Res Function(_$EducationModelImpl) then, - ) = __$$EducationModelImplCopyWithImpl<$Res>; + factory _$$EducationModelImplCopyWith(_$EducationModelImpl value, + $Res Function(_$EducationModelImpl) then) = + __$$EducationModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "has_medical_education") int? hasMedicalEducation, - @JsonKey(name: "completed_cources") - List>? completedCourses, - @JsonKey(name: "vk_link") String? vkLink, - @JsonKey(name: "insta_link") String? instaLink, - @JsonKey(name: "fb_link") String? fbLink, - @JsonKey(name: "tg_link") String? tgLink, - @JsonKey(name: "personal_site_link") String? personalSiteLink, - @JsonKey(name: "request_state") String? requestState, - }); + $Res call( + {@JsonKey(name: "has_medical_education") int? hasMedicalEducation, + @JsonKey(name: "completed_cources") + List>? completedCourses, + @JsonKey(name: "vk_link") String? vkLink, + @JsonKey(name: "insta_link") String? instaLink, + @JsonKey(name: "fb_link") String? fbLink, + @JsonKey(name: "tg_link") String? tgLink, + @JsonKey(name: "personal_site_link") String? personalSiteLink, + @JsonKey(name: "request_state") String? requestState}); } /// @nodoc @@ -1038,9 +961,8 @@ class __$$EducationModelImplCopyWithImpl<$Res> extends _$EducationModelCopyWithImpl<$Res, _$EducationModelImpl> implements _$$EducationModelImplCopyWith<$Res> { __$$EducationModelImplCopyWithImpl( - _$EducationModelImpl _value, - $Res Function(_$EducationModelImpl) _then, - ) : super(_value, _then); + _$EducationModelImpl _value, $Res Function(_$EducationModelImpl) _then) + : super(_value, _then); /// Create a copy of EducationModel /// with the given fields replaced by the non-null parameter values. @@ -1056,67 +978,57 @@ class __$$EducationModelImplCopyWithImpl<$Res> Object? personalSiteLink = freezed, Object? requestState = freezed, }) { - return _then( - _$EducationModelImpl( - hasMedicalEducation: - freezed == hasMedicalEducation - ? _value.hasMedicalEducation - : hasMedicalEducation // ignore: cast_nullable_to_non_nullable - as int?, - completedCourses: - freezed == completedCourses - ? _value._completedCourses - : completedCourses // ignore: cast_nullable_to_non_nullable - as List>?, - vkLink: - freezed == vkLink - ? _value.vkLink - : vkLink // ignore: cast_nullable_to_non_nullable - as String?, - instaLink: - freezed == instaLink - ? _value.instaLink - : instaLink // ignore: cast_nullable_to_non_nullable - as String?, - fbLink: - freezed == fbLink - ? _value.fbLink - : fbLink // ignore: cast_nullable_to_non_nullable - as String?, - tgLink: - freezed == tgLink - ? _value.tgLink - : tgLink // ignore: cast_nullable_to_non_nullable - as String?, - personalSiteLink: - freezed == personalSiteLink - ? _value.personalSiteLink - : personalSiteLink // ignore: cast_nullable_to_non_nullable - as String?, - requestState: - freezed == requestState - ? _value.requestState - : requestState // ignore: cast_nullable_to_non_nullable - as String?, - ), - ); + return _then(_$EducationModelImpl( + hasMedicalEducation: freezed == hasMedicalEducation + ? _value.hasMedicalEducation + : hasMedicalEducation // ignore: cast_nullable_to_non_nullable + as int?, + completedCourses: freezed == completedCourses + ? _value._completedCourses + : completedCourses // ignore: cast_nullable_to_non_nullable + as List>?, + vkLink: freezed == vkLink + ? _value.vkLink + : vkLink // ignore: cast_nullable_to_non_nullable + as String?, + instaLink: freezed == instaLink + ? _value.instaLink + : instaLink // ignore: cast_nullable_to_non_nullable + as String?, + fbLink: freezed == fbLink + ? _value.fbLink + : fbLink // ignore: cast_nullable_to_non_nullable + as String?, + tgLink: freezed == tgLink + ? _value.tgLink + : tgLink // ignore: cast_nullable_to_non_nullable + as String?, + personalSiteLink: freezed == personalSiteLink + ? _value.personalSiteLink + : personalSiteLink // ignore: cast_nullable_to_non_nullable + as String?, + requestState: freezed == requestState + ? _value.requestState + : requestState // ignore: cast_nullable_to_non_nullable + as String?, + )); } } /// @nodoc @JsonSerializable() class _$EducationModelImpl implements _EducationModel { - const _$EducationModelImpl({ - @JsonKey(name: "has_medical_education") this.hasMedicalEducation, - @JsonKey(name: "completed_cources") - final List>? completedCourses, - @JsonKey(name: "vk_link") this.vkLink, - @JsonKey(name: "insta_link") this.instaLink, - @JsonKey(name: "fb_link") this.fbLink, - @JsonKey(name: "tg_link") this.tgLink, - @JsonKey(name: "personal_site_link") this.personalSiteLink, - @JsonKey(name: "request_state") this.requestState, - }) : _completedCourses = completedCourses; + const _$EducationModelImpl( + {@JsonKey(name: "has_medical_education") this.hasMedicalEducation, + @JsonKey(name: "completed_cources") + final List>? completedCourses, + @JsonKey(name: "vk_link") this.vkLink, + @JsonKey(name: "insta_link") this.instaLink, + @JsonKey(name: "fb_link") this.fbLink, + @JsonKey(name: "tg_link") this.tgLink, + @JsonKey(name: "personal_site_link") this.personalSiteLink, + @JsonKey(name: "request_state") this.requestState}) + : _completedCourses = completedCourses; factory _$EducationModelImpl.fromJson(Map json) => _$$EducationModelImplFromJson(json); @@ -1167,10 +1079,8 @@ class _$EducationModelImpl implements _EducationModel { other is _$EducationModelImpl && (identical(other.hasMedicalEducation, hasMedicalEducation) || other.hasMedicalEducation == hasMedicalEducation) && - const DeepCollectionEquality().equals( - other._completedCourses, - _completedCourses, - ) && + const DeepCollectionEquality() + .equals(other._completedCourses, _completedCourses) && (identical(other.vkLink, vkLink) || other.vkLink == vkLink) && (identical(other.instaLink, instaLink) || other.instaLink == instaLink) && @@ -1185,16 +1095,15 @@ class _$EducationModelImpl implements _EducationModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - hasMedicalEducation, - const DeepCollectionEquality().hash(_completedCourses), - vkLink, - instaLink, - fbLink, - tgLink, - personalSiteLink, - requestState, - ); + runtimeType, + hasMedicalEducation, + const DeepCollectionEquality().hash(_completedCourses), + vkLink, + instaLink, + fbLink, + tgLink, + personalSiteLink, + requestState); /// Create a copy of EducationModel /// with the given fields replaced by the non-null parameter values. @@ -1203,28 +1112,28 @@ class _$EducationModelImpl implements _EducationModel { @pragma('vm:prefer-inline') _$$EducationModelImplCopyWith<_$EducationModelImpl> get copyWith => __$$EducationModelImplCopyWithImpl<_$EducationModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$EducationModelImplToJson(this); + return _$$EducationModelImplToJson( + this, + ); } } abstract class _EducationModel implements EducationModel { - const factory _EducationModel({ - @JsonKey(name: "has_medical_education") final int? hasMedicalEducation, - @JsonKey(name: "completed_cources") - final List>? completedCourses, - @JsonKey(name: "vk_link") final String? vkLink, - @JsonKey(name: "insta_link") final String? instaLink, - @JsonKey(name: "fb_link") final String? fbLink, - @JsonKey(name: "tg_link") final String? tgLink, - @JsonKey(name: "personal_site_link") final String? personalSiteLink, - @JsonKey(name: "request_state") final String? requestState, - }) = _$EducationModelImpl; + const factory _EducationModel( + {@JsonKey(name: "has_medical_education") final int? hasMedicalEducation, + @JsonKey(name: "completed_cources") + final List>? completedCourses, + @JsonKey(name: "vk_link") final String? vkLink, + @JsonKey(name: "insta_link") final String? instaLink, + @JsonKey(name: "fb_link") final String? fbLink, + @JsonKey(name: "tg_link") final String? tgLink, + @JsonKey(name: "personal_site_link") final String? personalSiteLink, + @JsonKey(name: "request_state") + final String? requestState}) = _$EducationModelImpl; factory _EducationModel.fromJson(Map json) = _$EducationModelImpl.fromJson; @@ -1263,8 +1172,7 @@ abstract class _EducationModel implements EducationModel { } CompletedCoursesModel _$CompletedCoursesModelFromJson( - Map json, -) { + Map json) { return _CompletedCoursesModel.fromJson(json); } @@ -1285,19 +1193,16 @@ mixin _$CompletedCoursesModel { /// @nodoc abstract class $CompletedCoursesModelCopyWith<$Res> { - factory $CompletedCoursesModelCopyWith( - CompletedCoursesModel value, - $Res Function(CompletedCoursesModel) then, - ) = _$CompletedCoursesModelCopyWithImpl<$Res, CompletedCoursesModel>; + factory $CompletedCoursesModelCopyWith(CompletedCoursesModel value, + $Res Function(CompletedCoursesModel) then) = + _$CompletedCoursesModelCopyWithImpl<$Res, CompletedCoursesModel>; @useResult $Res call({String date, String title}); } /// @nodoc -class _$CompletedCoursesModelCopyWithImpl< - $Res, - $Val extends CompletedCoursesModel -> +class _$CompletedCoursesModelCopyWithImpl<$Res, + $Val extends CompletedCoursesModel> implements $CompletedCoursesModelCopyWith<$Res> { _$CompletedCoursesModelCopyWithImpl(this._value, this._then); @@ -1310,22 +1215,20 @@ class _$CompletedCoursesModelCopyWithImpl< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? date = null, Object? title = null}) { - return _then( - _value.copyWith( - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as String, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? date = null, + Object? title = null, + }) { + return _then(_value.copyWith( + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as String, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -1333,9 +1236,9 @@ class _$CompletedCoursesModelCopyWithImpl< abstract class _$$CompletedCoursesModelImplCopyWith<$Res> implements $CompletedCoursesModelCopyWith<$Res> { factory _$$CompletedCoursesModelImplCopyWith( - _$CompletedCoursesModelImpl value, - $Res Function(_$CompletedCoursesModelImpl) then, - ) = __$$CompletedCoursesModelImplCopyWithImpl<$Res>; + _$CompletedCoursesModelImpl value, + $Res Function(_$CompletedCoursesModelImpl) then) = + __$$CompletedCoursesModelImplCopyWithImpl<$Res>; @override @useResult $Res call({String date, String title}); @@ -1343,33 +1246,31 @@ abstract class _$$CompletedCoursesModelImplCopyWith<$Res> /// @nodoc class __$$CompletedCoursesModelImplCopyWithImpl<$Res> - extends - _$CompletedCoursesModelCopyWithImpl<$Res, _$CompletedCoursesModelImpl> + extends _$CompletedCoursesModelCopyWithImpl<$Res, + _$CompletedCoursesModelImpl> implements _$$CompletedCoursesModelImplCopyWith<$Res> { - __$$CompletedCoursesModelImplCopyWithImpl( - _$CompletedCoursesModelImpl _value, - $Res Function(_$CompletedCoursesModelImpl) _then, - ) : super(_value, _then); + __$$CompletedCoursesModelImplCopyWithImpl(_$CompletedCoursesModelImpl _value, + $Res Function(_$CompletedCoursesModelImpl) _then) + : super(_value, _then); /// Create a copy of CompletedCoursesModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? date = null, Object? title = null}) { - return _then( - _$CompletedCoursesModelImpl( - date: - null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as String, - title: - null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? date = null, + Object? title = null, + }) { + return _then(_$CompletedCoursesModelImpl( + date: null == date + ? _value.date + : date // ignore: cast_nullable_to_non_nullable + as String, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -1410,23 +1311,21 @@ class _$CompletedCoursesModelImpl implements _CompletedCoursesModel { @override @pragma('vm:prefer-inline') _$$CompletedCoursesModelImplCopyWith<_$CompletedCoursesModelImpl> - get copyWith => - __$$CompletedCoursesModelImplCopyWithImpl<_$CompletedCoursesModelImpl>( - this, - _$identity, - ); + get copyWith => __$$CompletedCoursesModelImplCopyWithImpl< + _$CompletedCoursesModelImpl>(this, _$identity); @override Map toJson() { - return _$$CompletedCoursesModelImplToJson(this); + return _$$CompletedCoursesModelImplToJson( + this, + ); } } abstract class _CompletedCoursesModel implements CompletedCoursesModel { - const factory _CompletedCoursesModel({ - required final String date, - required final String title, - }) = _$CompletedCoursesModelImpl; + const factory _CompletedCoursesModel( + {required final String date, + required final String title}) = _$CompletedCoursesModelImpl; factory _CompletedCoursesModel.fromJson(Map json) = _$CompletedCoursesModelImpl.fromJson; @@ -1441,7 +1340,7 @@ abstract class _CompletedCoursesModel implements CompletedCoursesModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$CompletedCoursesModelImplCopyWith<_$CompletedCoursesModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } ProfileDetailsModel _$ProfileDetailsModelFromJson(Map json) { @@ -1518,39 +1417,37 @@ mixin _$ProfileDetailsModel { /// @nodoc abstract class $ProfileDetailsModelCopyWith<$Res> { factory $ProfileDetailsModelCopyWith( - ProfileDetailsModel value, - $Res Function(ProfileDetailsModel) then, - ) = _$ProfileDetailsModelCopyWithImpl<$Res, ProfileDetailsModel>; + ProfileDetailsModel value, $Res Function(ProfileDetailsModel) then) = + _$ProfileDetailsModelCopyWithImpl<$Res, ProfileDetailsModel>; @useResult - $Res call({ - @JsonKey(name: "first_name") String firstName, - @JsonKey(name: "last_name") String lastName, - @JsonKey(name: "birthdate") String birthdate, - @JsonKey(name: "gender") String gender, - @JsonKey(name: "country") String country, - @JsonKey(name: "city") String city, - @JsonKey(name: "lang") String lang, - @JsonKey(name: "weight") double weight, - @JsonKey(name: "height") int height, - @JsonKey(name: "chest_circumference") int chestCircumference, - @JsonKey(name: "waist_circumference") int waistCircumference, - @JsonKey(name: "hip_circumference") int hipCircumference, - @JsonKey(name: "blood_pressure_up") int bloodPressureUp, - @JsonKey(name: "blood_pressure_down") int bloodPressureDown, - @JsonKey(name: "has_hypo") bool hasHypo, - @JsonKey(name: "has_hyper") bool hasHyper, - @JsonKey(name: "about_alergy") String aboutAlergy, - @JsonKey(name: "about_taking_pils") String aboutTakingPils, - @JsonKey(name: "about_sport_hobbies") String aboutSportHobbies, - @JsonKey(name: "favorite_foods") String favoriteFoods, - @JsonKey(name: "unfavorite_foods") String unfavoriteFoods, - @JsonKey(name: "additional_info") String additionalInfo, - @JsonKey(name: "created_at") DateTime? createdAt, - @JsonKey(name: "updated_at") DateTime? updatedAt, - @JsonKey(name: "is_mood_fillable") bool isMoodFillable, - @JsonKey(name: "is_bedtime_fillable") bool isBedtimeFillable, - @JsonKey(name: "activity_coefficient") double activityCoefficient, - }); + $Res call( + {@JsonKey(name: "first_name") String firstName, + @JsonKey(name: "last_name") String lastName, + @JsonKey(name: "birthdate") String birthdate, + @JsonKey(name: "gender") String gender, + @JsonKey(name: "country") String country, + @JsonKey(name: "city") String city, + @JsonKey(name: "lang") String lang, + @JsonKey(name: "weight") double weight, + @JsonKey(name: "height") int height, + @JsonKey(name: "chest_circumference") int chestCircumference, + @JsonKey(name: "waist_circumference") int waistCircumference, + @JsonKey(name: "hip_circumference") int hipCircumference, + @JsonKey(name: "blood_pressure_up") int bloodPressureUp, + @JsonKey(name: "blood_pressure_down") int bloodPressureDown, + @JsonKey(name: "has_hypo") bool hasHypo, + @JsonKey(name: "has_hyper") bool hasHyper, + @JsonKey(name: "about_alergy") String aboutAlergy, + @JsonKey(name: "about_taking_pils") String aboutTakingPils, + @JsonKey(name: "about_sport_hobbies") String aboutSportHobbies, + @JsonKey(name: "favorite_foods") String favoriteFoods, + @JsonKey(name: "unfavorite_foods") String unfavoriteFoods, + @JsonKey(name: "additional_info") String additionalInfo, + @JsonKey(name: "created_at") DateTime? createdAt, + @JsonKey(name: "updated_at") DateTime? updatedAt, + @JsonKey(name: "is_mood_fillable") bool isMoodFillable, + @JsonKey(name: "is_bedtime_fillable") bool isBedtimeFillable, + @JsonKey(name: "activity_coefficient") double activityCoefficient}); } /// @nodoc @@ -1596,197 +1493,164 @@ class _$ProfileDetailsModelCopyWithImpl<$Res, $Val extends ProfileDetailsModel> Object? isBedtimeFillable = null, Object? activityCoefficient = null, }) { - return _then( - _value.copyWith( - firstName: - null == firstName - ? _value.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: - null == lastName - ? _value.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - birthdate: - null == birthdate - ? _value.birthdate - : birthdate // ignore: cast_nullable_to_non_nullable - as String, - gender: - null == gender - ? _value.gender - : gender // ignore: cast_nullable_to_non_nullable - as String, - country: - null == country - ? _value.country - : country // ignore: cast_nullable_to_non_nullable - as String, - city: - null == city - ? _value.city - : city // ignore: cast_nullable_to_non_nullable - as String, - lang: - null == lang - ? _value.lang - : lang // ignore: cast_nullable_to_non_nullable - as String, - weight: - null == weight - ? _value.weight - : weight // ignore: cast_nullable_to_non_nullable - as double, - height: - null == height - ? _value.height - : height // ignore: cast_nullable_to_non_nullable - as int, - chestCircumference: - null == chestCircumference - ? _value.chestCircumference - : chestCircumference // ignore: cast_nullable_to_non_nullable - as int, - waistCircumference: - null == waistCircumference - ? _value.waistCircumference - : waistCircumference // ignore: cast_nullable_to_non_nullable - as int, - hipCircumference: - null == hipCircumference - ? _value.hipCircumference - : hipCircumference // ignore: cast_nullable_to_non_nullable - as int, - bloodPressureUp: - null == bloodPressureUp - ? _value.bloodPressureUp - : bloodPressureUp // ignore: cast_nullable_to_non_nullable - as int, - bloodPressureDown: - null == bloodPressureDown - ? _value.bloodPressureDown - : bloodPressureDown // ignore: cast_nullable_to_non_nullable - as int, - hasHypo: - null == hasHypo - ? _value.hasHypo - : hasHypo // ignore: cast_nullable_to_non_nullable - as bool, - hasHyper: - null == hasHyper - ? _value.hasHyper - : hasHyper // ignore: cast_nullable_to_non_nullable - as bool, - aboutAlergy: - null == aboutAlergy - ? _value.aboutAlergy - : aboutAlergy // ignore: cast_nullable_to_non_nullable - as String, - aboutTakingPils: - null == aboutTakingPils - ? _value.aboutTakingPils - : aboutTakingPils // ignore: cast_nullable_to_non_nullable - as String, - aboutSportHobbies: - null == aboutSportHobbies - ? _value.aboutSportHobbies - : aboutSportHobbies // ignore: cast_nullable_to_non_nullable - as String, - favoriteFoods: - null == favoriteFoods - ? _value.favoriteFoods - : favoriteFoods // ignore: cast_nullable_to_non_nullable - as String, - unfavoriteFoods: - null == unfavoriteFoods - ? _value.unfavoriteFoods - : unfavoriteFoods // ignore: cast_nullable_to_non_nullable - as String, - additionalInfo: - null == additionalInfo - ? _value.additionalInfo - : additionalInfo // ignore: cast_nullable_to_non_nullable - as String, - createdAt: - freezed == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - updatedAt: - freezed == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - isMoodFillable: - null == isMoodFillable - ? _value.isMoodFillable - : isMoodFillable // ignore: cast_nullable_to_non_nullable - as bool, - isBedtimeFillable: - null == isBedtimeFillable - ? _value.isBedtimeFillable - : isBedtimeFillable // ignore: cast_nullable_to_non_nullable - as bool, - activityCoefficient: - null == activityCoefficient - ? _value.activityCoefficient - : activityCoefficient // ignore: cast_nullable_to_non_nullable - as double, - ) - as $Val, - ); + return _then(_value.copyWith( + firstName: null == firstName + ? _value.firstName + : firstName // ignore: cast_nullable_to_non_nullable + as String, + lastName: null == lastName + ? _value.lastName + : lastName // ignore: cast_nullable_to_non_nullable + as String, + birthdate: null == birthdate + ? _value.birthdate + : birthdate // ignore: cast_nullable_to_non_nullable + as String, + gender: null == gender + ? _value.gender + : gender // ignore: cast_nullable_to_non_nullable + as String, + country: null == country + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String, + city: null == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String, + lang: null == lang + ? _value.lang + : lang // ignore: cast_nullable_to_non_nullable + as String, + weight: null == weight + ? _value.weight + : weight // ignore: cast_nullable_to_non_nullable + as double, + height: null == height + ? _value.height + : height // ignore: cast_nullable_to_non_nullable + as int, + chestCircumference: null == chestCircumference + ? _value.chestCircumference + : chestCircumference // ignore: cast_nullable_to_non_nullable + as int, + waistCircumference: null == waistCircumference + ? _value.waistCircumference + : waistCircumference // ignore: cast_nullable_to_non_nullable + as int, + hipCircumference: null == hipCircumference + ? _value.hipCircumference + : hipCircumference // ignore: cast_nullable_to_non_nullable + as int, + bloodPressureUp: null == bloodPressureUp + ? _value.bloodPressureUp + : bloodPressureUp // ignore: cast_nullable_to_non_nullable + as int, + bloodPressureDown: null == bloodPressureDown + ? _value.bloodPressureDown + : bloodPressureDown // ignore: cast_nullable_to_non_nullable + as int, + hasHypo: null == hasHypo + ? _value.hasHypo + : hasHypo // ignore: cast_nullable_to_non_nullable + as bool, + hasHyper: null == hasHyper + ? _value.hasHyper + : hasHyper // ignore: cast_nullable_to_non_nullable + as bool, + aboutAlergy: null == aboutAlergy + ? _value.aboutAlergy + : aboutAlergy // ignore: cast_nullable_to_non_nullable + as String, + aboutTakingPils: null == aboutTakingPils + ? _value.aboutTakingPils + : aboutTakingPils // ignore: cast_nullable_to_non_nullable + as String, + aboutSportHobbies: null == aboutSportHobbies + ? _value.aboutSportHobbies + : aboutSportHobbies // ignore: cast_nullable_to_non_nullable + as String, + favoriteFoods: null == favoriteFoods + ? _value.favoriteFoods + : favoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + unfavoriteFoods: null == unfavoriteFoods + ? _value.unfavoriteFoods + : unfavoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + additionalInfo: null == additionalInfo + ? _value.additionalInfo + : additionalInfo // ignore: cast_nullable_to_non_nullable + as String, + createdAt: freezed == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + updatedAt: freezed == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + isMoodFillable: null == isMoodFillable + ? _value.isMoodFillable + : isMoodFillable // ignore: cast_nullable_to_non_nullable + as bool, + isBedtimeFillable: null == isBedtimeFillable + ? _value.isBedtimeFillable + : isBedtimeFillable // ignore: cast_nullable_to_non_nullable + as bool, + activityCoefficient: null == activityCoefficient + ? _value.activityCoefficient + : activityCoefficient // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); } } /// @nodoc abstract class _$$ProfileDetailsModelImplCopyWith<$Res> implements $ProfileDetailsModelCopyWith<$Res> { - factory _$$ProfileDetailsModelImplCopyWith( - _$ProfileDetailsModelImpl value, - $Res Function(_$ProfileDetailsModelImpl) then, - ) = __$$ProfileDetailsModelImplCopyWithImpl<$Res>; + factory _$$ProfileDetailsModelImplCopyWith(_$ProfileDetailsModelImpl value, + $Res Function(_$ProfileDetailsModelImpl) then) = + __$$ProfileDetailsModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "first_name") String firstName, - @JsonKey(name: "last_name") String lastName, - @JsonKey(name: "birthdate") String birthdate, - @JsonKey(name: "gender") String gender, - @JsonKey(name: "country") String country, - @JsonKey(name: "city") String city, - @JsonKey(name: "lang") String lang, - @JsonKey(name: "weight") double weight, - @JsonKey(name: "height") int height, - @JsonKey(name: "chest_circumference") int chestCircumference, - @JsonKey(name: "waist_circumference") int waistCircumference, - @JsonKey(name: "hip_circumference") int hipCircumference, - @JsonKey(name: "blood_pressure_up") int bloodPressureUp, - @JsonKey(name: "blood_pressure_down") int bloodPressureDown, - @JsonKey(name: "has_hypo") bool hasHypo, - @JsonKey(name: "has_hyper") bool hasHyper, - @JsonKey(name: "about_alergy") String aboutAlergy, - @JsonKey(name: "about_taking_pils") String aboutTakingPils, - @JsonKey(name: "about_sport_hobbies") String aboutSportHobbies, - @JsonKey(name: "favorite_foods") String favoriteFoods, - @JsonKey(name: "unfavorite_foods") String unfavoriteFoods, - @JsonKey(name: "additional_info") String additionalInfo, - @JsonKey(name: "created_at") DateTime? createdAt, - @JsonKey(name: "updated_at") DateTime? updatedAt, - @JsonKey(name: "is_mood_fillable") bool isMoodFillable, - @JsonKey(name: "is_bedtime_fillable") bool isBedtimeFillable, - @JsonKey(name: "activity_coefficient") double activityCoefficient, - }); + $Res call( + {@JsonKey(name: "first_name") String firstName, + @JsonKey(name: "last_name") String lastName, + @JsonKey(name: "birthdate") String birthdate, + @JsonKey(name: "gender") String gender, + @JsonKey(name: "country") String country, + @JsonKey(name: "city") String city, + @JsonKey(name: "lang") String lang, + @JsonKey(name: "weight") double weight, + @JsonKey(name: "height") int height, + @JsonKey(name: "chest_circumference") int chestCircumference, + @JsonKey(name: "waist_circumference") int waistCircumference, + @JsonKey(name: "hip_circumference") int hipCircumference, + @JsonKey(name: "blood_pressure_up") int bloodPressureUp, + @JsonKey(name: "blood_pressure_down") int bloodPressureDown, + @JsonKey(name: "has_hypo") bool hasHypo, + @JsonKey(name: "has_hyper") bool hasHyper, + @JsonKey(name: "about_alergy") String aboutAlergy, + @JsonKey(name: "about_taking_pils") String aboutTakingPils, + @JsonKey(name: "about_sport_hobbies") String aboutSportHobbies, + @JsonKey(name: "favorite_foods") String favoriteFoods, + @JsonKey(name: "unfavorite_foods") String unfavoriteFoods, + @JsonKey(name: "additional_info") String additionalInfo, + @JsonKey(name: "created_at") DateTime? createdAt, + @JsonKey(name: "updated_at") DateTime? updatedAt, + @JsonKey(name: "is_mood_fillable") bool isMoodFillable, + @JsonKey(name: "is_bedtime_fillable") bool isBedtimeFillable, + @JsonKey(name: "activity_coefficient") double activityCoefficient}); } /// @nodoc class __$$ProfileDetailsModelImplCopyWithImpl<$Res> extends _$ProfileDetailsModelCopyWithImpl<$Res, _$ProfileDetailsModelImpl> implements _$$ProfileDetailsModelImplCopyWith<$Res> { - __$$ProfileDetailsModelImplCopyWithImpl( - _$ProfileDetailsModelImpl _value, - $Res Function(_$ProfileDetailsModelImpl) _then, - ) : super(_value, _then); + __$$ProfileDetailsModelImplCopyWithImpl(_$ProfileDetailsModelImpl _value, + $Res Function(_$ProfileDetailsModelImpl) _then) + : super(_value, _then); /// Create a copy of ProfileDetailsModel /// with the given fields replaced by the non-null parameter values. @@ -1821,180 +1685,151 @@ class __$$ProfileDetailsModelImplCopyWithImpl<$Res> Object? isBedtimeFillable = null, Object? activityCoefficient = null, }) { - return _then( - _$ProfileDetailsModelImpl( - firstName: - null == firstName - ? _value.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: - null == lastName - ? _value.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - birthdate: - null == birthdate - ? _value.birthdate - : birthdate // ignore: cast_nullable_to_non_nullable - as String, - gender: - null == gender - ? _value.gender - : gender // ignore: cast_nullable_to_non_nullable - as String, - country: - null == country - ? _value.country - : country // ignore: cast_nullable_to_non_nullable - as String, - city: - null == city - ? _value.city - : city // ignore: cast_nullable_to_non_nullable - as String, - lang: - null == lang - ? _value.lang - : lang // ignore: cast_nullable_to_non_nullable - as String, - weight: - null == weight - ? _value.weight - : weight // ignore: cast_nullable_to_non_nullable - as double, - height: - null == height - ? _value.height - : height // ignore: cast_nullable_to_non_nullable - as int, - chestCircumference: - null == chestCircumference - ? _value.chestCircumference - : chestCircumference // ignore: cast_nullable_to_non_nullable - as int, - waistCircumference: - null == waistCircumference - ? _value.waistCircumference - : waistCircumference // ignore: cast_nullable_to_non_nullable - as int, - hipCircumference: - null == hipCircumference - ? _value.hipCircumference - : hipCircumference // ignore: cast_nullable_to_non_nullable - as int, - bloodPressureUp: - null == bloodPressureUp - ? _value.bloodPressureUp - : bloodPressureUp // ignore: cast_nullable_to_non_nullable - as int, - bloodPressureDown: - null == bloodPressureDown - ? _value.bloodPressureDown - : bloodPressureDown // ignore: cast_nullable_to_non_nullable - as int, - hasHypo: - null == hasHypo - ? _value.hasHypo - : hasHypo // ignore: cast_nullable_to_non_nullable - as bool, - hasHyper: - null == hasHyper - ? _value.hasHyper - : hasHyper // ignore: cast_nullable_to_non_nullable - as bool, - aboutAlergy: - null == aboutAlergy - ? _value.aboutAlergy - : aboutAlergy // ignore: cast_nullable_to_non_nullable - as String, - aboutTakingPils: - null == aboutTakingPils - ? _value.aboutTakingPils - : aboutTakingPils // ignore: cast_nullable_to_non_nullable - as String, - aboutSportHobbies: - null == aboutSportHobbies - ? _value.aboutSportHobbies - : aboutSportHobbies // ignore: cast_nullable_to_non_nullable - as String, - favoriteFoods: - null == favoriteFoods - ? _value.favoriteFoods - : favoriteFoods // ignore: cast_nullable_to_non_nullable - as String, - unfavoriteFoods: - null == unfavoriteFoods - ? _value.unfavoriteFoods - : unfavoriteFoods // ignore: cast_nullable_to_non_nullable - as String, - additionalInfo: - null == additionalInfo - ? _value.additionalInfo - : additionalInfo // ignore: cast_nullable_to_non_nullable - as String, - createdAt: - freezed == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - updatedAt: - freezed == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - isMoodFillable: - null == isMoodFillable - ? _value.isMoodFillable - : isMoodFillable // ignore: cast_nullable_to_non_nullable - as bool, - isBedtimeFillable: - null == isBedtimeFillable - ? _value.isBedtimeFillable - : isBedtimeFillable // ignore: cast_nullable_to_non_nullable - as bool, - activityCoefficient: - null == activityCoefficient - ? _value.activityCoefficient - : activityCoefficient // ignore: cast_nullable_to_non_nullable - as double, - ), - ); + return _then(_$ProfileDetailsModelImpl( + firstName: null == firstName + ? _value.firstName + : firstName // ignore: cast_nullable_to_non_nullable + as String, + lastName: null == lastName + ? _value.lastName + : lastName // ignore: cast_nullable_to_non_nullable + as String, + birthdate: null == birthdate + ? _value.birthdate + : birthdate // ignore: cast_nullable_to_non_nullable + as String, + gender: null == gender + ? _value.gender + : gender // ignore: cast_nullable_to_non_nullable + as String, + country: null == country + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String, + city: null == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String, + lang: null == lang + ? _value.lang + : lang // ignore: cast_nullable_to_non_nullable + as String, + weight: null == weight + ? _value.weight + : weight // ignore: cast_nullable_to_non_nullable + as double, + height: null == height + ? _value.height + : height // ignore: cast_nullable_to_non_nullable + as int, + chestCircumference: null == chestCircumference + ? _value.chestCircumference + : chestCircumference // ignore: cast_nullable_to_non_nullable + as int, + waistCircumference: null == waistCircumference + ? _value.waistCircumference + : waistCircumference // ignore: cast_nullable_to_non_nullable + as int, + hipCircumference: null == hipCircumference + ? _value.hipCircumference + : hipCircumference // ignore: cast_nullable_to_non_nullable + as int, + bloodPressureUp: null == bloodPressureUp + ? _value.bloodPressureUp + : bloodPressureUp // ignore: cast_nullable_to_non_nullable + as int, + bloodPressureDown: null == bloodPressureDown + ? _value.bloodPressureDown + : bloodPressureDown // ignore: cast_nullable_to_non_nullable + as int, + hasHypo: null == hasHypo + ? _value.hasHypo + : hasHypo // ignore: cast_nullable_to_non_nullable + as bool, + hasHyper: null == hasHyper + ? _value.hasHyper + : hasHyper // ignore: cast_nullable_to_non_nullable + as bool, + aboutAlergy: null == aboutAlergy + ? _value.aboutAlergy + : aboutAlergy // ignore: cast_nullable_to_non_nullable + as String, + aboutTakingPils: null == aboutTakingPils + ? _value.aboutTakingPils + : aboutTakingPils // ignore: cast_nullable_to_non_nullable + as String, + aboutSportHobbies: null == aboutSportHobbies + ? _value.aboutSportHobbies + : aboutSportHobbies // ignore: cast_nullable_to_non_nullable + as String, + favoriteFoods: null == favoriteFoods + ? _value.favoriteFoods + : favoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + unfavoriteFoods: null == unfavoriteFoods + ? _value.unfavoriteFoods + : unfavoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + additionalInfo: null == additionalInfo + ? _value.additionalInfo + : additionalInfo // ignore: cast_nullable_to_non_nullable + as String, + createdAt: freezed == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + updatedAt: freezed == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + isMoodFillable: null == isMoodFillable + ? _value.isMoodFillable + : isMoodFillable // ignore: cast_nullable_to_non_nullable + as bool, + isBedtimeFillable: null == isBedtimeFillable + ? _value.isBedtimeFillable + : isBedtimeFillable // ignore: cast_nullable_to_non_nullable + as bool, + activityCoefficient: null == activityCoefficient + ? _value.activityCoefficient + : activityCoefficient // ignore: cast_nullable_to_non_nullable + as double, + )); } } /// @nodoc @JsonSerializable() class _$ProfileDetailsModelImpl implements _ProfileDetailsModel { - const _$ProfileDetailsModelImpl({ - @JsonKey(name: "first_name") required this.firstName, - @JsonKey(name: "last_name") required this.lastName, - @JsonKey(name: "birthdate") required this.birthdate, - @JsonKey(name: "gender") required this.gender, - @JsonKey(name: "country") required this.country, - @JsonKey(name: "city") required this.city, - @JsonKey(name: "lang") required this.lang, - @JsonKey(name: "weight") required this.weight, - @JsonKey(name: "height") required this.height, - @JsonKey(name: "chest_circumference") required this.chestCircumference, - @JsonKey(name: "waist_circumference") required this.waistCircumference, - @JsonKey(name: "hip_circumference") required this.hipCircumference, - @JsonKey(name: "blood_pressure_up") required this.bloodPressureUp, - @JsonKey(name: "blood_pressure_down") required this.bloodPressureDown, - @JsonKey(name: "has_hypo") required this.hasHypo, - @JsonKey(name: "has_hyper") required this.hasHyper, - @JsonKey(name: "about_alergy") required this.aboutAlergy, - @JsonKey(name: "about_taking_pils") required this.aboutTakingPils, - @JsonKey(name: "about_sport_hobbies") required this.aboutSportHobbies, - @JsonKey(name: "favorite_foods") required this.favoriteFoods, - @JsonKey(name: "unfavorite_foods") required this.unfavoriteFoods, - @JsonKey(name: "additional_info") required this.additionalInfo, - @JsonKey(name: "created_at") this.createdAt, - @JsonKey(name: "updated_at") this.updatedAt, - @JsonKey(name: "is_mood_fillable") required this.isMoodFillable, - @JsonKey(name: "is_bedtime_fillable") required this.isBedtimeFillable, - @JsonKey(name: "activity_coefficient") required this.activityCoefficient, - }); + const _$ProfileDetailsModelImpl( + {@JsonKey(name: "first_name") required this.firstName, + @JsonKey(name: "last_name") required this.lastName, + @JsonKey(name: "birthdate") required this.birthdate, + @JsonKey(name: "gender") required this.gender, + @JsonKey(name: "country") required this.country, + @JsonKey(name: "city") required this.city, + @JsonKey(name: "lang") required this.lang, + @JsonKey(name: "weight") required this.weight, + @JsonKey(name: "height") required this.height, + @JsonKey(name: "chest_circumference") required this.chestCircumference, + @JsonKey(name: "waist_circumference") required this.waistCircumference, + @JsonKey(name: "hip_circumference") required this.hipCircumference, + @JsonKey(name: "blood_pressure_up") required this.bloodPressureUp, + @JsonKey(name: "blood_pressure_down") required this.bloodPressureDown, + @JsonKey(name: "has_hypo") required this.hasHypo, + @JsonKey(name: "has_hyper") required this.hasHyper, + @JsonKey(name: "about_alergy") required this.aboutAlergy, + @JsonKey(name: "about_taking_pils") required this.aboutTakingPils, + @JsonKey(name: "about_sport_hobbies") required this.aboutSportHobbies, + @JsonKey(name: "favorite_foods") required this.favoriteFoods, + @JsonKey(name: "unfavorite_foods") required this.unfavoriteFoods, + @JsonKey(name: "additional_info") required this.additionalInfo, + @JsonKey(name: "created_at") this.createdAt, + @JsonKey(name: "updated_at") this.updatedAt, + @JsonKey(name: "is_mood_fillable") required this.isMoodFillable, + @JsonKey(name: "is_bedtime_fillable") required this.isBedtimeFillable, + @JsonKey(name: "activity_coefficient") + required this.activityCoefficient}); factory _$ProfileDetailsModelImpl.fromJson(Map json) => _$$ProfileDetailsModelImplFromJson(json); @@ -2143,35 +1978,35 @@ class _$ProfileDetailsModelImpl implements _ProfileDetailsModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hashAll([ - runtimeType, - firstName, - lastName, - birthdate, - gender, - country, - city, - lang, - weight, - height, - chestCircumference, - waistCircumference, - hipCircumference, - bloodPressureUp, - bloodPressureDown, - hasHypo, - hasHyper, - aboutAlergy, - aboutTakingPils, - aboutSportHobbies, - favoriteFoods, - unfavoriteFoods, - additionalInfo, - createdAt, - updatedAt, - isMoodFillable, - isBedtimeFillable, - activityCoefficient, - ]); + runtimeType, + firstName, + lastName, + birthdate, + gender, + country, + city, + lang, + weight, + height, + chestCircumference, + waistCircumference, + hipCircumference, + bloodPressureUp, + bloodPressureDown, + hasHypo, + hasHyper, + aboutAlergy, + aboutTakingPils, + aboutSportHobbies, + favoriteFoods, + unfavoriteFoods, + additionalInfo, + createdAt, + updatedAt, + isMoodFillable, + isBedtimeFillable, + activityCoefficient + ]); /// Create a copy of ProfileDetailsModel /// with the given fields replaced by the non-null parameter values. @@ -2180,48 +2015,51 @@ class _$ProfileDetailsModelImpl implements _ProfileDetailsModel { @pragma('vm:prefer-inline') _$$ProfileDetailsModelImplCopyWith<_$ProfileDetailsModelImpl> get copyWith => __$$ProfileDetailsModelImplCopyWithImpl<_$ProfileDetailsModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$ProfileDetailsModelImplToJson(this); + return _$$ProfileDetailsModelImplToJson( + this, + ); } } abstract class _ProfileDetailsModel implements ProfileDetailsModel { - const factory _ProfileDetailsModel({ - @JsonKey(name: "first_name") required final String firstName, - @JsonKey(name: "last_name") required final String lastName, - @JsonKey(name: "birthdate") required final String birthdate, - @JsonKey(name: "gender") required final String gender, - @JsonKey(name: "country") required final String country, - @JsonKey(name: "city") required final String city, - @JsonKey(name: "lang") required final String lang, - @JsonKey(name: "weight") required final double weight, - @JsonKey(name: "height") required final int height, - @JsonKey(name: "chest_circumference") required final int chestCircumference, - @JsonKey(name: "waist_circumference") required final int waistCircumference, - @JsonKey(name: "hip_circumference") required final int hipCircumference, - @JsonKey(name: "blood_pressure_up") required final int bloodPressureUp, - @JsonKey(name: "blood_pressure_down") required final int bloodPressureDown, - @JsonKey(name: "has_hypo") required final bool hasHypo, - @JsonKey(name: "has_hyper") required final bool hasHyper, - @JsonKey(name: "about_alergy") required final String aboutAlergy, - @JsonKey(name: "about_taking_pils") required final String aboutTakingPils, - @JsonKey(name: "about_sport_hobbies") - required final String aboutSportHobbies, - @JsonKey(name: "favorite_foods") required final String favoriteFoods, - @JsonKey(name: "unfavorite_foods") required final String unfavoriteFoods, - @JsonKey(name: "additional_info") required final String additionalInfo, - @JsonKey(name: "created_at") final DateTime? createdAt, - @JsonKey(name: "updated_at") final DateTime? updatedAt, - @JsonKey(name: "is_mood_fillable") required final bool isMoodFillable, - @JsonKey(name: "is_bedtime_fillable") required final bool isBedtimeFillable, - @JsonKey(name: "activity_coefficient") - required final double activityCoefficient, - }) = _$ProfileDetailsModelImpl; + const factory _ProfileDetailsModel( + {@JsonKey(name: "first_name") required final String firstName, + @JsonKey(name: "last_name") required final String lastName, + @JsonKey(name: "birthdate") required final String birthdate, + @JsonKey(name: "gender") required final String gender, + @JsonKey(name: "country") required final String country, + @JsonKey(name: "city") required final String city, + @JsonKey(name: "lang") required final String lang, + @JsonKey(name: "weight") required final double weight, + @JsonKey(name: "height") required final int height, + @JsonKey(name: "chest_circumference") + required final int chestCircumference, + @JsonKey(name: "waist_circumference") + required final int waistCircumference, + @JsonKey(name: "hip_circumference") required final int hipCircumference, + @JsonKey(name: "blood_pressure_up") required final int bloodPressureUp, + @JsonKey(name: "blood_pressure_down") + required final int bloodPressureDown, + @JsonKey(name: "has_hypo") required final bool hasHypo, + @JsonKey(name: "has_hyper") required final bool hasHyper, + @JsonKey(name: "about_alergy") required final String aboutAlergy, + @JsonKey(name: "about_taking_pils") required final String aboutTakingPils, + @JsonKey(name: "about_sport_hobbies") + required final String aboutSportHobbies, + @JsonKey(name: "favorite_foods") required final String favoriteFoods, + @JsonKey(name: "unfavorite_foods") required final String unfavoriteFoods, + @JsonKey(name: "additional_info") required final String additionalInfo, + @JsonKey(name: "created_at") final DateTime? createdAt, + @JsonKey(name: "updated_at") final DateTime? updatedAt, + @JsonKey(name: "is_mood_fillable") required final bool isMoodFillable, + @JsonKey(name: "is_bedtime_fillable") + required final bool isBedtimeFillable, + @JsonKey(name: "activity_coefficient") + required final double activityCoefficient}) = _$ProfileDetailsModelImpl; factory _ProfileDetailsModel.fromJson(Map json) = _$ProfileDetailsModelImpl.fromJson; @@ -2338,9 +2176,8 @@ mixin _$ProfilePreviewModel { /// @nodoc abstract class $ProfilePreviewModelCopyWith<$Res> { factory $ProfilePreviewModelCopyWith( - ProfilePreviewModel value, - $Res Function(ProfilePreviewModel) then, - ) = _$ProfilePreviewModelCopyWithImpl<$Res, ProfilePreviewModel>; + ProfilePreviewModel value, $Res Function(ProfilePreviewModel) then) = + _$ProfilePreviewModelCopyWithImpl<$Res, ProfilePreviewModel>; @useResult $Res call({@JsonKey(name: "profile_photo_url") String profilePhotoUrl}); } @@ -2359,27 +2196,24 @@ class _$ProfilePreviewModelCopyWithImpl<$Res, $Val extends ProfilePreviewModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? profilePhotoUrl = null}) { - return _then( - _value.copyWith( - profilePhotoUrl: - null == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? profilePhotoUrl = null, + }) { + return _then(_value.copyWith( + profilePhotoUrl: null == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } /// @nodoc abstract class _$$ProfilePreviewModelImplCopyWith<$Res> implements $ProfilePreviewModelCopyWith<$Res> { - factory _$$ProfilePreviewModelImplCopyWith( - _$ProfilePreviewModelImpl value, - $Res Function(_$ProfilePreviewModelImpl) then, - ) = __$$ProfilePreviewModelImplCopyWithImpl<$Res>; + factory _$$ProfilePreviewModelImplCopyWith(_$ProfilePreviewModelImpl value, + $Res Function(_$ProfilePreviewModelImpl) then) = + __$$ProfilePreviewModelImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: "profile_photo_url") String profilePhotoUrl}); @@ -2389,34 +2223,31 @@ abstract class _$$ProfilePreviewModelImplCopyWith<$Res> class __$$ProfilePreviewModelImplCopyWithImpl<$Res> extends _$ProfilePreviewModelCopyWithImpl<$Res, _$ProfilePreviewModelImpl> implements _$$ProfilePreviewModelImplCopyWith<$Res> { - __$$ProfilePreviewModelImplCopyWithImpl( - _$ProfilePreviewModelImpl _value, - $Res Function(_$ProfilePreviewModelImpl) _then, - ) : super(_value, _then); + __$$ProfilePreviewModelImplCopyWithImpl(_$ProfilePreviewModelImpl _value, + $Res Function(_$ProfilePreviewModelImpl) _then) + : super(_value, _then); /// Create a copy of ProfilePreviewModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? profilePhotoUrl = null}) { - return _then( - _$ProfilePreviewModelImpl( - profilePhotoUrl: - null == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? profilePhotoUrl = null, + }) { + return _then(_$ProfilePreviewModelImpl( + profilePhotoUrl: null == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String, + )); } } /// @nodoc @JsonSerializable() class _$ProfilePreviewModelImpl implements _ProfilePreviewModel { - const _$ProfilePreviewModelImpl({ - @JsonKey(name: "profile_photo_url") required this.profilePhotoUrl, - }); + const _$ProfilePreviewModelImpl( + {@JsonKey(name: "profile_photo_url") required this.profilePhotoUrl}); factory _$ProfilePreviewModelImpl.fromJson(Map json) => _$$ProfilePreviewModelImplFromJson(json); @@ -2450,20 +2281,20 @@ class _$ProfilePreviewModelImpl implements _ProfilePreviewModel { @pragma('vm:prefer-inline') _$$ProfilePreviewModelImplCopyWith<_$ProfilePreviewModelImpl> get copyWith => __$$ProfilePreviewModelImplCopyWithImpl<_$ProfilePreviewModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$ProfilePreviewModelImplToJson(this); + return _$$ProfilePreviewModelImplToJson( + this, + ); } } abstract class _ProfilePreviewModel implements ProfilePreviewModel { - const factory _ProfilePreviewModel({ - @JsonKey(name: "profile_photo_url") required final String profilePhotoUrl, - }) = _$ProfilePreviewModelImpl; + const factory _ProfilePreviewModel( + {@JsonKey(name: "profile_photo_url") + required final String profilePhotoUrl}) = _$ProfilePreviewModelImpl; factory _ProfilePreviewModel.fromJson(Map json) = _$ProfilePreviewModelImpl.fromJson; diff --git a/lib/features/profile/models/profile_model.g.dart b/lib/features/profile/models/profile_model.g.dart index 596ea47e..ff237acb 100644 --- a/lib/features/profile/models/profile_model.g.dart +++ b/lib/features/profile/models/profile_model.g.dart @@ -6,57 +6,44 @@ part of 'profile_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ProfileModelImpl _$$ProfileModelImplFromJson( - Map json, -) => _$ProfileModelImpl( - id: (json['id'] as num).toInt(), - name: json['name'] as String, - email: json['email'] as String, - ratingPlace: (json['rating_place'] as num?)?.toInt(), - emailVerifiedAt: - json['email_verified_at'] == null +_$ProfileModelImpl _$$ProfileModelImplFromJson(Map json) => + _$ProfileModelImpl( + id: (json['id'] as num).toInt(), + name: json['name'] as String, + email: json['email'] as String, + ratingPlace: (json['rating_place'] as num?)?.toInt(), + emailVerifiedAt: json['email_verified_at'] == null ? null : DateTime.parse(json['email_verified_at'] as String), - createdAt: - json['created_at'] == null + createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), - updatedAt: - json['updated_at'] == null + updatedAt: json['updated_at'] == null ? null : DateTime.parse(json['updated_at'] as String), - isPublicProfile: json['is_public_profile'] as bool, - isEntitySubscribedByMe: json['is_entity_subscribed_by_me'] as bool, - slug: json['slug'] as String, - profilePhotoUrl: json['profile_photo_url'] as String, - roles: (json['roles'] as List).map((e) => e as String).toList(), - badges: - (json['badges'] as List) + isPublicProfile: parseBool(json['is_public_profile']), + isEntitySubscribedByMe: json['is_entity_subscribed_by_me'] as bool, + slug: json['slug'] as String, + profilePhotoUrl: json['profile_photo_url'] as String, + roles: (json['roles'] as List).map((e) => e as String).toList(), + badges: (json['badges'] as List) .map((e) => BadgeModel.fromJson(e as Map)) .toList(), - subscriptions: - (json['subscriptions'] as List) + subscriptions: (json['subscriptions'] as List) .map((e) => ProfilePreviewModel.fromJson(e as Map)) .toList(), - subscribers: - (json['subscribers'] as List) + subscribers: (json['subscribers'] as List) .map((e) => ProfilePreviewModel.fromJson(e as Map)) .toList(), - educationResource: - json['education_resource'] == null + educationResource: json['education_resource'] == null ? null : EducationModel.fromJson( - json['education_resource'] as Map, - ), - diplomasAndCertificates: - (json['cert_photos'] as List?) - ?.map( - (e) => DiplomasAndCertificatesModel.fromJson( - e as Map, - ), - ) + json['education_resource'] as Map), + diplomasAndCertificates: (json['cert_photos'] as List?) + ?.map((e) => + DiplomasAndCertificatesModel.fromJson(e as Map)) .toList(), -); + ); Map _$$ProfileModelImplToJson(_$ProfileModelImpl instance) => { @@ -80,30 +67,28 @@ Map _$$ProfileModelImplToJson(_$ProfileModelImpl instance) => }; _$DiplomasAndCertificatesModelImpl _$$DiplomasAndCertificatesModelImplFromJson( - Map json, -) => _$DiplomasAndCertificatesModelImpl( - id: (json['id'] as num).toInt(), - path: json['path'] as String, -); + Map json) => + _$DiplomasAndCertificatesModelImpl( + id: (json['id'] as num).toInt(), + path: json['path'] as String, + ); Map _$$DiplomasAndCertificatesModelImplToJson( - _$DiplomasAndCertificatesModelImpl instance, -) => {'id': instance.id, 'path': instance.path}; + _$DiplomasAndCertificatesModelImpl instance) => + { + 'id': instance.id, + 'path': instance.path, + }; _$EducationModelImpl _$$EducationModelImplFromJson(Map json) => _$EducationModelImpl( hasMedicalEducation: (json['has_medical_education'] as num?)?.toInt(), - completedCourses: - (json['completed_cources'] as List?) - ?.map( - (e) => (e as Map).map( - (k, e) => MapEntry( - k, - CompletedCoursesModel.fromJson(e as Map), - ), - ), - ) - .toList(), + completedCourses: (json['completed_cources'] as List?) + ?.map((e) => (e as Map).map( + (k, e) => MapEntry(k, + CompletedCoursesModel.fromJson(e as Map)), + )) + .toList(), vkLink: json['vk_link'] as String?, instaLink: json['insta_link'] as String?, fbLink: json['fb_link'] as String?, @@ -113,105 +98,108 @@ _$EducationModelImpl _$$EducationModelImplFromJson(Map json) => ); Map _$$EducationModelImplToJson( - _$EducationModelImpl instance, -) => { - 'has_medical_education': instance.hasMedicalEducation, - 'completed_cources': instance.completedCourses, - 'vk_link': instance.vkLink, - 'insta_link': instance.instaLink, - 'fb_link': instance.fbLink, - 'tg_link': instance.tgLink, - 'personal_site_link': instance.personalSiteLink, - 'request_state': instance.requestState, -}; + _$EducationModelImpl instance) => + { + 'has_medical_education': instance.hasMedicalEducation, + 'completed_cources': instance.completedCourses, + 'vk_link': instance.vkLink, + 'insta_link': instance.instaLink, + 'fb_link': instance.fbLink, + 'tg_link': instance.tgLink, + 'personal_site_link': instance.personalSiteLink, + 'request_state': instance.requestState, + }; _$CompletedCoursesModelImpl _$$CompletedCoursesModelImplFromJson( - Map json, -) => _$CompletedCoursesModelImpl( - date: json['date'] as String, - title: json['title'] as String, -); + Map json) => + _$CompletedCoursesModelImpl( + date: json['date'] as String, + title: json['title'] as String, + ); Map _$$CompletedCoursesModelImplToJson( - _$CompletedCoursesModelImpl instance, -) => {'date': instance.date, 'title': instance.title}; + _$CompletedCoursesModelImpl instance) => + { + 'date': instance.date, + 'title': instance.title, + }; _$ProfileDetailsModelImpl _$$ProfileDetailsModelImplFromJson( - Map json, -) => _$ProfileDetailsModelImpl( - firstName: json['first_name'] as String, - lastName: json['last_name'] as String, - birthdate: json['birthdate'] as String, - gender: json['gender'] as String, - country: json['country'] as String, - city: json['city'] as String, - lang: json['lang'] as String, - weight: (json['weight'] as num).toDouble(), - height: (json['height'] as num).toInt(), - chestCircumference: (json['chest_circumference'] as num).toInt(), - waistCircumference: (json['waist_circumference'] as num).toInt(), - hipCircumference: (json['hip_circumference'] as num).toInt(), - bloodPressureUp: (json['blood_pressure_up'] as num).toInt(), - bloodPressureDown: (json['blood_pressure_down'] as num).toInt(), - hasHypo: json['has_hypo'] as bool, - hasHyper: json['has_hyper'] as bool, - aboutAlergy: json['about_alergy'] as String, - aboutTakingPils: json['about_taking_pils'] as String, - aboutSportHobbies: json['about_sport_hobbies'] as String, - favoriteFoods: json['favorite_foods'] as String, - unfavoriteFoods: json['unfavorite_foods'] as String, - additionalInfo: json['additional_info'] as String, - createdAt: - json['created_at'] == null + Map json) => + _$ProfileDetailsModelImpl( + firstName: json['first_name'] as String, + lastName: json['last_name'] as String, + birthdate: json['birthdate'] as String, + gender: json['gender'] as String, + country: json['country'] as String, + city: json['city'] as String, + lang: json['lang'] as String, + weight: (json['weight'] as num).toDouble(), + height: (json['height'] as num).toInt(), + chestCircumference: (json['chest_circumference'] as num).toInt(), + waistCircumference: (json['waist_circumference'] as num).toInt(), + hipCircumference: (json['hip_circumference'] as num).toInt(), + bloodPressureUp: (json['blood_pressure_up'] as num).toInt(), + bloodPressureDown: (json['blood_pressure_down'] as num).toInt(), + hasHypo: json['has_hypo'] as bool, + hasHyper: json['has_hyper'] as bool, + aboutAlergy: json['about_alergy'] as String, + aboutTakingPils: json['about_taking_pils'] as String, + aboutSportHobbies: json['about_sport_hobbies'] as String, + favoriteFoods: json['favorite_foods'] as String, + unfavoriteFoods: json['unfavorite_foods'] as String, + additionalInfo: json['additional_info'] as String, + createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), - updatedAt: - json['updated_at'] == null + updatedAt: json['updated_at'] == null ? null : DateTime.parse(json['updated_at'] as String), - isMoodFillable: json['is_mood_fillable'] as bool, - isBedtimeFillable: json['is_bedtime_fillable'] as bool, - activityCoefficient: (json['activity_coefficient'] as num).toDouble(), -); + isMoodFillable: json['is_mood_fillable'] as bool, + isBedtimeFillable: json['is_bedtime_fillable'] as bool, + activityCoefficient: (json['activity_coefficient'] as num).toDouble(), + ); Map _$$ProfileDetailsModelImplToJson( - _$ProfileDetailsModelImpl instance, -) => { - 'first_name': instance.firstName, - 'last_name': instance.lastName, - 'birthdate': instance.birthdate, - 'gender': instance.gender, - 'country': instance.country, - 'city': instance.city, - 'lang': instance.lang, - 'weight': instance.weight, - 'height': instance.height, - 'chest_circumference': instance.chestCircumference, - 'waist_circumference': instance.waistCircumference, - 'hip_circumference': instance.hipCircumference, - 'blood_pressure_up': instance.bloodPressureUp, - 'blood_pressure_down': instance.bloodPressureDown, - 'has_hypo': instance.hasHypo, - 'has_hyper': instance.hasHyper, - 'about_alergy': instance.aboutAlergy, - 'about_taking_pils': instance.aboutTakingPils, - 'about_sport_hobbies': instance.aboutSportHobbies, - 'favorite_foods': instance.favoriteFoods, - 'unfavorite_foods': instance.unfavoriteFoods, - 'additional_info': instance.additionalInfo, - 'created_at': instance.createdAt?.toIso8601String(), - 'updated_at': instance.updatedAt?.toIso8601String(), - 'is_mood_fillable': instance.isMoodFillable, - 'is_bedtime_fillable': instance.isBedtimeFillable, - 'activity_coefficient': instance.activityCoefficient, -}; + _$ProfileDetailsModelImpl instance) => + { + 'first_name': instance.firstName, + 'last_name': instance.lastName, + 'birthdate': instance.birthdate, + 'gender': instance.gender, + 'country': instance.country, + 'city': instance.city, + 'lang': instance.lang, + 'weight': instance.weight, + 'height': instance.height, + 'chest_circumference': instance.chestCircumference, + 'waist_circumference': instance.waistCircumference, + 'hip_circumference': instance.hipCircumference, + 'blood_pressure_up': instance.bloodPressureUp, + 'blood_pressure_down': instance.bloodPressureDown, + 'has_hypo': instance.hasHypo, + 'has_hyper': instance.hasHyper, + 'about_alergy': instance.aboutAlergy, + 'about_taking_pils': instance.aboutTakingPils, + 'about_sport_hobbies': instance.aboutSportHobbies, + 'favorite_foods': instance.favoriteFoods, + 'unfavorite_foods': instance.unfavoriteFoods, + 'additional_info': instance.additionalInfo, + 'created_at': instance.createdAt?.toIso8601String(), + 'updated_at': instance.updatedAt?.toIso8601String(), + 'is_mood_fillable': instance.isMoodFillable, + 'is_bedtime_fillable': instance.isBedtimeFillable, + 'activity_coefficient': instance.activityCoefficient, + }; _$ProfilePreviewModelImpl _$$ProfilePreviewModelImplFromJson( - Map json, -) => _$ProfilePreviewModelImpl( - profilePhotoUrl: json['profile_photo_url'] as String, -); + Map json) => + _$ProfilePreviewModelImpl( + profilePhotoUrl: json['profile_photo_url'] as String, + ); Map _$$ProfilePreviewModelImplToJson( - _$ProfilePreviewModelImpl instance, -) => {'profile_photo_url': instance.profilePhotoUrl}; + _$ProfilePreviewModelImpl instance) => + { + 'profile_photo_url': instance.profilePhotoUrl, + }; diff --git a/lib/features/profile/models/sub_model.freezed.dart b/lib/features/profile/models/sub_model.freezed.dart index 995abca9..34d6ae49 100644 --- a/lib/features/profile/models/sub_model.freezed.dart +++ b/lib/features/profile/models/sub_model.freezed.dart @@ -12,8 +12,7 @@ part of 'sub_model.dart'; 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', -); + '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'); SubPaginationModel _$SubPaginationModelFromJson(Map json) { return _SubPaginationModel.fromJson(json); @@ -38,9 +37,8 @@ mixin _$SubPaginationModel { /// @nodoc abstract class $SubPaginationModelCopyWith<$Res> { factory $SubPaginationModelCopyWith( - SubPaginationModel value, - $Res Function(SubPaginationModel) then, - ) = _$SubPaginationModelCopyWithImpl<$Res, SubPaginationModel>; + SubPaginationModel value, $Res Function(SubPaginationModel) then) = + _$SubPaginationModelCopyWithImpl<$Res, SubPaginationModel>; @useResult $Res call({List data, Links links, Meta meta}); @@ -62,27 +60,25 @@ class _$SubPaginationModelCopyWithImpl<$Res, $Val extends SubPaginationModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _value.copyWith( - data: - null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ) - as $Val, - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_value.copyWith( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + ) as $Val); } /// Create a copy of SubPaginationModel @@ -109,10 +105,9 @@ class _$SubPaginationModelCopyWithImpl<$Res, $Val extends SubPaginationModel> /// @nodoc abstract class _$$SubPaginationModelImplCopyWith<$Res> implements $SubPaginationModelCopyWith<$Res> { - factory _$$SubPaginationModelImplCopyWith( - _$SubPaginationModelImpl value, - $Res Function(_$SubPaginationModelImpl) then, - ) = __$$SubPaginationModelImplCopyWithImpl<$Res>; + factory _$$SubPaginationModelImplCopyWith(_$SubPaginationModelImpl value, + $Res Function(_$SubPaginationModelImpl) then) = + __$$SubPaginationModelImplCopyWithImpl<$Res>; @override @useResult $Res call({List data, Links links, Meta meta}); @@ -127,46 +122,44 @@ abstract class _$$SubPaginationModelImplCopyWith<$Res> class __$$SubPaginationModelImplCopyWithImpl<$Res> extends _$SubPaginationModelCopyWithImpl<$Res, _$SubPaginationModelImpl> implements _$$SubPaginationModelImplCopyWith<$Res> { - __$$SubPaginationModelImplCopyWithImpl( - _$SubPaginationModelImpl _value, - $Res Function(_$SubPaginationModelImpl) _then, - ) : super(_value, _then); + __$$SubPaginationModelImplCopyWithImpl(_$SubPaginationModelImpl _value, + $Res Function(_$SubPaginationModelImpl) _then) + : super(_value, _then); /// Create a copy of SubPaginationModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? data = null, Object? links = null, Object? meta = null}) { - return _then( - _$SubPaginationModelImpl( - data: - null == data - ? _value._data - : data // ignore: cast_nullable_to_non_nullable - as List, - links: - null == links - ? _value.links - : links // ignore: cast_nullable_to_non_nullable - as Links, - meta: - null == meta - ? _value.meta - : meta // ignore: cast_nullable_to_non_nullable - as Meta, - ), - ); + $Res call({ + Object? data = null, + Object? links = null, + Object? meta = null, + }) { + return _then(_$SubPaginationModelImpl( + data: null == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as List, + links: null == links + ? _value.links + : links // ignore: cast_nullable_to_non_nullable + as Links, + meta: null == meta + ? _value.meta + : meta // ignore: cast_nullable_to_non_nullable + as Meta, + )); } } /// @nodoc @JsonSerializable() class _$SubPaginationModelImpl implements _SubPaginationModel { - const _$SubPaginationModelImpl({ - required final List data, - required this.links, - required this.meta, - }) : _data = data; + const _$SubPaginationModelImpl( + {required final List data, + required this.links, + required this.meta}) + : _data = data; factory _$SubPaginationModelImpl.fromJson(Map json) => _$$SubPaginationModelImplFromJson(json); @@ -202,11 +195,7 @@ class _$SubPaginationModelImpl implements _SubPaginationModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_data), - links, - meta, - ); + runtimeType, const DeepCollectionEquality().hash(_data), links, meta); /// Create a copy of SubPaginationModel /// with the given fields replaced by the non-null parameter values. @@ -215,22 +204,21 @@ class _$SubPaginationModelImpl implements _SubPaginationModel { @pragma('vm:prefer-inline') _$$SubPaginationModelImplCopyWith<_$SubPaginationModelImpl> get copyWith => __$$SubPaginationModelImplCopyWithImpl<_$SubPaginationModelImpl>( - this, - _$identity, - ); + this, _$identity); @override Map toJson() { - return _$$SubPaginationModelImplToJson(this); + return _$$SubPaginationModelImplToJson( + this, + ); } } abstract class _SubPaginationModel implements SubPaginationModel { - const factory _SubPaginationModel({ - required final List data, - required final Links links, - required final Meta meta, - }) = _$SubPaginationModelImpl; + const factory _SubPaginationModel( + {required final List data, + required final Links links, + required final Meta meta}) = _$SubPaginationModelImpl; factory _SubPaginationModel.fromJson(Map json) = _$SubPaginationModelImpl.fromJson; @@ -289,20 +277,19 @@ abstract class $SubModelCopyWith<$Res> { factory $SubModelCopyWith(SubModel value, $Res Function(SubModel) then) = _$SubModelCopyWithImpl<$Res, SubModel>; @useResult - $Res call({ - int id, - String slug, - String name, - String city, - DateTime birthdate, - @JsonKey(name: 'is_entity_subscribed_by_me') bool isEntitySubscribedByMe, - String email, - @JsonKey(name: 'profile_photo_url') String profilePhotoUrl, - String role, - @JsonKey(name: 'is_public_profile') bool isPublicProfile, - @JsonKey(name: 'created_at') DateTime createdAt, - @JsonKey(name: 'updated_at') DateTime updatedAt, - }); + $Res call( + {int id, + String slug, + String name, + String city, + DateTime birthdate, + @JsonKey(name: 'is_entity_subscribed_by_me') bool isEntitySubscribedByMe, + String email, + @JsonKey(name: 'profile_photo_url') String profilePhotoUrl, + String role, + @JsonKey(name: 'is_public_profile') bool isPublicProfile, + @JsonKey(name: 'created_at') DateTime createdAt, + @JsonKey(name: 'updated_at') DateTime updatedAt}); } /// @nodoc @@ -333,71 +320,56 @@ class _$SubModelCopyWithImpl<$Res, $Val extends SubModel> Object? createdAt = null, Object? updatedAt = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - city: - null == city - ? _value.city - : city // ignore: cast_nullable_to_non_nullable - as String, - birthdate: - null == birthdate - ? _value.birthdate - : birthdate // ignore: cast_nullable_to_non_nullable - as DateTime, - isEntitySubscribedByMe: - null == isEntitySubscribedByMe - ? _value.isEntitySubscribedByMe - : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable - as bool, - email: - null == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String, - profilePhotoUrl: - null == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String, - role: - null == role - ? _value.role - : role // ignore: cast_nullable_to_non_nullable - as String, - isPublicProfile: - null == isPublicProfile - ? _value.isPublicProfile - : isPublicProfile // ignore: cast_nullable_to_non_nullable - as bool, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + city: null == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String, + birthdate: null == birthdate + ? _value.birthdate + : birthdate // ignore: cast_nullable_to_non_nullable + as DateTime, + isEntitySubscribedByMe: null == isEntitySubscribedByMe + ? _value.isEntitySubscribedByMe + : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable + as bool, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + profilePhotoUrl: null == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String, + role: null == role + ? _value.role + : role // ignore: cast_nullable_to_non_nullable + as String, + isPublicProfile: null == isPublicProfile + ? _value.isPublicProfile + : isPublicProfile // ignore: cast_nullable_to_non_nullable + as bool, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ) as $Val); } } @@ -405,25 +377,23 @@ class _$SubModelCopyWithImpl<$Res, $Val extends SubModel> abstract class _$$SubModelImplCopyWith<$Res> implements $SubModelCopyWith<$Res> { factory _$$SubModelImplCopyWith( - _$SubModelImpl value, - $Res Function(_$SubModelImpl) then, - ) = __$$SubModelImplCopyWithImpl<$Res>; + _$SubModelImpl value, $Res Function(_$SubModelImpl) then) = + __$$SubModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - int id, - String slug, - String name, - String city, - DateTime birthdate, - @JsonKey(name: 'is_entity_subscribed_by_me') bool isEntitySubscribedByMe, - String email, - @JsonKey(name: 'profile_photo_url') String profilePhotoUrl, - String role, - @JsonKey(name: 'is_public_profile') bool isPublicProfile, - @JsonKey(name: 'created_at') DateTime createdAt, - @JsonKey(name: 'updated_at') DateTime updatedAt, - }); + $Res call( + {int id, + String slug, + String name, + String city, + DateTime birthdate, + @JsonKey(name: 'is_entity_subscribed_by_me') bool isEntitySubscribedByMe, + String email, + @JsonKey(name: 'profile_photo_url') String profilePhotoUrl, + String role, + @JsonKey(name: 'is_public_profile') bool isPublicProfile, + @JsonKey(name: 'created_at') DateTime createdAt, + @JsonKey(name: 'updated_at') DateTime updatedAt}); } /// @nodoc @@ -431,9 +401,8 @@ class __$$SubModelImplCopyWithImpl<$Res> extends _$SubModelCopyWithImpl<$Res, _$SubModelImpl> implements _$$SubModelImplCopyWith<$Res> { __$$SubModelImplCopyWithImpl( - _$SubModelImpl _value, - $Res Function(_$SubModelImpl) _then, - ) : super(_value, _then); + _$SubModelImpl _value, $Res Function(_$SubModelImpl) _then) + : super(_value, _then); /// Create a copy of SubModel /// with the given fields replaced by the non-null parameter values. @@ -453,91 +422,76 @@ class __$$SubModelImplCopyWithImpl<$Res> Object? createdAt = null, Object? updatedAt = null, }) { - return _then( - _$SubModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - slug: - null == slug - ? _value.slug - : slug // ignore: cast_nullable_to_non_nullable - as String, - name: - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - city: - null == city - ? _value.city - : city // ignore: cast_nullable_to_non_nullable - as String, - birthdate: - null == birthdate - ? _value.birthdate - : birthdate // ignore: cast_nullable_to_non_nullable - as DateTime, - isEntitySubscribedByMe: - null == isEntitySubscribedByMe - ? _value.isEntitySubscribedByMe - : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable - as bool, - email: - null == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String, - profilePhotoUrl: - null == profilePhotoUrl - ? _value.profilePhotoUrl - : profilePhotoUrl // ignore: cast_nullable_to_non_nullable - as String, - role: - null == role - ? _value.role - : role // ignore: cast_nullable_to_non_nullable - as String, - isPublicProfile: - null == isPublicProfile - ? _value.isPublicProfile - : isPublicProfile // ignore: cast_nullable_to_non_nullable - as bool, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - ), - ); + return _then(_$SubModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + city: null == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String, + birthdate: null == birthdate + ? _value.birthdate + : birthdate // ignore: cast_nullable_to_non_nullable + as DateTime, + isEntitySubscribedByMe: null == isEntitySubscribedByMe + ? _value.isEntitySubscribedByMe + : isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable + as bool, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + profilePhotoUrl: null == profilePhotoUrl + ? _value.profilePhotoUrl + : profilePhotoUrl // ignore: cast_nullable_to_non_nullable + as String, + role: null == role + ? _value.role + : role // ignore: cast_nullable_to_non_nullable + as String, + isPublicProfile: null == isPublicProfile + ? _value.isPublicProfile + : isPublicProfile // ignore: cast_nullable_to_non_nullable + as bool, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); } } /// @nodoc @JsonSerializable() class _$SubModelImpl implements _SubModel { - const _$SubModelImpl({ - required this.id, - required this.slug, - required this.name, - required this.city, - required this.birthdate, - @JsonKey(name: 'is_entity_subscribed_by_me') - required this.isEntitySubscribedByMe, - required this.email, - @JsonKey(name: 'profile_photo_url') required this.profilePhotoUrl, - required this.role, - @JsonKey(name: 'is_public_profile') required this.isPublicProfile, - @JsonKey(name: 'created_at') required this.createdAt, - @JsonKey(name: 'updated_at') required this.updatedAt, - }); + const _$SubModelImpl( + {required this.id, + required this.slug, + required this.name, + required this.city, + required this.birthdate, + @JsonKey(name: 'is_entity_subscribed_by_me') + required this.isEntitySubscribedByMe, + required this.email, + @JsonKey(name: 'profile_photo_url') required this.profilePhotoUrl, + required this.role, + @JsonKey(name: 'is_public_profile') required this.isPublicProfile, + @JsonKey(name: 'created_at') required this.createdAt, + @JsonKey(name: 'updated_at') required this.updatedAt}); factory _$SubModelImpl.fromJson(Map json) => _$$SubModelImplFromJson(json); @@ -605,20 +559,19 @@ class _$SubModelImpl implements _SubModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - id, - slug, - name, - city, - birthdate, - isEntitySubscribedByMe, - email, - profilePhotoUrl, - role, - isPublicProfile, - createdAt, - updatedAt, - ); + runtimeType, + id, + slug, + name, + city, + birthdate, + isEntitySubscribedByMe, + email, + profilePhotoUrl, + role, + isPublicProfile, + createdAt, + updatedAt); /// Create a copy of SubModel /// with the given fields replaced by the non-null parameter values. @@ -630,26 +583,28 @@ class _$SubModelImpl implements _SubModel { @override Map toJson() { - return _$$SubModelImplToJson(this); + return _$$SubModelImplToJson( + this, + ); } } abstract class _SubModel implements SubModel { - const factory _SubModel({ - required final int id, - required final String slug, - required final String name, - required final String city, - required final DateTime birthdate, - @JsonKey(name: 'is_entity_subscribed_by_me') - required final bool isEntitySubscribedByMe, - required final String email, - @JsonKey(name: 'profile_photo_url') required final String profilePhotoUrl, - required final String role, - @JsonKey(name: 'is_public_profile') required final bool isPublicProfile, - @JsonKey(name: 'created_at') required final DateTime createdAt, - @JsonKey(name: 'updated_at') required final DateTime updatedAt, - }) = _$SubModelImpl; + const factory _SubModel( + {required final int id, + required final String slug, + required final String name, + required final String city, + required final DateTime birthdate, + @JsonKey(name: 'is_entity_subscribed_by_me') + required final bool isEntitySubscribedByMe, + required final String email, + @JsonKey(name: 'profile_photo_url') required final String profilePhotoUrl, + required final String role, + @JsonKey(name: 'is_public_profile') required final bool isPublicProfile, + @JsonKey(name: 'created_at') required final DateTime createdAt, + @JsonKey(name: 'updated_at') + required final DateTime updatedAt}) = _$SubModelImpl; factory _SubModel.fromJson(Map json) = _$SubModelImpl.fromJson; diff --git a/lib/features/profile/models/sub_model.g.dart b/lib/features/profile/models/sub_model.g.dart index f4efe774..e3c9397e 100644 --- a/lib/features/profile/models/sub_model.g.dart +++ b/lib/features/profile/models/sub_model.g.dart @@ -7,23 +7,22 @@ part of 'sub_model.dart'; // ************************************************************************** _$SubPaginationModelImpl _$$SubPaginationModelImplFromJson( - Map json, -) => _$SubPaginationModelImpl( - data: - (json['data'] as List) + Map json) => + _$SubPaginationModelImpl( + data: (json['data'] as List) .map((e) => SubModel.fromJson(e as Map)) .toList(), - links: Links.fromJson(json['links'] as Map), - meta: Meta.fromJson(json['meta'] as Map), -); + links: Links.fromJson(json['links'] as Map), + meta: Meta.fromJson(json['meta'] as Map), + ); Map _$$SubPaginationModelImplToJson( - _$SubPaginationModelImpl instance, -) => { - 'data': instance.data, - 'links': instance.links, - 'meta': instance.meta, -}; + _$SubPaginationModelImpl instance) => + { + 'data': instance.data, + 'links': instance.links, + 'meta': instance.meta, + }; _$SubModelImpl _$$SubModelImplFromJson(Map json) => _$SubModelImpl( diff --git a/lib/features/profile/models/weight_model.freezed.dart b/lib/features/profile/models/weight_model.freezed.dart index 59e2ae3e..3ca65637 100644 --- a/lib/features/profile/models/weight_model.freezed.dart +++ b/lib/features/profile/models/weight_model.freezed.dart @@ -12,8 +12,7 @@ part of 'weight_model.dart'; 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', -); + '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'); WeightModel _$WeightModelFromJson(Map json) { return _WeightModel.fromJson(json); @@ -47,18 +46,16 @@ mixin _$WeightModel { /// @nodoc abstract class $WeightModelCopyWith<$Res> { factory $WeightModelCopyWith( - WeightModel value, - $Res Function(WeightModel) then, - ) = _$WeightModelCopyWithImpl<$Res, WeightModel>; + WeightModel value, $Res Function(WeightModel) then) = + _$WeightModelCopyWithImpl<$Res, WeightModel>; @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "user_id") int userId, - @JsonKey(name: "weight") int weight, - @JsonKey(name: "created_at") DateTime createdAt, - @JsonKey(name: "updated_at") DateTime updatedAt, - @JsonKey(name: "bmi") double bmi, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "user_id") int userId, + @JsonKey(name: "weight") int weight, + @JsonKey(name: "created_at") DateTime createdAt, + @JsonKey(name: "updated_at") DateTime updatedAt, + @JsonKey(name: "bmi") double bmi}); } /// @nodoc @@ -83,41 +80,32 @@ class _$WeightModelCopyWithImpl<$Res, $Val extends WeightModel> Object? updatedAt = null, Object? bmi = null, }) { - return _then( - _value.copyWith( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - userId: - null == userId - ? _value.userId - : userId // ignore: cast_nullable_to_non_nullable - as int, - weight: - null == weight - ? _value.weight - : weight // ignore: cast_nullable_to_non_nullable - as int, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - bmi: - null == bmi - ? _value.bmi - : bmi // ignore: cast_nullable_to_non_nullable - as double, - ) - as $Val, - ); + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as int, + weight: null == weight + ? _value.weight + : weight // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + bmi: null == bmi + ? _value.bmi + : bmi // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); } } @@ -125,19 +113,17 @@ class _$WeightModelCopyWithImpl<$Res, $Val extends WeightModel> abstract class _$$WeightModelImplCopyWith<$Res> implements $WeightModelCopyWith<$Res> { factory _$$WeightModelImplCopyWith( - _$WeightModelImpl value, - $Res Function(_$WeightModelImpl) then, - ) = __$$WeightModelImplCopyWithImpl<$Res>; + _$WeightModelImpl value, $Res Function(_$WeightModelImpl) then) = + __$$WeightModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "id") int id, - @JsonKey(name: "user_id") int userId, - @JsonKey(name: "weight") int weight, - @JsonKey(name: "created_at") DateTime createdAt, - @JsonKey(name: "updated_at") DateTime updatedAt, - @JsonKey(name: "bmi") double bmi, - }); + $Res call( + {@JsonKey(name: "id") int id, + @JsonKey(name: "user_id") int userId, + @JsonKey(name: "weight") int weight, + @JsonKey(name: "created_at") DateTime createdAt, + @JsonKey(name: "updated_at") DateTime updatedAt, + @JsonKey(name: "bmi") double bmi}); } /// @nodoc @@ -145,9 +131,8 @@ class __$$WeightModelImplCopyWithImpl<$Res> extends _$WeightModelCopyWithImpl<$Res, _$WeightModelImpl> implements _$$WeightModelImplCopyWith<$Res> { __$$WeightModelImplCopyWithImpl( - _$WeightModelImpl _value, - $Res Function(_$WeightModelImpl) _then, - ) : super(_value, _then); + _$WeightModelImpl _value, $Res Function(_$WeightModelImpl) _then) + : super(_value, _then); /// Create a copy of WeightModel /// with the given fields replaced by the non-null parameter values. @@ -161,54 +146,45 @@ class __$$WeightModelImplCopyWithImpl<$Res> Object? updatedAt = null, Object? bmi = null, }) { - return _then( - _$WeightModelImpl( - id: - null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - userId: - null == userId - ? _value.userId - : userId // ignore: cast_nullable_to_non_nullable - as int, - weight: - null == weight - ? _value.weight - : weight // ignore: cast_nullable_to_non_nullable - as int, - createdAt: - null == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as DateTime, - updatedAt: - null == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - bmi: - null == bmi - ? _value.bmi - : bmi // ignore: cast_nullable_to_non_nullable - as double, - ), - ); + return _then(_$WeightModelImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as int, + weight: null == weight + ? _value.weight + : weight // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + bmi: null == bmi + ? _value.bmi + : bmi // ignore: cast_nullable_to_non_nullable + as double, + )); } } /// @nodoc @JsonSerializable() class _$WeightModelImpl implements _WeightModel { - const _$WeightModelImpl({ - @JsonKey(name: "id") required this.id, - @JsonKey(name: "user_id") required this.userId, - @JsonKey(name: "weight") required this.weight, - @JsonKey(name: "created_at") required this.createdAt, - @JsonKey(name: "updated_at") required this.updatedAt, - @JsonKey(name: "bmi") required this.bmi, - }); + const _$WeightModelImpl( + {@JsonKey(name: "id") required this.id, + @JsonKey(name: "user_id") required this.userId, + @JsonKey(name: "weight") required this.weight, + @JsonKey(name: "created_at") required this.createdAt, + @JsonKey(name: "updated_at") required this.updatedAt, + @JsonKey(name: "bmi") required this.bmi}); factory _$WeightModelImpl.fromJson(Map json) => _$$WeightModelImplFromJson(json); @@ -267,19 +243,20 @@ class _$WeightModelImpl implements _WeightModel { @override Map toJson() { - return _$$WeightModelImplToJson(this); + return _$$WeightModelImplToJson( + this, + ); } } abstract class _WeightModel implements WeightModel { - const factory _WeightModel({ - @JsonKey(name: "id") required final int id, - @JsonKey(name: "user_id") required final int userId, - @JsonKey(name: "weight") required final int weight, - @JsonKey(name: "created_at") required final DateTime createdAt, - @JsonKey(name: "updated_at") required final DateTime updatedAt, - @JsonKey(name: "bmi") required final double bmi, - }) = _$WeightModelImpl; + const factory _WeightModel( + {@JsonKey(name: "id") required final int id, + @JsonKey(name: "user_id") required final int userId, + @JsonKey(name: "weight") required final int weight, + @JsonKey(name: "created_at") required final DateTime createdAt, + @JsonKey(name: "updated_at") required final DateTime updatedAt, + @JsonKey(name: "bmi") required final double bmi}) = _$WeightModelImpl; factory _WeightModel.fromJson(Map json) = _$WeightModelImpl.fromJson; diff --git a/lib/features/profile/presentation/bloc/plans_cubit/plans_state.freezed.dart b/lib/features/profile/presentation/bloc/plans_cubit/plans_state.freezed.dart index b9e153e6..9230dbdf 100644 --- a/lib/features/profile/presentation/bloc/plans_cubit/plans_state.freezed.dart +++ b/lib/features/profile/presentation/bloc/plans_cubit/plans_state.freezed.dart @@ -12,8 +12,7 @@ part of 'plans_state.dart'; 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', -); + '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'); /// @nodoc mixin _$PlansState { @@ -23,14 +22,16 @@ mixin _$PlansState { required TResult Function() loading, required TResult Function(List plansList) loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(List plansList)? loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -38,21 +39,24 @@ mixin _$PlansState { TResult Function(List plansList)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_PlansState value) $default, { required TResult Function(PlansStateLoading value) loading, required TResult Function(PlansStateLoaded value) loaded, required TResult Function(PlansStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_PlansState value)? $default, { TResult? Function(PlansStateLoading value)? loading, TResult? Function(PlansStateLoaded value)? loaded, TResult? Function(PlansStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_PlansState value)? $default, { @@ -60,15 +64,15 @@ mixin _$PlansState { TResult Function(PlansStateLoaded value)? loaded, TResult Function(PlansStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $PlansStateCopyWith<$Res> { factory $PlansStateCopyWith( - PlansState value, - $Res Function(PlansState) then, - ) = _$PlansStateCopyWithImpl<$Res, PlansState>; + PlansState value, $Res Function(PlansState) then) = + _$PlansStateCopyWithImpl<$Res, PlansState>; } /// @nodoc @@ -88,9 +92,8 @@ class _$PlansStateCopyWithImpl<$Res, $Val extends PlansState> /// @nodoc abstract class _$$PlansStateImplCopyWith<$Res> { factory _$$PlansStateImplCopyWith( - _$PlansStateImpl value, - $Res Function(_$PlansStateImpl) then, - ) = __$$PlansStateImplCopyWithImpl<$Res>; + _$PlansStateImpl value, $Res Function(_$PlansStateImpl) then) = + __$$PlansStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -98,9 +101,8 @@ class __$$PlansStateImplCopyWithImpl<$Res> extends _$PlansStateCopyWithImpl<$Res, _$PlansStateImpl> implements _$$PlansStateImplCopyWith<$Res> { __$$PlansStateImplCopyWithImpl( - _$PlansStateImpl _value, - $Res Function(_$PlansStateImpl) _then, - ) : super(_value, _then); + _$PlansStateImpl _value, $Res Function(_$PlansStateImpl) _then) + : super(_value, _then); /// Create a copy of PlansState /// with the given fields replaced by the non-null parameter values. @@ -206,20 +208,18 @@ abstract class _PlansState implements PlansState { /// @nodoc abstract class _$$PlansStateLoadingImplCopyWith<$Res> { - factory _$$PlansStateLoadingImplCopyWith( - _$PlansStateLoadingImpl value, - $Res Function(_$PlansStateLoadingImpl) then, - ) = __$$PlansStateLoadingImplCopyWithImpl<$Res>; + factory _$$PlansStateLoadingImplCopyWith(_$PlansStateLoadingImpl value, + $Res Function(_$PlansStateLoadingImpl) then) = + __$$PlansStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$PlansStateLoadingImplCopyWithImpl<$Res> extends _$PlansStateCopyWithImpl<$Res, _$PlansStateLoadingImpl> implements _$$PlansStateLoadingImplCopyWith<$Res> { - __$$PlansStateLoadingImplCopyWithImpl( - _$PlansStateLoadingImpl _value, - $Res Function(_$PlansStateLoadingImpl) _then, - ) : super(_value, _then); + __$$PlansStateLoadingImplCopyWithImpl(_$PlansStateLoadingImpl _value, + $Res Function(_$PlansStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of PlansState /// with the given fields replaced by the non-null parameter values. @@ -325,10 +325,9 @@ abstract class PlansStateLoading implements PlansState { /// @nodoc abstract class _$$PlansStateLoadedImplCopyWith<$Res> { - factory _$$PlansStateLoadedImplCopyWith( - _$PlansStateLoadedImpl value, - $Res Function(_$PlansStateLoadedImpl) then, - ) = __$$PlansStateLoadedImplCopyWithImpl<$Res>; + factory _$$PlansStateLoadedImplCopyWith(_$PlansStateLoadedImpl value, + $Res Function(_$PlansStateLoadedImpl) then) = + __$$PlansStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({List plansList}); } @@ -337,25 +336,23 @@ abstract class _$$PlansStateLoadedImplCopyWith<$Res> { class __$$PlansStateLoadedImplCopyWithImpl<$Res> extends _$PlansStateCopyWithImpl<$Res, _$PlansStateLoadedImpl> implements _$$PlansStateLoadedImplCopyWith<$Res> { - __$$PlansStateLoadedImplCopyWithImpl( - _$PlansStateLoadedImpl _value, - $Res Function(_$PlansStateLoadedImpl) _then, - ) : super(_value, _then); + __$$PlansStateLoadedImplCopyWithImpl(_$PlansStateLoadedImpl _value, + $Res Function(_$PlansStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of PlansState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? plansList = null}) { - return _then( - _$PlansStateLoadedImpl( - plansList: - null == plansList - ? _value._plansList - : plansList // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + $Res call({ + Object? plansList = null, + }) { + return _then(_$PlansStateLoadedImpl( + plansList: null == plansList + ? _value._plansList + : plansList // ignore: cast_nullable_to_non_nullable + as List, + )); } } @@ -363,7 +360,7 @@ class __$$PlansStateLoadedImplCopyWithImpl<$Res> class _$PlansStateLoadedImpl implements PlansStateLoaded { const _$PlansStateLoadedImpl({required final List plansList}) - : _plansList = plansList; + : _plansList = plansList; final List _plansList; @override @@ -383,10 +380,8 @@ class _$PlansStateLoadedImpl implements PlansStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PlansStateLoadedImpl && - const DeepCollectionEquality().equals( - other._plansList, - _plansList, - )); + const DeepCollectionEquality() + .equals(other._plansList, _plansList)); } @override @@ -400,9 +395,7 @@ class _$PlansStateLoadedImpl implements PlansStateLoaded { @pragma('vm:prefer-inline') _$$PlansStateLoadedImplCopyWith<_$PlansStateLoadedImpl> get copyWith => __$$PlansStateLoadedImplCopyWithImpl<_$PlansStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -494,10 +487,9 @@ abstract class PlansStateLoaded implements PlansState { /// @nodoc abstract class _$$PlansStateErrorImplCopyWith<$Res> { - factory _$$PlansStateErrorImplCopyWith( - _$PlansStateErrorImpl value, - $Res Function(_$PlansStateErrorImpl) then, - ) = __$$PlansStateErrorImplCopyWithImpl<$Res>; + factory _$$PlansStateErrorImplCopyWith(_$PlansStateErrorImpl value, + $Res Function(_$PlansStateErrorImpl) then) = + __$$PlansStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -507,24 +499,22 @@ class __$$PlansStateErrorImplCopyWithImpl<$Res> extends _$PlansStateCopyWithImpl<$Res, _$PlansStateErrorImpl> implements _$$PlansStateErrorImplCopyWith<$Res> { __$$PlansStateErrorImplCopyWithImpl( - _$PlansStateErrorImpl _value, - $Res Function(_$PlansStateErrorImpl) _then, - ) : super(_value, _then); + _$PlansStateErrorImpl _value, $Res Function(_$PlansStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of PlansState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$PlansStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$PlansStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -560,9 +550,7 @@ class _$PlansStateErrorImpl implements PlansStateError { @pragma('vm:prefer-inline') _$$PlansStateErrorImplCopyWith<_$PlansStateErrorImpl> get copyWith => __$$PlansStateErrorImplCopyWithImpl<_$PlansStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs diff --git a/lib/features/profile/presentation/bloc/profile_cubit/profile_state.freezed.dart b/lib/features/profile/presentation/bloc/profile_cubit/profile_state.freezed.dart index 13b0de4d..8919e36f 100644 --- a/lib/features/profile/presentation/bloc/profile_cubit/profile_state.freezed.dart +++ b/lib/features/profile/presentation/bloc/profile_cubit/profile_state.freezed.dart @@ -12,8 +12,7 @@ part of 'profile_state.dart'; 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', -); + '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'); /// @nodoc mixin _$ProfileState { @@ -22,58 +21,60 @@ mixin _$ProfileState { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - ) - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints) + loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_ProfileState value) $default, { required TResult Function(ProfileStateLoading value) loading, required TResult Function(ProfileStateLoaded value) loaded, required TResult Function(ProfileStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_ProfileState value)? $default, { TResult? Function(ProfileStateLoading value)? loading, TResult? Function(ProfileStateLoaded value)? loaded, TResult? Function(ProfileStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_ProfileState value)? $default, { @@ -81,15 +82,15 @@ mixin _$ProfileState { TResult Function(ProfileStateLoaded value)? loaded, TResult Function(ProfileStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ProfileStateCopyWith<$Res> { factory $ProfileStateCopyWith( - ProfileState value, - $Res Function(ProfileState) then, - ) = _$ProfileStateCopyWithImpl<$Res, ProfileState>; + ProfileState value, $Res Function(ProfileState) then) = + _$ProfileStateCopyWithImpl<$Res, ProfileState>; } /// @nodoc @@ -109,9 +110,8 @@ class _$ProfileStateCopyWithImpl<$Res, $Val extends ProfileState> /// @nodoc abstract class _$$ProfileStateImplCopyWith<$Res> { factory _$$ProfileStateImplCopyWith( - _$ProfileStateImpl value, - $Res Function(_$ProfileStateImpl) then, - ) = __$$ProfileStateImplCopyWithImpl<$Res>; + _$ProfileStateImpl value, $Res Function(_$ProfileStateImpl) then) = + __$$ProfileStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -119,9 +119,8 @@ class __$$ProfileStateImplCopyWithImpl<$Res> extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateImpl> implements _$$ProfileStateImplCopyWith<$Res> { __$$ProfileStateImplCopyWithImpl( - _$ProfileStateImpl _value, - $Res Function(_$ProfileStateImpl) _then, - ) : super(_value, _then); + _$ProfileStateImpl _value, $Res Function(_$ProfileStateImpl) _then) + : super(_value, _then); /// Create a copy of ProfileState /// with the given fields replaced by the non-null parameter values. @@ -152,13 +151,12 @@ class _$ProfileStateImpl implements _ProfileState { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - ) - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints) + loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -170,13 +168,12 @@ class _$ProfileStateImpl implements _ProfileState { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -188,13 +185,12 @@ class _$ProfileStateImpl implements _ProfileState { TResult Function()? $default, { TResult Function()? loading, TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -248,20 +244,18 @@ abstract class _ProfileState implements ProfileState { /// @nodoc abstract class _$$ProfileStateLoadingImplCopyWith<$Res> { - factory _$$ProfileStateLoadingImplCopyWith( - _$ProfileStateLoadingImpl value, - $Res Function(_$ProfileStateLoadingImpl) then, - ) = __$$ProfileStateLoadingImplCopyWithImpl<$Res>; + factory _$$ProfileStateLoadingImplCopyWith(_$ProfileStateLoadingImpl value, + $Res Function(_$ProfileStateLoadingImpl) then) = + __$$ProfileStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$ProfileStateLoadingImplCopyWithImpl<$Res> extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateLoadingImpl> implements _$$ProfileStateLoadingImplCopyWith<$Res> { - __$$ProfileStateLoadingImplCopyWithImpl( - _$ProfileStateLoadingImpl _value, - $Res Function(_$ProfileStateLoadingImpl) _then, - ) : super(_value, _then); + __$$ProfileStateLoadingImplCopyWithImpl(_$ProfileStateLoadingImpl _value, + $Res Function(_$ProfileStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of ProfileState /// with the given fields replaced by the non-null parameter values. @@ -293,13 +287,12 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - ) - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints) + loaded, required TResult Function(String errorMessage) error, }) { return loading(); @@ -311,13 +304,12 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult? Function(String errorMessage)? error, }) { return loading?.call(); @@ -329,13 +321,12 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading { TResult Function()? $default, { TResult Function()? loading, TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -389,18 +380,16 @@ abstract class ProfileStateLoading implements ProfileState { /// @nodoc abstract class _$$ProfileStateLoadedImplCopyWith<$Res> { - factory _$$ProfileStateLoadedImplCopyWith( - _$ProfileStateLoadedImpl value, - $Res Function(_$ProfileStateLoadedImpl) then, - ) = __$$ProfileStateLoadedImplCopyWithImpl<$Res>; + factory _$$ProfileStateLoadedImplCopyWith(_$ProfileStateLoadedImpl value, + $Res Function(_$ProfileStateLoadedImpl) then) = + __$$ProfileStateLoadedImplCopyWithImpl<$Res>; @useResult - $Res call({ - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - }); + $Res call( + {ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints}); $ProfileModelCopyWith<$Res> get profile; $ProfileDetailsModelCopyWith<$Res> get profileDetails; @@ -410,10 +399,9 @@ abstract class _$$ProfileStateLoadedImplCopyWith<$Res> { class __$$ProfileStateLoadedImplCopyWithImpl<$Res> extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateLoadedImpl> implements _$$ProfileStateLoadedImplCopyWith<$Res> { - __$$ProfileStateLoadedImplCopyWithImpl( - _$ProfileStateLoadedImpl _value, - $Res Function(_$ProfileStateLoadedImpl) _then, - ) : super(_value, _then); + __$$ProfileStateLoadedImplCopyWithImpl(_$ProfileStateLoadedImpl _value, + $Res Function(_$ProfileStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of ProfileState /// with the given fields replaced by the non-null parameter values. @@ -426,35 +414,28 @@ class __$$ProfileStateLoadedImplCopyWithImpl<$Res> Object? weightPoints = freezed, Object? circumferencePoints = freezed, }) { - return _then( - _$ProfileStateLoadedImpl( - profile: - null == profile - ? _value.profile - : profile // ignore: cast_nullable_to_non_nullable - as ProfileModel, - profileDetails: - null == profileDetails - ? _value.profileDetails - : profileDetails // ignore: cast_nullable_to_non_nullable - as ProfileDetailsModel, - blogPosts: - null == blogPosts - ? _value._blogPosts - : blogPosts // ignore: cast_nullable_to_non_nullable - as List, - weightPoints: - freezed == weightPoints - ? _value._weightPoints - : weightPoints // ignore: cast_nullable_to_non_nullable - as List?, - circumferencePoints: - freezed == circumferencePoints - ? _value._circumferencePoints - : circumferencePoints // ignore: cast_nullable_to_non_nullable - as List?, - ), - ); + return _then(_$ProfileStateLoadedImpl( + profile: null == profile + ? _value.profile + : profile // ignore: cast_nullable_to_non_nullable + as ProfileModel, + profileDetails: null == profileDetails + ? _value.profileDetails + : profileDetails // ignore: cast_nullable_to_non_nullable + as ProfileDetailsModel, + blogPosts: null == blogPosts + ? _value._blogPosts + : blogPosts // ignore: cast_nullable_to_non_nullable + as List, + weightPoints: freezed == weightPoints + ? _value._weightPoints + : weightPoints // ignore: cast_nullable_to_non_nullable + as List?, + circumferencePoints: freezed == circumferencePoints + ? _value._circumferencePoints + : circumferencePoints // ignore: cast_nullable_to_non_nullable + as List?, + )); } /// Create a copy of ProfileState @@ -481,15 +462,15 @@ class __$$ProfileStateLoadedImplCopyWithImpl<$Res> /// @nodoc class _$ProfileStateLoadedImpl implements ProfileStateLoaded { - const _$ProfileStateLoadedImpl({ - required this.profile, - required this.profileDetails, - required final List blogPosts, - final List? weightPoints, - final List? circumferencePoints, - }) : _blogPosts = blogPosts, - _weightPoints = weightPoints, - _circumferencePoints = circumferencePoints; + const _$ProfileStateLoadedImpl( + {required this.profile, + required this.profileDetails, + required final List blogPosts, + final List? weightPoints, + final List? circumferencePoints}) + : _blogPosts = blogPosts, + _weightPoints = weightPoints, + _circumferencePoints = circumferencePoints; @override final ProfileModel profile; @@ -537,29 +518,22 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded { (identical(other.profile, profile) || other.profile == profile) && (identical(other.profileDetails, profileDetails) || other.profileDetails == profileDetails) && - const DeepCollectionEquality().equals( - other._blogPosts, - _blogPosts, - ) && - const DeepCollectionEquality().equals( - other._weightPoints, - _weightPoints, - ) && - const DeepCollectionEquality().equals( - other._circumferencePoints, - _circumferencePoints, - )); + const DeepCollectionEquality() + .equals(other._blogPosts, _blogPosts) && + const DeepCollectionEquality() + .equals(other._weightPoints, _weightPoints) && + const DeepCollectionEquality() + .equals(other._circumferencePoints, _circumferencePoints)); } @override int get hashCode => Object.hash( - runtimeType, - profile, - profileDetails, - const DeepCollectionEquality().hash(_blogPosts), - const DeepCollectionEquality().hash(_weightPoints), - const DeepCollectionEquality().hash(_circumferencePoints), - ); + runtimeType, + profile, + profileDetails, + const DeepCollectionEquality().hash(_blogPosts), + const DeepCollectionEquality().hash(_weightPoints), + const DeepCollectionEquality().hash(_circumferencePoints)); /// Create a copy of ProfileState /// with the given fields replaced by the non-null parameter values. @@ -568,9 +542,7 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded { @pragma('vm:prefer-inline') _$$ProfileStateLoadedImplCopyWith<_$ProfileStateLoadedImpl> get copyWith => __$$ProfileStateLoadedImplCopyWithImpl<_$ProfileStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -578,22 +550,16 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - ) - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints) + loaded, required TResult Function(String errorMessage) error, }) { return loaded( - profile, - profileDetails, - blogPosts, - weightPoints, - circumferencePoints, - ); + profile, profileDetails, blogPosts, weightPoints, circumferencePoints); } @override @@ -602,22 +568,16 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult? Function(String errorMessage)? error, }) { return loaded?.call( - profile, - profileDetails, - blogPosts, - weightPoints, - circumferencePoints, - ); + profile, profileDetails, blogPosts, weightPoints, circumferencePoints); } @override @@ -626,24 +586,18 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded { TResult Function()? $default, { TResult Function()? loading, TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { if (loaded != null) { - return loaded( - profile, - profileDetails, - blogPosts, - weightPoints, - circumferencePoints, - ); + return loaded(profile, profileDetails, blogPosts, weightPoints, + circumferencePoints); } return orElse(); } @@ -687,13 +641,13 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded { } abstract class ProfileStateLoaded implements ProfileState { - const factory ProfileStateLoaded({ - required final ProfileModel profile, - required final ProfileDetailsModel profileDetails, - required final List blogPosts, - final List? weightPoints, - final List? circumferencePoints, - }) = _$ProfileStateLoadedImpl; + const factory ProfileStateLoaded( + {required final ProfileModel profile, + required final ProfileDetailsModel profileDetails, + required final List blogPosts, + final List? weightPoints, + final List? circumferencePoints}) = + _$ProfileStateLoadedImpl; ProfileModel get profile; ProfileDetailsModel get profileDetails; @@ -710,10 +664,9 @@ abstract class ProfileStateLoaded implements ProfileState { /// @nodoc abstract class _$$ProfileStateErrorImplCopyWith<$Res> { - factory _$$ProfileStateErrorImplCopyWith( - _$ProfileStateErrorImpl value, - $Res Function(_$ProfileStateErrorImpl) then, - ) = __$$ProfileStateErrorImplCopyWithImpl<$Res>; + factory _$$ProfileStateErrorImplCopyWith(_$ProfileStateErrorImpl value, + $Res Function(_$ProfileStateErrorImpl) then) = + __$$ProfileStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -722,25 +675,23 @@ abstract class _$$ProfileStateErrorImplCopyWith<$Res> { class __$$ProfileStateErrorImplCopyWithImpl<$Res> extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateErrorImpl> implements _$$ProfileStateErrorImplCopyWith<$Res> { - __$$ProfileStateErrorImplCopyWithImpl( - _$ProfileStateErrorImpl _value, - $Res Function(_$ProfileStateErrorImpl) _then, - ) : super(_value, _then); + __$$ProfileStateErrorImplCopyWithImpl(_$ProfileStateErrorImpl _value, + $Res Function(_$ProfileStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of ProfileState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$ProfileStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$ProfileStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -776,9 +727,7 @@ class _$ProfileStateErrorImpl implements ProfileStateError { @pragma('vm:prefer-inline') _$$ProfileStateErrorImplCopyWith<_$ProfileStateErrorImpl> get copyWith => __$$ProfileStateErrorImplCopyWithImpl<_$ProfileStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -786,13 +735,12 @@ class _$ProfileStateErrorImpl implements ProfileStateError { TResult Function() $default, { required TResult Function() loading, required TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - ) - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints) + loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -804,13 +752,12 @@ class _$ProfileStateErrorImpl implements ProfileStateError { TResult? Function()? $default, { TResult? Function()? loading, TResult? Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -822,13 +769,12 @@ class _$ProfileStateErrorImpl implements ProfileStateError { TResult Function()? $default, { TResult Function()? loading, TResult Function( - ProfileModel profile, - ProfileDetailsModel profileDetails, - List blogPosts, - List? weightPoints, - List? circumferencePoints, - )? - loaded, + ProfileModel profile, + ProfileDetailsModel profileDetails, + List blogPosts, + List? weightPoints, + List? circumferencePoints)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { diff --git a/lib/features/profile/presentation/bloc/sub_cubit/sub_state.freezed.dart b/lib/features/profile/presentation/bloc/sub_cubit/sub_state.freezed.dart index ffa284ec..f811921a 100644 --- a/lib/features/profile/presentation/bloc/sub_cubit/sub_state.freezed.dart +++ b/lib/features/profile/presentation/bloc/sub_cubit/sub_state.freezed.dart @@ -12,8 +12,7 @@ part of 'sub_state.dart'; 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', -); + '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'); /// @nodoc mixin _$SubState { @@ -23,14 +22,16 @@ mixin _$SubState { required TResult Function() loading, required TResult Function(List subList) loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, TResult? Function(List subList)? loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -38,21 +39,24 @@ mixin _$SubState { TResult Function(List subList)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_SubState value) $default, { required TResult Function(SubStateLoading value) loading, required TResult Function(SubStateLoaded value) loaded, required TResult Function(SubStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_SubState value)? $default, { TResult? Function(SubStateLoading value)? loading, TResult? Function(SubStateLoaded value)? loaded, TResult? Function(SubStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_SubState value)? $default, { @@ -60,7 +64,8 @@ mixin _$SubState { TResult Function(SubStateLoaded value)? loaded, TResult Function(SubStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc @@ -86,9 +91,8 @@ class _$SubStateCopyWithImpl<$Res, $Val extends SubState> /// @nodoc abstract class _$$SubStateImplCopyWith<$Res> { factory _$$SubStateImplCopyWith( - _$SubStateImpl value, - $Res Function(_$SubStateImpl) then, - ) = __$$SubStateImplCopyWithImpl<$Res>; + _$SubStateImpl value, $Res Function(_$SubStateImpl) then) = + __$$SubStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -96,9 +100,8 @@ class __$$SubStateImplCopyWithImpl<$Res> extends _$SubStateCopyWithImpl<$Res, _$SubStateImpl> implements _$$SubStateImplCopyWith<$Res> { __$$SubStateImplCopyWithImpl( - _$SubStateImpl _value, - $Res Function(_$SubStateImpl) _then, - ) : super(_value, _then); + _$SubStateImpl _value, $Res Function(_$SubStateImpl) _then) + : super(_value, _then); /// Create a copy of SubState /// with the given fields replaced by the non-null parameter values. @@ -204,10 +207,9 @@ abstract class _SubState implements SubState { /// @nodoc abstract class _$$SubStateLoadingImplCopyWith<$Res> { - factory _$$SubStateLoadingImplCopyWith( - _$SubStateLoadingImpl value, - $Res Function(_$SubStateLoadingImpl) then, - ) = __$$SubStateLoadingImplCopyWithImpl<$Res>; + factory _$$SubStateLoadingImplCopyWith(_$SubStateLoadingImpl value, + $Res Function(_$SubStateLoadingImpl) then) = + __$$SubStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc @@ -215,9 +217,8 @@ class __$$SubStateLoadingImplCopyWithImpl<$Res> extends _$SubStateCopyWithImpl<$Res, _$SubStateLoadingImpl> implements _$$SubStateLoadingImplCopyWith<$Res> { __$$SubStateLoadingImplCopyWithImpl( - _$SubStateLoadingImpl _value, - $Res Function(_$SubStateLoadingImpl) _then, - ) : super(_value, _then); + _$SubStateLoadingImpl _value, $Res Function(_$SubStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of SubState /// with the given fields replaced by the non-null parameter values. @@ -323,10 +324,9 @@ abstract class SubStateLoading implements SubState { /// @nodoc abstract class _$$SubStateLoadedImplCopyWith<$Res> { - factory _$$SubStateLoadedImplCopyWith( - _$SubStateLoadedImpl value, - $Res Function(_$SubStateLoadedImpl) then, - ) = __$$SubStateLoadedImplCopyWithImpl<$Res>; + factory _$$SubStateLoadedImplCopyWith(_$SubStateLoadedImpl value, + $Res Function(_$SubStateLoadedImpl) then) = + __$$SubStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({List subList}); } @@ -336,24 +336,22 @@ class __$$SubStateLoadedImplCopyWithImpl<$Res> extends _$SubStateCopyWithImpl<$Res, _$SubStateLoadedImpl> implements _$$SubStateLoadedImplCopyWith<$Res> { __$$SubStateLoadedImplCopyWithImpl( - _$SubStateLoadedImpl _value, - $Res Function(_$SubStateLoadedImpl) _then, - ) : super(_value, _then); + _$SubStateLoadedImpl _value, $Res Function(_$SubStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of SubState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? subList = null}) { - return _then( - _$SubStateLoadedImpl( - subList: - null == subList - ? _value._subList - : subList // ignore: cast_nullable_to_non_nullable - as List, - ), - ); + $Res call({ + Object? subList = null, + }) { + return _then(_$SubStateLoadedImpl( + subList: null == subList + ? _value._subList + : subList // ignore: cast_nullable_to_non_nullable + as List, + )); } } @@ -361,7 +359,7 @@ class __$$SubStateLoadedImplCopyWithImpl<$Res> class _$SubStateLoadedImpl implements SubStateLoaded { const _$SubStateLoadedImpl({required final List subList}) - : _subList = subList; + : _subList = subList; final List _subList; @override @@ -395,9 +393,7 @@ class _$SubStateLoadedImpl implements SubStateLoaded { @pragma('vm:prefer-inline') _$$SubStateLoadedImplCopyWith<_$SubStateLoadedImpl> get copyWith => __$$SubStateLoadedImplCopyWithImpl<_$SubStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs @@ -490,9 +486,8 @@ abstract class SubStateLoaded implements SubState { /// @nodoc abstract class _$$SubStateErrorImplCopyWith<$Res> { factory _$$SubStateErrorImplCopyWith( - _$SubStateErrorImpl value, - $Res Function(_$SubStateErrorImpl) then, - ) = __$$SubStateErrorImplCopyWithImpl<$Res>; + _$SubStateErrorImpl value, $Res Function(_$SubStateErrorImpl) then) = + __$$SubStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -502,24 +497,22 @@ class __$$SubStateErrorImplCopyWithImpl<$Res> extends _$SubStateCopyWithImpl<$Res, _$SubStateErrorImpl> implements _$$SubStateErrorImplCopyWith<$Res> { __$$SubStateErrorImplCopyWithImpl( - _$SubStateErrorImpl _value, - $Res Function(_$SubStateErrorImpl) _then, - ) : super(_value, _then); + _$SubStateErrorImpl _value, $Res Function(_$SubStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of SubState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$SubStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$SubStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index 707eddfa..12e4c4ea 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -85,7 +85,7 @@ class _ProfileScreenState extends State { if (isFirstFetch) { canSub = !state.profile.isEntitySubscribedByMe; if (state.profile.roles.contains('consultant')) { - plansCubit..getPlans(state.profile.slug); + plansCubit.getPlans(state.profile.slug); } isFirstFetch = false; } @@ -116,7 +116,7 @@ class _ProfileScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Colors.white, borderRadius: BorderRadius.vertical( bottom: Radius.circular(16), @@ -133,7 +133,7 @@ class _ProfileScreenState extends State { Row( children: [ const SizedBox(width: 16), - Text( + const Text( 'Консультант', style: TextStyle( fontSize: 16, @@ -148,7 +148,7 @@ class _ProfileScreenState extends State { Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( - color: Color(0xFFF6FAFF), + color: const Color(0xFFF6FAFF), borderRadius: BorderRadius.circular(12), ), child: Text( @@ -163,9 +163,9 @@ class _ProfileScreenState extends State { ], ), if (state.profile.educationResource?.hasMedicalEducation == 1) - Row( + const Row( children: [ - const SizedBox(width: 16), + SizedBox(width: 16), Icon( Icons.done_rounded, color: Colors.green, @@ -190,7 +190,7 @@ class _ProfileScreenState extends State { ), ), _subscriptionsAndSubscribers(state), - if (state.profile.badges.isNotEmpty) Padding(padding: EdgeInsets.only(bottom: 16), child: _badges(state)), + if (state.profile.badges.isNotEmpty) Padding(padding: const EdgeInsets.only(bottom: 16), child: _badges(state)), if (state.profile.roles.contains('consultant')) _socialLinks(state), if (state.profile.roles.contains('consultant')) _education(state), if (state.profile.roles.contains('consultant')) _diplomasAndCertificates(state), @@ -211,7 +211,7 @@ class _ProfileScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Colors.white, borderRadius: BorderRadius.vertical( bottom: Radius.circular(16), @@ -226,11 +226,11 @@ class _ProfileScreenState extends State { ), ), _subscriptionsAndSubscribers(state), - if (state.profile.badges.isNotEmpty) Padding(padding: EdgeInsets.only(bottom: 16), child: _badges(state)), + if (state.profile.badges.isNotEmpty) Padding(padding: const EdgeInsets.only(bottom: 16), child: _badges(state)), if (state.profile.roles.contains('consultant')) _socialLinks(state), if (state.profile.roles.contains('consultant')) _education(state), if (state.profile.roles.contains('consultant')) _diplomasAndCertificates(state), - Padding(padding: EdgeInsets.only(bottom: 16), child: _charts()), + Padding(padding: const EdgeInsets.only(bottom: 16), child: _charts()), if (state.profile.roles.contains('consultant')) _activePlans(state), _newBlogPostButton(), _blogPosts(state), @@ -253,8 +253,8 @@ class _ProfileScreenState extends State { } return Column( children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -293,7 +293,7 @@ class _ProfileScreenState extends State { ], ); } - return Loader(); + return const Loader(); }, ); } @@ -321,9 +321,9 @@ class _ProfileScreenState extends State { return AnimatedContainer( width: isActive ? 10 : 8, height: isActive ? 10 : 8, - duration: Duration(milliseconds: 150), + duration: const Duration(milliseconds: 150), decoration: BoxDecoration( - color: isActive ? appTheme.blueA400 : Color(0xFFD7D9DC), + color: isActive ? appTheme.blueA400 : const Color(0xFFD7D9DC), shape: BoxShape.circle, ), ); @@ -341,19 +341,19 @@ class _ProfileScreenState extends State { }, borderRadius: BorderRadius.circular(8), child: Ink( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), decoration: BoxDecoration( - color: Color(0xFFF6FAFF), + color: const Color(0xFFF6FAFF), borderRadius: BorderRadius.circular(8), ), - child: Row( + child: const Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.add_circle_outline_rounded, color: Color(0xFF2F80ED), ), - const SizedBox(width: 12), + SizedBox(width: 12), Text( 'Новая запись', style: TextStyle( @@ -383,7 +383,7 @@ class _ProfileScreenState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( + const Text( 'Дипломы\nи сертификаты', style: TextStyle( color: Color(0xFF323F4B), @@ -394,7 +394,7 @@ class _ProfileScreenState extends State { ), Text( widget.author == null ? 'Редактировать' : '', - style: TextStyle( + style: const TextStyle( color: Color(0xFF2F80ED), fontSize: 16, fontWeight: FontWeight.w500, @@ -417,7 +417,7 @@ class _ProfileScreenState extends State { child: Row( children: [ if (state.profile.diplomasAndCertificates != null) - ...state.profile.diplomasAndCertificates!.map((d) => _diplomaImage(baseUrl + '/storage/' + d.path)).toList(), + ...state.profile.diplomasAndCertificates!.map((d) => _diplomaImage('$baseUrl/storage/${d.path}')), ], ), ), @@ -457,7 +457,7 @@ class _ProfileScreenState extends State { _education(ProfileStateLoaded state) { if (!state.profile.roles.contains('consultant') || state.profile.educationResource?.completedCourses == null || - state.profile.educationResource?.completedCourses?.length == 0) { + (state.profile.educationResource?.completedCourses?.isEmpty ?? false)) { return const SizedBox.shrink(); } return Padding( @@ -469,7 +469,7 @@ class _ProfileScreenState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( + const Text( 'Образование', style: TextStyle( color: Color(0xFF323F4B), @@ -479,7 +479,7 @@ class _ProfileScreenState extends State { ), Text( widget.author == null ? 'Редактировать' : '', - style: TextStyle( + style: const TextStyle( color: Color(0xFF2F80ED), fontSize: 16, fontWeight: FontWeight.w500, @@ -499,7 +499,7 @@ class _ProfileScreenState extends State { child: Column( children: [ if (state.profile.educationResource?.completedCourses != null) - ...state.profile.educationResource!.completedCourses!.map((c) => _educationBlock(c.values.first.title, c.values.first.date)).toList(), + ...state.profile.educationResource!.completedCourses!.map((c) => _educationBlock(c.values.first.title, c.values.first.date)), ], ), ), @@ -514,7 +514,7 @@ class _ProfileScreenState extends State { return SizedBox( width: double.infinity, child: Material( - color: Color(0xFFF6FAFF), + color: const Color(0xFFF6FAFF), borderRadius: BorderRadius.circular(12), child: Padding( padding: const EdgeInsets.all(12), @@ -523,7 +523,7 @@ class _ProfileScreenState extends State { children: [ Text( title, - style: TextStyle( + style: const TextStyle( height: 1, color: Color(0xFF323F4B), fontWeight: FontWeight.w500, @@ -533,7 +533,7 @@ class _ProfileScreenState extends State { const SizedBox(height: 4), Text( date, - style: TextStyle( + style: const TextStyle( height: 1, color: Color(0xFF6D6F71), fontWeight: FontWeight.w500, @@ -613,14 +613,14 @@ class _ProfileScreenState extends State { width: MediaQuery.of(context).size.width / 3 - (56 / 3), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - color: Color(0xFFF6F6F6), + color: const Color(0xFFF6F6F6), ), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 16), child: SvgPicture.asset( icon, width: 24, - colorFilter: ColorFilter.mode(Colors.black12, BlendMode.srcIn), + colorFilter: const ColorFilter.mode(Colors.black12, BlendMode.srcIn), ), ), ), @@ -636,10 +636,14 @@ class _ProfileScreenState extends State { child: Ink( padding: const EdgeInsets.all(8), width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Достижения', style: TextStyle( color: Color(0xFF6D6F71), @@ -655,12 +659,12 @@ class _ProfileScreenState extends State { for (int i = 0; i < state.profile.badges.length; i++) ...[ state.profile.badges[i].image.contains('svg') ? SvgPicture.network( - baseUrl + '/storage/' + state.profile.badges[i].image, + '$baseUrl/storage/${state.profile.badges[i].image}', width: 40, height: 40, ) : CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + state.profile.badges[i].image, + imageUrl: '$baseUrl/storage/${state.profile.badges[i].image}', width: 40, height: 40, ), @@ -671,10 +675,6 @@ class _ProfileScreenState extends State { ), ], ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), ), ), ); @@ -688,7 +688,7 @@ class _ProfileScreenState extends State { InkWell( onTap: () => GoRouter.of(context).pushNamed( 'subsScreen', - extra: SubType.Subscriptions, + extra: SubType.subscriptions, pathParameters: { 'slug': state.profile.slug, }, @@ -697,6 +697,10 @@ class _ProfileScreenState extends State { child: Ink( padding: const EdgeInsets.all(8), width: MediaQuery.of(context).size.width / 2 - 6, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end, @@ -704,7 +708,7 @@ class _ProfileScreenState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Подписки', style: TextStyle( color: Color(0xFF6D6F71), @@ -714,7 +718,7 @@ class _ProfileScreenState extends State { ), Text( '${state.profile.subscriptions.length}', - style: TextStyle( + style: const TextStyle( color: Color(0xFF323F4B), fontSize: 22, fontWeight: FontWeight.w700, @@ -723,22 +727,18 @@ class _ProfileScreenState extends State { ], ), Padding( - padding: EdgeInsets.only(right: 8), + padding: const EdgeInsets.only(right: 8), child: _miniAvatars(state.profile.subscriptions.map((e) => e.profilePhotoUrl).toList()), ), ], ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), ), ), - SizedBox(width: 4), + const SizedBox(width: 4), InkWell( onTap: () => GoRouter.of(context).pushNamed( 'subsScreen', - extra: SubType.Subscribers, + extra: SubType.subscribers, pathParameters: { 'slug': state.profile.slug, }, @@ -747,6 +747,10 @@ class _ProfileScreenState extends State { child: Ink( padding: const EdgeInsets.all(8), width: MediaQuery.of(context).size.width / 2 - 6, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end, @@ -754,7 +758,7 @@ class _ProfileScreenState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Подписчики', style: TextStyle( color: Color(0xFF6D6F71), @@ -764,7 +768,7 @@ class _ProfileScreenState extends State { ), Text( '${state.profile.subscribers.length}', - style: TextStyle( + style: const TextStyle( color: Color(0xFF323F4B), fontSize: 22, fontWeight: FontWeight.w700, @@ -773,15 +777,11 @@ class _ProfileScreenState extends State { ], ), Padding( - padding: EdgeInsets.only(right: 8), + padding: const EdgeInsets.only(right: 8), child: _miniAvatars(state.profile.subscribers.map((e) => e.profilePhotoUrl).toList()), ), ], ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), ), ), ], @@ -810,14 +810,14 @@ class _ProfileScreenState extends State { _blogPosts(ProfileStateLoaded state) { return ListView.separated( - padding: EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 16), shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) => ProfileBlogPostWidget( index: index, profileCubit: profileCubit, ), - separatorBuilder: (context, index) => SizedBox(height: 8), + separatorBuilder: (context, index) => const SizedBox(height: 8), itemCount: state.blogPosts.length, ); } @@ -872,7 +872,7 @@ class _ProfileScreenState extends State { } }, child: const Row( - children: const [ + children: [ Icon(Icons.photo_camera), SizedBox(width: 8), Text('Фото'), @@ -890,7 +890,7 @@ class _ProfileScreenState extends State { } }, child: const Row( - children: const [ + children: [ Icon(Icons.photo), SizedBox(width: 8), Text('Галерея'), @@ -912,17 +912,17 @@ class _ProfileScreenState extends State { } }, itemBuilder: (context) => [ - PopupMenuItem( + const PopupMenuItem( value: 'view', child: Text('Посмотреть'), ), if (widget.author == null) - PopupMenuItem( + const PopupMenuItem( value: 'replace', child: Text('Заменить'), ), if (widget.author == null) - PopupMenuItem( + const PopupMenuItem( value: 'delete', child: Text('Удалить'), ), @@ -932,7 +932,7 @@ class _ProfileScreenState extends State { child: CircleAvatar( radius: 32, foregroundImage: NetworkImage(state.profile.profilePhotoUrl), - backgroundImage: AssetImage('assets/images/no_avatar.png'), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), ), ), ), @@ -941,8 +941,8 @@ class _ProfileScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - state.profileDetails.firstName + ' ' + state.profileDetails.lastName, - style: TextStyle( + '${state.profileDetails.firstName} ${state.profileDetails.lastName}', + style: const TextStyle( color: Colors.black, fontWeight: FontWeight.w600, fontSize: 16, @@ -963,7 +963,7 @@ class _ProfileScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text( + const Text( 'Подробнее', style: TextStyle( fontSize: 20, @@ -972,13 +972,13 @@ class _ProfileScreenState extends State { ), ), const SizedBox(height: 16), - _additional('Дата рожденя: ', '${state.profileDetails.birthdate}'), + _additional('Дата рожденя: ', state.profileDetails.birthdate), const SizedBox(height: 12), - _additional('Страна: ', '${state.profileDetails.country}'), + _additional('Страна: ', state.profileDetails.country), const SizedBox(height: 12), - _additional('Город: ', '${state.profileDetails.city}'), + _additional('Город: ', state.profileDetails.city), const SizedBox(height: 12), - _additional('Язык общения: ', '${state.profileDetails.lang}'), + _additional('Язык общения: ', state.profileDetails.lang), const SizedBox(height: 12), _additional('В Eatvio с: ', '${state.profile.createdAt?.format('d.MM.yyyy', 'ru')}'), const SizedBox(height: 12), @@ -987,14 +987,14 @@ class _ProfileScreenState extends State { ), ); }, - child: Row( + child: const Row( children: [ Icon( Icons.info_outline, size: 20, color: Color(0xFF6D6F71), ), - const SizedBox(width: 4), + SizedBox(width: 4), Text( 'Дополнительно', style: TextStyle( @@ -1015,7 +1015,7 @@ class _ProfileScreenState extends State { final box = context.findRenderObject() as RenderBox?; Share.shareUri( Uri.parse( - baseUrl + '/ru/profile/' + state.profile.slug, + '$baseUrl/ru/profile/${state.profile.slug}', ), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); @@ -1031,17 +1031,17 @@ class _ProfileScreenState extends State { } }, itemBuilder: (context) => [ - PopupMenuItem( + const PopupMenuItem( value: 'share', child: Text('Поделиться'), ), if (widget.author != null) - PopupMenuItem( + const PopupMenuItem( value: 'complain', child: Text('Пожаловаться'), ), ], - child: Icon(Icons.more_horiz_rounded), + child: const Icon(Icons.more_horiz_rounded), ), ], ), @@ -1053,7 +1053,7 @@ class _ProfileScreenState extends State { children: [ Text( title, - style: TextStyle( + style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF6D6F71), @@ -1061,7 +1061,7 @@ class _ProfileScreenState extends State { ), Text( value, - style: TextStyle( + style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF323F4B), @@ -1074,7 +1074,7 @@ class _ProfileScreenState extends State { _messageAndSubscribe(ProfileStateLoaded state) { return Row( children: [ - SizedBox(width: 16), + const SizedBox(width: 16), GestureDetector( onTap: () async { GoRouter.of(context).pushNamed( @@ -1086,7 +1086,7 @@ class _ProfileScreenState extends State { }, child: Container( alignment: Alignment.center, - padding: EdgeInsets.all(8), + padding: const EdgeInsets.all(8), width: (MediaQuery.of(context).size.width - 40) / 2, decoration: BoxDecoration( color: appTheme.blueA400.withValues(alpha: 0.1), @@ -1100,7 +1100,7 @@ class _ProfileScreenState extends State { ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), GestureDetector( onTap: () { setState(() { @@ -1110,7 +1110,7 @@ class _ProfileScreenState extends State { }, child: Container( alignment: Alignment.center, - padding: EdgeInsets.all(8), + padding: const EdgeInsets.all(8), width: (MediaQuery.of(context).size.width - 40) / 2, decoration: BoxDecoration( color: !canSub ? Colors.grey.shade200 : appTheme.blueA400, @@ -1124,7 +1124,7 @@ class _ProfileScreenState extends State { ), ), ), - SizedBox(width: 16), + const SizedBox(width: 16), ], ); } @@ -1138,14 +1138,14 @@ class _ProfileScreenState extends State { children: [ const SizedBox(height: 8), SingleChildScrollView( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), scrollDirection: Axis.horizontal, child: Row( children: [ _choiceChipWidget(0), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceChipWidget(1), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceChipWidget(2), ], ), @@ -1168,26 +1168,26 @@ class _ProfileScreenState extends State { weightPoints: weightPoints, ); default: - return SizedBox.shrink(); + return const SizedBox.shrink(); } }, ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( children: [ - SizedBox(width: 16), + const SizedBox(width: 16), _choiceIntervalChipWidget(0), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceIntervalChipWidget(1), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceIntervalChipWidget(2), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceIntervalChipWidget(3), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceIntervalChipWidget(4), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), ], ), ); diff --git a/lib/features/profile/presentation/pages/subs_screen.dart b/lib/features/profile/presentation/pages/subs_screen.dart index 82a9b166..1893b189 100644 --- a/lib/features/profile/presentation/pages/subs_screen.dart +++ b/lib/features/profile/presentation/pages/subs_screen.dart @@ -8,7 +8,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -enum SubType { Subscribers, Subscriptions } +enum SubType { subscribers, subscriptions } class SubsScreen extends StatefulWidget { final SubType subType; @@ -28,7 +28,7 @@ class _SubsScreenState extends State { @override Widget build(BuildContext context) { return BlocProvider( - create: (BuildContext context) => widget.subType == SubType.Subscriptions + create: (BuildContext context) => widget.subType == SubType.subscriptions ? (sl() ..getSubscriptions( widget.slug, @@ -46,21 +46,21 @@ class _SubsScreenState extends State { child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: CupertinoSearchTextField( - prefixIcon: Icon(Icons.search), + prefixIcon: const Icon(Icons.search), placeholder: 'Поиск', onChanged: (query) { if (query.length > 2) { EasyDebounce.debounce( 'searchSubs', - Duration(milliseconds: 300), + const Duration(milliseconds: 300), () { - widget.subType == SubType.Subscriptions + widget.subType == SubType.subscriptions ? (context.read().getSubscriptions(widget.slug, query)) : (context.read().getSubscribers(widget.slug, query)); }, ); } else { - widget.subType == SubType.Subscriptions + widget.subType == SubType.subscriptions ? (context.read().getSubscriptions(widget.slug)) : (context.read().getSubscribers(widget.slug)); } @@ -69,7 +69,7 @@ class _SubsScreenState extends State { ), ), title: Text( - widget.subType == SubType.Subscriptions ? 'Подписки' : 'Подписчики', + widget.subType == SubType.subscriptions ? 'Подписки' : 'Подписчики', ), ), body: _buildStates(state), @@ -81,7 +81,7 @@ class _SubsScreenState extends State { _buildStates(SubState state) { if (state is SubStateLoading) { - return Loader(); + return const Loader(); } if (state is SubStateError) { return Text(state.errorMessage); diff --git a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart index 8a303db7..f4f6e997 100644 --- a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart @@ -34,12 +34,12 @@ class _CircumferenceChartWidgetState extends State { children: [ if (widget.circumferencePoints.isNotEmpty) Padding( - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: Row( children: [ Text( '${widget.circumferencePoints.last.chestCircumference}', - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 40, fontWeight: FontWeight.w500, @@ -47,29 +47,29 @@ class _CircumferenceChartWidgetState extends State { ), if (widget.circumferencePoints.length == 1) Container( - margin: EdgeInsets.symmetric(horizontal: 12), + margin: const EdgeInsets.symmetric(horizontal: 12), width: 8, height: 8, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.black12, ), ), if (widget.circumferencePoints.length > 1) widget.circumferencePoints.last.chestCircumference > widget.circumferencePoints[widget.circumferencePoints.length - 2].chestCircumference - ? Icon( + ? const Icon( Icons.arrow_drop_up, size: 40, color: Colors.grey, ) - : Icon( + : const Icon( Icons.arrow_drop_down, size: 40, color: Colors.grey, ), Text( '${widget.circumferencePoints.last.waistCircumference}', - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 40, fontWeight: FontWeight.w500, @@ -77,29 +77,29 @@ class _CircumferenceChartWidgetState extends State { ), if (widget.circumferencePoints.length == 1) Container( - margin: EdgeInsets.symmetric(horizontal: 12), + margin: const EdgeInsets.symmetric(horizontal: 12), width: 8, height: 8, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.black12, ), ), if (widget.circumferencePoints.length > 1) widget.circumferencePoints.last.waistCircumference > widget.circumferencePoints[widget.circumferencePoints.length - 2].waistCircumference - ? Icon( + ? const Icon( Icons.arrow_drop_up, size: 40, color: Colors.grey, ) - : Icon( + : const Icon( Icons.arrow_drop_down, size: 40, color: Colors.grey, ), Text( '${widget.circumferencePoints.last.hipCircumference}', - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 40, fontWeight: FontWeight.w500, @@ -107,22 +107,22 @@ class _CircumferenceChartWidgetState extends State { ), if (widget.circumferencePoints.length == 1) Container( - margin: EdgeInsets.symmetric(horizontal: 12), + margin: const EdgeInsets.symmetric(horizontal: 12), width: 8, height: 8, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.black12, ), ), if (widget.circumferencePoints.length > 1) widget.circumferencePoints.last.hipCircumference > widget.circumferencePoints[widget.circumferencePoints.length - 2].hipCircumference - ? Icon( + ? const Icon( Icons.arrow_drop_up, size: 40, color: Colors.grey, ) - : Icon( + : const Icon( Icons.arrow_drop_down, size: 40, color: Colors.grey, @@ -134,33 +134,33 @@ class _CircumferenceChartWidgetState extends State { alignment: Alignment.center, children: [ SfCartesianChart( - margin: EdgeInsets.symmetric(horizontal: 8), + margin: const EdgeInsets.symmetric(horizontal: 8), enableAxisAnimation: true, plotAreaBorderWidth: 0, trackballBehavior: TrackballBehavior( enable: true, activationMode: ActivationMode.singleTap, tooltipDisplayMode: TrackballDisplayMode.groupAllPoints, - tooltipSettings: InteractiveTooltip(), + tooltipSettings: const InteractiveTooltip(), lineType: TrackballLineType.vertical, ), primaryXAxis: DateTimeCategoryAxis( tickPosition: TickPosition.inside, - majorTickLines: MajorTickLines( + majorTickLines: const MajorTickLines( size: 0, ), edgeLabelPlacement: EdgeLabelPlacement.shift, dateFormat: DateFormat.MMMd('ru'), - labelStyle: TextStyle( + labelStyle: const TextStyle( color: Colors.grey, ), - majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withValues(alpha: 0.3)), + majorGridLines: MajorGridLines(dashArray: const [1], color: Colors.grey.withValues(alpha: 0.3)), axisLine: AxisLine( color: Colors.grey.withValues(alpha: 0.3), width: 0.4, ), ), - primaryYAxis: NumericAxis( + primaryYAxis: const NumericAxis( isVisible: false, labelFormat: '{value} см', axisLine: AxisLine( @@ -259,12 +259,12 @@ class _CircumferenceChartWidgetState extends State { borderRadius: BorderRadius.circular(16), child: Ink( width: MediaQuery.of(context).size.width - 32, - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: appTheme.blueA400, borderRadius: BorderRadius.circular(16), ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( @@ -280,16 +280,16 @@ class _CircumferenceChartWidgetState extends State { ); }, backgroundColor: appTheme.blueA400, - shape: CircleBorder(), - child: Icon( + shape: const CircleBorder(), + child: const Icon( Icons.add, color: Colors.white, ), ), ), if (widget.circumferencePoints.isEmpty) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 48), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 48), child: Text( 'Добавьте Ваши замеры', textAlign: TextAlign.center, @@ -302,19 +302,19 @@ class _CircumferenceChartWidgetState extends State { } List> _getSplineSeries() { - final Color seriesColor1 = Colors.red; + const Color seriesColor1 = Colors.red; final Color seriesColor2 = appTheme.blueA400; - final Color seriesColor3 = Colors.green; + const Color seriesColor3 = Colors.green; return >[ SplineAreaSeries( - markerSettings: MarkerSettings( + markerSettings: const MarkerSettings( isVisible: true, color: seriesColor1, height: 8, width: 8, ), - dataLabelSettings: DataLabelSettings( + dataLabelSettings: const DataLabelSettings( labelAlignment: ChartDataLabelAlignment.top, isVisible: true, ), @@ -326,7 +326,7 @@ class _CircumferenceChartWidgetState extends State { Colors.transparent, ], begin: Alignment.topCenter, - end: Alignment(0, 0.6), + end: const Alignment(0, 0.6), ), name: 'Грудь', xValueMapper: (CircumferenceModel value, int index) => value.createdAt, @@ -339,7 +339,7 @@ class _CircumferenceChartWidgetState extends State { height: 8, width: 8, ), - dataLabelSettings: DataLabelSettings( + dataLabelSettings: const DataLabelSettings( labelAlignment: ChartDataLabelAlignment.top, isVisible: true, ), @@ -351,20 +351,20 @@ class _CircumferenceChartWidgetState extends State { Colors.transparent, ], begin: Alignment.topCenter, - end: Alignment(0, 0.6), + end: const Alignment(0, 0.6), ), name: 'Талия', xValueMapper: (CircumferenceModel value, int index) => value.createdAt, yValueMapper: (CircumferenceModel value, int index) => value.waistCircumference, ), SplineAreaSeries( - markerSettings: MarkerSettings( + markerSettings: const MarkerSettings( isVisible: true, color: seriesColor3, height: 8, width: 8, ), - dataLabelSettings: DataLabelSettings( + dataLabelSettings: const DataLabelSettings( labelAlignment: ChartDataLabelAlignment.top, isVisible: true, ), @@ -376,7 +376,7 @@ class _CircumferenceChartWidgetState extends State { Colors.transparent, ], begin: Alignment.topCenter, - end: Alignment(0, 0.6), + end: const Alignment(0, 0.6), ), name: 'Бёдра', xValueMapper: (CircumferenceModel value, int index) => value.createdAt, diff --git a/lib/features/profile/presentation/widgets/imt_chart_widget.dart b/lib/features/profile/presentation/widgets/imt_chart_widget.dart index 81aecd8c..e716c12d 100644 --- a/lib/features/profile/presentation/widgets/imt_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/imt_chart_widget.dart @@ -21,10 +21,10 @@ class ImtChartWidget extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: Row( children: [ - if (weightPoints.length > 0) + if (weightPoints.isNotEmpty) Text( - '${weightPoints.last.bmi.toStringAsFixed(2)}', - style: TextStyle( + weightPoints.last.bmi.toStringAsFixed(2), + style: const TextStyle( color: Colors.black, fontSize: 40, fontWeight: FontWeight.w500, @@ -32,12 +32,12 @@ class ImtChartWidget extends StatelessWidget { ), if (weightPoints.length > 1) weightPoints.last.bmi > weightPoints[weightPoints.length - 2].bmi - ? Icon( + ? const Icon( Icons.arrow_drop_up, size: 40, color: Colors.grey, ) - : Icon( + : const Icon( Icons.arrow_drop_down, size: 40, color: Colors.grey, @@ -49,41 +49,41 @@ class ImtChartWidget extends StatelessWidget { alignment: Alignment.center, children: [ SfCartesianChart( - margin: EdgeInsets.symmetric(horizontal: 8), + margin: const EdgeInsets.symmetric(horizontal: 8), enableAxisAnimation: true, plotAreaBorderWidth: 0, trackballBehavior: TrackballBehavior( enable: true, activationMode: ActivationMode.singleTap, tooltipDisplayMode: TrackballDisplayMode.groupAllPoints, - tooltipSettings: InteractiveTooltip(), + tooltipSettings: const InteractiveTooltip(), lineType: TrackballLineType.vertical, ), primaryXAxis: DateTimeCategoryAxis( tickPosition: TickPosition.inside, - majorTickLines: MajorTickLines( + majorTickLines: const MajorTickLines( size: 0, ), edgeLabelPlacement: EdgeLabelPlacement.shift, dateFormat: DateFormat.MMMd('ru'), - labelStyle: TextStyle( + labelStyle: const TextStyle( color: Colors.grey, ), - majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withValues(alpha: 0.3)), + majorGridLines: MajorGridLines(dashArray: const [1], color: Colors.grey.withValues(alpha: 0.3)), axisLine: AxisLine( color: Colors.grey.withValues(alpha: 0.3), width: 0.4, ), ), - primaryYAxis: NumericAxis( + primaryYAxis: const NumericAxis( isVisible: false, ), series: _getSplineSeries(), tooltipBehavior: TooltipBehavior(enable: true), ), if (weightPoints.isEmpty) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 32), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 32), child: Text( 'Индекс Массы Тела рассчитывается при указанных весе и росте', textAlign: TextAlign.center, @@ -104,7 +104,7 @@ class ImtChartWidget extends StatelessWidget { height: 8, width: 8, ), - dataLabelSettings: DataLabelSettings( + dataLabelSettings: const DataLabelSettings( labelAlignment: ChartDataLabelAlignment.top, isVisible: true, ), @@ -116,7 +116,7 @@ class ImtChartWidget extends StatelessWidget { Colors.transparent, ], begin: Alignment.topCenter, - end: Alignment(0, 0.6), + end: const Alignment(0, 0.6), ), name: 'ИМТ', xValueMapper: (WeightModel value, int index) => value.createdAt, 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 1b19f2b8..a180fee6 100644 --- a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart +++ b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart @@ -57,7 +57,7 @@ class _ProfileBlogPostWidgetState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Row( @@ -69,13 +69,13 @@ class _ProfileBlogPostWidgetState extends State { state.blogPosts[widget.index].author.authorProfileIcon, ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( state.blogPosts[widget.index].author.authorName, - style: TextStyle( + style: const TextStyle( height: 1, color: Colors.black87, fontWeight: FontWeight.w500, @@ -84,7 +84,7 @@ class _ProfileBlogPostWidgetState extends State { const SizedBox(height: 4), Text( '${calculateDifference(state.blogPosts[widget.index].createdAt)} в ${state.blogPosts[widget.index].createdAt.hour.toString().padLeft(2, '0')}:${state.blogPosts[widget.index].createdAt.minute.toString().padLeft(2, '0')}', - style: TextStyle( + style: const TextStyle( height: 1, color: Colors.black45, ), @@ -99,19 +99,19 @@ class _ProfileBlogPostWidgetState extends State { ], ), ), - if (state.blogPosts[widget.index].title.isNotEmpty || state.blogPosts[widget.index].description.isNotEmpty) SizedBox(height: 12), + if (state.blogPosts[widget.index].title.isNotEmpty || state.blogPosts[widget.index].description.isNotEmpty) const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Text( state.blogPosts[widget.index].title, - style: TextStyle( + style: const TextStyle( fontWeight: FontWeight.w600, fontSize: 18, color: Colors.black87, ), ), ), - if (state.blogPosts[widget.index].title.isNotEmpty && state.blogPosts[widget.index].description.isNotEmpty) SizedBox(height: 8), + if (state.blogPosts[widget.index].title.isNotEmpty && state.blogPosts[widget.index].description.isNotEmpty) const SizedBox(height: 8), if (state.blogPosts[widget.index].description.isNotEmpty) Padding( padding: const EdgeInsets.symmetric(horizontal: 4), @@ -139,28 +139,28 @@ class _ProfileBlogPostWidgetState extends State { ), ), ), - if (state.blogPosts[widget.index].title.isNotEmpty || state.blogPosts[widget.index].description.isNotEmpty) SizedBox(height: 8), + if (state.blogPosts[widget.index].title.isNotEmpty || state.blogPosts[widget.index].description.isNotEmpty) const SizedBox(height: 8), GestureDetector( onTap: () { context.pushTransparentRoute( rootNavigator: true, PhotoViewScreen( - imageUrls: [baseUrl + '/storage/' + state.blogPosts[widget.index].image], + imageUrls: ['$baseUrl/storage/${state.blogPosts[widget.index].image}'], index: 0, ), ); }, child: Hero( - tag: baseUrl + '/storage/' + state.blogPosts[widget.index].image, + tag: '$baseUrl/storage/${state.blogPosts[widget.index].image}', child: CachedNetworkImage( fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width, - imageUrl: baseUrl + '/storage/' + state.blogPosts[widget.index].image, - errorWidget: (context, str, object) => SizedBox.shrink(), + imageUrl: '$baseUrl/storage/${state.blogPosts[widget.index].image}', + errorWidget: (context, str, object) => const SizedBox.shrink(), ), ), ), - SizedBox(height: 12), + const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Row( @@ -185,7 +185,7 @@ class _ProfileBlogPostWidgetState extends State { ); }, ), - SizedBox(width: 8), + const SizedBox(width: 8), FeedIconButton( svgIcon: SvgPicture.asset( 'assets/icons/comment.svg', @@ -202,7 +202,7 @@ class _ProfileBlogPostWidgetState extends State { extra: state.blogPosts[widget.index], ), ), - SizedBox(width: 8), + const SizedBox(width: 8), FeedIconButton( svgIcon: SvgPicture.asset( height: 20, @@ -214,19 +214,19 @@ class _ProfileBlogPostWidgetState extends State { final box = context.findRenderObject() as RenderBox?; Share.shareUri( Uri.parse( - baseUrl + '/ru/blog_post/' + state.blogPosts[widget.index].id.toString(), + '$baseUrl/ru/blog_post/${state.blogPosts[widget.index].id}', ), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, ), - Spacer(), + const Spacer(), Icon( Icons.visibility_rounded, size: 16, color: appTheme.gray500, ), - SizedBox(width: 4), + const SizedBox(width: 4), Text( state.blogPosts[widget.index].totalViews.toString(), style: TextStyle( @@ -238,7 +238,7 @@ class _ProfileBlogPostWidgetState extends State { ], ), ), - SizedBox(height: 8), + const SizedBox(height: 8), ], ), ), diff --git a/lib/features/profile/presentation/widgets/sub_action_button_widget.dart b/lib/features/profile/presentation/widgets/sub_action_button_widget.dart index 429d7176..c1929a13 100644 --- a/lib/features/profile/presentation/widgets/sub_action_button_widget.dart +++ b/lib/features/profile/presentation/widgets/sub_action_button_widget.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; -enum SubActionType { SendMessage, Subscribe } +enum SubActionType { sendMessage, subscribe } class SubActionButtonWidget extends StatefulWidget { final SubActionType subActionType; @@ -33,22 +33,22 @@ class _SubActionButtonWidgetState extends State { @override Widget build(BuildContext context) { - if (subActionType == SubActionType.Subscribe) { + if (subActionType == SubActionType.subscribe) { return InkWell( onTap: () { context.read().subscribe(widget.slug); setState(() { - subActionType = SubActionType.SendMessage; + subActionType = SubActionType.sendMessage; }); }, borderRadius: BorderRadius.circular(8), child: Ink( - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: appTheme.blueA400, ), - child: Text( + child: const Text( 'Подписаться', style: TextStyle( fontSize: 13, @@ -65,17 +65,17 @@ class _SubActionButtonWidgetState extends State { 'chatScreen', extra: { 'chatId': await sl().getChatRoomIdBySlug(slug: widget.slug), - }, + }, ); }, borderRadius: BorderRadius.circular(8), child: Ink( - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: Color(0xFFF1F2F6), + color: const Color(0xFFF1F2F6), ), - child: Text( + child: const Text( 'Сообщение', style: TextStyle( fontSize: 13, diff --git a/lib/features/profile/presentation/widgets/sub_widget.dart b/lib/features/profile/presentation/widgets/sub_widget.dart index ad42573f..429772d3 100644 --- a/lib/features/profile/presentation/widgets/sub_widget.dart +++ b/lib/features/profile/presentation/widgets/sub_widget.dart @@ -31,7 +31,7 @@ class _SubWidgetState extends State { ), ), child: Ink( - padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), child: Row( children: [ CircleAvatar( @@ -45,7 +45,7 @@ class _SubWidgetState extends State { children: [ Text( widget.subModel.name, - style: TextStyle( + style: const TextStyle( color: Color(0xFF323F4B), fontSize: 16, fontWeight: FontWeight.w600, @@ -55,7 +55,7 @@ class _SubWidgetState extends State { const SizedBox(height: 4), Text( '${DateTime.now().year - widget.subModel.birthdate.year - (DateTime.now().isBefore(DateTime(DateTime.now().year, widget.subModel.birthdate.month, widget.subModel.birthdate.day)) ? 1 : 0)} лет, ${widget.subModel.city}', - style: TextStyle( + style: const TextStyle( color: Color(0xFF6D6F71), fontSize: 12, fontWeight: FontWeight.w500, @@ -66,7 +66,7 @@ class _SubWidgetState extends State { ), const Spacer(), SubActionButtonWidget( - subActionType: widget.subModel.isEntitySubscribedByMe ? SubActionType.SendMessage : SubActionType.Subscribe, + subActionType: widget.subModel.isEntitySubscribedByMe ? SubActionType.sendMessage : SubActionType.subscribe, slug: widget.subModel.slug, ), ], diff --git a/lib/features/profile/presentation/widgets/weight_chart_widget.dart b/lib/features/profile/presentation/widgets/weight_chart_widget.dart index efaa7af6..4062bcd2 100644 --- a/lib/features/profile/presentation/widgets/weight_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/weight_chart_widget.dart @@ -38,7 +38,7 @@ class _WeightChartWidgetState extends State { children: [ Text( '${widget.weightPoints.last.weight.toStringAsFixed(1)} кг', - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 40, fontWeight: FontWeight.w500, @@ -46,10 +46,10 @@ class _WeightChartWidgetState extends State { ), if (widget.weightPoints.length == 1) Container( - margin: EdgeInsets.symmetric(horizontal: 12), + margin: const EdgeInsets.symmetric(horizontal: 12), width: 8, height: 8, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.black12, ), @@ -73,33 +73,33 @@ class _WeightChartWidgetState extends State { alignment: Alignment.center, children: [ SfCartesianChart( - margin: EdgeInsets.symmetric(horizontal: 8), + margin: const EdgeInsets.symmetric(horizontal: 8), enableAxisAnimation: true, plotAreaBorderWidth: 0, trackballBehavior: TrackballBehavior( enable: true, activationMode: ActivationMode.singleTap, tooltipDisplayMode: TrackballDisplayMode.groupAllPoints, - tooltipSettings: InteractiveTooltip(), + tooltipSettings: const InteractiveTooltip(), lineType: TrackballLineType.vertical, ), primaryXAxis: DateTimeCategoryAxis( tickPosition: TickPosition.inside, - majorTickLines: MajorTickLines( + majorTickLines: const MajorTickLines( size: 0, ), edgeLabelPlacement: EdgeLabelPlacement.shift, dateFormat: DateFormat.MMMd('ru'), - labelStyle: TextStyle( + labelStyle: const TextStyle( color: Colors.grey, ), - majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withValues(alpha: 0.3)), + majorGridLines: MajorGridLines(dashArray: const [1], color: Colors.grey.withValues(alpha: 0.3)), axisLine: AxisLine( color: Colors.grey.withValues(alpha: 0.3), width: 0.4, ), ), - primaryYAxis: NumericAxis( + primaryYAxis: const NumericAxis( isVisible: false, labelFormat: '{value} кг', majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey), @@ -181,12 +181,12 @@ class _WeightChartWidgetState extends State { borderRadius: BorderRadius.circular(16), child: Ink( width: MediaQuery.of(context).size.width - 32, - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: appTheme.blueA400, borderRadius: BorderRadius.circular(16), ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( @@ -202,14 +202,14 @@ class _WeightChartWidgetState extends State { ); }, backgroundColor: appTheme.blueA400, - shape: CircleBorder(), - child: Icon( + shape: const CircleBorder(), + child: const Icon( Icons.add, color: Colors.white, ), ), ), - if (widget.weightPoints.isEmpty) Text('Добавьте Ваш вес'), + if (widget.weightPoints.isEmpty) const Text('Добавьте Ваш вес'), ], ), ], @@ -225,7 +225,7 @@ class _WeightChartWidgetState extends State { height: 8, width: 8, ), - dataLabelSettings: DataLabelSettings( + dataLabelSettings: const DataLabelSettings( labelAlignment: ChartDataLabelAlignment.top, isVisible: true, ), @@ -237,7 +237,7 @@ class _WeightChartWidgetState extends State { Colors.transparent, ], begin: Alignment.topCenter, - end: Alignment(0, 0.6), + end: const Alignment(0, 0.6), ), name: 'Вес', xValueMapper: (WeightModel value, int index) => value.createdAt, diff --git a/lib/features/profile/services/profile_service.g.dart b/lib/features/profile/services/profile_service.g.dart index 2cec0b5a..1ac6c499 100644 --- a/lib/features/profile/services/profile_service.g.dart +++ b/lib/features/profile/services/profile_service.g.dart @@ -200,13 +200,12 @@ class _ProfileService implements ProfileService { final _result = await _dio.fetch>(_options); late List _value; try { - _value = - _result.data! - .map( - (dynamic i) => - FeedBlogPostModel.fromJson(i as Map), - ) - .toList(); + _value = _result.data! + .map( + (dynamic i) => + FeedBlogPostModel.fromJson(i as Map), + ) + .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; @@ -233,12 +232,11 @@ class _ProfileService implements ProfileService { final _result = await _dio.fetch>(_options); late List _value; try { - _value = - _result.data! - .map( - (dynamic i) => WeightModel.fromJson(i as Map), - ) - .toList(); + _value = _result.data! + .map( + (dynamic i) => WeightModel.fromJson(i as Map), + ) + .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; @@ -268,12 +266,11 @@ class _ProfileService implements ProfileService { final _result = await _dio.fetch>(_options); late List _value; try { - _value = - _result.data! - .map( - (dynamic i) => WeightModel.fromJson(i as Map), - ) - .toList(); + _value = _result.data! + .map( + (dynamic i) => WeightModel.fromJson(i as Map), + ) + .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; @@ -302,13 +299,12 @@ class _ProfileService implements ProfileService { final _result = await _dio.fetch>(_options); late List _value; try { - _value = - _result.data! - .map( - (dynamic i) => - CircumferenceModel.fromJson(i as Map), - ) - .toList(); + _value = _result.data! + .map( + (dynamic i) => + CircumferenceModel.fromJson(i as Map), + ) + .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; @@ -338,13 +334,12 @@ class _ProfileService implements ProfileService { final _result = await _dio.fetch>(_options); late List _value; try { - _value = - _result.data! - .map( - (dynamic i) => - CircumferenceModel.fromJson(i as Map), - ) - .toList(); + _value = _result.data! + .map( + (dynamic i) => + CircumferenceModel.fromJson(i as Map), + ) + .toList(); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); rethrow; @@ -473,11 +468,11 @@ class _ProfileService implements ProfileService { ); final _options = _setStreamType( Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) .compose( _dio.options, '/api/profile/photo/upload', diff --git a/lib/features/recipe/presentation/about_recipe_screen.dart b/lib/features/recipe/presentation/about_recipe_screen.dart index 5f1f6d7f..ee906963 100644 --- a/lib/features/recipe/presentation/about_recipe_screen.dart +++ b/lib/features/recipe/presentation/about_recipe_screen.dart @@ -39,7 +39,7 @@ class AboutRecipeScreen extends StatefulWidget { final int? index; final bool navigateToComments; - AboutRecipeScreen({super.key, required this.recipe, required this.index, required this.navigateToComments}); + const AboutRecipeScreen({super.key, required this.recipe, required this.index, required this.navigateToComments}); @override State createState() => _AboutRecipeScreenState(); @@ -89,7 +89,7 @@ class _AboutRecipeScreenState extends State { return BlocBuilder( builder: (context, recipeState) { if (recipeState is AboutRecipeStateLoaded) { - Future.delayed(Duration(milliseconds: 500), () { + Future.delayed(const Duration(milliseconds: 500), () { if (widget.navigateToComments && !_jumped) { _scrollToBottom(); } @@ -98,7 +98,7 @@ class _AboutRecipeScreenState extends State { backgroundColor: appTheme.gray100, resizeToAvoidBottomInset: true, bottomSheet: Container( - padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), + padding: const EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), decoration: BoxDecoration(color: Colors.white, border: Border(top: BorderSide(color: Colors.black.withValues(alpha: 0.1)))), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16), @@ -122,13 +122,13 @@ class _AboutRecipeScreenState extends State { decoration: BoxDecoration(color: appTheme.blueA400, shape: BoxShape.circle), height: 32, width: 32, - child: Icon(Icons.close_rounded, size: 18, color: Colors.white), + child: const Icon(Icons.close_rounded, size: 18, color: Colors.white), ), ), - if (replyId != null) SizedBox(width: 8), + if (replyId != null) const SizedBox(width: 8), Expanded( child: ConstrainedBox( - constraints: BoxConstraints(minHeight: 52), + constraints: const BoxConstraints(minHeight: 52), child: TextFormField( textCapitalization: TextCapitalization.sentences, onChanged: (_) { @@ -138,24 +138,24 @@ class _AboutRecipeScreenState extends State { maxLines: 5, minLines: 1, keyboardType: TextInputType.multiline, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1.2), + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1.2), decoration: InputDecoration( isDense: false, // убираем true, чтобы padding учитывался корректно - contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен hintText: 'Комментарий', - hintStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, height: 1.2, color: Color(0xFFAEAEB2)), + hintStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w400, height: 1.2, color: Color(0xFFAEAEB2)), filled: true, border: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1), + borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1), ), ), ), @@ -176,7 +176,7 @@ class _AboutRecipeScreenState extends State { textEditingController.clear(); replyId = null; }); - Future.delayed(Duration(milliseconds: 500), () { + Future.delayed(const Duration(milliseconds: 500), () { recipeCubit.getRecipe(widget.recipe.slug, index: widget.index); }); FocusManager.instance.primaryFocus?.unfocus(); @@ -189,7 +189,7 @@ class _AboutRecipeScreenState extends State { ), height: 32, width: 32, - child: Icon(Icons.send_rounded, size: 18, color: Colors.white), + child: const Icon(Icons.send_rounded, size: 18, color: Colors.white), ), ), ], @@ -216,7 +216,7 @@ class _AboutRecipeScreenState extends State { path: 'recipe/${widget.recipe.slug}', slug: widget.recipe.slug, ), - anchor: Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), + anchor: const Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), child: IconButton( onPressed: () { setState(() { @@ -230,11 +230,11 @@ class _AboutRecipeScreenState extends State { ), body: SingleChildScrollView( controller: scrollController, - padding: EdgeInsets.only(bottom: 160), + padding: const EdgeInsets.only(bottom: 160), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 8), + const SizedBox(height: 8), MainBackgroundBouble( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -242,7 +242,7 @@ class _AboutRecipeScreenState extends State { Stack( children: [ CachedNetworkImage( - imageUrl: baseUrl + '/storage/' + widget.recipe.image, + imageUrl: '$baseUrl/storage/${widget.recipe.image}', height: 300, width: MediaQuery.sizeOf(context).width, fit: BoxFit.fill, @@ -255,19 +255,20 @@ class _AboutRecipeScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset('assets/icons/eye.svg', width: 18, height: 12), - SizedBox(width: 8), + const SizedBox(width: 8), Text(widget.recipe.viewsCount.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)), ], - backgroundColor: appTheme.whiteA700, ), - SizedBox(width: 12), + const SizedBox(width: 12), GestureDetector( onTap: () { recipeCubit.likeRecipe(widget.recipe.slug, widget.index); }, child: InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset( 'assets/icons/heart.svg', @@ -275,26 +276,25 @@ class _AboutRecipeScreenState extends State { height: 12, colorFilter: recipeState.recipe.wasLikedByMe ? ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn) : null, ), - SizedBox(width: 8), + const SizedBox(width: 8), Text( recipeState.recipe.likesCount.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), ), - SizedBox(width: 12), + const SizedBox(width: 12), InfoBouble( + backgroundColor: appTheme.whiteA700, children: [ SvgPicture.asset('assets/icons/comment2.svg', width: 13, height: 12), - SizedBox(width: 8), + const SizedBox(width: 8), Text( recipeState.recipe.commentsCount.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), ), ], - backgroundColor: appTheme.whiteA700, ), ], ), @@ -311,7 +311,7 @@ class _AboutRecipeScreenState extends State { }, color: appTheme.whiteA700, isFavorite: recipeState.recipe.isFavorite, - borderRadius: BorderRadius.vertical(bottom: Radius.circular(12)), + borderRadius: const BorderRadius.vertical(bottom: Radius.circular(12)), width: 40, height: 44, size: 19, @@ -319,12 +319,12 @@ class _AboutRecipeScreenState extends State { ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Text(s.about_recipe, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black)), ), - SizedBox(height: 12), + const SizedBox(height: 12), InfoRow(recipe: widget.recipe, type: ProductType.recipe), if (widget.recipe.videoUrl != null && widget.recipe.videoUrl!.isNotEmpty) Padding( @@ -345,39 +345,39 @@ class _AboutRecipeScreenState extends State { mainAxisSize: MainAxisSize.min, children: [ Text(s.check_out_video_recipe, style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), - SizedBox(width: 12), + const SizedBox(width: 12), SvgPicture.asset('assets/icons/play_icon.svg', width: 16, height: 16), ], ), ), ), ExpandableText(text: widget.recipe.description), - SizedBox(height: 20), + const SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: AuthorCard(author: widget.recipe.author, title: s.recipe_author), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ), - SizedBox(height: 12), + const SizedBox(height: 12), if (widget.recipe.ingredients?.isNotEmpty == true) IngredientsWidget(recipe: widget.recipe), - if (widget.recipe.steps?.isNotEmpty == true) ...[SizedBox(height: 12), StepsWidget(recipe: widget.recipe)], - SizedBox(height: 8), + if (widget.recipe.steps?.isNotEmpty == true) ...[const SizedBox(height: 12), StepsWidget(recipe: widget.recipe)], + const SizedBox(height: 8), MainBackgroundBouble( - padding: EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 16), child: Column( children: [ Container( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), alignment: Alignment.centerLeft, child: Text( - recipeState.recipe.commentsCount.toString() + ' ' + getCommentForm(widget.recipe.commentsCount, s), + '${recipeState.recipe.commentsCount} ${getCommentForm(widget.recipe.commentsCount, s)}', style: TextStyles.textMMedium.copyWith(color: appTheme.gray500), ), ), - SizedBox(height: 16), + const SizedBox(height: 16), if (state is CommentsStateLoading) const Loader(), if (state is CommentsStateLoaded) CommentsWidget(id: widget.recipe.slug, commentSourceType: CommentSourceType.recipe, comment: state.comment, replyId: replyId), @@ -409,7 +409,7 @@ class _AboutRecipeScreenState extends State { path: 'recipe/${widget.recipe.slug}', slug: widget.recipe.slug, ), - anchor: Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), + anchor: const Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), child: IconButton( onPressed: () { setState(() { @@ -443,7 +443,7 @@ class _AboutRecipeScreenState extends State { path: 'recipe/${widget.recipe.slug}', slug: widget.recipe.slug, ), - anchor: Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), + anchor: const Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), child: IconButton( onPressed: () { setState(() { diff --git a/lib/features/recipe/presentation/cubit/about_recipe_cubit.dart b/lib/features/recipe/presentation/cubit/about_recipe_cubit.dart index 24480a29..9e00eda9 100644 --- a/lib/features/recipe/presentation/cubit/about_recipe_cubit.dart +++ b/lib/features/recipe/presentation/cubit/about_recipe_cubit.dart @@ -9,7 +9,7 @@ import 'package:eatvio_app/features/recipe/presentation/cubit/about_recipe_state import 'package:flutter_bloc/flutter_bloc.dart'; class AboutRecipeCubit extends Cubit { - AboutRecipeCubit({required this.recipeRepository, required this.profileRepository}) : super(AboutRecipeState.initial()); + AboutRecipeCubit({required this.recipeRepository, required this.profileRepository}) : super(const AboutRecipeState.initial()); final AboutRecipeRepository recipeRepository; final ProfileRepository profileRepository; bool isCurrentDietStarted = false; @@ -31,7 +31,7 @@ class AboutRecipeCubit extends Cubit { Future initRecipe(String id, {int? index}) async { try { - emit(AboutRecipeState.loading()); + emit(const AboutRecipeState.loading()); final recipe = await recipeRepository.getRecipe(id); if (index != null) { recipeRepository.emitCommentsStateToFeed(CommentsState(index: index, totalComments: recipe.commentsCount)); @@ -72,7 +72,7 @@ class AboutRecipeCubit extends Cubit { EasyDebounce.debounce( 'like_recipe', - Duration(seconds: 1), + const Duration(seconds: 1), () async { try { await recipeRepository.likeRecipe(id); @@ -103,7 +103,7 @@ class AboutRecipeCubit extends Cubit { EasyDebounce.debounce( 'add_or_remove_diet_to_favorites', - Duration(seconds: 1), + const Duration(seconds: 1), () async { try { await recipeRepository.addToFavorite(id); @@ -134,7 +134,7 @@ class AboutRecipeCubit extends Cubit { EasyDebounce.debounce( 'add_or_remove_diet_to_favorites', - Duration(seconds: 1), + const Duration(seconds: 1), () async { try { await recipeRepository.removeFromFavorite(id); diff --git a/lib/features/recipe/presentation/cubit/about_recipe_state.freezed.dart b/lib/features/recipe/presentation/cubit/about_recipe_state.freezed.dart index 4d6d3375..850c5386 100644 --- a/lib/features/recipe/presentation/cubit/about_recipe_state.freezed.dart +++ b/lib/features/recipe/presentation/cubit/about_recipe_state.freezed.dart @@ -12,8 +12,7 @@ part of 'about_recipe_state.dart'; 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', -); + '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'); /// @nodoc mixin _$AboutRecipeState { @@ -24,7 +23,8 @@ mixin _$AboutRecipeState { required TResult Function() loading, required TResult Function(Recipe recipe) loaded, required TResult Function(String message) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { @@ -32,7 +32,8 @@ mixin _$AboutRecipeState { TResult? Function()? loading, TResult? Function(Recipe recipe)? loaded, TResult? Function(String message)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { @@ -41,7 +42,8 @@ mixin _$AboutRecipeState { TResult Function(Recipe recipe)? loaded, TResult Function(String message)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_AboutRecipeState value) $default, { @@ -49,7 +51,8 @@ mixin _$AboutRecipeState { required TResult Function(AboutRecipeStateLoading value) loading, required TResult Function(AboutRecipeStateLoaded value) loaded, required TResult Function(RecipeStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_AboutRecipeState value)? $default, { @@ -57,7 +60,8 @@ mixin _$AboutRecipeState { TResult? Function(AboutRecipeStateLoading value)? loading, TResult? Function(AboutRecipeStateLoaded value)? loaded, TResult? Function(RecipeStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_AboutRecipeState value)? $default, { @@ -66,15 +70,15 @@ mixin _$AboutRecipeState { TResult Function(AboutRecipeStateLoaded value)? loaded, TResult Function(RecipeStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $AboutRecipeStateCopyWith<$Res> { factory $AboutRecipeStateCopyWith( - AboutRecipeState value, - $Res Function(AboutRecipeState) then, - ) = _$AboutRecipeStateCopyWithImpl<$Res, AboutRecipeState>; + AboutRecipeState value, $Res Function(AboutRecipeState) then) = + _$AboutRecipeStateCopyWithImpl<$Res, AboutRecipeState>; } /// @nodoc @@ -93,20 +97,18 @@ class _$AboutRecipeStateCopyWithImpl<$Res, $Val extends AboutRecipeState> /// @nodoc abstract class _$$AboutRecipeStateImplCopyWith<$Res> { - factory _$$AboutRecipeStateImplCopyWith( - _$AboutRecipeStateImpl value, - $Res Function(_$AboutRecipeStateImpl) then, - ) = __$$AboutRecipeStateImplCopyWithImpl<$Res>; + factory _$$AboutRecipeStateImplCopyWith(_$AboutRecipeStateImpl value, + $Res Function(_$AboutRecipeStateImpl) then) = + __$$AboutRecipeStateImplCopyWithImpl<$Res>; } /// @nodoc class __$$AboutRecipeStateImplCopyWithImpl<$Res> extends _$AboutRecipeStateCopyWithImpl<$Res, _$AboutRecipeStateImpl> implements _$$AboutRecipeStateImplCopyWith<$Res> { - __$$AboutRecipeStateImplCopyWithImpl( - _$AboutRecipeStateImpl _value, - $Res Function(_$AboutRecipeStateImpl) _then, - ) : super(_value, _then); + __$$AboutRecipeStateImplCopyWithImpl(_$AboutRecipeStateImpl _value, + $Res Function(_$AboutRecipeStateImpl) _then) + : super(_value, _then); /// Create a copy of AboutRecipeState /// with the given fields replaced by the non-null parameter values. @@ -219,9 +221,9 @@ abstract class _AboutRecipeState implements AboutRecipeState { /// @nodoc abstract class _$$AboutRecipeStateInitialImplCopyWith<$Res> { factory _$$AboutRecipeStateInitialImplCopyWith( - _$AboutRecipeStateInitialImpl value, - $Res Function(_$AboutRecipeStateInitialImpl) then, - ) = __$$AboutRecipeStateInitialImplCopyWithImpl<$Res>; + _$AboutRecipeStateInitialImpl value, + $Res Function(_$AboutRecipeStateInitialImpl) then) = + __$$AboutRecipeStateInitialImplCopyWithImpl<$Res>; } /// @nodoc @@ -229,9 +231,9 @@ class __$$AboutRecipeStateInitialImplCopyWithImpl<$Res> extends _$AboutRecipeStateCopyWithImpl<$Res, _$AboutRecipeStateInitialImpl> implements _$$AboutRecipeStateInitialImplCopyWith<$Res> { __$$AboutRecipeStateInitialImplCopyWithImpl( - _$AboutRecipeStateInitialImpl _value, - $Res Function(_$AboutRecipeStateInitialImpl) _then, - ) : super(_value, _then); + _$AboutRecipeStateInitialImpl _value, + $Res Function(_$AboutRecipeStateInitialImpl) _then) + : super(_value, _then); /// Create a copy of AboutRecipeState /// with the given fields replaced by the non-null parameter values. @@ -345,9 +347,9 @@ abstract class AboutRecipeStateInitial implements AboutRecipeState { /// @nodoc abstract class _$$AboutRecipeStateLoadingImplCopyWith<$Res> { factory _$$AboutRecipeStateLoadingImplCopyWith( - _$AboutRecipeStateLoadingImpl value, - $Res Function(_$AboutRecipeStateLoadingImpl) then, - ) = __$$AboutRecipeStateLoadingImplCopyWithImpl<$Res>; + _$AboutRecipeStateLoadingImpl value, + $Res Function(_$AboutRecipeStateLoadingImpl) then) = + __$$AboutRecipeStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc @@ -355,9 +357,9 @@ class __$$AboutRecipeStateLoadingImplCopyWithImpl<$Res> extends _$AboutRecipeStateCopyWithImpl<$Res, _$AboutRecipeStateLoadingImpl> implements _$$AboutRecipeStateLoadingImplCopyWith<$Res> { __$$AboutRecipeStateLoadingImplCopyWithImpl( - _$AboutRecipeStateLoadingImpl _value, - $Res Function(_$AboutRecipeStateLoadingImpl) _then, - ) : super(_value, _then); + _$AboutRecipeStateLoadingImpl _value, + $Res Function(_$AboutRecipeStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of AboutRecipeState /// with the given fields replaced by the non-null parameter values. @@ -471,9 +473,9 @@ abstract class AboutRecipeStateLoading implements AboutRecipeState { /// @nodoc abstract class _$$AboutRecipeStateLoadedImplCopyWith<$Res> { factory _$$AboutRecipeStateLoadedImplCopyWith( - _$AboutRecipeStateLoadedImpl value, - $Res Function(_$AboutRecipeStateLoadedImpl) then, - ) = __$$AboutRecipeStateLoadedImplCopyWithImpl<$Res>; + _$AboutRecipeStateLoadedImpl value, + $Res Function(_$AboutRecipeStateLoadedImpl) then) = + __$$AboutRecipeStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({Recipe recipe}); @@ -485,24 +487,23 @@ class __$$AboutRecipeStateLoadedImplCopyWithImpl<$Res> extends _$AboutRecipeStateCopyWithImpl<$Res, _$AboutRecipeStateLoadedImpl> implements _$$AboutRecipeStateLoadedImplCopyWith<$Res> { __$$AboutRecipeStateLoadedImplCopyWithImpl( - _$AboutRecipeStateLoadedImpl _value, - $Res Function(_$AboutRecipeStateLoadedImpl) _then, - ) : super(_value, _then); + _$AboutRecipeStateLoadedImpl _value, + $Res Function(_$AboutRecipeStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of AboutRecipeState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? recipe = null}) { - return _then( - _$AboutRecipeStateLoadedImpl( - recipe: - null == recipe - ? _value.recipe - : recipe // ignore: cast_nullable_to_non_nullable - as Recipe, - ), - ); + $Res call({ + Object? recipe = null, + }) { + return _then(_$AboutRecipeStateLoadedImpl( + recipe: null == recipe + ? _value.recipe + : recipe // ignore: cast_nullable_to_non_nullable + as Recipe, + )); } /// Create a copy of AboutRecipeState @@ -546,11 +547,8 @@ class _$AboutRecipeStateLoadedImpl implements AboutRecipeStateLoaded { @override @pragma('vm:prefer-inline') _$$AboutRecipeStateLoadedImplCopyWith<_$AboutRecipeStateLoadedImpl> - get copyWith => - __$$AboutRecipeStateLoadedImplCopyWithImpl<_$AboutRecipeStateLoadedImpl>( - this, - _$identity, - ); + get copyWith => __$$AboutRecipeStateLoadedImplCopyWithImpl< + _$AboutRecipeStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -643,15 +641,14 @@ abstract class AboutRecipeStateLoaded implements AboutRecipeState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) _$$AboutRecipeStateLoadedImplCopyWith<_$AboutRecipeStateLoadedImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$RecipeStateErrorImplCopyWith<$Res> { - factory _$$RecipeStateErrorImplCopyWith( - _$RecipeStateErrorImpl value, - $Res Function(_$RecipeStateErrorImpl) then, - ) = __$$RecipeStateErrorImplCopyWithImpl<$Res>; + factory _$$RecipeStateErrorImplCopyWith(_$RecipeStateErrorImpl value, + $Res Function(_$RecipeStateErrorImpl) then) = + __$$RecipeStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String message}); } @@ -660,25 +657,23 @@ abstract class _$$RecipeStateErrorImplCopyWith<$Res> { class __$$RecipeStateErrorImplCopyWithImpl<$Res> extends _$AboutRecipeStateCopyWithImpl<$Res, _$RecipeStateErrorImpl> implements _$$RecipeStateErrorImplCopyWith<$Res> { - __$$RecipeStateErrorImplCopyWithImpl( - _$RecipeStateErrorImpl _value, - $Res Function(_$RecipeStateErrorImpl) _then, - ) : super(_value, _then); + __$$RecipeStateErrorImplCopyWithImpl(_$RecipeStateErrorImpl _value, + $Res Function(_$RecipeStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of AboutRecipeState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? message = null}) { - return _then( - _$RecipeStateErrorImpl( - message: - null == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? message = null, + }) { + return _then(_$RecipeStateErrorImpl( + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -713,9 +708,7 @@ class _$RecipeStateErrorImpl implements RecipeStateError { @pragma('vm:prefer-inline') _$$RecipeStateErrorImplCopyWith<_$RecipeStateErrorImpl> get copyWith => __$$RecipeStateErrorImplCopyWithImpl<_$RecipeStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs diff --git a/lib/features/recipe/presentation/widgets/ingredients_widget.dart b/lib/features/recipe/presentation/widgets/ingredients_widget.dart index 6f83d6c1..140237b0 100644 --- a/lib/features/recipe/presentation/widgets/ingredients_widget.dart +++ b/lib/features/recipe/presentation/widgets/ingredients_widget.dart @@ -16,7 +16,7 @@ class IngredientsWidget extends StatelessWidget { return MainBackgroundBouble( child: ExpansionTile( initiallyExpanded: true, - shape: Border(), + shape: const Border(), title: Text( s.ingredients, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), @@ -34,7 +34,7 @@ class IngredientsWidget extends StatelessWidget { shape: BoxShape.circle, ), ), - SizedBox(width: 4), + const SizedBox(width: 4), Builder( builder: (context) { final portion = Portion.getPortionFromValue(recipe.ingredients![index].unit ?? ''); @@ -44,7 +44,7 @@ class IngredientsWidget extends StatelessWidget { portionName = getLocalizedMeasurementUnits(s, portion); } return Text( - '${recipe.ingredients![index].name} - ${recipe.ingredients![index].portion} ${portionName}', + '${recipe.ingredients![index].name} - ${recipe.ingredients![index].portion} $portionName', style: TextStyles.textMMedium.copyWith(color: appTheme.black), ); }, diff --git a/lib/features/recipe/presentation/widgets/steps_widget.dart b/lib/features/recipe/presentation/widgets/steps_widget.dart index 3e41164d..f4281c81 100644 --- a/lib/features/recipe/presentation/widgets/steps_widget.dart +++ b/lib/features/recipe/presentation/widgets/steps_widget.dart @@ -13,7 +13,7 @@ class StepsWidget extends StatelessWidget { Widget build(BuildContext context) { final s = S.of(context); return MainBackgroundBouble( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: Column( spacing: 16, crossAxisAlignment: CrossAxisAlignment.start, @@ -32,7 +32,7 @@ class StepsWidget extends StatelessWidget { color: appTheme.blueA400, borderRadius: BorderRadius.circular(8), ), - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), child: Text( '${s.step} ${index + 1}', style: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700), @@ -44,7 +44,7 @@ class StepsWidget extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.circular(16), child: Image.network( - baseUrl + '/storage/' + recipe.steps![index].image, + '$baseUrl/storage/${recipe.steps![index].image}', fit: BoxFit.cover, ), ), diff --git a/lib/features/registration/consts/cities_list.dart b/lib/features/registration/consts/cities_list.dart index 0eea40d6..06312c91 100644 --- a/lib/features/registration/consts/cities_list.dart +++ b/lib/features/registration/consts/cities_list.dart @@ -1,4 +1,4 @@ -const List citiesList = const [ +const List citiesList = [ "Абаза", "Абакан", "Абдулино", diff --git a/lib/features/registration/models/location_model.freezed.dart b/lib/features/registration/models/location_model.freezed.dart index 05810e6f..95f81d60 100644 --- a/lib/features/registration/models/location_model.freezed.dart +++ b/lib/features/registration/models/location_model.freezed.dart @@ -12,8 +12,7 @@ part of 'location_model.dart'; 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', -); + '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'); LocationModel _$LocationModelFromJson(Map json) { return _LocationModel.fromJson(json); @@ -38,14 +37,12 @@ mixin _$LocationModel { /// @nodoc abstract class $LocationModelCopyWith<$Res> { factory $LocationModelCopyWith( - LocationModel value, - $Res Function(LocationModel) then, - ) = _$LocationModelCopyWithImpl<$Res, LocationModel>; + LocationModel value, $Res Function(LocationModel) then) = + _$LocationModelCopyWithImpl<$Res, LocationModel>; @useResult - $Res call({ - List locations, - @JsonKey(name: 'response_body') String responseBody, - }); + $Res call( + {List locations, + @JsonKey(name: 'response_body') String responseBody}); } /// @nodoc @@ -62,22 +59,20 @@ class _$LocationModelCopyWithImpl<$Res, $Val extends LocationModel> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? locations = null, Object? responseBody = null}) { - return _then( - _value.copyWith( - locations: - null == locations - ? _value.locations - : locations // ignore: cast_nullable_to_non_nullable - as List, - responseBody: - null == responseBody - ? _value.responseBody - : responseBody // ignore: cast_nullable_to_non_nullable - as String, - ) - as $Val, - ); + $Res call({ + Object? locations = null, + Object? responseBody = null, + }) { + return _then(_value.copyWith( + locations: null == locations + ? _value.locations + : locations // ignore: cast_nullable_to_non_nullable + as List, + responseBody: null == responseBody + ? _value.responseBody + : responseBody // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); } } @@ -85,15 +80,13 @@ class _$LocationModelCopyWithImpl<$Res, $Val extends LocationModel> abstract class _$$LocationModelImplCopyWith<$Res> implements $LocationModelCopyWith<$Res> { factory _$$LocationModelImplCopyWith( - _$LocationModelImpl value, - $Res Function(_$LocationModelImpl) then, - ) = __$$LocationModelImplCopyWithImpl<$Res>; + _$LocationModelImpl value, $Res Function(_$LocationModelImpl) then) = + __$$LocationModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - List locations, - @JsonKey(name: 'response_body') String responseBody, - }); + $Res call( + {List locations, + @JsonKey(name: 'response_body') String responseBody}); } /// @nodoc @@ -101,39 +94,37 @@ class __$$LocationModelImplCopyWithImpl<$Res> extends _$LocationModelCopyWithImpl<$Res, _$LocationModelImpl> implements _$$LocationModelImplCopyWith<$Res> { __$$LocationModelImplCopyWithImpl( - _$LocationModelImpl _value, - $Res Function(_$LocationModelImpl) _then, - ) : super(_value, _then); + _$LocationModelImpl _value, $Res Function(_$LocationModelImpl) _then) + : super(_value, _then); /// Create a copy of LocationModel /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? locations = null, Object? responseBody = null}) { - return _then( - _$LocationModelImpl( - locations: - null == locations - ? _value._locations - : locations // ignore: cast_nullable_to_non_nullable - as List, - responseBody: - null == responseBody - ? _value.responseBody - : responseBody // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? locations = null, + Object? responseBody = null, + }) { + return _then(_$LocationModelImpl( + locations: null == locations + ? _value._locations + : locations // ignore: cast_nullable_to_non_nullable + as List, + responseBody: null == responseBody + ? _value.responseBody + : responseBody // ignore: cast_nullable_to_non_nullable + as String, + )); } } /// @nodoc @JsonSerializable() class _$LocationModelImpl implements _LocationModel { - const _$LocationModelImpl({ - required final List locations, - @JsonKey(name: 'response_body') required this.responseBody, - }) : _locations = locations; + const _$LocationModelImpl( + {required final List locations, + @JsonKey(name: 'response_body') required this.responseBody}) + : _locations = locations; factory _$LocationModelImpl.fromJson(Map json) => _$$LocationModelImplFromJson(json); @@ -160,21 +151,16 @@ class _$LocationModelImpl implements _LocationModel { return identical(this, other) || (other.runtimeType == runtimeType && other is _$LocationModelImpl && - const DeepCollectionEquality().equals( - other._locations, - _locations, - ) && + const DeepCollectionEquality() + .equals(other._locations, _locations) && (identical(other.responseBody, responseBody) || other.responseBody == responseBody)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_locations), - responseBody, - ); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_locations), responseBody); /// Create a copy of LocationModel /// with the given fields replaced by the non-null parameter values. @@ -186,15 +172,17 @@ class _$LocationModelImpl implements _LocationModel { @override Map toJson() { - return _$$LocationModelImplToJson(this); + return _$$LocationModelImplToJson( + this, + ); } } abstract class _LocationModel implements LocationModel { - const factory _LocationModel({ - required final List locations, - @JsonKey(name: 'response_body') required final String responseBody, - }) = _$LocationModelImpl; + const factory _LocationModel( + {required final List locations, + @JsonKey(name: 'response_body') required final String responseBody}) = + _$LocationModelImpl; factory _LocationModel.fromJson(Map json) = _$LocationModelImpl.fromJson; diff --git a/lib/features/registration/models/user_registration_model.freezed.dart b/lib/features/registration/models/user_registration_model.freezed.dart index a75a4bdb..aed86670 100644 --- a/lib/features/registration/models/user_registration_model.freezed.dart +++ b/lib/features/registration/models/user_registration_model.freezed.dart @@ -12,12 +12,10 @@ part of 'user_registration_model.dart'; 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', -); + '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'); UserRegistrationSheet _$UserRegistrationSheetFromJson( - Map json, -) { + Map json) { return _UserRegistrationSheet.fromJson(json); } @@ -83,48 +81,44 @@ mixin _$UserRegistrationSheet { /// @nodoc abstract class $UserRegistrationSheetCopyWith<$Res> { - factory $UserRegistrationSheetCopyWith( - UserRegistrationSheet value, - $Res Function(UserRegistrationSheet) then, - ) = _$UserRegistrationSheetCopyWithImpl<$Res, UserRegistrationSheet>; + factory $UserRegistrationSheetCopyWith(UserRegistrationSheet value, + $Res Function(UserRegistrationSheet) then) = + _$UserRegistrationSheetCopyWithImpl<$Res, UserRegistrationSheet>; @useResult - $Res call({ - @JsonKey(name: 'first_name') String firstName, - @JsonKey(name: 'last_name') String lastName, - String email, - String password, - @JsonKey(name: 'password_confirmation') String passwordConfirmation, - @JsonKey(name: 'terms') String termsAccepted, - String birthdate, - String gender, - String location, - @JsonKey(name: 'response_body') String responseBody, - String lang, - int weight, - int height, - String phone, - @JsonKey(name: 'chest_circumference') int chestCircumference, - @JsonKey(name: 'waist_circumference') int waistCircumference, - @JsonKey(name: 'hip_circumference') int hipCircumference, - @JsonKey(name: 'blood_pressure_up') int bloodPressureUp, - @JsonKey(name: 'blood_pressure_down') int bloodPressureDown, - @JsonKey(name: 'has_hypo') int hasHypo, - @JsonKey(name: 'has_hyper') int hasHyper, - @JsonKey(name: 'about_alergy') String aboutAllergy, - @JsonKey(name: 'about_taking_pils') String aboutTakingPils, - @JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies, - @JsonKey(name: 'favorite_foods') String favoriteFoods, - @JsonKey(name: 'unfavorite_foods') String unfavoriteFoods, - @JsonKey(name: 'additional_info') String additionalInfo, - @JsonKey(name: 'activity_coefficient') double activityCoefficient, - }); + $Res call( + {@JsonKey(name: 'first_name') String firstName, + @JsonKey(name: 'last_name') String lastName, + String email, + String password, + @JsonKey(name: 'password_confirmation') String passwordConfirmation, + @JsonKey(name: 'terms') String termsAccepted, + String birthdate, + String gender, + String location, + @JsonKey(name: 'response_body') String responseBody, + String lang, + int weight, + int height, + String phone, + @JsonKey(name: 'chest_circumference') int chestCircumference, + @JsonKey(name: 'waist_circumference') int waistCircumference, + @JsonKey(name: 'hip_circumference') int hipCircumference, + @JsonKey(name: 'blood_pressure_up') int bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') int bloodPressureDown, + @JsonKey(name: 'has_hypo') int hasHypo, + @JsonKey(name: 'has_hyper') int hasHyper, + @JsonKey(name: 'about_alergy') String aboutAllergy, + @JsonKey(name: 'about_taking_pils') String aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies, + @JsonKey(name: 'favorite_foods') String favoriteFoods, + @JsonKey(name: 'unfavorite_foods') String unfavoriteFoods, + @JsonKey(name: 'additional_info') String additionalInfo, + @JsonKey(name: 'activity_coefficient') double activityCoefficient}); } /// @nodoc -class _$UserRegistrationSheetCopyWithImpl< - $Res, - $Val extends UserRegistrationSheet -> +class _$UserRegistrationSheetCopyWithImpl<$Res, + $Val extends UserRegistrationSheet> implements $UserRegistrationSheetCopyWith<$Res> { _$UserRegistrationSheetCopyWithImpl(this._value, this._then); @@ -167,151 +161,120 @@ class _$UserRegistrationSheetCopyWithImpl< Object? additionalInfo = null, Object? activityCoefficient = null, }) { - return _then( - _value.copyWith( - firstName: - null == firstName - ? _value.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: - null == lastName - ? _value.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - email: - null == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String, - password: - null == password - ? _value.password - : password // ignore: cast_nullable_to_non_nullable - as String, - passwordConfirmation: - null == passwordConfirmation - ? _value.passwordConfirmation - : passwordConfirmation // ignore: cast_nullable_to_non_nullable - as String, - termsAccepted: - null == termsAccepted - ? _value.termsAccepted - : termsAccepted // ignore: cast_nullable_to_non_nullable - as String, - birthdate: - null == birthdate - ? _value.birthdate - : birthdate // ignore: cast_nullable_to_non_nullable - as String, - gender: - null == gender - ? _value.gender - : gender // ignore: cast_nullable_to_non_nullable - as String, - location: - null == location - ? _value.location - : location // ignore: cast_nullable_to_non_nullable - as String, - responseBody: - null == responseBody - ? _value.responseBody - : responseBody // ignore: cast_nullable_to_non_nullable - as String, - lang: - null == lang - ? _value.lang - : lang // ignore: cast_nullable_to_non_nullable - as String, - weight: - null == weight - ? _value.weight - : weight // ignore: cast_nullable_to_non_nullable - as int, - height: - null == height - ? _value.height - : height // ignore: cast_nullable_to_non_nullable - as int, - phone: - null == phone - ? _value.phone - : phone // ignore: cast_nullable_to_non_nullable - as String, - chestCircumference: - null == chestCircumference - ? _value.chestCircumference - : chestCircumference // ignore: cast_nullable_to_non_nullable - as int, - waistCircumference: - null == waistCircumference - ? _value.waistCircumference - : waistCircumference // ignore: cast_nullable_to_non_nullable - as int, - hipCircumference: - null == hipCircumference - ? _value.hipCircumference - : hipCircumference // ignore: cast_nullable_to_non_nullable - as int, - bloodPressureUp: - null == bloodPressureUp - ? _value.bloodPressureUp - : bloodPressureUp // ignore: cast_nullable_to_non_nullable - as int, - bloodPressureDown: - null == bloodPressureDown - ? _value.bloodPressureDown - : bloodPressureDown // ignore: cast_nullable_to_non_nullable - as int, - hasHypo: - null == hasHypo - ? _value.hasHypo - : hasHypo // ignore: cast_nullable_to_non_nullable - as int, - hasHyper: - null == hasHyper - ? _value.hasHyper - : hasHyper // ignore: cast_nullable_to_non_nullable - as int, - aboutAllergy: - null == aboutAllergy - ? _value.aboutAllergy - : aboutAllergy // ignore: cast_nullable_to_non_nullable - as String, - aboutTakingPils: - null == aboutTakingPils - ? _value.aboutTakingPils - : aboutTakingPils // ignore: cast_nullable_to_non_nullable - as String, - aboutSportHobbies: - null == aboutSportHobbies - ? _value.aboutSportHobbies - : aboutSportHobbies // ignore: cast_nullable_to_non_nullable - as String, - favoriteFoods: - null == favoriteFoods - ? _value.favoriteFoods - : favoriteFoods // ignore: cast_nullable_to_non_nullable - as String, - unfavoriteFoods: - null == unfavoriteFoods - ? _value.unfavoriteFoods - : unfavoriteFoods // ignore: cast_nullable_to_non_nullable - as String, - additionalInfo: - null == additionalInfo - ? _value.additionalInfo - : additionalInfo // ignore: cast_nullable_to_non_nullable - as String, - activityCoefficient: - null == activityCoefficient - ? _value.activityCoefficient - : activityCoefficient // ignore: cast_nullable_to_non_nullable - as double, - ) - as $Val, - ); + return _then(_value.copyWith( + firstName: null == firstName + ? _value.firstName + : firstName // ignore: cast_nullable_to_non_nullable + as String, + lastName: null == lastName + ? _value.lastName + : lastName // ignore: cast_nullable_to_non_nullable + as String, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _value.password + : password // ignore: cast_nullable_to_non_nullable + as String, + passwordConfirmation: null == passwordConfirmation + ? _value.passwordConfirmation + : passwordConfirmation // ignore: cast_nullable_to_non_nullable + as String, + termsAccepted: null == termsAccepted + ? _value.termsAccepted + : termsAccepted // ignore: cast_nullable_to_non_nullable + as String, + birthdate: null == birthdate + ? _value.birthdate + : birthdate // ignore: cast_nullable_to_non_nullable + as String, + gender: null == gender + ? _value.gender + : gender // ignore: cast_nullable_to_non_nullable + as String, + location: null == location + ? _value.location + : location // ignore: cast_nullable_to_non_nullable + as String, + responseBody: null == responseBody + ? _value.responseBody + : responseBody // ignore: cast_nullable_to_non_nullable + as String, + lang: null == lang + ? _value.lang + : lang // ignore: cast_nullable_to_non_nullable + as String, + weight: null == weight + ? _value.weight + : weight // ignore: cast_nullable_to_non_nullable + as int, + height: null == height + ? _value.height + : height // ignore: cast_nullable_to_non_nullable + as int, + phone: null == phone + ? _value.phone + : phone // ignore: cast_nullable_to_non_nullable + as String, + chestCircumference: null == chestCircumference + ? _value.chestCircumference + : chestCircumference // ignore: cast_nullable_to_non_nullable + as int, + waistCircumference: null == waistCircumference + ? _value.waistCircumference + : waistCircumference // ignore: cast_nullable_to_non_nullable + as int, + hipCircumference: null == hipCircumference + ? _value.hipCircumference + : hipCircumference // ignore: cast_nullable_to_non_nullable + as int, + bloodPressureUp: null == bloodPressureUp + ? _value.bloodPressureUp + : bloodPressureUp // ignore: cast_nullable_to_non_nullable + as int, + bloodPressureDown: null == bloodPressureDown + ? _value.bloodPressureDown + : bloodPressureDown // ignore: cast_nullable_to_non_nullable + as int, + hasHypo: null == hasHypo + ? _value.hasHypo + : hasHypo // ignore: cast_nullable_to_non_nullable + as int, + hasHyper: null == hasHyper + ? _value.hasHyper + : hasHyper // ignore: cast_nullable_to_non_nullable + as int, + aboutAllergy: null == aboutAllergy + ? _value.aboutAllergy + : aboutAllergy // ignore: cast_nullable_to_non_nullable + as String, + aboutTakingPils: null == aboutTakingPils + ? _value.aboutTakingPils + : aboutTakingPils // ignore: cast_nullable_to_non_nullable + as String, + aboutSportHobbies: null == aboutSportHobbies + ? _value.aboutSportHobbies + : aboutSportHobbies // ignore: cast_nullable_to_non_nullable + as String, + favoriteFoods: null == favoriteFoods + ? _value.favoriteFoods + : favoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + unfavoriteFoods: null == unfavoriteFoods + ? _value.unfavoriteFoods + : unfavoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + additionalInfo: null == additionalInfo + ? _value.additionalInfo + : additionalInfo // ignore: cast_nullable_to_non_nullable + as String, + activityCoefficient: null == activityCoefficient + ? _value.activityCoefficient + : activityCoefficient // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); } } @@ -319,52 +282,50 @@ class _$UserRegistrationSheetCopyWithImpl< abstract class _$$UserRegistrationSheetImplCopyWith<$Res> implements $UserRegistrationSheetCopyWith<$Res> { factory _$$UserRegistrationSheetImplCopyWith( - _$UserRegistrationSheetImpl value, - $Res Function(_$UserRegistrationSheetImpl) then, - ) = __$$UserRegistrationSheetImplCopyWithImpl<$Res>; + _$UserRegistrationSheetImpl value, + $Res Function(_$UserRegistrationSheetImpl) then) = + __$$UserRegistrationSheetImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: 'first_name') String firstName, - @JsonKey(name: 'last_name') String lastName, - String email, - String password, - @JsonKey(name: 'password_confirmation') String passwordConfirmation, - @JsonKey(name: 'terms') String termsAccepted, - String birthdate, - String gender, - String location, - @JsonKey(name: 'response_body') String responseBody, - String lang, - int weight, - int height, - String phone, - @JsonKey(name: 'chest_circumference') int chestCircumference, - @JsonKey(name: 'waist_circumference') int waistCircumference, - @JsonKey(name: 'hip_circumference') int hipCircumference, - @JsonKey(name: 'blood_pressure_up') int bloodPressureUp, - @JsonKey(name: 'blood_pressure_down') int bloodPressureDown, - @JsonKey(name: 'has_hypo') int hasHypo, - @JsonKey(name: 'has_hyper') int hasHyper, - @JsonKey(name: 'about_alergy') String aboutAllergy, - @JsonKey(name: 'about_taking_pils') String aboutTakingPils, - @JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies, - @JsonKey(name: 'favorite_foods') String favoriteFoods, - @JsonKey(name: 'unfavorite_foods') String unfavoriteFoods, - @JsonKey(name: 'additional_info') String additionalInfo, - @JsonKey(name: 'activity_coefficient') double activityCoefficient, - }); + $Res call( + {@JsonKey(name: 'first_name') String firstName, + @JsonKey(name: 'last_name') String lastName, + String email, + String password, + @JsonKey(name: 'password_confirmation') String passwordConfirmation, + @JsonKey(name: 'terms') String termsAccepted, + String birthdate, + String gender, + String location, + @JsonKey(name: 'response_body') String responseBody, + String lang, + int weight, + int height, + String phone, + @JsonKey(name: 'chest_circumference') int chestCircumference, + @JsonKey(name: 'waist_circumference') int waistCircumference, + @JsonKey(name: 'hip_circumference') int hipCircumference, + @JsonKey(name: 'blood_pressure_up') int bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') int bloodPressureDown, + @JsonKey(name: 'has_hypo') int hasHypo, + @JsonKey(name: 'has_hyper') int hasHyper, + @JsonKey(name: 'about_alergy') String aboutAllergy, + @JsonKey(name: 'about_taking_pils') String aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies, + @JsonKey(name: 'favorite_foods') String favoriteFoods, + @JsonKey(name: 'unfavorite_foods') String unfavoriteFoods, + @JsonKey(name: 'additional_info') String additionalInfo, + @JsonKey(name: 'activity_coefficient') double activityCoefficient}); } /// @nodoc class __$$UserRegistrationSheetImplCopyWithImpl<$Res> - extends - _$UserRegistrationSheetCopyWithImpl<$Res, _$UserRegistrationSheetImpl> + extends _$UserRegistrationSheetCopyWithImpl<$Res, + _$UserRegistrationSheetImpl> implements _$$UserRegistrationSheetImplCopyWith<$Res> { - __$$UserRegistrationSheetImplCopyWithImpl( - _$UserRegistrationSheetImpl _value, - $Res Function(_$UserRegistrationSheetImpl) _then, - ) : super(_value, _then); + __$$UserRegistrationSheetImplCopyWithImpl(_$UserRegistrationSheetImpl _value, + $Res Function(_$UserRegistrationSheetImpl) _then) + : super(_value, _then); /// Create a copy of UserRegistrationSheet /// with the given fields replaced by the non-null parameter values. @@ -400,186 +361,156 @@ class __$$UserRegistrationSheetImplCopyWithImpl<$Res> Object? additionalInfo = null, Object? activityCoefficient = null, }) { - return _then( - _$UserRegistrationSheetImpl( - firstName: - null == firstName - ? _value.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: - null == lastName - ? _value.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - email: - null == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String, - password: - null == password - ? _value.password - : password // ignore: cast_nullable_to_non_nullable - as String, - passwordConfirmation: - null == passwordConfirmation - ? _value.passwordConfirmation - : passwordConfirmation // ignore: cast_nullable_to_non_nullable - as String, - termsAccepted: - null == termsAccepted - ? _value.termsAccepted - : termsAccepted // ignore: cast_nullable_to_non_nullable - as String, - birthdate: - null == birthdate - ? _value.birthdate - : birthdate // ignore: cast_nullable_to_non_nullable - as String, - gender: - null == gender - ? _value.gender - : gender // ignore: cast_nullable_to_non_nullable - as String, - location: - null == location - ? _value.location - : location // ignore: cast_nullable_to_non_nullable - as String, - responseBody: - null == responseBody - ? _value.responseBody - : responseBody // ignore: cast_nullable_to_non_nullable - as String, - lang: - null == lang - ? _value.lang - : lang // ignore: cast_nullable_to_non_nullable - as String, - weight: - null == weight - ? _value.weight - : weight // ignore: cast_nullable_to_non_nullable - as int, - height: - null == height - ? _value.height - : height // ignore: cast_nullable_to_non_nullable - as int, - phone: - null == phone - ? _value.phone - : phone // ignore: cast_nullable_to_non_nullable - as String, - chestCircumference: - null == chestCircumference - ? _value.chestCircumference - : chestCircumference // ignore: cast_nullable_to_non_nullable - as int, - waistCircumference: - null == waistCircumference - ? _value.waistCircumference - : waistCircumference // ignore: cast_nullable_to_non_nullable - as int, - hipCircumference: - null == hipCircumference - ? _value.hipCircumference - : hipCircumference // ignore: cast_nullable_to_non_nullable - as int, - bloodPressureUp: - null == bloodPressureUp - ? _value.bloodPressureUp - : bloodPressureUp // ignore: cast_nullable_to_non_nullable - as int, - bloodPressureDown: - null == bloodPressureDown - ? _value.bloodPressureDown - : bloodPressureDown // ignore: cast_nullable_to_non_nullable - as int, - hasHypo: - null == hasHypo - ? _value.hasHypo - : hasHypo // ignore: cast_nullable_to_non_nullable - as int, - hasHyper: - null == hasHyper - ? _value.hasHyper - : hasHyper // ignore: cast_nullable_to_non_nullable - as int, - aboutAllergy: - null == aboutAllergy - ? _value.aboutAllergy - : aboutAllergy // ignore: cast_nullable_to_non_nullable - as String, - aboutTakingPils: - null == aboutTakingPils - ? _value.aboutTakingPils - : aboutTakingPils // ignore: cast_nullable_to_non_nullable - as String, - aboutSportHobbies: - null == aboutSportHobbies - ? _value.aboutSportHobbies - : aboutSportHobbies // ignore: cast_nullable_to_non_nullable - as String, - favoriteFoods: - null == favoriteFoods - ? _value.favoriteFoods - : favoriteFoods // ignore: cast_nullable_to_non_nullable - as String, - unfavoriteFoods: - null == unfavoriteFoods - ? _value.unfavoriteFoods - : unfavoriteFoods // ignore: cast_nullable_to_non_nullable - as String, - additionalInfo: - null == additionalInfo - ? _value.additionalInfo - : additionalInfo // ignore: cast_nullable_to_non_nullable - as String, - activityCoefficient: - null == activityCoefficient - ? _value.activityCoefficient - : activityCoefficient // ignore: cast_nullable_to_non_nullable - as double, - ), - ); + return _then(_$UserRegistrationSheetImpl( + firstName: null == firstName + ? _value.firstName + : firstName // ignore: cast_nullable_to_non_nullable + as String, + lastName: null == lastName + ? _value.lastName + : lastName // ignore: cast_nullable_to_non_nullable + as String, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _value.password + : password // ignore: cast_nullable_to_non_nullable + as String, + passwordConfirmation: null == passwordConfirmation + ? _value.passwordConfirmation + : passwordConfirmation // ignore: cast_nullable_to_non_nullable + as String, + termsAccepted: null == termsAccepted + ? _value.termsAccepted + : termsAccepted // ignore: cast_nullable_to_non_nullable + as String, + birthdate: null == birthdate + ? _value.birthdate + : birthdate // ignore: cast_nullable_to_non_nullable + as String, + gender: null == gender + ? _value.gender + : gender // ignore: cast_nullable_to_non_nullable + as String, + location: null == location + ? _value.location + : location // ignore: cast_nullable_to_non_nullable + as String, + responseBody: null == responseBody + ? _value.responseBody + : responseBody // ignore: cast_nullable_to_non_nullable + as String, + lang: null == lang + ? _value.lang + : lang // ignore: cast_nullable_to_non_nullable + as String, + weight: null == weight + ? _value.weight + : weight // ignore: cast_nullable_to_non_nullable + as int, + height: null == height + ? _value.height + : height // ignore: cast_nullable_to_non_nullable + as int, + phone: null == phone + ? _value.phone + : phone // ignore: cast_nullable_to_non_nullable + as String, + chestCircumference: null == chestCircumference + ? _value.chestCircumference + : chestCircumference // ignore: cast_nullable_to_non_nullable + as int, + waistCircumference: null == waistCircumference + ? _value.waistCircumference + : waistCircumference // ignore: cast_nullable_to_non_nullable + as int, + hipCircumference: null == hipCircumference + ? _value.hipCircumference + : hipCircumference // ignore: cast_nullable_to_non_nullable + as int, + bloodPressureUp: null == bloodPressureUp + ? _value.bloodPressureUp + : bloodPressureUp // ignore: cast_nullable_to_non_nullable + as int, + bloodPressureDown: null == bloodPressureDown + ? _value.bloodPressureDown + : bloodPressureDown // ignore: cast_nullable_to_non_nullable + as int, + hasHypo: null == hasHypo + ? _value.hasHypo + : hasHypo // ignore: cast_nullable_to_non_nullable + as int, + hasHyper: null == hasHyper + ? _value.hasHyper + : hasHyper // ignore: cast_nullable_to_non_nullable + as int, + aboutAllergy: null == aboutAllergy + ? _value.aboutAllergy + : aboutAllergy // ignore: cast_nullable_to_non_nullable + as String, + aboutTakingPils: null == aboutTakingPils + ? _value.aboutTakingPils + : aboutTakingPils // ignore: cast_nullable_to_non_nullable + as String, + aboutSportHobbies: null == aboutSportHobbies + ? _value.aboutSportHobbies + : aboutSportHobbies // ignore: cast_nullable_to_non_nullable + as String, + favoriteFoods: null == favoriteFoods + ? _value.favoriteFoods + : favoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + unfavoriteFoods: null == unfavoriteFoods + ? _value.unfavoriteFoods + : unfavoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + additionalInfo: null == additionalInfo + ? _value.additionalInfo + : additionalInfo // ignore: cast_nullable_to_non_nullable + as String, + activityCoefficient: null == activityCoefficient + ? _value.activityCoefficient + : activityCoefficient // ignore: cast_nullable_to_non_nullable + as double, + )); } } /// @nodoc @JsonSerializable() class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { - const _$UserRegistrationSheetImpl({ - @JsonKey(name: 'first_name') required this.firstName, - @JsonKey(name: 'last_name') required this.lastName, - required this.email, - required this.password, - @JsonKey(name: 'password_confirmation') required this.passwordConfirmation, - @JsonKey(name: 'terms') this.termsAccepted = 'accepted', - required this.birthdate, - required this.gender, - required this.location, - @JsonKey(name: 'response_body') required this.responseBody, - required this.lang, - required this.weight, - required this.height, - required this.phone, - @JsonKey(name: 'chest_circumference') required this.chestCircumference, - @JsonKey(name: 'waist_circumference') required this.waistCircumference, - @JsonKey(name: 'hip_circumference') required this.hipCircumference, - @JsonKey(name: 'blood_pressure_up') required this.bloodPressureUp, - @JsonKey(name: 'blood_pressure_down') required this.bloodPressureDown, - @JsonKey(name: 'has_hypo') required this.hasHypo, - @JsonKey(name: 'has_hyper') required this.hasHyper, - @JsonKey(name: 'about_alergy') required this.aboutAllergy, - @JsonKey(name: 'about_taking_pils') required this.aboutTakingPils, - @JsonKey(name: 'about_sport_hobbies') required this.aboutSportHobbies, - @JsonKey(name: 'favorite_foods') required this.favoriteFoods, - @JsonKey(name: 'unfavorite_foods') required this.unfavoriteFoods, - @JsonKey(name: 'additional_info') required this.additionalInfo, - @JsonKey(name: 'activity_coefficient') this.activityCoefficient = 1.2, - }); + const _$UserRegistrationSheetImpl( + {@JsonKey(name: 'first_name') required this.firstName, + @JsonKey(name: 'last_name') required this.lastName, + required this.email, + required this.password, + @JsonKey(name: 'password_confirmation') + required this.passwordConfirmation, + @JsonKey(name: 'terms') this.termsAccepted = 'accepted', + required this.birthdate, + required this.gender, + required this.location, + @JsonKey(name: 'response_body') required this.responseBody, + required this.lang, + required this.weight, + required this.height, + required this.phone, + @JsonKey(name: 'chest_circumference') required this.chestCircumference, + @JsonKey(name: 'waist_circumference') required this.waistCircumference, + @JsonKey(name: 'hip_circumference') required this.hipCircumference, + @JsonKey(name: 'blood_pressure_up') required this.bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') required this.bloodPressureDown, + @JsonKey(name: 'has_hypo') required this.hasHypo, + @JsonKey(name: 'has_hyper') required this.hasHyper, + @JsonKey(name: 'about_alergy') required this.aboutAllergy, + @JsonKey(name: 'about_taking_pils') required this.aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') required this.aboutSportHobbies, + @JsonKey(name: 'favorite_foods') required this.favoriteFoods, + @JsonKey(name: 'unfavorite_foods') required this.unfavoriteFoods, + @JsonKey(name: 'additional_info') required this.additionalInfo, + @JsonKey(name: 'activity_coefficient') this.activityCoefficient = 1.2}); factory _$UserRegistrationSheetImpl.fromJson(Map json) => _$$UserRegistrationSheetImplFromJson(json); @@ -724,36 +655,36 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hashAll([ - runtimeType, - firstName, - lastName, - email, - password, - passwordConfirmation, - termsAccepted, - birthdate, - gender, - location, - responseBody, - lang, - weight, - height, - phone, - chestCircumference, - waistCircumference, - hipCircumference, - bloodPressureUp, - bloodPressureDown, - hasHypo, - hasHyper, - aboutAllergy, - aboutTakingPils, - aboutSportHobbies, - favoriteFoods, - unfavoriteFoods, - additionalInfo, - activityCoefficient, - ]); + runtimeType, + firstName, + lastName, + email, + password, + passwordConfirmation, + termsAccepted, + birthdate, + gender, + location, + responseBody, + lang, + weight, + height, + phone, + chestCircumference, + waistCircumference, + hipCircumference, + bloodPressureUp, + bloodPressureDown, + hasHypo, + hasHyper, + aboutAllergy, + aboutTakingPils, + aboutSportHobbies, + favoriteFoods, + unfavoriteFoods, + additionalInfo, + activityCoefficient + ]); /// Create a copy of UserRegistrationSheet /// with the given fields replaced by the non-null parameter values. @@ -761,51 +692,53 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @override @pragma('vm:prefer-inline') _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> - get copyWith => - __$$UserRegistrationSheetImplCopyWithImpl<_$UserRegistrationSheetImpl>( - this, - _$identity, - ); + get copyWith => __$$UserRegistrationSheetImplCopyWithImpl< + _$UserRegistrationSheetImpl>(this, _$identity); @override Map toJson() { - return _$$UserRegistrationSheetImplToJson(this); + return _$$UserRegistrationSheetImplToJson( + this, + ); } } abstract class _UserRegistrationSheet implements UserRegistrationSheet { - const factory _UserRegistrationSheet({ - @JsonKey(name: 'first_name') required final String firstName, - @JsonKey(name: 'last_name') required final String lastName, - required final String email, - required final String password, - @JsonKey(name: 'password_confirmation') - required final String passwordConfirmation, - @JsonKey(name: 'terms') final String termsAccepted, - required final String birthdate, - required final String gender, - required final String location, - @JsonKey(name: 'response_body') required final String responseBody, - required final String lang, - required final int weight, - required final int height, - required final String phone, - @JsonKey(name: 'chest_circumference') required final int chestCircumference, - @JsonKey(name: 'waist_circumference') required final int waistCircumference, - @JsonKey(name: 'hip_circumference') required final int hipCircumference, - @JsonKey(name: 'blood_pressure_up') required final int bloodPressureUp, - @JsonKey(name: 'blood_pressure_down') required final int bloodPressureDown, - @JsonKey(name: 'has_hypo') required final int hasHypo, - @JsonKey(name: 'has_hyper') required final int hasHyper, - @JsonKey(name: 'about_alergy') required final String aboutAllergy, - @JsonKey(name: 'about_taking_pils') required final String aboutTakingPils, - @JsonKey(name: 'about_sport_hobbies') - required final String aboutSportHobbies, - @JsonKey(name: 'favorite_foods') required final String favoriteFoods, - @JsonKey(name: 'unfavorite_foods') required final String unfavoriteFoods, - @JsonKey(name: 'additional_info') required final String additionalInfo, - @JsonKey(name: 'activity_coefficient') final double activityCoefficient, - }) = _$UserRegistrationSheetImpl; + const factory _UserRegistrationSheet( + {@JsonKey(name: 'first_name') required final String firstName, + @JsonKey(name: 'last_name') required final String lastName, + required final String email, + required final String password, + @JsonKey(name: 'password_confirmation') + required final String passwordConfirmation, + @JsonKey(name: 'terms') final String termsAccepted, + required final String birthdate, + required final String gender, + required final String location, + @JsonKey(name: 'response_body') required final String responseBody, + required final String lang, + required final int weight, + required final int height, + required final String phone, + @JsonKey(name: 'chest_circumference') + required final int chestCircumference, + @JsonKey(name: 'waist_circumference') + required final int waistCircumference, + @JsonKey(name: 'hip_circumference') required final int hipCircumference, + @JsonKey(name: 'blood_pressure_up') required final int bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') + required final int bloodPressureDown, + @JsonKey(name: 'has_hypo') required final int hasHypo, + @JsonKey(name: 'has_hyper') required final int hasHyper, + @JsonKey(name: 'about_alergy') required final String aboutAllergy, + @JsonKey(name: 'about_taking_pils') required final String aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') + required final String aboutSportHobbies, + @JsonKey(name: 'favorite_foods') required final String favoriteFoods, + @JsonKey(name: 'unfavorite_foods') required final String unfavoriteFoods, + @JsonKey(name: 'additional_info') required final String additionalInfo, + @JsonKey(name: 'activity_coefficient') + final double activityCoefficient}) = _$UserRegistrationSheetImpl; factory _UserRegistrationSheet.fromJson(Map json) = _$UserRegistrationSheetImpl.fromJson; @@ -891,5 +824,5 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/registration/models/user_registration_model.g.dart b/lib/features/registration/models/user_registration_model.g.dart index d5bbf8c6..076923a5 100644 --- a/lib/features/registration/models/user_registration_model.g.dart +++ b/lib/features/registration/models/user_registration_model.g.dart @@ -7,68 +7,68 @@ part of 'user_registration_model.dart'; // ************************************************************************** _$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson( - Map json, -) => _$UserRegistrationSheetImpl( - firstName: json['first_name'] as String, - lastName: json['last_name'] as String, - email: json['email'] as String, - password: json['password'] as String, - passwordConfirmation: json['password_confirmation'] as String, - termsAccepted: json['terms'] as String? ?? 'accepted', - birthdate: json['birthdate'] as String, - gender: json['gender'] as String, - location: json['location'] as String, - responseBody: json['response_body'] as String, - lang: json['lang'] as String, - weight: (json['weight'] as num).toInt(), - height: (json['height'] as num).toInt(), - phone: json['phone'] as String, - chestCircumference: (json['chest_circumference'] as num).toInt(), - waistCircumference: (json['waist_circumference'] as num).toInt(), - hipCircumference: (json['hip_circumference'] as num).toInt(), - bloodPressureUp: (json['blood_pressure_up'] as num).toInt(), - bloodPressureDown: (json['blood_pressure_down'] as num).toInt(), - hasHypo: (json['has_hypo'] as num).toInt(), - hasHyper: (json['has_hyper'] as num).toInt(), - aboutAllergy: json['about_alergy'] as String, - aboutTakingPils: json['about_taking_pils'] as String, - aboutSportHobbies: json['about_sport_hobbies'] as String, - favoriteFoods: json['favorite_foods'] as String, - unfavoriteFoods: json['unfavorite_foods'] as String, - additionalInfo: json['additional_info'] as String, - activityCoefficient: - (json['activity_coefficient'] as num?)?.toDouble() ?? 1.2, -); + Map json) => + _$UserRegistrationSheetImpl( + firstName: json['first_name'] as String, + lastName: json['last_name'] as String, + email: json['email'] as String, + password: json['password'] as String, + passwordConfirmation: json['password_confirmation'] as String, + termsAccepted: json['terms'] as String? ?? 'accepted', + birthdate: json['birthdate'] as String, + gender: json['gender'] as String, + location: json['location'] as String, + responseBody: json['response_body'] as String, + lang: json['lang'] as String, + weight: (json['weight'] as num).toInt(), + height: (json['height'] as num).toInt(), + phone: json['phone'] as String, + chestCircumference: (json['chest_circumference'] as num).toInt(), + waistCircumference: (json['waist_circumference'] as num).toInt(), + hipCircumference: (json['hip_circumference'] as num).toInt(), + bloodPressureUp: (json['blood_pressure_up'] as num).toInt(), + bloodPressureDown: (json['blood_pressure_down'] as num).toInt(), + hasHypo: (json['has_hypo'] as num).toInt(), + hasHyper: (json['has_hyper'] as num).toInt(), + aboutAllergy: json['about_alergy'] as String, + aboutTakingPils: json['about_taking_pils'] as String, + aboutSportHobbies: json['about_sport_hobbies'] as String, + favoriteFoods: json['favorite_foods'] as String, + unfavoriteFoods: json['unfavorite_foods'] as String, + additionalInfo: json['additional_info'] as String, + activityCoefficient: + (json['activity_coefficient'] as num?)?.toDouble() ?? 1.2, + ); Map _$$UserRegistrationSheetImplToJson( - _$UserRegistrationSheetImpl instance, -) => { - 'first_name': instance.firstName, - 'last_name': instance.lastName, - 'email': instance.email, - 'password': instance.password, - 'password_confirmation': instance.passwordConfirmation, - 'terms': instance.termsAccepted, - 'birthdate': instance.birthdate, - 'gender': instance.gender, - 'location': instance.location, - 'response_body': instance.responseBody, - 'lang': instance.lang, - 'weight': instance.weight, - 'height': instance.height, - 'phone': instance.phone, - 'chest_circumference': instance.chestCircumference, - 'waist_circumference': instance.waistCircumference, - 'hip_circumference': instance.hipCircumference, - 'blood_pressure_up': instance.bloodPressureUp, - 'blood_pressure_down': instance.bloodPressureDown, - 'has_hypo': instance.hasHypo, - 'has_hyper': instance.hasHyper, - 'about_alergy': instance.aboutAllergy, - 'about_taking_pils': instance.aboutTakingPils, - 'about_sport_hobbies': instance.aboutSportHobbies, - 'favorite_foods': instance.favoriteFoods, - 'unfavorite_foods': instance.unfavoriteFoods, - 'additional_info': instance.additionalInfo, - 'activity_coefficient': instance.activityCoefficient, -}; + _$UserRegistrationSheetImpl instance) => + { + 'first_name': instance.firstName, + 'last_name': instance.lastName, + 'email': instance.email, + 'password': instance.password, + 'password_confirmation': instance.passwordConfirmation, + 'terms': instance.termsAccepted, + 'birthdate': instance.birthdate, + 'gender': instance.gender, + 'location': instance.location, + 'response_body': instance.responseBody, + 'lang': instance.lang, + 'weight': instance.weight, + 'height': instance.height, + 'phone': instance.phone, + 'chest_circumference': instance.chestCircumference, + 'waist_circumference': instance.waistCircumference, + 'hip_circumference': instance.hipCircumference, + 'blood_pressure_up': instance.bloodPressureUp, + 'blood_pressure_down': instance.bloodPressureDown, + 'has_hypo': instance.hasHypo, + 'has_hyper': instance.hasHyper, + 'about_alergy': instance.aboutAllergy, + 'about_taking_pils': instance.aboutTakingPils, + 'about_sport_hobbies': instance.aboutSportHobbies, + 'favorite_foods': instance.favoriteFoods, + 'unfavorite_foods': instance.unfavoriteFoods, + 'additional_info': instance.additionalInfo, + 'activity_coefficient': instance.activityCoefficient, + }; 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 c5b5133e..9a1cb16d 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -15,7 +15,7 @@ class RegistrationCubit extends Cubit { RegistrationCubit({ required this.registrationRepository, }) : super( - RegistrationState( + const RegistrationState( sheet: UserRegistrationSheet( firstName: '', lastName: '', diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart index 711c672d..ae0a9706 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart @@ -12,8 +12,7 @@ part of 'registration_state.dart'; 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', -); + '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'); /// @nodoc mixin _$RegistrationState { @@ -29,9 +28,8 @@ mixin _$RegistrationState { /// @nodoc abstract class $RegistrationStateCopyWith<$Res> { factory $RegistrationStateCopyWith( - RegistrationState value, - $Res Function(RegistrationState) then, - ) = _$RegistrationStateCopyWithImpl<$Res, RegistrationState>; + RegistrationState value, $Res Function(RegistrationState) then) = + _$RegistrationStateCopyWithImpl<$Res, RegistrationState>; @useResult $Res call({UserRegistrationSheet sheet}); @@ -52,17 +50,15 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? sheet = null}) { - return _then( - _value.copyWith( - sheet: - null == sheet - ? _value.sheet - : sheet // ignore: cast_nullable_to_non_nullable - as UserRegistrationSheet, - ) - as $Val, - ); + $Res call({ + Object? sheet = null, + }) { + return _then(_value.copyWith( + sheet: null == sheet + ? _value.sheet + : sheet // ignore: cast_nullable_to_non_nullable + as UserRegistrationSheet, + ) as $Val); } /// Create a copy of RegistrationState @@ -79,10 +75,9 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> /// @nodoc abstract class _$$RegistrationStateImplCopyWith<$Res> implements $RegistrationStateCopyWith<$Res> { - factory _$$RegistrationStateImplCopyWith( - _$RegistrationStateImpl value, - $Res Function(_$RegistrationStateImpl) then, - ) = __$$RegistrationStateImplCopyWithImpl<$Res>; + factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value, + $Res Function(_$RegistrationStateImpl) then) = + __$$RegistrationStateImplCopyWithImpl<$Res>; @override @useResult $Res call({UserRegistrationSheet sheet}); @@ -95,25 +90,23 @@ abstract class _$$RegistrationStateImplCopyWith<$Res> class __$$RegistrationStateImplCopyWithImpl<$Res> extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateImpl> implements _$$RegistrationStateImplCopyWith<$Res> { - __$$RegistrationStateImplCopyWithImpl( - _$RegistrationStateImpl _value, - $Res Function(_$RegistrationStateImpl) _then, - ) : super(_value, _then); + __$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value, + $Res Function(_$RegistrationStateImpl) _then) + : super(_value, _then); /// Create a copy of RegistrationState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? sheet = null}) { - return _then( - _$RegistrationStateImpl( - sheet: - null == sheet - ? _value.sheet - : sheet // ignore: cast_nullable_to_non_nullable - as UserRegistrationSheet, - ), - ); + $Res call({ + Object? sheet = null, + }) { + return _then(_$RegistrationStateImpl( + sheet: null == sheet + ? _value.sheet + : sheet // ignore: cast_nullable_to_non_nullable + as UserRegistrationSheet, + )); } } @@ -148,15 +141,12 @@ class _$RegistrationStateImpl implements _RegistrationState { @pragma('vm:prefer-inline') _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => __$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _RegistrationState implements RegistrationState { - const factory _RegistrationState({ - required final UserRegistrationSheet sheet, - }) = _$RegistrationStateImpl; + const factory _RegistrationState( + {required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl; @override UserRegistrationSheet get sheet; diff --git a/lib/features/registration/presentation/pages/additional_information_screen.dart b/lib/features/registration/presentation/pages/additional_information_screen.dart index 437fe06f..1bcdca97 100644 --- a/lib/features/registration/presentation/pages/additional_information_screen.dart +++ b/lib/features/registration/presentation/pages/additional_information_screen.dart @@ -28,23 +28,23 @@ class _AdditionalInformationScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(s.allergies_presence + ' (не обязательно)'), - SizedBox(height: 4), + Text('${s.allergies_presence} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( controller: enterInformationController, hintText: 'Например: орехи, мёд и т.д.', diff --git a/lib/features/registration/presentation/pages/blood_pressure_screen.dart b/lib/features/registration/presentation/pages/blood_pressure_screen.dart index e3d1f688..b8c9d8fc 100644 --- a/lib/features/registration/presentation/pages/blood_pressure_screen.dart +++ b/lib/features/registration/presentation/pages/blood_pressure_screen.dart @@ -20,11 +20,11 @@ class BloodPressureScreen extends StatefulWidget { class _BloodPressureScreenState extends State { final List selectionPopupList = [ - SelectionPopupModel( + const SelectionPopupModel( id: 1, title: "Да", ), - SelectionPopupModel( + const SelectionPopupModel( id: 0, title: "Нет", ), @@ -54,12 +54,12 @@ class _BloodPressureScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(s.up_pressure + ' (не обязательно)'), - SizedBox(height: 4), + Text('${s.up_pressure} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], controller: upPressureController, @@ -71,9 +71,9 @@ class _BloodPressureScreenState extends State { registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureUp: int.parse(newValue))); }, ), - SizedBox(height: 16), - Text(s.down_pressure + ' (не обязательно)'), - SizedBox(height: 4), + const SizedBox(height: 16), + Text('${s.down_pressure} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], controller: downPressureController, @@ -83,12 +83,12 @@ class _BloodPressureScreenState extends State { registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureDown: int.parse(newValue))); }, ), - SizedBox(height: 16), - Text(s.do_you_have_hypotension_tendency + ' (не обязательно)'), - SizedBox(height: 4), + const SizedBox(height: 16), + Text('${s.do_you_have_hypotension_tendency} (не обязательно)'), + const SizedBox(height: 4), CustomDropDown( icon: Container( - margin: EdgeInsets.all(16), + margin: const EdgeInsets.all(16), decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), ), @@ -109,12 +109,12 @@ class _BloodPressureScreenState extends State { }); }, ), - SizedBox(height: 16), - Text(s.do_you_have_hypertension_tendency + ' (не обязательно)'), - SizedBox(height: 4), + const SizedBox(height: 16), + Text('${s.do_you_have_hypertension_tendency} (не обязательно)'), + const SizedBox(height: 4), CustomDropDown( icon: Container( - margin: EdgeInsets.all(16), + margin: const EdgeInsets.all(16), decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), ), diff --git a/lib/features/registration/presentation/pages/body_circumferences_screen.dart b/lib/features/registration/presentation/pages/body_circumferences_screen.dart index e14c62ef..b5fba5d4 100644 --- a/lib/features/registration/presentation/pages/body_circumferences_screen.dart +++ b/lib/features/registration/presentation/pages/body_circumferences_screen.dart @@ -35,12 +35,12 @@ class _BodyCircumferencesScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(s.chest_circumference + ' (не обязательно)'), - SizedBox(height: 4), + Text('${s.chest_circumference} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], autofocus: true, @@ -52,9 +52,9 @@ class _BodyCircumferencesScreenState extends State { registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(chestCircumference: int.parse(value))); }, ), - SizedBox(height: 16), - Text(s.waist_circumference + ' (не обязательно)'), - SizedBox(height: 4), + const SizedBox(height: 16), + Text('${s.waist_circumference} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], controller: waistCircumferenceController, @@ -64,9 +64,9 @@ class _BodyCircumferencesScreenState extends State { registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(waistCircumference: int.parse(value))); }, ), - SizedBox(height: 16), - Text(s.hip_circumference + ' (не обязательно)'), - SizedBox(height: 4), + const SizedBox(height: 16), + Text('${s.hip_circumference} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], controller: hipCircumferenceController, diff --git a/lib/features/registration/presentation/pages/city_of_living_screen.dart b/lib/features/registration/presentation/pages/city_of_living_screen.dart index f844bae4..507fc275 100644 --- a/lib/features/registration/presentation/pages/city_of_living_screen.dart +++ b/lib/features/registration/presentation/pages/city_of_living_screen.dart @@ -18,7 +18,7 @@ class CityOfLivingScreen extends StatefulWidget { class _CityOfLivingScreenState extends State { final dropdownItemList = [ - SelectionPopupModel(id: 1, title: "Россия", isSelected: true), + const SelectionPopupModel(id: 1, title: "Россия", isSelected: true), ]; late SelectionPopupModel selectedItem; @@ -37,18 +37,18 @@ class _CityOfLivingScreenState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Местоположение"), - SizedBox(height: 4), + const Text("Местоположение"), + const SizedBox(height: 4), Row( children: [ SizedBox( width: MediaQuery.of(context).size.width - 32, child: TypeAheadField( - debounceDuration: Duration(milliseconds: 300), + debounceDuration: const Duration(milliseconds: 300), controller: cityController, suggestionsController: suggestionsController, builder: (context, controller, focus) => CustomTextFormField( @@ -60,7 +60,7 @@ class _CityOfLivingScreenState extends State { final registrationCubit = context.read(); registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(location: value)); }, - textStyle: TextStyle( + textStyle: const TextStyle( fontSize: 16, color: Colors.black, ), diff --git a/lib/features/registration/presentation/pages/credentials_screen.dart b/lib/features/registration/presentation/pages/credentials_screen.dart index 06b9dc17..26b8508f 100644 --- a/lib/features/registration/presentation/pages/credentials_screen.dart +++ b/lib/features/registration/presentation/pages/credentials_screen.dart @@ -36,13 +36,13 @@ class _CredentialsScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16), + padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.email), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: emailController, focusNode: emailFocusNode, @@ -56,9 +56,9 @@ class _CredentialsScreenState extends State { registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(email: newValue)); }, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.password), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( obscureText: hidePassword, controller: passwordController, @@ -80,9 +80,9 @@ class _CredentialsScreenState extends State { registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(password: newValue)); }, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.password_confirmation), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( obscureText: hidePassword, controller: passwordConfirmationController, diff --git a/lib/features/registration/presentation/pages/date_of_birth_screen.dart b/lib/features/registration/presentation/pages/date_of_birth_screen.dart index b8a9aad4..089cb180 100644 --- a/lib/features/registration/presentation/pages/date_of_birth_screen.dart +++ b/lib/features/registration/presentation/pages/date_of_birth_screen.dart @@ -37,16 +37,16 @@ class _DateOfBirthScreenState extends State { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16), + padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.date_of_birth), - SizedBox(height: 4), + const SizedBox(height: 4), ListTile( onTap: onTapCalendar(context), leading: Icon(Icons.calendar_month_rounded, color: appTheme.blueA400), - trailing: Icon(Icons.keyboard_arrow_down_rounded), + trailing: const Icon(Icons.keyboard_arrow_down_rounded), title: Text(selectedDate.format('dd MMMM yyyy', 'ru')), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), @@ -112,7 +112,7 @@ class _DateOfBirthScreenState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( diff --git a/lib/features/registration/presentation/pages/favorite_foods_screen.dart b/lib/features/registration/presentation/pages/favorite_foods_screen.dart index 6b662609..ab6db46a 100644 --- a/lib/features/registration/presentation/pages/favorite_foods_screen.dart +++ b/lib/features/registration/presentation/pages/favorite_foods_screen.dart @@ -31,12 +31,12 @@ class _FavoriteFoodsScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(s.favorite_foods + ' (не обязательно)'), - SizedBox(height: 4), + Text('${s.favorite_foods} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( controller: favoriteFoodsController, hintText: s.enter_information, @@ -49,9 +49,9 @@ class _FavoriteFoodsScreenState extends State { registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(favoriteFoods: newValue)); }, ), - SizedBox(height: 16), - Text(s.unfavorite_foods + ' (не обязательно)'), - SizedBox(height: 4), + const SizedBox(height: 16), + Text('${s.unfavorite_foods} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( controller: unFavoriteFoodsController, hintText: s.enter_information, diff --git a/lib/features/registration/presentation/pages/favorite_sports_screen.dart b/lib/features/registration/presentation/pages/favorite_sports_screen.dart index a70af7d4..b711f0ab 100644 --- a/lib/features/registration/presentation/pages/favorite_sports_screen.dart +++ b/lib/features/registration/presentation/pages/favorite_sports_screen.dart @@ -29,12 +29,12 @@ class _FavoriteSportsScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(s.your_favorite_sports + ' (не обязательно)'), - SizedBox(height: 4), + Text('${s.your_favorite_sports} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( controller: enterInformationController, focusNode: infoFocusNode, diff --git a/lib/features/registration/presentation/pages/gender_screen.dart b/lib/features/registration/presentation/pages/gender_screen.dart index 46d56da3..4403b54e 100644 --- a/lib/features/registration/presentation/pages/gender_screen.dart +++ b/lib/features/registration/presentation/pages/gender_screen.dart @@ -24,7 +24,7 @@ class _GenderScreenState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16), + padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16), child: Column( children: [ RadioListTile( @@ -32,7 +32,7 @@ class _GenderScreenState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), - title: Text('Мужской'), + title: const Text('Мужской'), value: 'male', groupValue: currentValue, onChanged: (newValue) { @@ -48,13 +48,13 @@ class _GenderScreenState extends State { height: 40, ), ), - SizedBox(height: 16), + const SizedBox(height: 16), RadioListTile( contentPadding: EdgeInsets.zero, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), - title: Text('Женский'), + title: const Text('Женский'), value: 'female', groupValue: currentValue, onChanged: (newValue) { diff --git a/lib/features/registration/presentation/pages/height_screen.dart b/lib/features/registration/presentation/pages/height_screen.dart index 4e43bea7..485cf838 100644 --- a/lib/features/registration/presentation/pages/height_screen.dart +++ b/lib/features/registration/presentation/pages/height_screen.dart @@ -30,12 +30,12 @@ class _HeightScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.your_height), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( textInputAction: TextInputAction.done, autofocus: true, diff --git a/lib/features/registration/presentation/pages/language_select_screen.dart b/lib/features/registration/presentation/pages/language_select_screen.dart index 2fac31d6..cd396ea5 100644 --- a/lib/features/registration/presentation/pages/language_select_screen.dart +++ b/lib/features/registration/presentation/pages/language_select_screen.dart @@ -17,7 +17,7 @@ class LanguageSelectScreen extends StatefulWidget { class _LanguageSelectScreenState extends State { final List dropdownItemList = [ - SelectionPopupModel(id: 1, title: "Русский", isSelected: true), + const SelectionPopupModel(id: 1, title: "Русский", isSelected: true), ]; late SelectionPopupModel value; @@ -38,7 +38,7 @@ class _LanguageSelectScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/features/registration/presentation/pages/medicine_intake_screen.dart b/lib/features/registration/presentation/pages/medicine_intake_screen.dart index 214e30c7..65560e87 100644 --- a/lib/features/registration/presentation/pages/medicine_intake_screen.dart +++ b/lib/features/registration/presentation/pages/medicine_intake_screen.dart @@ -29,12 +29,12 @@ class _MedicineIntakeScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(s.do_you_take_pills + ' (не обязательно)'), - SizedBox(height: 4), + Text('${s.do_you_take_pills} (не обязательно)'), + const SizedBox(height: 4), CustomTextFormField( controller: enterInformationController, hintText: s.enter_information, diff --git a/lib/features/registration/presentation/pages/name_screen.dart b/lib/features/registration/presentation/pages/name_screen.dart index 1b7dd28e..d69e0ea9 100644 --- a/lib/features/registration/presentation/pages/name_screen.dart +++ b/lib/features/registration/presentation/pages/name_screen.dart @@ -31,12 +31,12 @@ class _NameScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16), + padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.first_name), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: firstNameController, focusNode: nameFocus, @@ -47,9 +47,9 @@ class _NameScreenState extends State { registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(firstName: newValue)); }, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.last_name), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: lastNameController, textInputAction: TextInputAction.done, diff --git a/lib/features/registration/presentation/pages/phone_screen.dart b/lib/features/registration/presentation/pages/phone_screen.dart index 99942cc1..e4f458cd 100644 --- a/lib/features/registration/presentation/pages/phone_screen.dart +++ b/lib/features/registration/presentation/pages/phone_screen.dart @@ -36,12 +36,12 @@ class _PhoneScreenState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('Номер телефона'), - SizedBox(height: 4), + const Text('Номер телефона'), + const SizedBox(height: 4), CustomTextFormField( textInputAction: TextInputAction.done, autofocus: true, diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index 7331b852..69ae62d5 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -52,7 +52,7 @@ class _RegistrationScreenState extends State { Container( height: 48, width: MediaQuery.of(context).size.width * 0.2, - padding: EdgeInsets.only(left: 16, right: 4), + padding: const EdgeInsets.only(left: 16, right: 4), child: FloatingActionButton.extended( heroTag: 'backButtonRegistration', highlightElevation: 0, @@ -61,7 +61,7 @@ class _RegistrationScreenState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), - backgroundColor: Color(0xFFEAF2FD), + backgroundColor: const Color(0xFFEAF2FD), onPressed: () async { setState(() { pageController.previousPage( @@ -79,7 +79,7 @@ class _RegistrationScreenState extends State { Container( height: 48, width: MediaQuery.of(context).size.width * 0.8, - padding: EdgeInsets.only(left: 4, right: 16), + padding: const EdgeInsets.only(left: 4, right: 16), child: FloatingActionButton.extended( heroTag: 'nextButtonRegistration', highlightElevation: 0, @@ -90,7 +90,7 @@ class _RegistrationScreenState extends State { ), backgroundColor: appTheme.blueA400, onPressed: () async { - if (await canGoNext(state)) { + if (await canGoNext(state, context)) { setState(() { pageController.nextPage( duration: const Duration(milliseconds: 350), @@ -111,7 +111,7 @@ class _RegistrationScreenState extends State { automaticallyImplyLeading: false, leading: Builder( builder: (context) => IconButton( - icon: Icon(Icons.close_rounded), + icon: const Icon(Icons.close_rounded), onPressed: () => GoRouter.of(context).pop(), ), ), @@ -150,7 +150,7 @@ class _RegistrationScreenState extends State { ), ), body: PageView( - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), controller: pageController, onPageChanged: (index) { setState(() { @@ -183,19 +183,19 @@ class _RegistrationScreenState extends State { ); } - Future canGoNext(RegistrationState state) async { + Future canGoNext(RegistrationState state, BuildContext context) async { switch (step) { case 1: if (state.sheet.phone.length != 18) { showDialog( context: context, builder: (context) => AlertDialog( - title: Text('Ошибка'), - content: Text('Введите корректный номер телефона'), + title: const Text('Ошибка'), + content: const Text('Введите корректный номер телефона'), actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text('OK'), + child: const Text('OK'), ), ], ), @@ -217,18 +217,18 @@ class _RegistrationScreenState extends State { String errorMessage = ''; for (var error in errors) { - errorMessage += error + '\n\n'; + errorMessage += '$error\n\n'; } showDialog( context: context, builder: (context) => AlertDialog( - title: Text('Ошибка'), + title: const Text('Ошибка'), content: Text(errorMessage), actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text('OK'), + child: const Text('OK'), ), ], ), @@ -247,18 +247,18 @@ class _RegistrationScreenState extends State { String errorMessage = ''; for (var error in errors) { - errorMessage += error + '\n\n'; + errorMessage += '$error\n\n'; } showDialog( context: context, builder: (context) => AlertDialog( - title: Text('Ошибка'), + title: const Text('Ошибка'), content: Text(errorMessage), actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text('OK'), + child: const Text('OK'), ), ], ), @@ -266,18 +266,18 @@ class _RegistrationScreenState extends State { return false; } case 4: - if (state.sheet.gender.isNotEmpty) + if (state.sheet.gender.isNotEmpty) { return true; - else { + } else { showDialog( context: context, builder: (context) => AlertDialog( - title: Text('Ошибка'), - content: Text('Выберете пол'), + title: const Text('Ошибка'), + content: const Text('Выберете пол'), actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text('OK'), + child: const Text('OK'), ), ], ), @@ -285,18 +285,18 @@ class _RegistrationScreenState extends State { return false; } case 6: - if (state.sheet.location.isNotEmpty) + if (state.sheet.location.isNotEmpty) { return true; - else { + } else { showDialog( context: context, builder: (context) => AlertDialog( - title: Text('Ошибка'), - content: Text('Заполните все поля'), + title: const Text('Ошибка'), + content: const Text('Заполните все поля'), actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text('OK'), + child: const Text('OK'), ), ], ), @@ -316,18 +316,18 @@ class _RegistrationScreenState extends State { String errorMessage = ''; for (var error in errors) { - errorMessage += error + '\n\n'; + errorMessage += '$error\n\n'; } showDialog( context: context, builder: (context) => AlertDialog( - title: Text('Ошибка'), + title: const Text('Ошибка'), content: Text(errorMessage), actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text('OK'), + child: const Text('OK'), ), ], ), @@ -340,21 +340,25 @@ class _RegistrationScreenState extends State { barrierDismissible: false, useSafeArea: false, context: context, - builder: (context) => PopScope( + builder: (context) => const PopScope( canPop: false, - child: const Loader(), + child: Loader(), ), ); await registrationCubit.tryRegistration(); - Navigator.pop(context); + if (context.mounted) { + Navigator.pop(context); + } } catch (e) { - Navigator.pop(context); - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text('Ошибка при попытке регистрации'), - ), - ); + if (context.mounted) { + Navigator.pop(context); + showDialog( + context: context, + builder: (context) => const AlertDialog( + title: Text('Ошибка при попытке регистрации'), + ), + ); + } } return false; default: @@ -423,7 +427,7 @@ class _RegistrationScreenState extends State { errors.add('First name cannot be empty'); } - if (firstName.length < 1) { + if (firstName.isEmpty) { errors.add('First name is too short'); } @@ -431,7 +435,7 @@ class _RegistrationScreenState extends State { errors.add('Last name cannot be empty'); } - if (lastName.length < 1) { + if (lastName.isEmpty) { errors.add('Last name is too short'); } diff --git a/lib/features/registration/presentation/pages/webview_registration_screen.dart b/lib/features/registration/presentation/pages/webview_registration_screen.dart index 54f4a199..f1dc435f 100644 --- a/lib/features/registration/presentation/pages/webview_registration_screen.dart +++ b/lib/features/registration/presentation/pages/webview_registration_screen.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:developer'; import 'package:eatvio_app/core/const.dart'; import 'package:eatvio_app/core/locator_service.dart'; @@ -7,7 +8,7 @@ import 'package:flutter/material.dart'; import 'package:webview_flutter/webview_flutter.dart'; class WebViewRegistrationScreen extends StatefulWidget { - const WebViewRegistrationScreen(); + const WebViewRegistrationScreen({super.key}); @override State createState() => _WebViewRegistrationScreenState(); @@ -31,10 +32,10 @@ class _WebViewRegistrationScreenState extends State { final data = jsonDecode(message.message); if (data['type'] == 'email') { email = data['value']; - print("Email: $email"); + log("Email: $email"); } else if (data['type'] == 'password') { password = data['value']; - print("Password: $password"); + log("Password: $password"); } }, ) @@ -51,13 +52,13 @@ class _WebViewRegistrationScreenState extends State { }, ), ) - ..loadRequest(Uri.parse(baseUrl + '/registration/step1')); + ..loadRequest(Uri.parse('$baseUrl/registration/step1')); _injectJavaScript(); } void _injectJavaScript() async { - await Future.delayed(Duration(seconds: 2)); + await Future.delayed(const Duration(seconds: 2)); _controller.runJavaScript(''' function sendMessageToFlutter(data) { window.flutter_inject.postMessage(JSON.stringify(data)); diff --git a/lib/features/registration/presentation/pages/weight_screen.dart b/lib/features/registration/presentation/pages/weight_screen.dart index 364804d0..8c5cfd8a 100644 --- a/lib/features/registration/presentation/pages/weight_screen.dart +++ b/lib/features/registration/presentation/pages/weight_screen.dart @@ -30,12 +30,12 @@ class _WeightScreenState extends State { Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), + padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.your_weight), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( autofocus: true, hintText: 'кг', diff --git a/lib/features/settings/models/profile_settings_model.freezed.dart b/lib/features/settings/models/profile_settings_model.freezed.dart index 81b3eb7b..e6a0ff83 100644 --- a/lib/features/settings/models/profile_settings_model.freezed.dart +++ b/lib/features/settings/models/profile_settings_model.freezed.dart @@ -12,8 +12,7 @@ part of 'profile_settings_model.dart'; 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', -); + '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'); ProfileSettingsModel _$ProfileSettingsModelFromJson(Map json) { return _ProfileSettingsModel.fromJson(json); @@ -44,26 +43,23 @@ mixin _$ProfileSettingsModel { /// @nodoc abstract class $ProfileSettingsModelCopyWith<$Res> { - factory $ProfileSettingsModelCopyWith( - ProfileSettingsModel value, - $Res Function(ProfileSettingsModel) then, - ) = _$ProfileSettingsModelCopyWithImpl<$Res, ProfileSettingsModel>; + factory $ProfileSettingsModelCopyWith(ProfileSettingsModel value, + $Res Function(ProfileSettingsModel) then) = + _$ProfileSettingsModelCopyWithImpl<$Res, ProfileSettingsModel>; @useResult - $Res call({ - @JsonKey(name: "new_updates_notifications") dynamic newUpdatesNotifications, - @JsonKey(name: "diary_reminder_notifications") - dynamic diaryReminderNotifications, - @JsonKey(name: "is_mood_fillable") bool isMoodFillable, - @JsonKey(name: "is_bedtime_fillable") bool isBedtimeFillable, - @JsonKey(name: "is_public_profile") bool isPublicProfile, - }); + $Res call( + {@JsonKey(name: "new_updates_notifications") + dynamic newUpdatesNotifications, + @JsonKey(name: "diary_reminder_notifications") + dynamic diaryReminderNotifications, + @JsonKey(name: "is_mood_fillable") bool isMoodFillable, + @JsonKey(name: "is_bedtime_fillable") bool isBedtimeFillable, + @JsonKey(name: "is_public_profile") bool isPublicProfile}); } /// @nodoc -class _$ProfileSettingsModelCopyWithImpl< - $Res, - $Val extends ProfileSettingsModel -> +class _$ProfileSettingsModelCopyWithImpl<$Res, + $Val extends ProfileSettingsModel> implements $ProfileSettingsModelCopyWith<$Res> { _$ProfileSettingsModelCopyWithImpl(this._value, this._then); @@ -83,66 +79,56 @@ class _$ProfileSettingsModelCopyWithImpl< Object? isBedtimeFillable = null, Object? isPublicProfile = null, }) { - return _then( - _value.copyWith( - newUpdatesNotifications: - freezed == newUpdatesNotifications - ? _value.newUpdatesNotifications - : newUpdatesNotifications // ignore: cast_nullable_to_non_nullable - as dynamic, - diaryReminderNotifications: - freezed == diaryReminderNotifications - ? _value.diaryReminderNotifications - : diaryReminderNotifications // ignore: cast_nullable_to_non_nullable - as dynamic, - isMoodFillable: - null == isMoodFillable - ? _value.isMoodFillable - : isMoodFillable // ignore: cast_nullable_to_non_nullable - as bool, - isBedtimeFillable: - null == isBedtimeFillable - ? _value.isBedtimeFillable - : isBedtimeFillable // ignore: cast_nullable_to_non_nullable - as bool, - isPublicProfile: - null == isPublicProfile - ? _value.isPublicProfile - : isPublicProfile // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + return _then(_value.copyWith( + newUpdatesNotifications: freezed == newUpdatesNotifications + ? _value.newUpdatesNotifications + : newUpdatesNotifications // ignore: cast_nullable_to_non_nullable + as dynamic, + diaryReminderNotifications: freezed == diaryReminderNotifications + ? _value.diaryReminderNotifications + : diaryReminderNotifications // ignore: cast_nullable_to_non_nullable + as dynamic, + isMoodFillable: null == isMoodFillable + ? _value.isMoodFillable + : isMoodFillable // ignore: cast_nullable_to_non_nullable + as bool, + isBedtimeFillable: null == isBedtimeFillable + ? _value.isBedtimeFillable + : isBedtimeFillable // ignore: cast_nullable_to_non_nullable + as bool, + isPublicProfile: null == isPublicProfile + ? _value.isPublicProfile + : isPublicProfile // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } } /// @nodoc abstract class _$$ProfileSettingsModelImplCopyWith<$Res> implements $ProfileSettingsModelCopyWith<$Res> { - factory _$$ProfileSettingsModelImplCopyWith( - _$ProfileSettingsModelImpl value, - $Res Function(_$ProfileSettingsModelImpl) then, - ) = __$$ProfileSettingsModelImplCopyWithImpl<$Res>; + factory _$$ProfileSettingsModelImplCopyWith(_$ProfileSettingsModelImpl value, + $Res Function(_$ProfileSettingsModelImpl) then) = + __$$ProfileSettingsModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - @JsonKey(name: "new_updates_notifications") dynamic newUpdatesNotifications, - @JsonKey(name: "diary_reminder_notifications") - dynamic diaryReminderNotifications, - @JsonKey(name: "is_mood_fillable") bool isMoodFillable, - @JsonKey(name: "is_bedtime_fillable") bool isBedtimeFillable, - @JsonKey(name: "is_public_profile") bool isPublicProfile, - }); + $Res call( + {@JsonKey(name: "new_updates_notifications") + dynamic newUpdatesNotifications, + @JsonKey(name: "diary_reminder_notifications") + dynamic diaryReminderNotifications, + @JsonKey(name: "is_mood_fillable") bool isMoodFillable, + @JsonKey(name: "is_bedtime_fillable") bool isBedtimeFillable, + @JsonKey(name: "is_public_profile") bool isPublicProfile}); } /// @nodoc class __$$ProfileSettingsModelImplCopyWithImpl<$Res> extends _$ProfileSettingsModelCopyWithImpl<$Res, _$ProfileSettingsModelImpl> implements _$$ProfileSettingsModelImplCopyWith<$Res> { - __$$ProfileSettingsModelImplCopyWithImpl( - _$ProfileSettingsModelImpl _value, - $Res Function(_$ProfileSettingsModelImpl) _then, - ) : super(_value, _then); + __$$ProfileSettingsModelImplCopyWithImpl(_$ProfileSettingsModelImpl _value, + $Res Function(_$ProfileSettingsModelImpl) _then) + : super(_value, _then); /// Create a copy of ProfileSettingsModel /// with the given fields replaced by the non-null parameter values. @@ -155,50 +141,42 @@ class __$$ProfileSettingsModelImplCopyWithImpl<$Res> Object? isBedtimeFillable = null, Object? isPublicProfile = null, }) { - return _then( - _$ProfileSettingsModelImpl( - newUpdatesNotifications: - freezed == newUpdatesNotifications - ? _value.newUpdatesNotifications - : newUpdatesNotifications // ignore: cast_nullable_to_non_nullable - as dynamic, - diaryReminderNotifications: - freezed == diaryReminderNotifications - ? _value.diaryReminderNotifications - : diaryReminderNotifications // ignore: cast_nullable_to_non_nullable - as dynamic, - isMoodFillable: - null == isMoodFillable - ? _value.isMoodFillable - : isMoodFillable // ignore: cast_nullable_to_non_nullable - as bool, - isBedtimeFillable: - null == isBedtimeFillable - ? _value.isBedtimeFillable - : isBedtimeFillable // ignore: cast_nullable_to_non_nullable - as bool, - isPublicProfile: - null == isPublicProfile - ? _value.isPublicProfile - : isPublicProfile // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + return _then(_$ProfileSettingsModelImpl( + newUpdatesNotifications: freezed == newUpdatesNotifications + ? _value.newUpdatesNotifications + : newUpdatesNotifications // ignore: cast_nullable_to_non_nullable + as dynamic, + diaryReminderNotifications: freezed == diaryReminderNotifications + ? _value.diaryReminderNotifications + : diaryReminderNotifications // ignore: cast_nullable_to_non_nullable + as dynamic, + isMoodFillable: null == isMoodFillable + ? _value.isMoodFillable + : isMoodFillable // ignore: cast_nullable_to_non_nullable + as bool, + isBedtimeFillable: null == isBedtimeFillable + ? _value.isBedtimeFillable + : isBedtimeFillable // ignore: cast_nullable_to_non_nullable + as bool, + isPublicProfile: null == isPublicProfile + ? _value.isPublicProfile + : isPublicProfile // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc @JsonSerializable() class _$ProfileSettingsModelImpl implements _ProfileSettingsModel { - const _$ProfileSettingsModelImpl({ - @JsonKey(name: "new_updates_notifications") - required this.newUpdatesNotifications, - @JsonKey(name: "diary_reminder_notifications") - required this.diaryReminderNotifications, - @JsonKey(name: "is_mood_fillable") required this.isMoodFillable, - @JsonKey(name: "is_bedtime_fillable") required this.isBedtimeFillable, - @JsonKey(name: "is_public_profile") required this.isPublicProfile, - }); + const _$ProfileSettingsModelImpl( + {@JsonKey(name: "new_updates_notifications") + required this.newUpdatesNotifications, + @JsonKey(name: "diary_reminder_notifications") + required this.diaryReminderNotifications, + @JsonKey(name: "is_mood_fillable") required this.isMoodFillable, + @JsonKey(name: "is_bedtime_fillable") required this.isBedtimeFillable, + @JsonKey(name: "is_public_profile") required this.isPublicProfile}); factory _$ProfileSettingsModelImpl.fromJson(Map json) => _$$ProfileSettingsModelImplFromJson(json); @@ -230,13 +208,9 @@ class _$ProfileSettingsModelImpl implements _ProfileSettingsModel { (other.runtimeType == runtimeType && other is _$ProfileSettingsModelImpl && const DeepCollectionEquality().equals( - other.newUpdatesNotifications, - newUpdatesNotifications, - ) && + other.newUpdatesNotifications, newUpdatesNotifications) && const DeepCollectionEquality().equals( - other.diaryReminderNotifications, - diaryReminderNotifications, - ) && + other.diaryReminderNotifications, diaryReminderNotifications) && (identical(other.isMoodFillable, isMoodFillable) || other.isMoodFillable == isMoodFillable) && (identical(other.isBedtimeFillable, isBedtimeFillable) || @@ -248,13 +222,12 @@ class _$ProfileSettingsModelImpl implements _ProfileSettingsModel { @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(newUpdatesNotifications), - const DeepCollectionEquality().hash(diaryReminderNotifications), - isMoodFillable, - isBedtimeFillable, - isPublicProfile, - ); + runtimeType, + const DeepCollectionEquality().hash(newUpdatesNotifications), + const DeepCollectionEquality().hash(diaryReminderNotifications), + isMoodFillable, + isBedtimeFillable, + isPublicProfile); /// Create a copy of ProfileSettingsModel /// with the given fields replaced by the non-null parameter values. @@ -262,28 +235,29 @@ class _$ProfileSettingsModelImpl implements _ProfileSettingsModel { @override @pragma('vm:prefer-inline') _$$ProfileSettingsModelImplCopyWith<_$ProfileSettingsModelImpl> - get copyWith => - __$$ProfileSettingsModelImplCopyWithImpl<_$ProfileSettingsModelImpl>( - this, - _$identity, - ); + get copyWith => + __$$ProfileSettingsModelImplCopyWithImpl<_$ProfileSettingsModelImpl>( + this, _$identity); @override Map toJson() { - return _$$ProfileSettingsModelImplToJson(this); + return _$$ProfileSettingsModelImplToJson( + this, + ); } } abstract class _ProfileSettingsModel implements ProfileSettingsModel { - const factory _ProfileSettingsModel({ - @JsonKey(name: "new_updates_notifications") - required final dynamic newUpdatesNotifications, - @JsonKey(name: "diary_reminder_notifications") - required final dynamic diaryReminderNotifications, - @JsonKey(name: "is_mood_fillable") required final bool isMoodFillable, - @JsonKey(name: "is_bedtime_fillable") required final bool isBedtimeFillable, - @JsonKey(name: "is_public_profile") required final bool isPublicProfile, - }) = _$ProfileSettingsModelImpl; + const factory _ProfileSettingsModel( + {@JsonKey(name: "new_updates_notifications") + required final dynamic newUpdatesNotifications, + @JsonKey(name: "diary_reminder_notifications") + required final dynamic diaryReminderNotifications, + @JsonKey(name: "is_mood_fillable") required final bool isMoodFillable, + @JsonKey(name: "is_bedtime_fillable") + required final bool isBedtimeFillable, + @JsonKey(name: "is_public_profile") + required final bool isPublicProfile}) = _$ProfileSettingsModelImpl; factory _ProfileSettingsModel.fromJson(Map json) = _$ProfileSettingsModelImpl.fromJson; @@ -309,5 +283,5 @@ abstract class _ProfileSettingsModel implements ProfileSettingsModel { @override @JsonKey(includeFromJson: false, includeToJson: false) _$$ProfileSettingsModelImplCopyWith<_$ProfileSettingsModelImpl> - get copyWith => throw _privateConstructorUsedError; + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/settings/models/profile_settings_model.g.dart b/lib/features/settings/models/profile_settings_model.g.dart index c6ee5ede..d7a7e6eb 100644 --- a/lib/features/settings/models/profile_settings_model.g.dart +++ b/lib/features/settings/models/profile_settings_model.g.dart @@ -7,21 +7,21 @@ part of 'profile_settings_model.dart'; // ************************************************************************** _$ProfileSettingsModelImpl _$$ProfileSettingsModelImplFromJson( - Map json, -) => _$ProfileSettingsModelImpl( - newUpdatesNotifications: json['new_updates_notifications'], - diaryReminderNotifications: json['diary_reminder_notifications'], - isMoodFillable: json['is_mood_fillable'] as bool, - isBedtimeFillable: json['is_bedtime_fillable'] as bool, - isPublicProfile: json['is_public_profile'] as bool, -); + Map json) => + _$ProfileSettingsModelImpl( + newUpdatesNotifications: json['new_updates_notifications'], + diaryReminderNotifications: json['diary_reminder_notifications'], + isMoodFillable: json['is_mood_fillable'] as bool, + isBedtimeFillable: json['is_bedtime_fillable'] as bool, + isPublicProfile: json['is_public_profile'] as bool, + ); Map _$$ProfileSettingsModelImplToJson( - _$ProfileSettingsModelImpl instance, -) => { - 'new_updates_notifications': instance.newUpdatesNotifications, - 'diary_reminder_notifications': instance.diaryReminderNotifications, - 'is_mood_fillable': instance.isMoodFillable, - 'is_bedtime_fillable': instance.isBedtimeFillable, - 'is_public_profile': instance.isPublicProfile, -}; + _$ProfileSettingsModelImpl instance) => + { + 'new_updates_notifications': instance.newUpdatesNotifications, + 'diary_reminder_notifications': instance.diaryReminderNotifications, + 'is_mood_fillable': instance.isMoodFillable, + 'is_bedtime_fillable': instance.isBedtimeFillable, + 'is_public_profile': instance.isPublicProfile, + }; diff --git a/lib/features/settings/presentation/bloc/settings_cubit/settings_state.freezed.dart b/lib/features/settings/presentation/bloc/settings_cubit/settings_state.freezed.dart index 56f9946d..a812e217 100644 --- a/lib/features/settings/presentation/bloc/settings_cubit/settings_state.freezed.dart +++ b/lib/features/settings/presentation/bloc/settings_cubit/settings_state.freezed.dart @@ -12,8 +12,7 @@ part of 'settings_state.dart'; 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', -); + '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'); /// @nodoc mixin _$SettingsState { @@ -21,53 +20,49 @@ mixin _$SettingsState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - ) - loaded, + required TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile) + loaded, required TResult Function(String errorMessage) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult? Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult? Function(String errorMessage)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult map( TResult Function(_SettingsState value) $default, { required TResult Function(SettingsStateLoading value) loading, required TResult Function(SettingsStateLoaded value) loaded, required TResult Function(SettingsStateError value) error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( TResult? Function(_SettingsState value)? $default, { TResult? Function(SettingsStateLoading value)? loading, TResult? Function(SettingsStateLoaded value)? loaded, TResult? Function(SettingsStateError value)? error, - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap( TResult Function(_SettingsState value)? $default, { @@ -75,15 +70,15 @@ mixin _$SettingsState { TResult Function(SettingsStateLoaded value)? loaded, TResult Function(SettingsStateError value)? error, required TResult orElse(), - }) => throw _privateConstructorUsedError; + }) => + throw _privateConstructorUsedError; } /// @nodoc abstract class $SettingsStateCopyWith<$Res> { factory $SettingsStateCopyWith( - SettingsState value, - $Res Function(SettingsState) then, - ) = _$SettingsStateCopyWithImpl<$Res, SettingsState>; + SettingsState value, $Res Function(SettingsState) then) = + _$SettingsStateCopyWithImpl<$Res, SettingsState>; } /// @nodoc @@ -103,9 +98,8 @@ class _$SettingsStateCopyWithImpl<$Res, $Val extends SettingsState> /// @nodoc abstract class _$$SettingsStateImplCopyWith<$Res> { factory _$$SettingsStateImplCopyWith( - _$SettingsStateImpl value, - $Res Function(_$SettingsStateImpl) then, - ) = __$$SettingsStateImplCopyWithImpl<$Res>; + _$SettingsStateImpl value, $Res Function(_$SettingsStateImpl) then) = + __$$SettingsStateImplCopyWithImpl<$Res>; } /// @nodoc @@ -113,9 +107,8 @@ class __$$SettingsStateImplCopyWithImpl<$Res> extends _$SettingsStateCopyWithImpl<$Res, _$SettingsStateImpl> implements _$$SettingsStateImplCopyWith<$Res> { __$$SettingsStateImplCopyWithImpl( - _$SettingsStateImpl _value, - $Res Function(_$SettingsStateImpl) _then, - ) : super(_value, _then); + _$SettingsStateImpl _value, $Res Function(_$SettingsStateImpl) _then) + : super(_value, _then); /// Create a copy of SettingsState /// with the given fields replaced by the non-null parameter values. @@ -145,12 +138,9 @@ class _$SettingsStateImpl implements _SettingsState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - ) - loaded, + required TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile) + loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -161,12 +151,9 @@ class _$SettingsStateImpl implements _SettingsState { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult? Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -177,12 +164,9 @@ class _$SettingsStateImpl implements _SettingsState { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -236,20 +220,18 @@ abstract class _SettingsState implements SettingsState { /// @nodoc abstract class _$$SettingsStateLoadingImplCopyWith<$Res> { - factory _$$SettingsStateLoadingImplCopyWith( - _$SettingsStateLoadingImpl value, - $Res Function(_$SettingsStateLoadingImpl) then, - ) = __$$SettingsStateLoadingImplCopyWithImpl<$Res>; + factory _$$SettingsStateLoadingImplCopyWith(_$SettingsStateLoadingImpl value, + $Res Function(_$SettingsStateLoadingImpl) then) = + __$$SettingsStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc class __$$SettingsStateLoadingImplCopyWithImpl<$Res> extends _$SettingsStateCopyWithImpl<$Res, _$SettingsStateLoadingImpl> implements _$$SettingsStateLoadingImplCopyWith<$Res> { - __$$SettingsStateLoadingImplCopyWithImpl( - _$SettingsStateLoadingImpl _value, - $Res Function(_$SettingsStateLoadingImpl) _then, - ) : super(_value, _then); + __$$SettingsStateLoadingImplCopyWithImpl(_$SettingsStateLoadingImpl _value, + $Res Function(_$SettingsStateLoadingImpl) _then) + : super(_value, _then); /// Create a copy of SettingsState /// with the given fields replaced by the non-null parameter values. @@ -280,12 +262,9 @@ class _$SettingsStateLoadingImpl implements SettingsStateLoading { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - ) - loaded, + required TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile) + loaded, required TResult Function(String errorMessage) error, }) { return loading(); @@ -296,12 +275,9 @@ class _$SettingsStateLoadingImpl implements SettingsStateLoading { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult? Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult? Function(String errorMessage)? error, }) { return loading?.call(); @@ -312,12 +288,9 @@ class _$SettingsStateLoadingImpl implements SettingsStateLoading { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -371,16 +344,14 @@ abstract class SettingsStateLoading implements SettingsState { /// @nodoc abstract class _$$SettingsStateLoadedImplCopyWith<$Res> { - factory _$$SettingsStateLoadedImplCopyWith( - _$SettingsStateLoadedImpl value, - $Res Function(_$SettingsStateLoadedImpl) then, - ) = __$$SettingsStateLoadedImplCopyWithImpl<$Res>; + factory _$$SettingsStateLoadedImplCopyWith(_$SettingsStateLoadedImpl value, + $Res Function(_$SettingsStateLoadedImpl) then) = + __$$SettingsStateLoadedImplCopyWithImpl<$Res>; @useResult - $Res call({ - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - }); + $Res call( + {ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, + ProfileModel profile}); $ProfileSettingsModelCopyWith<$Res> get profileSettings; $ProfileDetailsModelCopyWith<$Res> get profileDetails; @@ -391,10 +362,9 @@ abstract class _$$SettingsStateLoadedImplCopyWith<$Res> { class __$$SettingsStateLoadedImplCopyWithImpl<$Res> extends _$SettingsStateCopyWithImpl<$Res, _$SettingsStateLoadedImpl> implements _$$SettingsStateLoadedImplCopyWith<$Res> { - __$$SettingsStateLoadedImplCopyWithImpl( - _$SettingsStateLoadedImpl _value, - $Res Function(_$SettingsStateLoadedImpl) _then, - ) : super(_value, _then); + __$$SettingsStateLoadedImplCopyWithImpl(_$SettingsStateLoadedImpl _value, + $Res Function(_$SettingsStateLoadedImpl) _then) + : super(_value, _then); /// Create a copy of SettingsState /// with the given fields replaced by the non-null parameter values. @@ -405,25 +375,20 @@ class __$$SettingsStateLoadedImplCopyWithImpl<$Res> Object? profileDetails = null, Object? profile = null, }) { - return _then( - _$SettingsStateLoadedImpl( - profileSettings: - null == profileSettings - ? _value.profileSettings - : profileSettings // ignore: cast_nullable_to_non_nullable - as ProfileSettingsModel, - profileDetails: - null == profileDetails - ? _value.profileDetails - : profileDetails // ignore: cast_nullable_to_non_nullable - as ProfileDetailsModel, - profile: - null == profile - ? _value.profile - : profile // ignore: cast_nullable_to_non_nullable - as ProfileModel, - ), - ); + return _then(_$SettingsStateLoadedImpl( + profileSettings: null == profileSettings + ? _value.profileSettings + : profileSettings // ignore: cast_nullable_to_non_nullable + as ProfileSettingsModel, + profileDetails: null == profileDetails + ? _value.profileDetails + : profileDetails // ignore: cast_nullable_to_non_nullable + as ProfileDetailsModel, + profile: null == profile + ? _value.profile + : profile // ignore: cast_nullable_to_non_nullable + as ProfileModel, + )); } /// Create a copy of SettingsState @@ -460,11 +425,10 @@ class __$$SettingsStateLoadedImplCopyWithImpl<$Res> /// @nodoc class _$SettingsStateLoadedImpl implements SettingsStateLoaded { - const _$SettingsStateLoadedImpl({ - required this.profileSettings, - required this.profileDetails, - required this.profile, - }); + const _$SettingsStateLoadedImpl( + {required this.profileSettings, + required this.profileDetails, + required this.profile}); @override final ProfileSettingsModel profileSettings; @@ -501,21 +465,16 @@ class _$SettingsStateLoadedImpl implements SettingsStateLoaded { @pragma('vm:prefer-inline') _$$SettingsStateLoadedImplCopyWith<_$SettingsStateLoadedImpl> get copyWith => __$$SettingsStateLoadedImplCopyWithImpl<_$SettingsStateLoadedImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - ) - loaded, + required TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile) + loaded, required TResult Function(String errorMessage) error, }) { return loaded(profileSettings, profileDetails, profile); @@ -526,12 +485,9 @@ class _$SettingsStateLoadedImpl implements SettingsStateLoaded { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult? Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult? Function(String errorMessage)? error, }) { return loaded?.call(profileSettings, profileDetails, profile); @@ -542,12 +498,9 @@ class _$SettingsStateLoadedImpl implements SettingsStateLoaded { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -596,11 +549,10 @@ class _$SettingsStateLoadedImpl implements SettingsStateLoaded { } abstract class SettingsStateLoaded implements SettingsState { - const factory SettingsStateLoaded({ - required final ProfileSettingsModel profileSettings, - required final ProfileDetailsModel profileDetails, - required final ProfileModel profile, - }) = _$SettingsStateLoadedImpl; + const factory SettingsStateLoaded( + {required final ProfileSettingsModel profileSettings, + required final ProfileDetailsModel profileDetails, + required final ProfileModel profile}) = _$SettingsStateLoadedImpl; ProfileSettingsModel get profileSettings; ProfileDetailsModel get profileDetails; @@ -615,10 +567,9 @@ abstract class SettingsStateLoaded implements SettingsState { /// @nodoc abstract class _$$SettingsStateErrorImplCopyWith<$Res> { - factory _$$SettingsStateErrorImplCopyWith( - _$SettingsStateErrorImpl value, - $Res Function(_$SettingsStateErrorImpl) then, - ) = __$$SettingsStateErrorImplCopyWithImpl<$Res>; + factory _$$SettingsStateErrorImplCopyWith(_$SettingsStateErrorImpl value, + $Res Function(_$SettingsStateErrorImpl) then) = + __$$SettingsStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } @@ -627,25 +578,23 @@ abstract class _$$SettingsStateErrorImplCopyWith<$Res> { class __$$SettingsStateErrorImplCopyWithImpl<$Res> extends _$SettingsStateCopyWithImpl<$Res, _$SettingsStateErrorImpl> implements _$$SettingsStateErrorImplCopyWith<$Res> { - __$$SettingsStateErrorImplCopyWithImpl( - _$SettingsStateErrorImpl _value, - $Res Function(_$SettingsStateErrorImpl) _then, - ) : super(_value, _then); + __$$SettingsStateErrorImplCopyWithImpl(_$SettingsStateErrorImpl _value, + $Res Function(_$SettingsStateErrorImpl) _then) + : super(_value, _then); /// Create a copy of SettingsState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? errorMessage = null}) { - return _then( - _$SettingsStateErrorImpl( - errorMessage: - null == errorMessage - ? _value.errorMessage - : errorMessage // ignore: cast_nullable_to_non_nullable - as String, - ), - ); + $Res call({ + Object? errorMessage = null, + }) { + return _then(_$SettingsStateErrorImpl( + errorMessage: null == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String, + )); } } @@ -681,21 +630,16 @@ class _$SettingsStateErrorImpl implements SettingsStateError { @pragma('vm:prefer-inline') _$$SettingsStateErrorImplCopyWith<_$SettingsStateErrorImpl> get copyWith => __$$SettingsStateErrorImplCopyWithImpl<_$SettingsStateErrorImpl>( - this, - _$identity, - ); + this, _$identity); @override @optionalTypeArgs TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - ) - loaded, + required TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile) + loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -706,12 +650,9 @@ class _$SettingsStateErrorImpl implements SettingsStateError { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult? Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -722,12 +663,9 @@ class _$SettingsStateErrorImpl implements SettingsStateError { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function( - ProfileSettingsModel profileSettings, - ProfileDetailsModel profileDetails, - ProfileModel profile, - )? - loaded, + TResult Function(ProfileSettingsModel profileSettings, + ProfileDetailsModel profileDetails, ProfileModel profile)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { diff --git a/lib/features/settings/presentation/pages/change_email_screen.dart b/lib/features/settings/presentation/pages/change_email_screen.dart index b2637bb9..a71ef272 100644 --- a/lib/features/settings/presentation/pages/change_email_screen.dart +++ b/lib/features/settings/presentation/pages/change_email_screen.dart @@ -18,9 +18,9 @@ class _ChangeEmailScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Смена Email-a'), + title: const Text('Смена Email-a'), ), - body: Center( + body: const Center( child: Text('Coming soon...'), ), ); diff --git a/lib/features/settings/presentation/pages/change_password_screen.dart b/lib/features/settings/presentation/pages/change_password_screen.dart index b67df070..a226ed81 100644 --- a/lib/features/settings/presentation/pages/change_password_screen.dart +++ b/lib/features/settings/presentation/pages/change_password_screen.dart @@ -18,9 +18,9 @@ class _ChangePasswordScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Смена пароля'), + title: const Text('Смена пароля'), ), - body: Center( + body: const Center( child: Text('Coming soon...'), ), ); diff --git a/lib/features/settings/presentation/pages/general_info_screen.dart b/lib/features/settings/presentation/pages/general_info_screen.dart index df43e5b7..9e12ee19 100644 --- a/lib/features/settings/presentation/pages/general_info_screen.dart +++ b/lib/features/settings/presentation/pages/general_info_screen.dart @@ -33,13 +33,13 @@ class _GeneralInfoScreenState extends State { late SelectionPopupModel isPublicProfile; final List genderSelectionPopupList = [ - SelectionPopupModel(id: 0, title: 'Женский', value: 'female'), - SelectionPopupModel(id: 1, title: 'Мужской', value: 'male'), + const SelectionPopupModel(id: 0, title: 'Женский', value: 'female'), + const SelectionPopupModel(id: 1, title: 'Мужской', value: 'male'), ]; final List isPublicProfileSelectionPopupList = [ - SelectionPopupModel(id: 0, title: 'Только зарегистрированным', value: false), - SelectionPopupModel(id: 1, title: 'Всем', value: true), + const SelectionPopupModel(id: 0, title: 'Только зарегистрированным', value: false), + const SelectionPopupModel(id: 1, title: 'Всем', value: true), ]; @override @@ -63,49 +63,49 @@ class _GeneralInfoScreenState extends State { return Scaffold( appBar: AppBar( - title: Text('Общая информация'), + title: const Text('Общая информация'), ), bottomSheet: _saveButton(), body: SingleChildScrollView( physics: const BouncingScrollPhysics(), - padding: EdgeInsets.all(16) + EdgeInsets.only(bottom: 64), + padding: const EdgeInsets.all(16) + const EdgeInsets.only(bottom: 64), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.first_name), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: firstNameController, hintText: 'Введите имя', onChanged: (newValue) {}, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.last_name), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: lastNameController, hintText: 'Введите фамилию', onChanged: (newValue) {}, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.date_of_birth), - SizedBox(height: 4), + const SizedBox(height: 4), ListTile( onTap: onTapCalendar(context), trailing: Icon( Icons.keyboard_arrow_down_rounded, color: Colors.grey.shade700, ), - contentPadding: EdgeInsets.symmetric(horizontal: 12), + contentPadding: const EdgeInsets.symmetric(horizontal: 12), title: Text(selectedDate.format('dd MMMM yyyy', 'ru')), - tileColor: Color(0xFFF6F6F6), + tileColor: const Color(0xFFF6F6F6), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), ), - SizedBox(height: 16), - Text('Пол'), - SizedBox(height: 4), + const SizedBox(height: 16), + const Text('Пол'), + const SizedBox(height: 4), CustomDropDown( items: genderSelectionPopupList, value: gender, @@ -115,27 +115,27 @@ class _GeneralInfoScreenState extends State { }); }, ), - SizedBox(height: 16), - Text('Страна'), - SizedBox(height: 4), + const SizedBox(height: 16), + const Text('Страна'), + const SizedBox(height: 4), CustomTextFormField( controller: countryController, ), - SizedBox(height: 16), - Text('Город'), - SizedBox(height: 4), + const SizedBox(height: 16), + const Text('Город'), + const SizedBox(height: 4), CustomTextFormField( controller: cityController, ), - SizedBox(height: 16), - Text('Предпочтительный язык общения'), - SizedBox(height: 4), + const SizedBox(height: 16), + const Text('Предпочтительный язык общения'), + const SizedBox(height: 4), CustomTextFormField( controller: languageController, ), - SizedBox(height: 16), - Text('Показывать анкету'), - SizedBox(height: 4), + const SizedBox(height: 16), + const Text('Показывать анкету'), + const SizedBox(height: 4), CustomDropDown( items: isPublicProfileSelectionPopupList, value: isPublicProfile, @@ -216,7 +216,7 @@ class _GeneralInfoScreenState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( diff --git a/lib/features/settings/presentation/pages/other_info_screen.dart b/lib/features/settings/presentation/pages/other_info_screen.dart index c322aacf..555eb97e 100644 --- a/lib/features/settings/presentation/pages/other_info_screen.dart +++ b/lib/features/settings/presentation/pages/other_info_screen.dart @@ -43,16 +43,16 @@ class _OtherInfoScreenState extends State { return Scaffold( appBar: AppBar( - title: Text('Прочая информаиця'), + title: const Text('Прочая информаиця'), ), bottomSheet: _saveButton(), body: SingleChildScrollView( - padding: EdgeInsets.all(16) + EdgeInsets.only(bottom: 64), + padding: const EdgeInsets.all(16) + const EdgeInsets.only(bottom: 64), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.allergies_presence), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: aboutAllergyController, hintText: 'Например: орехи, мёд и т.д.', @@ -62,9 +62,9 @@ class _OtherInfoScreenState extends State { maxLength: 250, onChanged: (newValue) {}, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.do_you_take_pills), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: aboutTakingPillsController, hintText: s.enter_information, @@ -74,9 +74,9 @@ class _OtherInfoScreenState extends State { maxLines: 8, onChanged: (newValue) {}, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.your_favorite_sports), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: aboutSportHobbiesController, hintText: @@ -86,9 +86,9 @@ class _OtherInfoScreenState extends State { maxLength: 250, onChanged: (newValue) {}, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.favorite_foods), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: favoriteFoodsController, hintText: s.enter_information, @@ -97,9 +97,9 @@ class _OtherInfoScreenState extends State { maxLength: 250, onChanged: (newValue) {}, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.unfavorite_foods), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: unFavouriteFoodsController, hintText: s.enter_information, @@ -108,14 +108,14 @@ class _OtherInfoScreenState extends State { maxLength: 250, onChanged: (newValue) {}, ), - SizedBox(height: 16), - Text( + const SizedBox(height: 16), + const Text( 'Дополнительная информация', maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.start, ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: additionalInfoController, maxLength: 250, @@ -152,7 +152,7 @@ class _OtherInfoScreenState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( diff --git a/lib/features/settings/presentation/pages/physical_activity_screen.dart b/lib/features/settings/presentation/pages/physical_activity_screen.dart index 0f1bfb5b..c3ef542f 100644 --- a/lib/features/settings/presentation/pages/physical_activity_screen.dart +++ b/lib/features/settings/presentation/pages/physical_activity_screen.dart @@ -47,7 +47,7 @@ class _PhysicalActivityScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Физическая нагрузка'), + title: const Text('Физическая нагрузка'), ), bottomSheet: _saveButton(), body: SingleChildScrollView( @@ -56,7 +56,7 @@ class _PhysicalActivityScreenState extends State { child: Column( children: [ RadioListTile( - contentPadding: EdgeInsets.only(left: 8, right: 16), + contentPadding: const EdgeInsets.only(left: 8, right: 16), title: const Text('1,2 — минимальный (сидячая работа, отсутствие физических нагрузок);'), value: PhysicalActivity.minimum, groupValue: _physicalActivity, @@ -67,7 +67,7 @@ class _PhysicalActivityScreenState extends State { }, ), RadioListTile( - contentPadding: EdgeInsets.only(left: 8, right: 16), + contentPadding: const EdgeInsets.only(left: 8, right: 16), title: const Text('1,375 — низкий (тренировки не менее 20 мин 1–3 раза в неделю);'), value: PhysicalActivity.low, groupValue: _physicalActivity, @@ -78,7 +78,7 @@ class _PhysicalActivityScreenState extends State { }, ), RadioListTile( - contentPadding: EdgeInsets.only(left: 8, right: 16), + contentPadding: const EdgeInsets.only(left: 8, right: 16), title: const Text('1,55 — умеренный (тренировки 30–60 мин 3–4 раза в неделю);'), value: PhysicalActivity.medium, groupValue: _physicalActivity, @@ -89,7 +89,7 @@ class _PhysicalActivityScreenState extends State { }, ), RadioListTile( - contentPadding: EdgeInsets.only(left: 8, right: 16), + contentPadding: const EdgeInsets.only(left: 8, right: 16), title: const Text('1,7 — высокий (тренировки 30–60 мин 5–7 раза в неделю; тяжёлая физическая работа);'), value: PhysicalActivity.high, groupValue: _physicalActivity, @@ -100,7 +100,7 @@ class _PhysicalActivityScreenState extends State { }, ), RadioListTile( - contentPadding: EdgeInsets.only(left: 8, right: 16), + contentPadding: const EdgeInsets.only(left: 8, right: 16), title: const Text('1,9 — экстремальный (несколько интенсивных тренировок в день'), value: PhysicalActivity.extreme, groupValue: _physicalActivity, @@ -154,7 +154,7 @@ class _PhysicalActivityScreenState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( diff --git a/lib/features/settings/presentation/pages/physical_form_screen.dart b/lib/features/settings/presentation/pages/physical_form_screen.dart index 2b2aa24d..8574d222 100644 --- a/lib/features/settings/presentation/pages/physical_form_screen.dart +++ b/lib/features/settings/presentation/pages/physical_form_screen.dart @@ -43,51 +43,51 @@ class _PhysicalFormScreenState extends State { return Scaffold( appBar: AppBar( - title: Text('Физическая форма'), + title: const Text('Физическая форма'), ), bottomSheet: _saveButton(), body: SingleChildScrollView( physics: const BouncingScrollPhysics(), - padding: EdgeInsets.all(16) + EdgeInsets.only(bottom: 64), + padding: const EdgeInsets.all(16) + const EdgeInsets.only(bottom: 64), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.chest_circumference), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], controller: chestCircumferenceController, hintText: 'см', ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.waist_circumference), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], controller: waistCircumferenceController, hintText: 'см', ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.hip_circumference), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], controller: hipCircumferenceController, hintText: 'см', textInputAction: TextInputAction.done, ), - SizedBox(height: 16), - Text('Рост'), - SizedBox(height: 4), + const SizedBox(height: 16), + const Text('Рост'), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], controller: heightController, hintText: 'см', textInputAction: TextInputAction.done, ), - SizedBox(height: 16), - Text('Вес'), - SizedBox(height: 4), + const SizedBox(height: 16), + const Text('Вес'), + const SizedBox(height: 4), CustomTextFormField( inputFormatters: [digitsOnly], controller: weightController, @@ -122,7 +122,7 @@ class _PhysicalFormScreenState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( diff --git a/lib/features/settings/presentation/pages/pressure_screen.dart b/lib/features/settings/presentation/pages/pressure_screen.dart index e71642fe..1a155dcb 100644 --- a/lib/features/settings/presentation/pages/pressure_screen.dart +++ b/lib/features/settings/presentation/pages/pressure_screen.dart @@ -38,8 +38,8 @@ class _PressureScreenState extends State { } final List selectionPopupList = [ - SelectionPopupModel(id: 0, title: 'Нет', value: false), - SelectionPopupModel(id: 1, title: 'Да', value: true), + const SelectionPopupModel(id: 0, title: 'Нет', value: false), + const SelectionPopupModel(id: 1, title: 'Да', value: true), ]; @override @@ -48,35 +48,35 @@ class _PressureScreenState extends State { return Scaffold( appBar: AppBar( - title: Text('Давление'), + title: const Text('Давление'), ), bottomSheet: _saveButton(), body: SingleChildScrollView( physics: const BouncingScrollPhysics(), - padding: EdgeInsets.all(16) + EdgeInsets.only(bottom: 64), + padding: const EdgeInsets.all(16) + const EdgeInsets.only(bottom: 64), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.up_pressure), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: bloodPressureUpController, inputFormatters: [digitsOnly], hintText: "90", onChanged: (newValue) {}, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.down_pressure), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( controller: bloodPressureDownController, inputFormatters: [digitsOnly], hintText: '90', onChanged: (newValue) {}, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.do_you_have_hypotension_tendency), - SizedBox(height: 4), + const SizedBox(height: 4), CustomDropDown( items: selectionPopupList, value: hypo, @@ -87,9 +87,9 @@ class _PressureScreenState extends State { }); }, ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(s.do_you_have_hypertension_tendency), - SizedBox(height: 4), + const SizedBox(height: 4), CustomDropDown( items: selectionPopupList, value: hyper, @@ -127,7 +127,7 @@ class _PressureScreenState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Сохранить', style: TextStyle( diff --git a/lib/features/settings/presentation/pages/settings_screen.dart b/lib/features/settings/presentation/pages/settings_screen.dart index 00ce51c0..c7f97d39 100644 --- a/lib/features/settings/presentation/pages/settings_screen.dart +++ b/lib/features/settings/presentation/pages/settings_screen.dart @@ -44,10 +44,10 @@ class _SettingsScreenState extends State { if (state is SettingsStateLoaded) { return Scaffold( appBar: AppBar( - title: Text('Настройки'), + title: const Text('Настройки'), ), body: SingleChildScrollView( - padding: EdgeInsets.symmetric(vertical: 16), + padding: const EdgeInsets.symmetric(vertical: 16), physics: const BouncingScrollPhysics(), child: Column( children: [ @@ -71,16 +71,16 @@ class _SettingsScreenState extends State { if (state is SettingsStateError) { return Scaffold( appBar: AppBar( - title: Text('Настройки'), + title: const Text('Настройки'), ), body: DataErrorWidget(onReload: () => settingsCubit.init()), ); } return Scaffold( appBar: AppBar( - title: Text('Настройки'), + title: const Text('Настройки'), ), - body: Loader(), + body: const Loader(), ); }, ), @@ -91,8 +91,8 @@ class _SettingsScreenState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), child: Text( 'Дополнительаная информация', style: TextStyle( @@ -194,8 +194,8 @@ class _SettingsScreenState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), child: Text( 'Уведомления', style: TextStyle( @@ -206,7 +206,7 @@ class _SettingsScreenState extends State { ), ), _tile( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), onTap: () { setState(() { updatesNotificationsSwitchState = !updatesNotificationsSwitchState; @@ -235,7 +235,7 @@ class _SettingsScreenState extends State { ), _divider(context), _tile( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), onTap: () { setState(() { fillDiaryNotificationsSwitchState = !fillDiaryNotificationsSwitchState; @@ -264,7 +264,7 @@ class _SettingsScreenState extends State { ), _divider(context), _tile( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), onTap: () { setState(() { moodSwitchState = !moodSwitchState; @@ -293,7 +293,7 @@ class _SettingsScreenState extends State { ), _divider(context), _tile( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), onTap: () { setState(() { bedTimeSwitchState = !bedTimeSwitchState; @@ -328,8 +328,8 @@ class _SettingsScreenState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), child: Text( 'О Eatvio', style: TextStyle( @@ -341,12 +341,12 @@ class _SettingsScreenState extends State { ), _tile( title: 'О компании', - onTap: () async => await launchUrl(Uri.parse(baseUrl + '/ru/company-details')), + onTap: () async => await launchUrl(Uri.parse('$baseUrl/ru/company-details')), ), _divider(context), _tile( title: 'Пользовательское соглашение', - onTap: () async => await launchUrl(Uri.parse(baseUrl + '/oferta_bs.pdf')), + onTap: () async => await launchUrl(Uri.parse('$baseUrl/oferta_bs.pdf')), ), ], ); @@ -354,7 +354,7 @@ class _SettingsScreenState extends State { _becomeConsultantButton(SettingsStateLoaded state) { return Padding( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), child: InkWell( onTap: () => GoRouter.of(context).pushNamed('becomeConsultantScreen'), borderRadius: BorderRadius.circular(20), @@ -365,7 +365,7 @@ class _SettingsScreenState extends State { borderRadius: BorderRadius.circular(20), color: appTheme.blueA400, ), - child: Center( + child: const Center( child: Text( 'Стать консультантом', style: TextStyle( @@ -382,7 +382,7 @@ class _SettingsScreenState extends State { _deleteAccountButton(SettingsStateLoaded state) { return Padding( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), child: InkWell( onTap: () {}, borderRadius: BorderRadius.circular(20), @@ -391,9 +391,9 @@ class _SettingsScreenState extends State { width: MediaQuery.of(context).size.width - 16, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - color: Color(0xFFEAEAEA), + color: const Color(0xFFEAEAEA), ), - child: Center( + child: const Center( child: Text( 'Удалить аккаунт', style: TextStyle( @@ -419,14 +419,14 @@ class _SettingsScreenState extends State { onTap: onTap, title: Text( title, - style: TextStyle( + style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w500, height: 1, ), ), trailing: trailing ?? - Icon( + const Icon( Icons.arrow_forward_ios_rounded, size: 12, color: Colors.black38, diff --git a/lib/features/support/presentation/pages/support_screen.dart b/lib/features/support/presentation/pages/support_screen.dart index dcac5568..a5a298e2 100644 --- a/lib/features/support/presentation/pages/support_screen.dart +++ b/lib/features/support/presentation/pages/support_screen.dart @@ -9,12 +9,12 @@ class SupportScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Поддержка'), + title: const Text('Поддержка'), ), body: Column( children: [ - Padding( - padding: const EdgeInsets.all(16), + const Padding( + padding: EdgeInsets.all(16), child: Text( 'Если у вас есть вопросы по работе нашего приложения, вы можете задать их, перейдя по ссылке:', style: TextStyle( @@ -40,10 +40,10 @@ class SupportScreen extends StatelessWidget { children: [ SvgPicture.asset( 'assets/icons/telegram.svg', - colorFilter: ColorFilter.mode(Colors.black, BlendMode.srcIn), + colorFilter: const ColorFilter.mode(Colors.black, BlendMode.srcIn), ), const SizedBox(width: 12), - Text( + const Text( 'Telegram', style: TextStyle( fontSize: 16, @@ -68,10 +68,10 @@ class SupportScreen extends StatelessWidget { ), width: double.infinity, padding: const EdgeInsets.all(16), - child: Row( + child: const Row( children: [ Icon(Icons.alternate_email_rounded), - const SizedBox(width: 12), + SizedBox(width: 12), Text( 'E-mail', style: TextStyle( diff --git a/lib/features/user_details/presentation/cubit/user_details_state.freezed.dart b/lib/features/user_details/presentation/cubit/user_details_state.freezed.dart index 67ba4353..5cad9acb 100644 --- a/lib/features/user_details/presentation/cubit/user_details_state.freezed.dart +++ b/lib/features/user_details/presentation/cubit/user_details_state.freezed.dart @@ -12,8 +12,7 @@ part of 'user_details_state.dart'; 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', -); + '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'); /// @nodoc mixin _$UserDetailsState { @@ -34,17 +33,15 @@ mixin _$UserDetailsState { /// @nodoc abstract class $UserDetailsStateCopyWith<$Res> { factory $UserDetailsStateCopyWith( - UserDetailsState value, - $Res Function(UserDetailsState) then, - ) = _$UserDetailsStateCopyWithImpl<$Res, UserDetailsState>; + UserDetailsState value, $Res Function(UserDetailsState) then) = + _$UserDetailsStateCopyWithImpl<$Res, UserDetailsState>; @useResult - $Res call({ - bool isLoading, - String? error, - ProfileDetailsModel? profileDetails, - List? weightPoints, - List? circumferencePoints, - }); + $Res call( + {bool isLoading, + String? error, + ProfileDetailsModel? profileDetails, + List? weightPoints, + List? circumferencePoints}); $ProfileDetailsModelCopyWith<$Res>? get profileDetails; } @@ -70,36 +67,28 @@ class _$UserDetailsStateCopyWithImpl<$Res, $Val extends UserDetailsState> Object? weightPoints = freezed, Object? circumferencePoints = freezed, }) { - return _then( - _value.copyWith( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - profileDetails: - freezed == profileDetails - ? _value.profileDetails - : profileDetails // ignore: cast_nullable_to_non_nullable - as ProfileDetailsModel?, - weightPoints: - freezed == weightPoints - ? _value.weightPoints - : weightPoints // ignore: cast_nullable_to_non_nullable - as List?, - circumferencePoints: - freezed == circumferencePoints - ? _value.circumferencePoints - : circumferencePoints // ignore: cast_nullable_to_non_nullable - as List?, - ) - as $Val, - ); + return _then(_value.copyWith( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + profileDetails: freezed == profileDetails + ? _value.profileDetails + : profileDetails // ignore: cast_nullable_to_non_nullable + as ProfileDetailsModel?, + weightPoints: freezed == weightPoints + ? _value.weightPoints + : weightPoints // ignore: cast_nullable_to_non_nullable + as List?, + circumferencePoints: freezed == circumferencePoints + ? _value.circumferencePoints + : circumferencePoints // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); } /// Create a copy of UserDetailsState @@ -120,19 +109,17 @@ class _$UserDetailsStateCopyWithImpl<$Res, $Val extends UserDetailsState> /// @nodoc abstract class _$$UserDetailsStateImplCopyWith<$Res> implements $UserDetailsStateCopyWith<$Res> { - factory _$$UserDetailsStateImplCopyWith( - _$UserDetailsStateImpl value, - $Res Function(_$UserDetailsStateImpl) then, - ) = __$$UserDetailsStateImplCopyWithImpl<$Res>; + factory _$$UserDetailsStateImplCopyWith(_$UserDetailsStateImpl value, + $Res Function(_$UserDetailsStateImpl) then) = + __$$UserDetailsStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - bool isLoading, - String? error, - ProfileDetailsModel? profileDetails, - List? weightPoints, - List? circumferencePoints, - }); + $Res call( + {bool isLoading, + String? error, + ProfileDetailsModel? profileDetails, + List? weightPoints, + List? circumferencePoints}); @override $ProfileDetailsModelCopyWith<$Res>? get profileDetails; @@ -142,10 +129,9 @@ abstract class _$$UserDetailsStateImplCopyWith<$Res> class __$$UserDetailsStateImplCopyWithImpl<$Res> extends _$UserDetailsStateCopyWithImpl<$Res, _$UserDetailsStateImpl> implements _$$UserDetailsStateImplCopyWith<$Res> { - __$$UserDetailsStateImplCopyWithImpl( - _$UserDetailsStateImpl _value, - $Res Function(_$UserDetailsStateImpl) _then, - ) : super(_value, _then); + __$$UserDetailsStateImplCopyWithImpl(_$UserDetailsStateImpl _value, + $Res Function(_$UserDetailsStateImpl) _then) + : super(_value, _then); /// Create a copy of UserDetailsState /// with the given fields replaced by the non-null parameter values. @@ -158,49 +144,42 @@ class __$$UserDetailsStateImplCopyWithImpl<$Res> Object? weightPoints = freezed, Object? circumferencePoints = freezed, }) { - return _then( - _$UserDetailsStateImpl( - isLoading: - null == isLoading - ? _value.isLoading - : isLoading // ignore: cast_nullable_to_non_nullable - as bool, - error: - freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as String?, - profileDetails: - freezed == profileDetails - ? _value.profileDetails - : profileDetails // ignore: cast_nullable_to_non_nullable - as ProfileDetailsModel?, - weightPoints: - freezed == weightPoints - ? _value._weightPoints - : weightPoints // ignore: cast_nullable_to_non_nullable - as List?, - circumferencePoints: - freezed == circumferencePoints - ? _value._circumferencePoints - : circumferencePoints // ignore: cast_nullable_to_non_nullable - as List?, - ), - ); + return _then(_$UserDetailsStateImpl( + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + profileDetails: freezed == profileDetails + ? _value.profileDetails + : profileDetails // ignore: cast_nullable_to_non_nullable + as ProfileDetailsModel?, + weightPoints: freezed == weightPoints + ? _value._weightPoints + : weightPoints // ignore: cast_nullable_to_non_nullable + as List?, + circumferencePoints: freezed == circumferencePoints + ? _value._circumferencePoints + : circumferencePoints // ignore: cast_nullable_to_non_nullable + as List?, + )); } } /// @nodoc class _$UserDetailsStateImpl implements _UserDetailsState { - _$UserDetailsStateImpl({ - this.isLoading = false, - this.error, - this.profileDetails, - final List? weightPoints, - final List? circumferencePoints, - }) : _weightPoints = weightPoints, - _circumferencePoints = circumferencePoints; + _$UserDetailsStateImpl( + {this.isLoading = false, + this.error, + this.profileDetails, + final List? weightPoints, + final List? circumferencePoints}) + : _weightPoints = weightPoints, + _circumferencePoints = circumferencePoints; @override @JsonKey() @@ -245,25 +224,20 @@ class _$UserDetailsStateImpl implements _UserDetailsState { (identical(other.error, error) || other.error == error) && (identical(other.profileDetails, profileDetails) || other.profileDetails == profileDetails) && - const DeepCollectionEquality().equals( - other._weightPoints, - _weightPoints, - ) && - const DeepCollectionEquality().equals( - other._circumferencePoints, - _circumferencePoints, - )); + const DeepCollectionEquality() + .equals(other._weightPoints, _weightPoints) && + const DeepCollectionEquality() + .equals(other._circumferencePoints, _circumferencePoints)); } @override int get hashCode => Object.hash( - runtimeType, - isLoading, - error, - profileDetails, - const DeepCollectionEquality().hash(_weightPoints), - const DeepCollectionEquality().hash(_circumferencePoints), - ); + runtimeType, + isLoading, + error, + profileDetails, + const DeepCollectionEquality().hash(_weightPoints), + const DeepCollectionEquality().hash(_circumferencePoints)); /// Create a copy of UserDetailsState /// with the given fields replaced by the non-null parameter values. @@ -272,19 +246,17 @@ class _$UserDetailsStateImpl implements _UserDetailsState { @pragma('vm:prefer-inline') _$$UserDetailsStateImplCopyWith<_$UserDetailsStateImpl> get copyWith => __$$UserDetailsStateImplCopyWithImpl<_$UserDetailsStateImpl>( - this, - _$identity, - ); + this, _$identity); } abstract class _UserDetailsState implements UserDetailsState { - factory _UserDetailsState({ - final bool isLoading, - final String? error, - final ProfileDetailsModel? profileDetails, - final List? weightPoints, - final List? circumferencePoints, - }) = _$UserDetailsStateImpl; + factory _UserDetailsState( + {final bool isLoading, + final String? error, + final ProfileDetailsModel? profileDetails, + final List? weightPoints, + final List? circumferencePoints}) = + _$UserDetailsStateImpl; @override bool get isLoading; diff --git a/lib/features/user_details/presentation/user_details_screen.dart b/lib/features/user_details/presentation/user_details_screen.dart index 49f90f1f..e13b3c7a 100644 --- a/lib/features/user_details/presentation/user_details_screen.dart +++ b/lib/features/user_details/presentation/user_details_screen.dart @@ -84,7 +84,7 @@ class _UserDetailsContentState extends State { complainedContentType: ComplainedContent.profile, slug: widget.slug, ), - anchor: Aligned( + anchor: const Aligned( shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight, @@ -108,15 +108,17 @@ class _UserDetailsContentState extends State { child: SingleChildScrollView( controller: ScrollController() ..addListener(() { - setState(() { - isMoreOptionsVisible = false; - }); + if (isMoreOptionsVisible) { + setState(() { + isMoreOptionsVisible = false; + }); + } }), child: Column( mainAxisAlignment: MainAxisAlignment.start, spacing: 12, children: [ - SizedBox.shrink(), + const SizedBox.shrink(), _charts(), ExpandableBouble( initiallyExpanded: true, @@ -126,22 +128,22 @@ class _UserDetailsContentState extends State { s.date_of_birth, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: DateTime.parse(profileDetails.birthdate).format('dd.MM.yyyy')), ), - SizedBox(height: 16), + const SizedBox(height: 16), Text( s.sex, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.gender.parseGender()), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ExpandableBouble( @@ -157,7 +159,7 @@ class _UserDetailsContentState extends State { s.height, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.height.toString()), @@ -165,7 +167,7 @@ class _UserDetailsContentState extends State { ], ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -174,7 +176,7 @@ class _UserDetailsContentState extends State { s.weight, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.weight.toStringAsFixed(0)), @@ -184,7 +186,7 @@ class _UserDetailsContentState extends State { ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Row( children: [ Expanded( @@ -195,7 +197,7 @@ class _UserDetailsContentState extends State { s.chest_circumference, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.chestCircumference.toString()), @@ -203,7 +205,7 @@ class _UserDetailsContentState extends State { ], ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -212,7 +214,7 @@ class _UserDetailsContentState extends State { s.waist_circumference, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.waistCircumference.toString()), @@ -220,7 +222,7 @@ class _UserDetailsContentState extends State { ], ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -229,7 +231,7 @@ class _UserDetailsContentState extends State { s.hip_circumference, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.hipCircumference.toString()), @@ -239,7 +241,7 @@ class _UserDetailsContentState extends State { ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ExpandableBouble( @@ -255,7 +257,7 @@ class _UserDetailsContentState extends State { s.upper, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.bloodPressureUp.toString()), @@ -263,7 +265,7 @@ class _UserDetailsContentState extends State { ], ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -272,7 +274,7 @@ class _UserDetailsContentState extends State { s.lower, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.bloodPressureDown.toStringAsFixed(0)), @@ -282,7 +284,7 @@ class _UserDetailsContentState extends State { ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Row( children: [ Expanded( @@ -293,7 +295,7 @@ class _UserDetailsContentState extends State { s.has_hypo, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.hasHypo.toString()), @@ -301,7 +303,7 @@ class _UserDetailsContentState extends State { ], ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -310,7 +312,7 @@ class _UserDetailsContentState extends State { s.has_hyper, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.hasHyper.toString()), @@ -320,7 +322,7 @@ class _UserDetailsContentState extends State { ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ExpandableBouble( @@ -330,57 +332,57 @@ class _UserDetailsContentState extends State { s.has_alergy, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.aboutAlergy), ), - SizedBox(height: 16), + const SizedBox(height: 16), Text( s.takes_pills, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.aboutTakingPils), ), - SizedBox(height: 16), + const SizedBox(height: 16), Text( s.sport_hobbies, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.aboutSportHobbies), ), - SizedBox(height: 16), + const SizedBox(height: 16), Text( s.liked_groceries, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.favoriteFoods), ), - SizedBox(height: 16), + const SizedBox(height: 16), Text( s.not_liked_groceries, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: profileDetails.unfavoriteFoods), ), - SizedBox(height: 16), + const SizedBox(height: 16), Text( s.additional_information, style: TextStyles.textSMedium.copyWith(color: appTheme.black), ), - SizedBox(height: 4), + const SizedBox(height: 4), SizedBox( height: 112, child: CustomTextFormField( @@ -393,7 +395,7 @@ class _UserDetailsContentState extends State { controller: TextEditingController(text: profileDetails.additionalInfo), ), ), - SizedBox(height: 16), + const SizedBox(height: 16), ], ), ], @@ -413,7 +415,7 @@ class _UserDetailsContentState extends State { } return Scaffold( appBar: AppBar(), - body: Loader(), + body: const Loader(), ); }, ); @@ -428,14 +430,14 @@ class _UserDetailsContentState extends State { children: [ const SizedBox(height: 8), SingleChildScrollView( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), scrollDirection: Axis.horizontal, child: Row( children: [ _choiceChipWidget(0), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceChipWidget(1), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceChipWidget(2), ], ), @@ -456,26 +458,26 @@ class _UserDetailsContentState extends State { weightPoints: weightPoints, ); default: - return SizedBox.shrink(); + return const SizedBox.shrink(); } }, ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( children: [ - SizedBox(width: 16), + const SizedBox(width: 16), _choiceIntervalChipWidget(0), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceIntervalChipWidget(1), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceIntervalChipWidget(2), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceIntervalChipWidget(3), - SizedBox(width: 8), + const SizedBox(width: 8), _choiceIntervalChipWidget(4), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), ], ), ); diff --git a/lib/features/user_details/presentation/widgets/expandable_bouble.dart b/lib/features/user_details/presentation/widgets/expandable_bouble.dart index e5303a06..d0dde725 100644 --- a/lib/features/user_details/presentation/widgets/expandable_bouble.dart +++ b/lib/features/user_details/presentation/widgets/expandable_bouble.dart @@ -11,7 +11,7 @@ class ExpandableBouble extends StatelessWidget { @override Widget build(BuildContext context) { return AnimatedSize( - duration: Duration(seconds: 1), + duration: const Duration(seconds: 1), child: MainBackgroundBouble( child: Theme( data: Theme.of(context).copyWith(dividerColor: Colors.transparent), @@ -19,8 +19,8 @@ class ExpandableBouble extends StatelessWidget { initiallyExpanded: initiallyExpanded, expandedCrossAxisAlignment: CrossAxisAlignment.start, expandedAlignment: Alignment.bottomLeft, - tilePadding: EdgeInsets.symmetric(horizontal: 16), - childrenPadding: EdgeInsets.symmetric(horizontal: 16), + tilePadding: const EdgeInsets.symmetric(horizontal: 16), + childrenPadding: const EdgeInsets.symmetric(horizontal: 16), title: Text( title, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 0839370a..97e92111 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -97,6 +97,9 @@ class MessageLookup extends MessageLookupByLibrary { "choose_start_diet_date": MessageLookupByLibrary.simpleMessage( "Выберите дату старты диеты. Она отобразиться у Вас в дневнике", ), + "chose_plan_start_date_2": MessageLookupByLibrary.simpleMessage( + "Выберите дату старты плана. Она отобразиться в дневнике пользователя", + ), "circumference_empty": MessageLookupByLibrary.simpleMessage( "Все замеры обязательны к заполнению", ), @@ -193,6 +196,7 @@ class MessageLookup extends MessageLookupByLibrary { "do_you_take_pills": MessageLookupByLibrary.simpleMessage( "Принимаете ли вы лекарства или бады?", ), + "done": MessageLookupByLibrary.simpleMessage("Завершен"), "down_pressure": MessageLookupByLibrary.simpleMessage( "Нижние показатели давления:", ), @@ -402,6 +406,10 @@ class MessageLookup extends MessageLookupByLibrary { ), "option_title": MessageLookupByLibrary.simpleMessage("Заголовок опции"), "order": MessageLookupByLibrary.simpleMessage("Порядок"), + "order_created": MessageLookupByLibrary.simpleMessage("Заказ создан"), + "order_paid": MessageLookupByLibrary.simpleMessage("Заказ оплачен"), + "order_price": MessageLookupByLibrary.simpleMessage("Сумма заказа"), + "order_status": MessageLookupByLibrary.simpleMessage("Статус заказа"), "other": MessageLookupByLibrary.simpleMessage("Другое"), "other_info": MessageLookupByLibrary.simpleMessage("Прочая информация"), "password": MessageLookupByLibrary.simpleMessage("Пароль"), @@ -418,6 +426,7 @@ class MessageLookup extends MessageLookupByLibrary { "В пароле должно быть минимум 6 символов", ), "pay": MessageLookupByLibrary.simpleMessage("Оплатить"), + "payment_failed": MessageLookupByLibrary.simpleMessage("Оплата не прошла"), "pcs": MessageLookupByLibrary.simpleMessage("шт"), "personal": MessageLookupByLibrary.simpleMessage("Персональные"), "personal_diet_state": MessageLookupByLibrary.simpleMessage("Персональная"), @@ -435,6 +444,7 @@ class MessageLookup extends MessageLookupByLibrary { "plan_label_desc": MessageLookupByLibrary.simpleMessage( "План для поддержания формы", ), + "plan_seller": MessageLookupByLibrary.simpleMessage("Продавец плана"), "plan_type": MessageLookupByLibrary.simpleMessage("Тип плана"), "plans_complete": MessageLookupByLibrary.simpleMessage("Пройденные планы"), "please_try_again_later": MessageLookupByLibrary.simpleMessage( @@ -517,6 +527,9 @@ class MessageLookup extends MessageLookupByLibrary { "stage": MessageLookupByLibrary.simpleMessage("этап"), "stages": MessageLookupByLibrary.simpleMessage("этапов"), "standard": MessageLookupByLibrary.simpleMessage("Стандарт"), + "startDateHasBeenSet": MessageLookupByLibrary.simpleMessage( + "Выбрана дата старта", + ), "startDiet": MessageLookupByLibrary.simpleMessage("Начать диету"), "statistic": MessageLookupByLibrary.simpleMessage("Статистика"), "step": MessageLookupByLibrary.simpleMessage("Шаг"), @@ -528,12 +541,18 @@ class MessageLookup extends MessageLookupByLibrary { ), "suicide": MessageLookupByLibrary.simpleMessage("Склонение к самоубийству"), "takes_pills": MessageLookupByLibrary.simpleMessage("Принимает лекарства"), + "tap_on_link_to_pay": MessageLookupByLibrary.simpleMessage( + "Перейдите по ссылке для оплаты консультации", + ), "tell_your_schedule": MessageLookupByLibrary.simpleMessage( "Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:", ), "there_is_a_video": MessageLookupByLibrary.simpleMessage("Есть видео"), "three_options": MessageLookupByLibrary.simpleMessage("3 опции"), "time": MessageLookupByLibrary.simpleMessage("Время прохождения"), + "time_to_complete_plan": MessageLookupByLibrary.simpleMessage( + "Время выполнения плана", + ), "toOffer": MessageLookupByLibrary.simpleMessage("Предложить"), "to_draft": MessageLookupByLibrary.simpleMessage("В черновик"), "to_order": MessageLookupByLibrary.simpleMessage("Заказать"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 35ece7a4..0a00d232 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -2585,7 +2585,15 @@ class S { ); } - // skipped getter for the 'tap_on_link_to)pay' key + /// `Перейдите по ссылке для оплаты консультации` + String get tap_on_link_to_pay { + return Intl.message( + 'Перейдите по ссылке для оплаты консультации', + name: 'tap_on_link_to_pay', + desc: '', + args: [], + ); + } /// `Оплатить` String get pay { @@ -2651,6 +2659,101 @@ class S { args: [], ); } + + /// `Выберите дату старты плана. Она отобразиться в дневнике пользователя` + String get chose_plan_start_date_2 { + return Intl.message( + 'Выберите дату старты плана. Она отобразиться в дневнике пользователя', + name: 'chose_plan_start_date_2', + desc: '', + args: [], + ); + } + + /// `Продавец плана` + String get plan_seller { + return Intl.message( + 'Продавец плана', + name: 'plan_seller', + desc: '', + args: [], + ); + } + + /// `Оплата не прошла` + String get payment_failed { + return Intl.message( + 'Оплата не прошла', + name: 'payment_failed', + desc: '', + args: [], + ); + } + + /// `Заказ оплачен` + String get order_paid { + return Intl.message( + 'Заказ оплачен', + name: 'order_paid', + desc: '', + args: [], + ); + } + + /// `Статус заказа` + String get order_status { + return Intl.message( + 'Статус заказа', + name: 'order_status', + desc: '', + args: [], + ); + } + + /// `Сумма заказа` + String get order_price { + return Intl.message( + 'Сумма заказа', + name: 'order_price', + desc: '', + args: [], + ); + } + + /// `Время выполнения плана` + String get time_to_complete_plan { + return Intl.message( + 'Время выполнения плана', + name: 'time_to_complete_plan', + desc: '', + args: [], + ); + } + + /// `Заказ создан` + String get order_created { + return Intl.message( + 'Заказ создан', + name: 'order_created', + desc: '', + args: [], + ); + } + + /// `Выбрана дата старта` + String get startDateHasBeenSet { + return Intl.message( + 'Выбрана дата старта', + name: 'startDateHasBeenSet', + desc: '', + args: [], + ); + } + + /// `Завершен` + String get done { + return Intl.message('Завершен', name: 'done', desc: '', args: []); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 5d85eb52..ee829899 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -319,7 +319,7 @@ "choose_plan_start_date": "Выберите дату старта плана питания", "choose_date": "Выбрать дату", "date_has_ben_set": "Дата старта начала консультации установлена", - "tap_on_link_to)pay": "Перейдите по ссылке для оплаты консультации", + "tap_on_link_to_pay": "Перейдите по ссылке для оплаты консультации", "pay": "Оплатить", "more_about_order": "Подробнее о заказе", "cancel_order": "Отменить заказ", @@ -327,7 +327,17 @@ "user_info": "Анкета пользователя", "my_cards": "Мои карты", "new_card": "Добавить карту", - "no_default_cards": "У вас нет привязанных карт. Что бы начать работу, привяжите карту" - + "no_default_cards": "У вас нет привязанных карт. Что бы начать работу, привяжите карту", + "chose_plan_start_date_2":"Выберите дату старты плана. Она отобразиться в дневнике пользователя", + "plan_seller": "Продавец плана", + "payment_failed": "Оплата не прошла", + "order_paid": "Заказ оплачен", + "order_status": "Статус заказа", + "order_price": "Сумма заказа", + "time_to_complete_plan": "Время выполнения плана", + "order_created": "Заказ создан", + "startDateHasBeenSet": "Выбрана дата старта", + "done": "Завершен" + } diff --git a/lib/main.dart b/lib/main.dart index 65691c42..82fed7ea 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -22,16 +22,18 @@ import 'package:sentry_flutter/sentry_flutter.dart'; Future main() async { WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized(); FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); - await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); + await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); await di.init(); await SentryFlutter.init((options) { options.dsn = 'http://ba7f2653067776f3034e6e89850e85a1@sentry.md-desk.ru:9000/2'; options.tracesSampleRate = 1.0; - }, appRunner: () => runApp(MyApp())); + }, appRunner: () => runApp(const MyApp())); FlutterNativeSplash.remove(); } class MyApp extends StatelessWidget { + const MyApp({super.key}); + @override Widget build(BuildContext context) { return MultiBlocProvider( @@ -55,7 +57,7 @@ class MyApp extends StatelessWidget { GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], - supportedLocales: [Locale.fromSubtags(languageCode: 'ru')], + supportedLocales: const [Locale.fromSubtags(languageCode: 'ru')], ), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 59a1033d..376970ba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,6 +64,9 @@ dependencies: visibility_detector: ^0.4.0+2 firebase_core: ^3.12.1 firebase_messaging: ^15.2.4 + http_parser: ^4.1.2 + path: ^1.9.0 + collection: ^1.19.0 dependency_overrides: intl: ^0.19.0 @@ -78,6 +81,7 @@ dev_dependencies: flutter_test: sdk: flutter + flutter_lints: ^5.0.0 flutter: uses-material-design: true diff --git a/test/features/profile/services/profile_service_test.dart b/test/features/profile/services/profile_service_test.dart index dc04bfd2..2304e0c7 100644 --- a/test/features/profile/services/profile_service_test.dart +++ b/test/features/profile/services/profile_service_test.dart @@ -15,7 +15,7 @@ void main() { test('getMyProfile', () async { when(mockProfileService.getMyProfile()).thenAnswer( (_) async => await Future.value( - ProfileModel( + const ProfileModel( id: 0, name: 'Alexander Avanesyan', email: 'mso7nueh@mail.ru', @@ -36,7 +36,7 @@ void main() { test('getProfileDetailsBySlug', () async { when(mockProfileService.getProfileDetailsBySlug(slug: 'slug')).thenAnswer( (_) async => await Future.value( - ProfileDetailsModel( + const ProfileDetailsModel( firstName: 'Alexnader', lastName: 'Avanesyan', birthdate: '2024-05-28',