Merge pull request 'main' (#20) from eatvio/eatvio_app:main into main

Reviewed-on: mso7nueh/eatvio_app#20
This commit is contained in:
mso7nueh
2025-03-14 13:05:25 +00:00
58 changed files with 3777 additions and 1566 deletions

View File

@@ -41,6 +41,7 @@ jobs:
# - name: Build apk # - name: Build apk
# run: flutter build apk # run: flutter build apk
# some test
# - name: Rename and move apk # - name: Rename and move apk
# run: | # run: |

View File

@@ -0,0 +1,4 @@
<svg width="68" height="69" viewBox="0 0 68 69" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M68 34.6406C68 53.2716 52.7777 68.375 34 68.375C15.2223 68.375 0 53.2716 0 34.6406C0 16.0096 15.2223 0.90625 34 0.90625C52.7777 0.90625 68 16.0096 68 34.6406Z" fill="white"/>
<path d="M31.6767 54.8812V26.6568H36.2667V54.8812H31.6767ZM31.11 20.2473V15.1309H36.7767V20.2473H31.11Z" fill="#2F80ED"/>
</svg>

After

Width:  |  Height:  |  Size: 409 B

View File

@@ -7,7 +7,6 @@ import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/prof
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart';
import 'package:eatvio_app/features/calendar/presentation/pages/calendar_screen.dart'; import 'package:eatvio_app/features/calendar/presentation/pages/calendar_screen.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart';
import 'package:eatvio_app/features/chat/presentation/pages/chat_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/chats_screen.dart';
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart'; import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
@@ -243,11 +242,9 @@ class AppRouter {
name: 'chatScreen', name: 'chatScreen',
builder: (context, state) { builder: (context, state) {
final data = state.extra as Map<String, dynamic>; final data = state.extra as Map<String, dynamic>;
final chatsCubit = data['chatsCubit'] as ChatsCubit;
final chatId = data['chatId'] as String; final chatId = data['chatId'] as String;
return ChatScreen( return ChatScreen(
chatId: chatId, chatId: chatId,
chatsCubit: chatsCubit,
); );
}, },
), ),

View File

@@ -1,5 +1,5 @@
String baseUrl = 'https://eatvio.ru'; // String baseUrl = 'https://eatvio.ru';
// String baseUrl = 'https://dev2.eatvio.com'; String baseUrl = 'https://dev2.eatvio.com';
const List<int> durationValues = [7, 14, 21]; const List<int> durationValues = [7, 14, 21];
@@ -9,3 +9,4 @@ const List<String> planTypeValues = ['fit', 'slim', 'wellness', 'behavior'];
const newMessagesChannelName = 'private-new-chat-messages'; const newMessagesChannelName = 'private-new-chat-messages';
const newNotificationsChannelName = 'private-message-events'; const newNotificationsChannelName = 'private-message-events';
const directChatChannelName = 'private-direct-chat'; const directChatChannelName = 'private-direct-chat';
const thresholdForPagination = 150;

View File

@@ -87,6 +87,7 @@ Future<void> init() async {
sl.registerLazySingleton<NotificationsCubit>(() => NotificationsCubit(wsManager: sl())); sl.registerLazySingleton<NotificationsCubit>(() => NotificationsCubit(wsManager: sl()));
sl.registerLazySingleton<FeedCubit>(() => FeedCubit(feedRepository: sl())); sl.registerLazySingleton<FeedCubit>(() => FeedCubit(feedRepository: sl()));
sl.registerLazySingleton<ProfileAvatarCubit>(() => ProfileAvatarCubit(profileRepository: sl())); sl.registerLazySingleton<ProfileAvatarCubit>(() => ProfileAvatarCubit(profileRepository: sl()));
sl.registerLazySingleton<ChatsCubit>(() => ChatsCubit(chatRepository: sl(), wsManager: sl(), profileRepository: sl()));
// Cubit factories // Cubit factories
sl.registerFactory<RegistrationCubit>(() => RegistrationCubit(registrationRepository: sl())); sl.registerFactory<RegistrationCubit>(() => RegistrationCubit(registrationRepository: sl()));
@@ -97,7 +98,6 @@ Future<void> init() async {
sl.registerFactory<profilePlans.PlansCubit>(() => profilePlans.PlansCubit(plansRepository: sl())); sl.registerFactory<profilePlans.PlansCubit>(() => profilePlans.PlansCubit(plansRepository: sl()));
sl.registerFactory<DietsCubit>(() => DietsCubit(feedRepository: sl(), dietsRepository: sl())); sl.registerFactory<DietsCubit>(() => DietsCubit(feedRepository: sl(), dietsRepository: sl()));
sl.registerFactory<CommentsCubit>(() => CommentsCubit(feedRepository: sl())); sl.registerFactory<CommentsCubit>(() => CommentsCubit(feedRepository: sl()));
sl.registerFactory<ChatsCubit>(() => ChatsCubit(chatRepository: sl(), wsManager: sl(), profileRepository: sl()));
sl.registerFactory<PlansCubit>(() => PlansCubit(feedRepository: sl(), planRepository: sl())); sl.registerFactory<PlansCubit>(() => PlansCubit(feedRepository: sl(), planRepository: sl()));
sl.registerFactory<SettingsCubit>(() => SettingsCubit(profileRepository: sl(), settingsRepository: sl())); sl.registerFactory<SettingsCubit>(() => SettingsCubit(profileRepository: sl(), settingsRepository: sl()));
sl.registerFactory<RegisterConsultantCubit>(() => RegisterConsultantCubit(consultantRepository: sl())); sl.registerFactory<RegisterConsultantCubit>(() => RegisterConsultantCubit(consultantRepository: sl()));

View File

@@ -184,6 +184,7 @@ class PrimaryColors {
Color get dottedBorder => Color(0xFFE6E6E6); Color get dottedBorder => Color(0xFFE6E6E6);
Color get red => Color(0xFFCD4141); Color get red => Color(0xFFCD4141);
Color get strongRed => Color(0xFFD01717);
Color get transparentRed => Color(0xFFCD4141).withValues(alpha: 0.75); Color get transparentRed => Color(0xFFCD4141).withValues(alpha: 0.75);

View File

@@ -0,0 +1,8 @@
import 'package:eatvio_app/core/const.dart';
import 'package:flutter/material.dart';
void loadNewContent(ScrollNotification notification, Future<void> Function() load) {
if (notification.metrics.pixels >= notification.metrics.maxScrollExtent - thresholdForPagination && !notification.metrics.outOfRange) {
load();
}
}

View File

@@ -0,0 +1,47 @@
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class ItemWidget extends StatelessWidget {
const ItemWidget({super.key, required this.text, this.reversed = false, this.iconSize = 20});
final String text;
final bool reversed;
final double iconSize;
@override
Widget build(BuildContext context) {
if (reversed) {
return Row(
children: [
SvgPicture.asset(
'assets/icons/ok.svg',
width: iconSize,
height: iconSize,
),
SizedBox(width: 8),
Expanded(
child: Text(
text,
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
],
);
}
return Row(
children: [
Expanded(
child: Text(
text,
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
SvgPicture.asset(
'assets/icons/ok.svg',
width: iconSize,
height: iconSize,
),
],
);
}
}

View File

@@ -1,10 +1,8 @@
import 'package:eatvio_app/core/app_router.dart'; import 'package:eatvio_app/core/app_router.dart';
import 'package:eatvio_app/core/locator_service.dart';
import 'package:eatvio_app/core/token_storage.dart'; import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/core/utils/toasts.dart'; import 'package:eatvio_app/core/utils/toasts.dart';
import 'package:eatvio_app/features/auth/presentation/bloc/auth_state.dart'; import 'package:eatvio_app/features/auth/presentation/bloc/auth_state.dart';
import 'package:eatvio_app/features/auth/repositories/auth_repository.dart'; import 'package:eatvio_app/features/auth/repositories/auth_repository.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
@@ -15,7 +13,7 @@ class AuthCubit extends Cubit<AuthState> {
required this.authRepository, required this.authRepository,
}) : super(AuthState()); }) : super(AuthState());
getTokenByCredentials(String email, String password) async { Future<bool> getTokenByCredentials(String email, String password) async {
emit(AuthState.loading()); emit(AuthState.loading());
try { try {
final token = (await authRepository.getTokenByCredentials( final token = (await authRepository.getTokenByCredentials(
@@ -23,7 +21,6 @@ class AuthCubit extends Cubit<AuthState> {
password, password,
)) ))
.token; .token;
print(token);
emit( emit(
AuthState.loaded( AuthState.loaded(
token: token, token: token,
@@ -31,12 +28,13 @@ class AuthCubit extends Cubit<AuthState> {
); );
showSuccessToast('Успешный вход'); showSuccessToast('Успешный вход');
await TokenStorage.saveTokenInStorage(token); await TokenStorage.saveTokenInStorage(token);
await sl<ProfileAvatarCubit>().getMyProfile();
AppRouter.navigatorKey.currentContext?.go('/my-profile-screen'); AppRouter.navigatorKey.currentContext?.go('/my-profile-screen');
return true;
} catch (e) { } catch (e) {
print(e); print(e);
showErrorToast('Неверный адрес электронной почты или пароль'); showErrorToast('Неверный адрес электронной почты или пароль');
emit(AuthState.error(errorMessage: '$e')); emit(AuthState.error(errorMessage: '$e'));
return false;
} }
} }
} }

View File

@@ -6,8 +6,11 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/core/utils/image_constant.dart'; import 'package:eatvio_app/core/utils/image_constant.dart';
import 'package:eatvio_app/core/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/core/widgets/custom_text_form_field.dart';
import 'package:eatvio_app/features/auth/presentation/bloc/auth_cubit.dart'; import 'package:eatvio_app/features/auth/presentation/bloc/auth_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart';
import 'package:eatvio_app/generated/l10n.dart'; import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
@@ -116,30 +119,30 @@ class _AuthScreenState extends State<AuthScreen> {
], ],
), ),
Spacer(), Spacer(),
Row( Center(
mainAxisAlignment: MainAxisAlignment.center, child: RichText(
children: [ textAlign: TextAlign.center,
Text( text: TextSpan(
'Нажимая "Войти", Вы соглашаетесь с ', text: 'Нажимая "Войти", Вы соглашаетесь \n',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: Colors.black,
), ),
), children: [
GestureDetector( TextSpan(text: 'c '),
onTap: () async { TextSpan(
await launchUrl(Uri.parse(baseUrl + '/oferta_bs.pdf')); text: ' Публичной офертой',
}, style: TextStyle(
child: Text( fontSize: 12,
'Публичной офертой', color: appTheme.blueA400,
style: TextStyle( decorationColor: appTheme.blueA400,
fontSize: 12, decoration: TextDecoration.underline,
color: appTheme.blueA400, ),
decorationColor: appTheme.blueA400, recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse(baseUrl + '/oferta_bs.pdf')),
decoration: TextDecoration.underline,
), ),
), ],
), ),
], ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Container( Container(
@@ -156,10 +159,16 @@ class _AuthScreenState extends State<AuthScreen> {
backgroundColor: state is AuthStateLoading ? Colors.black.withAlpha(50) : appTheme.blueA400, backgroundColor: state is AuthStateLoading ? Colors.black.withAlpha(50) : appTheme.blueA400,
onPressed: state is AuthStateLoading onPressed: state is AuthStateLoading
? null ? null
: () => authCubit.getTokenByCredentials( : () async {
final isAuthenticated = await authCubit.getTokenByCredentials(
emailController.text, emailController.text,
passwordController.text, passwordController.text,
), );
if (isAuthenticated) {
context.read<ProfileAvatarCubit>().getMyProfile();
context.read<ChatsCubit>().getChatRoomsWithLoading();
}
},
label: state is AuthStateLoading label: state is AuthStateLoading
? CupertinoActivityIndicator() ? CupertinoActivityIndicator()
: Text( : Text(

View File

@@ -1,5 +1,6 @@
import 'package:eatvio_app/features/chat/models/chat_room_settings_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_settings_model.dart';
import 'package:eatvio_app/features/chat/models/chat_user_model.dart'; import 'package:eatvio_app/features/chat/models/chat_user_model.dart';
import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
part 'chat_room_model.freezed.dart'; part 'chat_room_model.freezed.dart';
@@ -10,8 +11,23 @@ class ChatRoomModel with _$ChatRoomModel {
const factory ChatRoomModel({ const factory ChatRoomModel({
required String id, required String id,
@JsonKey(name: 'chat_room_setting') required ChatRoomSettingsModel chatRoomSettings, @JsonKey(name: 'chat_room_setting') required ChatRoomSettingsModel chatRoomSettings,
required Map<String, ChatUserModel> users, required Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) required ChosenPlanModel? chosenPlan,
}) = _ChatRoomModel; }) = _ChatRoomModel;
factory ChatRoomModel.fromJson(Map<String, Object?> json) => _$ChatRoomModelFromJson(json); factory ChatRoomModel.fromJson(Map<String, Object?> json) => _$ChatRoomModelFromJson(json);
} }
@freezed
class Users with _$Users {
const factory Users({
@JsonKey(name: 'from_chat_user') required ChatUserModel sender,
@JsonKey(name: 'to_chat_user') required ChatUserModel receiver,
}) = _Users;
factory Users.fromJson(Map<String, Object?> json) => _$UsersFromJson(json);
}

View File

@@ -24,7 +24,9 @@ mixin _$ChatRoomModel {
@JsonKey(name: 'chat_room_setting') @JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel get chatRoomSettings => ChatRoomSettingsModel get chatRoomSettings =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
Map<String, ChatUserModel> get users => throw _privateConstructorUsedError; Users get users => throw _privateConstructorUsedError;
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? get chosenPlan => throw _privateConstructorUsedError;
/// Serializes this ChatRoomModel to a JSON map. /// Serializes this ChatRoomModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -46,9 +48,13 @@ abstract class $ChatRoomModelCopyWith<$Res> {
{String id, {String id,
@JsonKey(name: 'chat_room_setting') @JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel chatRoomSettings, ChatRoomSettingsModel chatRoomSettings,
Map<String, ChatUserModel> users}); Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? chosenPlan});
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings;
$UsersCopyWith<$Res> get users;
$ChosenPlanModelCopyWith<$Res>? get chosenPlan;
} }
/// @nodoc /// @nodoc
@@ -69,6 +75,7 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
Object? id = null, Object? id = null,
Object? chatRoomSettings = null, Object? chatRoomSettings = null,
Object? users = null, Object? users = null,
Object? chosenPlan = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
id: null == id id: null == id
@@ -82,7 +89,11 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
users: null == users users: null == users
? _value.users ? _value.users
: users // ignore: cast_nullable_to_non_nullable : users // ignore: cast_nullable_to_non_nullable
as Map<String, ChatUserModel>, as Users,
chosenPlan: freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
) as $Val); ) as $Val);
} }
@@ -96,6 +107,30 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
return _then(_value.copyWith(chatRoomSettings: value) as $Val); return _then(_value.copyWith(chatRoomSettings: value) as $Val);
}); });
} }
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UsersCopyWith<$Res> get users {
return $UsersCopyWith<$Res>(_value.users, (value) {
return _then(_value.copyWith(users: value) as $Val);
});
}
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChosenPlanModelCopyWith<$Res>? get chosenPlan {
if (_value.chosenPlan == null) {
return null;
}
return $ChosenPlanModelCopyWith<$Res>(_value.chosenPlan!, (value) {
return _then(_value.copyWith(chosenPlan: value) as $Val);
});
}
} }
/// @nodoc /// @nodoc
@@ -110,10 +145,16 @@ abstract class _$$ChatRoomModelImplCopyWith<$Res>
{String id, {String id,
@JsonKey(name: 'chat_room_setting') @JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel chatRoomSettings, ChatRoomSettingsModel chatRoomSettings,
Map<String, ChatUserModel> users}); Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? chosenPlan});
@override @override
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings;
@override
$UsersCopyWith<$Res> get users;
@override
$ChosenPlanModelCopyWith<$Res>? get chosenPlan;
} }
/// @nodoc /// @nodoc
@@ -132,6 +173,7 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res>
Object? id = null, Object? id = null,
Object? chatRoomSettings = null, Object? chatRoomSettings = null,
Object? users = null, Object? users = null,
Object? chosenPlan = freezed,
}) { }) {
return _then(_$ChatRoomModelImpl( return _then(_$ChatRoomModelImpl(
id: null == id id: null == id
@@ -143,9 +185,13 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res>
: chatRoomSettings // ignore: cast_nullable_to_non_nullable : chatRoomSettings // ignore: cast_nullable_to_non_nullable
as ChatRoomSettingsModel, as ChatRoomSettingsModel,
users: null == users users: null == users
? _value._users ? _value.users
: users // ignore: cast_nullable_to_non_nullable : users // ignore: cast_nullable_to_non_nullable
as Map<String, ChatUserModel>, as Users,
chosenPlan: freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
)); ));
} }
} }
@@ -156,8 +202,9 @@ class _$ChatRoomModelImpl implements _ChatRoomModel {
const _$ChatRoomModelImpl( const _$ChatRoomModelImpl(
{required this.id, {required this.id,
@JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings,
required final Map<String, ChatUserModel> users}) required this.users,
: _users = users; @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
required this.chosenPlan});
factory _$ChatRoomModelImpl.fromJson(Map<String, dynamic> json) => factory _$ChatRoomModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatRoomModelImplFromJson(json); _$$ChatRoomModelImplFromJson(json);
@@ -167,17 +214,15 @@ class _$ChatRoomModelImpl implements _ChatRoomModel {
@override @override
@JsonKey(name: 'chat_room_setting') @JsonKey(name: 'chat_room_setting')
final ChatRoomSettingsModel chatRoomSettings; final ChatRoomSettingsModel chatRoomSettings;
final Map<String, ChatUserModel> _users;
@override @override
Map<String, ChatUserModel> get users { final Users users;
if (_users is EqualUnmodifiableMapView) return _users; @override
// ignore: implicit_dynamic_type @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
return EqualUnmodifiableMapView(_users); final ChosenPlanModel? chosenPlan;
}
@override @override
String toString() { String toString() {
return 'ChatRoomModel(id: $id, chatRoomSettings: $chatRoomSettings, users: $users)'; return 'ChatRoomModel(id: $id, chatRoomSettings: $chatRoomSettings, users: $users, chosenPlan: $chosenPlan)';
} }
@override @override
@@ -188,13 +233,15 @@ class _$ChatRoomModelImpl implements _ChatRoomModel {
(identical(other.id, id) || other.id == id) && (identical(other.id, id) || other.id == id) &&
(identical(other.chatRoomSettings, chatRoomSettings) || (identical(other.chatRoomSettings, chatRoomSettings) ||
other.chatRoomSettings == chatRoomSettings) && other.chatRoomSettings == chatRoomSettings) &&
const DeepCollectionEquality().equals(other._users, _users)); (identical(other.users, users) || other.users == users) &&
(identical(other.chosenPlan, chosenPlan) ||
other.chosenPlan == chosenPlan));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType, id, chatRoomSettings, int get hashCode =>
const DeepCollectionEquality().hash(_users)); Object.hash(runtimeType, id, chatRoomSettings, users, chosenPlan);
/// Create a copy of ChatRoomModel /// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@@ -217,7 +264,9 @@ abstract class _ChatRoomModel implements ChatRoomModel {
{required final String id, {required final String id,
@JsonKey(name: 'chat_room_setting') @JsonKey(name: 'chat_room_setting')
required final ChatRoomSettingsModel chatRoomSettings, required final ChatRoomSettingsModel chatRoomSettings,
required final Map<String, ChatUserModel> users}) = _$ChatRoomModelImpl; required final Users users,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
required final ChosenPlanModel? chosenPlan}) = _$ChatRoomModelImpl;
factory _ChatRoomModel.fromJson(Map<String, dynamic> json) = factory _ChatRoomModel.fromJson(Map<String, dynamic> json) =
_$ChatRoomModelImpl.fromJson; _$ChatRoomModelImpl.fromJson;
@@ -228,7 +277,10 @@ abstract class _ChatRoomModel implements ChatRoomModel {
@JsonKey(name: 'chat_room_setting') @JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel get chatRoomSettings; ChatRoomSettingsModel get chatRoomSettings;
@override @override
Map<String, ChatUserModel> get users; Users get users;
@override
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? get chosenPlan;
/// Create a copy of ChatRoomModel /// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@@ -237,3 +289,208 @@ abstract class _ChatRoomModel implements ChatRoomModel {
_$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
} }
Users _$UsersFromJson(Map<String, dynamic> json) {
return _Users.fromJson(json);
}
/// @nodoc
mixin _$Users {
@JsonKey(name: 'from_chat_user')
ChatUserModel get sender => throw _privateConstructorUsedError;
@JsonKey(name: 'to_chat_user')
ChatUserModel get receiver => throw _privateConstructorUsedError;
/// Serializes this Users to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$UsersCopyWith<Users> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
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});
$ChatUserModelCopyWith<$Res> get sender;
$ChatUserModelCopyWith<$Res> get receiver;
}
/// @nodoc
class _$UsersCopyWithImpl<$Res, $Val extends Users>
implements $UsersCopyWith<$Res> {
_$UsersCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _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(_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
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatUserModelCopyWith<$Res> get sender {
return $ChatUserModelCopyWith<$Res>(_value.sender, (value) {
return _then(_value.copyWith(sender: value) as $Val);
});
}
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatUserModelCopyWith<$Res> get receiver {
return $ChatUserModelCopyWith<$Res>(_value.receiver, (value) {
return _then(_value.copyWith(receiver: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$UsersImplCopyWith<$Res> implements $UsersCopyWith<$Res> {
factory _$$UsersImplCopyWith(
_$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});
@override
$ChatUserModelCopyWith<$Res> get sender;
@override
$ChatUserModelCopyWith<$Res> get receiver;
}
/// @nodoc
class __$$UsersImplCopyWithImpl<$Res>
extends _$UsersCopyWithImpl<$Res, _$UsersImpl>
implements _$$UsersImplCopyWith<$Res> {
__$$UsersImplCopyWithImpl(
_$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,
));
}
}
/// @nodoc
@JsonSerializable()
class _$UsersImpl implements _Users {
const _$UsersImpl(
{@JsonKey(name: 'from_chat_user') required this.sender,
@JsonKey(name: 'to_chat_user') required this.receiver});
factory _$UsersImpl.fromJson(Map<String, dynamic> json) =>
_$$UsersImplFromJson(json);
@override
@JsonKey(name: 'from_chat_user')
final ChatUserModel sender;
@override
@JsonKey(name: 'to_chat_user')
final ChatUserModel receiver;
@override
String toString() {
return 'Users(sender: $sender, receiver: $receiver)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UsersImpl &&
(identical(other.sender, sender) || other.sender == sender) &&
(identical(other.receiver, receiver) ||
other.receiver == receiver));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, sender, receiver);
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$UsersImplCopyWith<_$UsersImpl> get copyWith =>
__$$UsersImplCopyWithImpl<_$UsersImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
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;
factory _Users.fromJson(Map<String, dynamic> json) = _$UsersImpl.fromJson;
@override
@JsonKey(name: 'from_chat_user')
ChatUserModel get sender;
@override
@JsonKey(name: 'to_chat_user')
ChatUserModel get receiver;
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$UsersImplCopyWith<_$UsersImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -11,10 +11,8 @@ _$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map<String, dynamic> json) =>
id: json['id'] as String, id: json['id'] as String,
chatRoomSettings: ChatRoomSettingsModel.fromJson( chatRoomSettings: ChatRoomSettingsModel.fromJson(
json['chat_room_setting'] as Map<String, dynamic>), json['chat_room_setting'] as Map<String, dynamic>),
users: (json['users'] as Map<String, dynamic>).map( users: Users.fromJson(json['users'] as Map<String, dynamic>),
(k, e) => chosenPlan: parseChosenPlan(json['chosen_plan']),
MapEntry(k, ChatUserModel.fromJson(e as Map<String, dynamic>)),
),
); );
Map<String, dynamic> _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) => Map<String, dynamic> _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) =>
@@ -22,4 +20,18 @@ Map<String, dynamic> _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) =>
'id': instance.id, 'id': instance.id,
'chat_room_setting': instance.chatRoomSettings, 'chat_room_setting': instance.chatRoomSettings,
'users': instance.users, 'users': instance.users,
'chosen_plan': instance.chosenPlan,
};
_$UsersImpl _$$UsersImplFromJson(Map<String, dynamic> json) => _$UsersImpl(
sender: ChatUserModel.fromJson(
json['from_chat_user'] as Map<String, dynamic>),
receiver:
ChatUserModel.fromJson(json['to_chat_user'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$UsersImplToJson(_$UsersImpl instance) =>
<String, dynamic>{
'from_chat_user': instance.sender,
'to_chat_user': instance.receiver,
}; };

View File

@@ -1,16 +1,29 @@
import 'package:eatvio_app/features/chat/models/chat_message_model.dart'; import 'package:eatvio_app/features/chat/models/chat_message_model.dart';
import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
part 'chat_room_preview_model.freezed.dart'; part 'chat_room_pagination_model.freezed.dart';
part 'chat_room_preview_model.g.dart'; part 'chat_room_pagination_model.g.dart';
@freezed @freezed
class ChatRoomPreviewModel with _$ChatRoomPreviewModel { class ChatRoomPaginationModel with _$ChatRoomPaginationModel {
const factory ChatRoomPreviewModel({ const factory ChatRoomPaginationModel({
@JsonKey(name: "chatRooms") required List<ChatRoom> chatRooms, @JsonKey(name: "chatRooms") required ChatRooms chatRooms,
@JsonKey(name: "number_of_unread_chat_rooms") required int unreadChatsCount,
}) = _ChatRoomPreviewModel; }) = _ChatRoomPreviewModel;
factory ChatRoomPreviewModel.fromJson(Map<String, dynamic> json) => _$ChatRoomPreviewModelFromJson(json); factory ChatRoomPaginationModel.fromJson(Map<String, dynamic> json) => _$ChatRoomPaginationModelFromJson(json);
}
@freezed
class ChatRooms with _$ChatRooms {
const factory ChatRooms({
@JsonKey(name: "data") required List<ChatRoom> data,
@JsonKey(name: "last_page") required int lastPage,
@JsonKey(name: "current_page") required int currentPage,
}) = _ChatRooms;
factory ChatRooms.fromJson(Map<String, dynamic> json) => _$ChatRoomsFromJson(json);
} }
@freezed @freezed
@@ -21,6 +34,7 @@ class ChatRoom with _$ChatRoom {
@JsonKey(name: "last_message", fromJson: parseLastMessage) required ChatMessageModel? lastMessage, @JsonKey(name: "last_message", fromJson: parseLastMessage) required ChatMessageModel? lastMessage,
@JsonKey(name: "users") required Users users, @JsonKey(name: "users") required Users users,
@JsonKey(name: "unread_messages_count") required int unreadMessagesCount, @JsonKey(name: "unread_messages_count") required int unreadMessagesCount,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan) required ChosenPlanModel? chosenPlan,
}) = _ChatRoom; }) = _ChatRoom;
factory ChatRoom.fromJson(Map<String, dynamic> json) => _$ChatRoomFromJson(json); factory ChatRoom.fromJson(Map<String, dynamic> json) => _$ChatRoomFromJson(json);

View File

@@ -3,7 +3,7 @@
// ignore_for_file: type=lint // 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 // 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 'chat_room_preview_model.dart'; part of 'chat_room_pagination_model.dart';
// ************************************************************************** // **************************************************************************
// FreezedGenerator // FreezedGenerator
@@ -14,92 +14,125 @@ T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError( 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');
ChatRoomPreviewModel _$ChatRoomPreviewModelFromJson(Map<String, dynamic> json) { ChatRoomPaginationModel _$ChatRoomPaginationModelFromJson(
Map<String, dynamic> json) {
return _ChatRoomPreviewModel.fromJson(json); return _ChatRoomPreviewModel.fromJson(json);
} }
/// @nodoc /// @nodoc
mixin _$ChatRoomPreviewModel { mixin _$ChatRoomPaginationModel {
@JsonKey(name: "chatRooms") @JsonKey(name: "chatRooms")
List<ChatRoom> get chatRooms => throw _privateConstructorUsedError; ChatRooms get chatRooms => throw _privateConstructorUsedError;
@JsonKey(name: "number_of_unread_chat_rooms")
int get unreadChatsCount => throw _privateConstructorUsedError;
/// Serializes this ChatRoomPreviewModel to a JSON map. /// Serializes this ChatRoomPaginationModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatRoomPreviewModel /// Create a copy of ChatRoomPaginationModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
$ChatRoomPreviewModelCopyWith<ChatRoomPreviewModel> get copyWith => $ChatRoomPaginationModelCopyWith<ChatRoomPaginationModel> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
} }
/// @nodoc /// @nodoc
abstract class $ChatRoomPreviewModelCopyWith<$Res> { abstract class $ChatRoomPaginationModelCopyWith<$Res> {
factory $ChatRoomPreviewModelCopyWith(ChatRoomPreviewModel value, factory $ChatRoomPaginationModelCopyWith(ChatRoomPaginationModel value,
$Res Function(ChatRoomPreviewModel) then) = $Res Function(ChatRoomPaginationModel) then) =
_$ChatRoomPreviewModelCopyWithImpl<$Res, ChatRoomPreviewModel>; _$ChatRoomPaginationModelCopyWithImpl<$Res, ChatRoomPaginationModel>;
@useResult @useResult
$Res call({@JsonKey(name: "chatRooms") List<ChatRoom> chatRooms}); $Res call(
{@JsonKey(name: "chatRooms") ChatRooms chatRooms,
@JsonKey(name: "number_of_unread_chat_rooms") int unreadChatsCount});
$ChatRoomsCopyWith<$Res> get chatRooms;
} }
/// @nodoc /// @nodoc
class _$ChatRoomPreviewModelCopyWithImpl<$Res, class _$ChatRoomPaginationModelCopyWithImpl<$Res,
$Val extends ChatRoomPreviewModel> $Val extends ChatRoomPaginationModel>
implements $ChatRoomPreviewModelCopyWith<$Res> { implements $ChatRoomPaginationModelCopyWith<$Res> {
_$ChatRoomPreviewModelCopyWithImpl(this._value, this._then); _$ChatRoomPaginationModelCopyWithImpl(this._value, this._then);
// ignore: unused_field // ignore: unused_field
final $Val _value; final $Val _value;
// ignore: unused_field // ignore: unused_field
final $Res Function($Val) _then; final $Res Function($Val) _then;
/// Create a copy of ChatRoomPreviewModel /// Create a copy of ChatRoomPaginationModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? chatRooms = null, Object? chatRooms = null,
Object? unreadChatsCount = null,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
chatRooms: null == chatRooms chatRooms: null == chatRooms
? _value.chatRooms ? _value.chatRooms
: chatRooms // ignore: cast_nullable_to_non_nullable : chatRooms // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>, as ChatRooms,
unreadChatsCount: null == unreadChatsCount
? _value.unreadChatsCount
: unreadChatsCount // ignore: cast_nullable_to_non_nullable
as int,
) as $Val); ) as $Val);
} }
/// Create a copy of ChatRoomPaginationModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatRoomsCopyWith<$Res> get chatRooms {
return $ChatRoomsCopyWith<$Res>(_value.chatRooms, (value) {
return _then(_value.copyWith(chatRooms: value) as $Val);
});
}
} }
/// @nodoc /// @nodoc
abstract class _$$ChatRoomPreviewModelImplCopyWith<$Res> abstract class _$$ChatRoomPreviewModelImplCopyWith<$Res>
implements $ChatRoomPreviewModelCopyWith<$Res> { implements $ChatRoomPaginationModelCopyWith<$Res> {
factory _$$ChatRoomPreviewModelImplCopyWith(_$ChatRoomPreviewModelImpl value, factory _$$ChatRoomPreviewModelImplCopyWith(_$ChatRoomPreviewModelImpl value,
$Res Function(_$ChatRoomPreviewModelImpl) then) = $Res Function(_$ChatRoomPreviewModelImpl) then) =
__$$ChatRoomPreviewModelImplCopyWithImpl<$Res>; __$$ChatRoomPreviewModelImplCopyWithImpl<$Res>;
@override @override
@useResult @useResult
$Res call({@JsonKey(name: "chatRooms") List<ChatRoom> chatRooms}); $Res call(
{@JsonKey(name: "chatRooms") ChatRooms chatRooms,
@JsonKey(name: "number_of_unread_chat_rooms") int unreadChatsCount});
@override
$ChatRoomsCopyWith<$Res> get chatRooms;
} }
/// @nodoc /// @nodoc
class __$$ChatRoomPreviewModelImplCopyWithImpl<$Res> class __$$ChatRoomPreviewModelImplCopyWithImpl<$Res>
extends _$ChatRoomPreviewModelCopyWithImpl<$Res, _$ChatRoomPreviewModelImpl> extends _$ChatRoomPaginationModelCopyWithImpl<$Res,
_$ChatRoomPreviewModelImpl>
implements _$$ChatRoomPreviewModelImplCopyWith<$Res> { implements _$$ChatRoomPreviewModelImplCopyWith<$Res> {
__$$ChatRoomPreviewModelImplCopyWithImpl(_$ChatRoomPreviewModelImpl _value, __$$ChatRoomPreviewModelImplCopyWithImpl(_$ChatRoomPreviewModelImpl _value,
$Res Function(_$ChatRoomPreviewModelImpl) _then) $Res Function(_$ChatRoomPreviewModelImpl) _then)
: super(_value, _then); : super(_value, _then);
/// Create a copy of ChatRoomPreviewModel /// Create a copy of ChatRoomPaginationModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? chatRooms = null, Object? chatRooms = null,
Object? unreadChatsCount = null,
}) { }) {
return _then(_$ChatRoomPreviewModelImpl( return _then(_$ChatRoomPreviewModelImpl(
chatRooms: null == chatRooms chatRooms: null == chatRooms
? _value._chatRooms ? _value.chatRooms
: chatRooms // ignore: cast_nullable_to_non_nullable : chatRooms // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>, as ChatRooms,
unreadChatsCount: null == unreadChatsCount
? _value.unreadChatsCount
: unreadChatsCount // ignore: cast_nullable_to_non_nullable
as int,
)); ));
} }
} }
@@ -108,24 +141,23 @@ class __$$ChatRoomPreviewModelImplCopyWithImpl<$Res>
@JsonSerializable() @JsonSerializable()
class _$ChatRoomPreviewModelImpl implements _ChatRoomPreviewModel { class _$ChatRoomPreviewModelImpl implements _ChatRoomPreviewModel {
const _$ChatRoomPreviewModelImpl( const _$ChatRoomPreviewModelImpl(
{@JsonKey(name: "chatRooms") required final List<ChatRoom> chatRooms}) {@JsonKey(name: "chatRooms") required this.chatRooms,
: _chatRooms = chatRooms; @JsonKey(name: "number_of_unread_chat_rooms")
required this.unreadChatsCount});
factory _$ChatRoomPreviewModelImpl.fromJson(Map<String, dynamic> json) => factory _$ChatRoomPreviewModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatRoomPreviewModelImplFromJson(json); _$$ChatRoomPreviewModelImplFromJson(json);
final List<ChatRoom> _chatRooms;
@override @override
@JsonKey(name: "chatRooms") @JsonKey(name: "chatRooms")
List<ChatRoom> get chatRooms { final ChatRooms chatRooms;
if (_chatRooms is EqualUnmodifiableListView) return _chatRooms; @override
// ignore: implicit_dynamic_type @JsonKey(name: "number_of_unread_chat_rooms")
return EqualUnmodifiableListView(_chatRooms); final int unreadChatsCount;
}
@override @override
String toString() { String toString() {
return 'ChatRoomPreviewModel(chatRooms: $chatRooms)'; return 'ChatRoomPaginationModel(chatRooms: $chatRooms, unreadChatsCount: $unreadChatsCount)';
} }
@override @override
@@ -133,16 +165,17 @@ class _$ChatRoomPreviewModelImpl implements _ChatRoomPreviewModel {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$ChatRoomPreviewModelImpl && other is _$ChatRoomPreviewModelImpl &&
const DeepCollectionEquality() (identical(other.chatRooms, chatRooms) ||
.equals(other._chatRooms, _chatRooms)); other.chatRooms == chatRooms) &&
(identical(other.unreadChatsCount, unreadChatsCount) ||
other.unreadChatsCount == unreadChatsCount));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => int get hashCode => Object.hash(runtimeType, chatRooms, unreadChatsCount);
Object.hash(runtimeType, const DeepCollectionEquality().hash(_chatRooms));
/// Create a copy of ChatRoomPreviewModel /// Create a copy of ChatRoomPaginationModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@@ -160,19 +193,23 @@ class _$ChatRoomPreviewModelImpl implements _ChatRoomPreviewModel {
} }
} }
abstract class _ChatRoomPreviewModel implements ChatRoomPreviewModel { abstract class _ChatRoomPreviewModel implements ChatRoomPaginationModel {
const factory _ChatRoomPreviewModel( const factory _ChatRoomPreviewModel(
{@JsonKey(name: "chatRooms") {@JsonKey(name: "chatRooms") required final ChatRooms chatRooms,
required final List<ChatRoom> chatRooms}) = _$ChatRoomPreviewModelImpl; @JsonKey(name: "number_of_unread_chat_rooms")
required final int unreadChatsCount}) = _$ChatRoomPreviewModelImpl;
factory _ChatRoomPreviewModel.fromJson(Map<String, dynamic> json) = factory _ChatRoomPreviewModel.fromJson(Map<String, dynamic> json) =
_$ChatRoomPreviewModelImpl.fromJson; _$ChatRoomPreviewModelImpl.fromJson;
@override @override
@JsonKey(name: "chatRooms") @JsonKey(name: "chatRooms")
List<ChatRoom> get chatRooms; ChatRooms get chatRooms;
@override
@JsonKey(name: "number_of_unread_chat_rooms")
int get unreadChatsCount;
/// Create a copy of ChatRoomPreviewModel /// Create a copy of ChatRoomPaginationModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -180,6 +217,218 @@ abstract class _ChatRoomPreviewModel implements ChatRoomPreviewModel {
get copyWith => throw _privateConstructorUsedError; get copyWith => throw _privateConstructorUsedError;
} }
ChatRooms _$ChatRoomsFromJson(Map<String, dynamic> json) {
return _ChatRooms.fromJson(json);
}
/// @nodoc
mixin _$ChatRooms {
@JsonKey(name: "data")
List<ChatRoom> get data => throw _privateConstructorUsedError;
@JsonKey(name: "last_page")
int get lastPage => throw _privateConstructorUsedError;
@JsonKey(name: "current_page")
int get currentPage => throw _privateConstructorUsedError;
/// Serializes this ChatRooms to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatRooms
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatRoomsCopyWith<ChatRooms> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ChatRoomsCopyWith<$Res> {
factory $ChatRoomsCopyWith(ChatRooms value, $Res Function(ChatRooms) then) =
_$ChatRoomsCopyWithImpl<$Res, ChatRooms>;
@useResult
$Res call(
{@JsonKey(name: "data") List<ChatRoom> data,
@JsonKey(name: "last_page") int lastPage,
@JsonKey(name: "current_page") int currentPage});
}
/// @nodoc
class _$ChatRoomsCopyWithImpl<$Res, $Val extends ChatRooms>
implements $ChatRoomsCopyWith<$Res> {
_$ChatRoomsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRooms
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? data = null,
Object? lastPage = null,
Object? currentPage = null,
}) {
return _then(_value.copyWith(
data: null == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>,
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);
}
}
/// @nodoc
abstract class _$$ChatRoomsImplCopyWith<$Res>
implements $ChatRoomsCopyWith<$Res> {
factory _$$ChatRoomsImplCopyWith(
_$ChatRoomsImpl value, $Res Function(_$ChatRoomsImpl) then) =
__$$ChatRoomsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{@JsonKey(name: "data") List<ChatRoom> data,
@JsonKey(name: "last_page") int lastPage,
@JsonKey(name: "current_page") int currentPage});
}
/// @nodoc
class __$$ChatRoomsImplCopyWithImpl<$Res>
extends _$ChatRoomsCopyWithImpl<$Res, _$ChatRoomsImpl>
implements _$$ChatRoomsImplCopyWith<$Res> {
__$$ChatRoomsImplCopyWithImpl(
_$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.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? data = null,
Object? lastPage = null,
Object? currentPage = null,
}) {
return _then(_$ChatRoomsImpl(
data: null == data
? _value._data
: data // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>,
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<ChatRoom> data,
@JsonKey(name: "last_page") required this.lastPage,
@JsonKey(name: "current_page") required this.currentPage})
: _data = data;
factory _$ChatRoomsImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatRoomsImplFromJson(json);
final List<ChatRoom> _data;
@override
@JsonKey(name: "data")
List<ChatRoom> get data {
if (_data is EqualUnmodifiableListView) return _data;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_data);
}
@override
@JsonKey(name: "last_page")
final int lastPage;
@override
@JsonKey(name: "current_page")
final int currentPage;
@override
String toString() {
return 'ChatRooms(data: $data, lastPage: $lastPage, currentPage: $currentPage)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ChatRoomsImpl &&
const DeepCollectionEquality().equals(other._data, _data) &&
(identical(other.lastPage, lastPage) ||
other.lastPage == lastPage) &&
(identical(other.currentPage, currentPage) ||
other.currentPage == currentPage));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
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.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomsImplCopyWith<_$ChatRoomsImpl> get copyWith =>
__$$ChatRoomsImplCopyWithImpl<_$ChatRoomsImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ChatRoomsImplToJson(
this,
);
}
}
abstract class _ChatRooms implements ChatRooms {
const factory _ChatRooms(
{@JsonKey(name: "data") required final List<ChatRoom> data,
@JsonKey(name: "last_page") required final int lastPage,
@JsonKey(name: "current_page") required final int currentPage}) =
_$ChatRoomsImpl;
factory _ChatRooms.fromJson(Map<String, dynamic> json) =
_$ChatRoomsImpl.fromJson;
@override
@JsonKey(name: "data")
List<ChatRoom> get data;
@override
@JsonKey(name: "last_page")
int get lastPage;
@override
@JsonKey(name: "current_page")
int get currentPage;
/// Create a copy of ChatRooms
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatRoomsImplCopyWith<_$ChatRoomsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
ChatRoom _$ChatRoomFromJson(Map<String, dynamic> json) { ChatRoom _$ChatRoomFromJson(Map<String, dynamic> json) {
return _ChatRoom.fromJson(json); return _ChatRoom.fromJson(json);
} }
@@ -196,6 +445,8 @@ mixin _$ChatRoom {
Users get users => throw _privateConstructorUsedError; Users get users => throw _privateConstructorUsedError;
@JsonKey(name: "unread_messages_count") @JsonKey(name: "unread_messages_count")
int get unreadMessagesCount => throw _privateConstructorUsedError; int get unreadMessagesCount => throw _privateConstructorUsedError;
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? get chosenPlan => throw _privateConstructorUsedError;
/// Serializes this ChatRoom to a JSON map. /// Serializes this ChatRoom to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -218,10 +469,13 @@ abstract class $ChatRoomCopyWith<$Res> {
@JsonKey(name: "last_message", fromJson: parseLastMessage) @JsonKey(name: "last_message", fromJson: parseLastMessage)
ChatMessageModel? lastMessage, ChatMessageModel? lastMessage,
@JsonKey(name: "users") Users users, @JsonKey(name: "users") Users users,
@JsonKey(name: "unread_messages_count") int unreadMessagesCount}); @JsonKey(name: "unread_messages_count") int unreadMessagesCount,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? chosenPlan});
$ChatMessageModelCopyWith<$Res>? get lastMessage; $ChatMessageModelCopyWith<$Res>? get lastMessage;
$UsersCopyWith<$Res> get users; $UsersCopyWith<$Res> get users;
$ChosenPlanModelCopyWith<$Res>? get chosenPlan;
} }
/// @nodoc /// @nodoc
@@ -244,6 +498,7 @@ class _$ChatRoomCopyWithImpl<$Res, $Val extends ChatRoom>
Object? lastMessage = freezed, Object? lastMessage = freezed,
Object? users = null, Object? users = null,
Object? unreadMessagesCount = null, Object? unreadMessagesCount = null,
Object? chosenPlan = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
id: null == id id: null == id
@@ -266,6 +521,10 @@ class _$ChatRoomCopyWithImpl<$Res, $Val extends ChatRoom>
? _value.unreadMessagesCount ? _value.unreadMessagesCount
: unreadMessagesCount // ignore: cast_nullable_to_non_nullable : unreadMessagesCount // ignore: cast_nullable_to_non_nullable
as int, as int,
chosenPlan: freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
) as $Val); ) as $Val);
} }
@@ -292,6 +551,20 @@ class _$ChatRoomCopyWithImpl<$Res, $Val extends ChatRoom>
return _then(_value.copyWith(users: value) as $Val); return _then(_value.copyWith(users: value) as $Val);
}); });
} }
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChosenPlanModelCopyWith<$Res>? get chosenPlan {
if (_value.chosenPlan == null) {
return null;
}
return $ChosenPlanModelCopyWith<$Res>(_value.chosenPlan!, (value) {
return _then(_value.copyWith(chosenPlan: value) as $Val);
});
}
} }
/// @nodoc /// @nodoc
@@ -308,12 +581,16 @@ abstract class _$$ChatRoomImplCopyWith<$Res>
@JsonKey(name: "last_message", fromJson: parseLastMessage) @JsonKey(name: "last_message", fromJson: parseLastMessage)
ChatMessageModel? lastMessage, ChatMessageModel? lastMessage,
@JsonKey(name: "users") Users users, @JsonKey(name: "users") Users users,
@JsonKey(name: "unread_messages_count") int unreadMessagesCount}); @JsonKey(name: "unread_messages_count") int unreadMessagesCount,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? chosenPlan});
@override @override
$ChatMessageModelCopyWith<$Res>? get lastMessage; $ChatMessageModelCopyWith<$Res>? get lastMessage;
@override @override
$UsersCopyWith<$Res> get users; $UsersCopyWith<$Res> get users;
@override
$ChosenPlanModelCopyWith<$Res>? get chosenPlan;
} }
/// @nodoc /// @nodoc
@@ -334,6 +611,7 @@ class __$$ChatRoomImplCopyWithImpl<$Res>
Object? lastMessage = freezed, Object? lastMessage = freezed,
Object? users = null, Object? users = null,
Object? unreadMessagesCount = null, Object? unreadMessagesCount = null,
Object? chosenPlan = freezed,
}) { }) {
return _then(_$ChatRoomImpl( return _then(_$ChatRoomImpl(
id: null == id id: null == id
@@ -356,6 +634,10 @@ class __$$ChatRoomImplCopyWithImpl<$Res>
? _value.unreadMessagesCount ? _value.unreadMessagesCount
: unreadMessagesCount // ignore: cast_nullable_to_non_nullable : unreadMessagesCount // ignore: cast_nullable_to_non_nullable
as int, as int,
chosenPlan: freezed == chosenPlan
? _value.chosenPlan
: chosenPlan // ignore: cast_nullable_to_non_nullable
as ChosenPlanModel?,
)); ));
} }
} }
@@ -369,8 +651,9 @@ class _$ChatRoomImpl implements _ChatRoom {
@JsonKey(name: "last_message", fromJson: parseLastMessage) @JsonKey(name: "last_message", fromJson: parseLastMessage)
required this.lastMessage, required this.lastMessage,
@JsonKey(name: "users") required this.users, @JsonKey(name: "users") required this.users,
@JsonKey(name: "unread_messages_count") @JsonKey(name: "unread_messages_count") required this.unreadMessagesCount,
required this.unreadMessagesCount}); @JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
required this.chosenPlan});
factory _$ChatRoomImpl.fromJson(Map<String, dynamic> json) => factory _$ChatRoomImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatRoomImplFromJson(json); _$$ChatRoomImplFromJson(json);
@@ -390,10 +673,13 @@ class _$ChatRoomImpl implements _ChatRoom {
@override @override
@JsonKey(name: "unread_messages_count") @JsonKey(name: "unread_messages_count")
final int unreadMessagesCount; final int unreadMessagesCount;
@override
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
final ChosenPlanModel? chosenPlan;
@override @override
String toString() { String toString() {
return 'ChatRoom(id: $id, roomName: $roomName, lastMessage: $lastMessage, users: $users, unreadMessagesCount: $unreadMessagesCount)'; return 'ChatRoom(id: $id, roomName: $roomName, lastMessage: $lastMessage, users: $users, unreadMessagesCount: $unreadMessagesCount, chosenPlan: $chosenPlan)';
} }
@override @override
@@ -408,13 +694,15 @@ class _$ChatRoomImpl implements _ChatRoom {
other.lastMessage == lastMessage) && other.lastMessage == lastMessage) &&
(identical(other.users, users) || other.users == users) && (identical(other.users, users) || other.users == users) &&
(identical(other.unreadMessagesCount, unreadMessagesCount) || (identical(other.unreadMessagesCount, unreadMessagesCount) ||
other.unreadMessagesCount == unreadMessagesCount)); other.unreadMessagesCount == unreadMessagesCount) &&
(identical(other.chosenPlan, chosenPlan) ||
other.chosenPlan == chosenPlan));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash( int get hashCode => Object.hash(runtimeType, id, roomName, lastMessage, users,
runtimeType, id, roomName, lastMessage, users, unreadMessagesCount); unreadMessagesCount, chosenPlan);
/// Create a copy of ChatRoom /// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@@ -440,7 +728,9 @@ abstract class _ChatRoom implements ChatRoom {
required final ChatMessageModel? lastMessage, required final ChatMessageModel? lastMessage,
@JsonKey(name: "users") required final Users users, @JsonKey(name: "users") required final Users users,
@JsonKey(name: "unread_messages_count") @JsonKey(name: "unread_messages_count")
required final int unreadMessagesCount}) = _$ChatRoomImpl; required final int unreadMessagesCount,
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
required final ChosenPlanModel? chosenPlan}) = _$ChatRoomImpl;
factory _ChatRoom.fromJson(Map<String, dynamic> json) = factory _ChatRoom.fromJson(Map<String, dynamic> json) =
_$ChatRoomImpl.fromJson; _$ChatRoomImpl.fromJson;
@@ -460,6 +750,9 @@ abstract class _ChatRoom implements ChatRoom {
@override @override
@JsonKey(name: "unread_messages_count") @JsonKey(name: "unread_messages_count")
int get unreadMessagesCount; int get unreadMessagesCount;
@override
@JsonKey(name: 'chosen_plan', fromJson: parseChosenPlan)
ChosenPlanModel? get chosenPlan;
/// Create a copy of ChatRoom /// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.

View File

@@ -1,6 +1,6 @@
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'chat_room_preview_model.dart'; part of 'chat_room_pagination_model.dart';
// ************************************************************************** // **************************************************************************
// JsonSerializableGenerator // JsonSerializableGenerator
@@ -9,15 +9,31 @@ part of 'chat_room_preview_model.dart';
_$ChatRoomPreviewModelImpl _$$ChatRoomPreviewModelImplFromJson( _$ChatRoomPreviewModelImpl _$$ChatRoomPreviewModelImplFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$ChatRoomPreviewModelImpl( _$ChatRoomPreviewModelImpl(
chatRooms: (json['chatRooms'] as List<dynamic>) chatRooms: ChatRooms.fromJson(json['chatRooms'] as Map<String, dynamic>),
.map((e) => ChatRoom.fromJson(e as Map<String, dynamic>)) unreadChatsCount: (json['number_of_unread_chat_rooms'] as num).toInt(),
.toList(),
); );
Map<String, dynamic> _$$ChatRoomPreviewModelImplToJson( Map<String, dynamic> _$$ChatRoomPreviewModelImplToJson(
_$ChatRoomPreviewModelImpl instance) => _$ChatRoomPreviewModelImpl instance) =>
<String, dynamic>{ <String, dynamic>{
'chatRooms': instance.chatRooms, 'chatRooms': instance.chatRooms,
'number_of_unread_chat_rooms': instance.unreadChatsCount,
};
_$ChatRoomsImpl _$$ChatRoomsImplFromJson(Map<String, dynamic> json) =>
_$ChatRoomsImpl(
data: (json['data'] as List<dynamic>)
.map((e) => ChatRoom.fromJson(e as Map<String, dynamic>))
.toList(),
lastPage: (json['last_page'] as num).toInt(),
currentPage: (json['current_page'] as num).toInt(),
);
Map<String, dynamic> _$$ChatRoomsImplToJson(_$ChatRoomsImpl instance) =>
<String, dynamic>{
'data': instance.data,
'last_page': instance.lastPage,
'current_page': instance.currentPage,
}; };
_$ChatRoomImpl _$$ChatRoomImplFromJson(Map<String, dynamic> json) => _$ChatRoomImpl _$$ChatRoomImplFromJson(Map<String, dynamic> json) =>
@@ -27,6 +43,7 @@ _$ChatRoomImpl _$$ChatRoomImplFromJson(Map<String, dynamic> json) =>
lastMessage: parseLastMessage(json['last_message']), lastMessage: parseLastMessage(json['last_message']),
users: Users.fromJson(json['users'] as Map<String, dynamic>), users: Users.fromJson(json['users'] as Map<String, dynamic>),
unreadMessagesCount: (json['unread_messages_count'] as num).toInt(), unreadMessagesCount: (json['unread_messages_count'] as num).toInt(),
chosenPlan: parseChosenPlan(json['chosen_plan']),
); );
Map<String, dynamic> _$$ChatRoomImplToJson(_$ChatRoomImpl instance) => Map<String, dynamic> _$$ChatRoomImplToJson(_$ChatRoomImpl instance) =>
@@ -36,6 +53,7 @@ Map<String, dynamic> _$$ChatRoomImplToJson(_$ChatRoomImpl instance) =>
'last_message': instance.lastMessage, 'last_message': instance.lastMessage,
'users': instance.users, 'users': instance.users,
'unread_messages_count': instance.unreadMessagesCount, 'unread_messages_count': instance.unreadMessagesCount,
'chosen_plan': instance.chosenPlan,
}; };
_$UsersImpl _$$UsersImplFromJson(Map<String, dynamic> json) => _$UsersImpl( _$UsersImpl _$$UsersImplFromJson(Map<String, dynamic> json) => _$UsersImpl(

View File

@@ -86,6 +86,18 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
} }
} }
Future<void> cancelChosenPlan({required String chatId, required int planId}) async {
try {
await chatRepository.cancelChosenPlan(id: planId);
final chatRoom = await chatRepository.getChatRoom(chatId);
emit(
(state as ChatRoomStateLoaded).copyWith(chatRoom: chatRoom),
);
} catch (e) {
emit(ChatRoomState.error(errorMessage: 'Ошибка получеия данных'));
}
}
Future<void> _subscribeToChatChannel({ Future<void> _subscribeToChatChannel({
required String chatId, required String chatId,
}) async { }) async {
@@ -93,7 +105,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
if (client == null) return; if (client == null) return;
await wsManager.initPrivateDirectChatChannel(chatId); await wsManager.initPrivateDirectChatChannel(chatId);
wsManager.subscribeDirectChatChannel(); wsManager.subscribeDirectChatChannel();
wsManager.directChatStream?.listen((event) { messagesSubscription = wsManager.directChatStream?.listen((event) {
AudioPlayer().play((AssetSource('audio/recive_message.wav'))); AudioPlayer().play((AssetSource('audio/recive_message.wav')));
final message = ChatMessageModel.fromJson(jsonDecode(event.data)['message']); final message = ChatMessageModel.fromJson(jsonDecode(event.data)['message']);
List<ChatMessageModel> messagesList = [ List<ChatMessageModel> messagesList = [
@@ -111,7 +123,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
); );
}); });
wsManager.clientTypingStream?.listen((event) { typingSubscription = wsManager.clientTypingStream?.listen((event) {
emit( emit(
ChatRoomState.loaded( ChatRoomState.loaded(
chatRoom: (state as ChatRoomStateLoaded).chatRoom, chatRoom: (state as ChatRoomStateLoaded).chatRoom,
@@ -180,6 +192,8 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
@override @override
Future<void> close() async { Future<void> close() async {
wsManager.unsubscribeDirectChatChannel(); wsManager.unsubscribeDirectChatChannel();
messagesSubscription?.cancel();
typingSubscription?.cancel();
super.close(); super.close();
} }
} }

View File

@@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
import 'package:eatvio_app/core/enums/base_state.dart'; import 'package:eatvio_app/core/enums/base_state.dart';
import 'package:eatvio_app/core/websockets/ws_manager.dart'; import 'package:eatvio_app/core/websockets/ws_manager.dart';
@@ -30,21 +31,24 @@ class ChatsCubit extends Cubit<ChatsState> {
}); });
} }
String? _query; String? _query;
int page = 1;
late int lastPage;
Future<void> getChatRoomsWithLoading({String? query}) async { Future<void> getChatRoomsWithLoading({String? query}) async {
page = 1;
_query = query; _query = query;
emit(state.copyWith(state: BaseState.loading)); emit(state.copyWith(state: BaseState.loading));
try { try {
final chatRooms = await chatRepository.getChatRoomPreviews(query: query); final chatRoomsPaginationModel = await chatRepository.getChatRooms(query: query);
final unreadChats = chatRooms.where( final unreadChats = chatRoomsPaginationModel.unreadChatsCount;
(element) => element.unreadMessagesCount > 0, lastPage = chatRoomsPaginationModel.chatRooms.lastPage + 1;
);
emit( emit(
state.copyWith( state.copyWith(
chatRooms: chatRooms, chatRooms: chatRoomsPaginationModel.chatRooms.data,
chatsWithUnreadMessagesCount: unreadChats.length, chatsWithUnreadMessagesCount: unreadChats,
state: BaseState.success, state: BaseState.success,
), ),
); );
page++;
} catch (e) { } catch (e) {
emit( emit(
state.copyWith(errorMessage: e.toString(), state: BaseState.error), state.copyWith(errorMessage: e.toString(), state: BaseState.error),
@@ -53,26 +57,55 @@ class ChatsCubit extends Cubit<ChatsState> {
} }
Future<void> getChatRooms({String? query}) async { Future<void> getChatRooms({String? query}) async {
page = 1;
_query = query; _query = query;
try { try {
final chatRooms = await chatRepository.getChatRoomPreviews(query: query); final chatRoomsPaginationModel = await chatRepository.getChatRooms(query: query);
final unreadChats = chatRooms.where( final unreadChats = chatRoomsPaginationModel.unreadChatsCount;
(element) => element.unreadMessagesCount > 0, lastPage = chatRoomsPaginationModel.chatRooms.lastPage + 1;
);
emit( emit(
state.copyWith( state.copyWith(
chatRooms: chatRooms, chatRooms: chatRoomsPaginationModel.chatRooms.data,
chatsWithUnreadMessagesCount: unreadChats.length, chatsWithUnreadMessagesCount: unreadChats,
state: BaseState.success, state: BaseState.success,
), ),
); );
} catch (e) { page++;
} catch (e, st) {
log(e.toString(), stackTrace: st);
emit( emit(
state.copyWith(errorMessage: e.toString(), state: BaseState.error), state.copyWith(errorMessage: e.toString(), state: BaseState.error),
); );
} }
} }
Future<void> loadMoreChatRooms() async {
try {
if (state.isLoadingMoreChats || lastPage == page) return;
emit(state.copyWith(isLoadingMoreChats: true));
final chatRoomsPaginationModel = await chatRepository.getChatRooms(query: _query, page: page);
final unreadChats = chatRoomsPaginationModel.unreadChatsCount;
emit(
state.copyWith(
chatRooms: [...state.chatRooms, ...chatRoomsPaginationModel.chatRooms.data],
chatsWithUnreadMessagesCount: unreadChats,
state: BaseState.success,
isLoadingMoreChats: false,
),
);
page++;
} catch (e, st) {
log(e.toString(), stackTrace: st);
emit(
state.copyWith(
errorMessage: e.toString(),
state: BaseState.error,
isLoadingMoreChats: false,
),
);
}
}
void reduceUnreadMessagesCount({required String chatId, required int count}) { void reduceUnreadMessagesCount({required String chatId, required int count}) {
bool isChatRead = false; bool isChatRead = false;
final updatedChatRooms = state.chatRooms.map((room) { final updatedChatRooms = state.chatRooms.map((room) {

View File

@@ -1,5 +1,5 @@
import 'package:eatvio_app/core/enums/base_state.dart'; import 'package:eatvio_app/core/enums/base_state.dart';
import 'package:eatvio_app/features/chat/models/chat_room_preview_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_pagination_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
part 'chats_state.freezed.dart'; part 'chats_state.freezed.dart';
@@ -11,6 +11,7 @@ class ChatsState with _$ChatsState {
@Default(BaseState.initial) BaseState state, @Default(BaseState.initial) BaseState state,
@Default(0) int chatsWithUnreadMessagesCount, @Default(0) int chatsWithUnreadMessagesCount,
@Default([]) List<ChatRoom> chatRooms, @Default([]) List<ChatRoom> chatRooms,
@Default(false) bool isLoadingMoreChats,
@Default(null) String? errorMessage, @Default(null) String? errorMessage,
}) = _ChatsState; }) = _ChatsState;

View File

@@ -19,6 +19,7 @@ mixin _$ChatsState {
BaseState get state => throw _privateConstructorUsedError; BaseState get state => throw _privateConstructorUsedError;
int get chatsWithUnreadMessagesCount => throw _privateConstructorUsedError; int get chatsWithUnreadMessagesCount => throw _privateConstructorUsedError;
List<ChatRoom> get chatRooms => throw _privateConstructorUsedError; List<ChatRoom> get chatRooms => throw _privateConstructorUsedError;
bool get isLoadingMoreChats => throw _privateConstructorUsedError;
String? get errorMessage => throw _privateConstructorUsedError; String? get errorMessage => throw _privateConstructorUsedError;
/// Create a copy of ChatsState /// Create a copy of ChatsState
@@ -38,6 +39,7 @@ abstract class $ChatsStateCopyWith<$Res> {
{BaseState state, {BaseState state,
int chatsWithUnreadMessagesCount, int chatsWithUnreadMessagesCount,
List<ChatRoom> chatRooms, List<ChatRoom> chatRooms,
bool isLoadingMoreChats,
String? errorMessage}); String? errorMessage});
} }
@@ -59,6 +61,7 @@ class _$ChatsStateCopyWithImpl<$Res, $Val extends ChatsState>
Object? state = null, Object? state = null,
Object? chatsWithUnreadMessagesCount = null, Object? chatsWithUnreadMessagesCount = null,
Object? chatRooms = null, Object? chatRooms = null,
Object? isLoadingMoreChats = null,
Object? errorMessage = freezed, Object? errorMessage = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
@@ -74,6 +77,10 @@ class _$ChatsStateCopyWithImpl<$Res, $Val extends ChatsState>
? _value.chatRooms ? _value.chatRooms
: chatRooms // ignore: cast_nullable_to_non_nullable : chatRooms // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>, as List<ChatRoom>,
isLoadingMoreChats: null == isLoadingMoreChats
? _value.isLoadingMoreChats
: isLoadingMoreChats // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage: freezed == errorMessage errorMessage: freezed == errorMessage
? _value.errorMessage ? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable : errorMessage // ignore: cast_nullable_to_non_nullable
@@ -94,6 +101,7 @@ abstract class _$$ChatsStateImplCopyWith<$Res>
{BaseState state, {BaseState state,
int chatsWithUnreadMessagesCount, int chatsWithUnreadMessagesCount,
List<ChatRoom> chatRooms, List<ChatRoom> chatRooms,
bool isLoadingMoreChats,
String? errorMessage}); String? errorMessage});
} }
@@ -113,6 +121,7 @@ class __$$ChatsStateImplCopyWithImpl<$Res>
Object? state = null, Object? state = null,
Object? chatsWithUnreadMessagesCount = null, Object? chatsWithUnreadMessagesCount = null,
Object? chatRooms = null, Object? chatRooms = null,
Object? isLoadingMoreChats = null,
Object? errorMessage = freezed, Object? errorMessage = freezed,
}) { }) {
return _then(_$ChatsStateImpl( return _then(_$ChatsStateImpl(
@@ -128,6 +137,10 @@ class __$$ChatsStateImplCopyWithImpl<$Res>
? _value._chatRooms ? _value._chatRooms
: chatRooms // ignore: cast_nullable_to_non_nullable : chatRooms // ignore: cast_nullable_to_non_nullable
as List<ChatRoom>, as List<ChatRoom>,
isLoadingMoreChats: null == isLoadingMoreChats
? _value.isLoadingMoreChats
: isLoadingMoreChats // ignore: cast_nullable_to_non_nullable
as bool,
errorMessage: freezed == errorMessage errorMessage: freezed == errorMessage
? _value.errorMessage ? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable : errorMessage // ignore: cast_nullable_to_non_nullable
@@ -143,6 +156,7 @@ class _$ChatsStateImpl implements _ChatsState {
{this.state = BaseState.initial, {this.state = BaseState.initial,
this.chatsWithUnreadMessagesCount = 0, this.chatsWithUnreadMessagesCount = 0,
final List<ChatRoom> chatRooms = const [], final List<ChatRoom> chatRooms = const [],
this.isLoadingMoreChats = false,
this.errorMessage = null}) this.errorMessage = null})
: _chatRooms = chatRooms; : _chatRooms = chatRooms;
@@ -161,13 +175,16 @@ class _$ChatsStateImpl implements _ChatsState {
return EqualUnmodifiableListView(_chatRooms); return EqualUnmodifiableListView(_chatRooms);
} }
@override
@JsonKey()
final bool isLoadingMoreChats;
@override @override
@JsonKey() @JsonKey()
final String? errorMessage; final String? errorMessage;
@override @override
String toString() { String toString() {
return 'ChatsState(state: $state, chatsWithUnreadMessagesCount: $chatsWithUnreadMessagesCount, chatRooms: $chatRooms, errorMessage: $errorMessage)'; return 'ChatsState(state: $state, chatsWithUnreadMessagesCount: $chatsWithUnreadMessagesCount, chatRooms: $chatRooms, isLoadingMoreChats: $isLoadingMoreChats, errorMessage: $errorMessage)';
} }
@override @override
@@ -182,6 +199,8 @@ class _$ChatsStateImpl implements _ChatsState {
chatsWithUnreadMessagesCount) && chatsWithUnreadMessagesCount) &&
const DeepCollectionEquality() const DeepCollectionEquality()
.equals(other._chatRooms, _chatRooms) && .equals(other._chatRooms, _chatRooms) &&
(identical(other.isLoadingMoreChats, isLoadingMoreChats) ||
other.isLoadingMoreChats == isLoadingMoreChats) &&
(identical(other.errorMessage, errorMessage) || (identical(other.errorMessage, errorMessage) ||
other.errorMessage == errorMessage)); other.errorMessage == errorMessage));
} }
@@ -192,6 +211,7 @@ class _$ChatsStateImpl implements _ChatsState {
state, state,
chatsWithUnreadMessagesCount, chatsWithUnreadMessagesCount,
const DeepCollectionEquality().hash(_chatRooms), const DeepCollectionEquality().hash(_chatRooms),
isLoadingMoreChats,
errorMessage); errorMessage);
/// Create a copy of ChatsState /// Create a copy of ChatsState
@@ -208,6 +228,7 @@ abstract class _ChatsState implements ChatsState {
{final BaseState state, {final BaseState state,
final int chatsWithUnreadMessagesCount, final int chatsWithUnreadMessagesCount,
final List<ChatRoom> chatRooms, final List<ChatRoom> chatRooms,
final bool isLoadingMoreChats,
final String? errorMessage}) = _$ChatsStateImpl; final String? errorMessage}) = _$ChatsStateImpl;
@override @override
@@ -217,6 +238,8 @@ abstract class _ChatsState implements ChatsState {
@override @override
List<ChatRoom> get chatRooms; List<ChatRoom> get chatRooms;
@override @override
bool get isLoadingMoreChats;
@override
String? get errorMessage; String? get errorMessage;
/// Create a copy of ChatsState /// Create a copy of ChatsState

View File

@@ -11,18 +11,20 @@ import 'package:eatvio_app/features/chat/presentation/widgets/chat_bubble_widget
import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/locator_service.dart';
import 'package:eatvio_app/core/theme/custom_text_style.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/theme/theme_helper.dart';
import 'package:eatvio_app/features/chat/presentation/widgets/order_card.dart';
import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:visibility_detector/visibility_detector.dart'; import 'package:visibility_detector/visibility_detector.dart';
class ChatScreen extends StatefulWidget { class ChatScreen extends StatefulWidget {
final String chatId; final String chatId;
final ChatsCubit chatsCubit;
const ChatScreen({ const ChatScreen({
required this.chatId, required this.chatId,
required this.chatsCubit,
super.key, super.key,
}); });
@@ -36,6 +38,7 @@ class _ChatScreenState extends State<ChatScreen> {
final ChatRoomCubit chatRoomCubit = sl<ChatRoomCubit>(); final ChatRoomCubit chatRoomCubit = sl<ChatRoomCubit>();
final List<({int id, int index})> unreadMessagesIds = []; final List<({int id, int index})> unreadMessagesIds = [];
final List<({int id, int index})> unreadMessagesIdsCopy = []; final List<({int id, int index})> unreadMessagesIdsCopy = [];
final showableChatBadgeStates = ChosenPlanStateEnum.getShowableChatBadgeStates();
@override @override
void initState() { void initState() {
@@ -53,6 +56,7 @@ class _ChatScreenState extends State<ChatScreen> {
@override @override
void dispose() { void dispose() {
scrollController.dispose(); scrollController.dispose();
chatRoomCubit.close();
super.dispose(); super.dispose();
} }
@@ -80,6 +84,9 @@ class _ChatScreenState extends State<ChatScreen> {
} }
_buildChat(BuildContext context, ChatRoomStateLoaded state) { _buildChat(BuildContext context, ChatRoomStateLoaded state) {
final chosenPlan = state.chatRoom.chosenPlan;
final amIConsultant = chosenPlan?.consultantId == state.chatRoom.users.sender.id;
final showAboutOrderButton = showableChatBadgeStates.contains(chosenPlan?.chosenPlanState);
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: AppBar( appBar: AppBar(
@@ -88,12 +95,12 @@ class _ChatScreenState extends State<ChatScreen> {
centerTitle: false, centerTitle: false,
title: Row( title: Row(
children: [ children: [
if (state.chatRoom.users['to_chat_user']!.profilePhotoUrl != null) if (state.chatRoom.users.receiver.profilePhotoUrl != null)
CircleAvatar( CircleAvatar(
radius: 20, radius: 20,
foregroundImage: NetworkImage(state.chatRoom.users['to_chat_user']!.profilePhotoUrl!), foregroundImage: NetworkImage(state.chatRoom.users.receiver.profilePhotoUrl!),
), ),
if (state.chatRoom.users['to_chat_user']!.profilePhotoUrl == null) if (state.chatRoom.users.receiver.profilePhotoUrl == null)
Container( Container(
width: 40, width: 40,
height: 40, height: 40,
@@ -103,7 +110,7 @@ class _ChatScreenState extends State<ChatScreen> {
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
child: Text( child: Text(
state.chatRoom.users['to_chat_user']!.name.split(' ').first[0] + state.chatRoom.users['to_chat_user']!.name.split(' ')[1][0], state.chatRoom.users.receiver.name.split(' ').first[0] + state.chatRoom.users.receiver.name.split(' ')[1][0],
style: TextStyle( style: TextStyle(
color: Color(0xFF7F9CF5), color: Color(0xFF7F9CF5),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@@ -116,7 +123,7 @@ class _ChatScreenState extends State<ChatScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
state.chatRoom.users['to_chat_user']!.name, state.chatRoom.users.receiver.name,
style: CustomTextStyles.titleSmallBold.copyWith( style: CustomTextStyles.titleSmallBold.copyWith(
color: PrimaryColors().black, color: PrimaryColors().black,
), ),
@@ -138,28 +145,38 @@ class _ChatScreenState extends State<ChatScreen> {
), ),
), ),
body: SafeArea( body: SafeArea(
child: Column( child: Stack(
mainAxisSize: MainAxisSize.min,
children: [ children: [
Expanded( Column(
child: Container( mainAxisSize: MainAxisSize.min,
color: appTheme.whiteA700, children: [
width: double.maxFinite, Expanded(
child: CustomScrollView( child: Container(
physics: BouncingScrollPhysics(), color: appTheme.whiteA700,
controller: scrollController, width: double.maxFinite,
reverse: true, child: SingleChildScrollView(
slivers: [ physics: BouncingScrollPhysics(),
SliverPadding( controller: scrollController,
padding: EdgeInsets.symmetric(vertical: 16), reverse: true,
sliver: SliverList( child: Column(
delegate: SliverChildBuilderDelegate( children: [
(context, index) { SizedBox(height: 16),
if (index < state.chatMessages.length) { ListView.builder(
physics: NeverScrollableScrollPhysics(),
reverse: true,
shrinkWrap: true,
itemBuilder: (context, index) {
if (index == state.chatMessages.length) {
return Padding(
padding: const EdgeInsets.all(8),
child: const Loader(),
);
}
if ((index + 1 != state.chatMessages.length && if ((index + 1 != state.chatMessages.length &&
state.chatMessages[index].updatedAt.day != state.chatMessages[index + 1].updatedAt.day) || state.chatMessages[index].updatedAt.day != state.chatMessages[index + 1].updatedAt.day) ||
index + 1 == state.chatMessages.length) { index + 1 == state.chatMessages.length) {
final isCurrentUserAuthor = state.chatRoom.users['to_chat_user']!.id != state.chatMessages[index].authorId; final isCurrentUserAuthor = state.chatRoom.users.receiver.id != state.chatMessages[index].authorId;
return Column( return Column(
children: [ children: [
_messageDate(state.chatMessages[index].updatedAt), _messageDate(state.chatMessages[index].updatedAt),
@@ -174,7 +191,9 @@ class _ChatScreenState extends State<ChatScreen> {
() async { () async {
final result = await context.read<ChatRoomCubit>().markMessagesAsRead(state.chatRoom.id, unreadMessagesIdsCopy); final result = await context.read<ChatRoomCubit>().markMessagesAsRead(state.chatRoom.id, unreadMessagesIdsCopy);
if (!result) return; if (!result) return;
widget.chatsCubit.reduceUnreadMessagesCount(chatId: state.chatRoom.id, count: unreadMessagesIdsCopy.length); context
.read<ChatsCubit>()
.reduceUnreadMessagesCount(chatId: state.chatRoom.id, count: unreadMessagesIdsCopy.length);
unreadMessagesIdsCopy.clear(); unreadMessagesIdsCopy.clear();
}, },
); );
@@ -191,7 +210,7 @@ class _ChatScreenState extends State<ChatScreen> {
], ],
); );
} }
final isCurrentUserAuthor = state.chatRoom.users['to_chat_user']!.id != state.chatMessages[index].authorId; final isCurrentUserAuthor = state.chatRoom.users.receiver.id != state.chatMessages[index].authorId;
return VisibilityDetector( return VisibilityDetector(
key: Key(state.chatMessages[index].id.toString()), key: Key(state.chatMessages[index].id.toString()),
onVisibilityChanged: (VisibilityInfo info) { onVisibilityChanged: (VisibilityInfo info) {
@@ -203,7 +222,7 @@ class _ChatScreenState extends State<ChatScreen> {
() async { () async {
final result = await context.read<ChatRoomCubit>().markMessagesAsRead(state.chatRoom.id, unreadMessagesIds); final result = await context.read<ChatRoomCubit>().markMessagesAsRead(state.chatRoom.id, unreadMessagesIds);
if (!result) return; if (!result) return;
widget.chatsCubit.reduceUnreadMessagesCount(chatId: state.chatRoom.id, count: unreadMessagesIds.length); context.read<ChatsCubit>().reduceUnreadMessagesCount(chatId: state.chatRoom.id, count: unreadMessagesIds.length);
unreadMessagesIds.clear(); unreadMessagesIds.clear();
}, },
); );
@@ -217,157 +236,208 @@ class _ChatScreenState extends State<ChatScreen> {
mediaData: state.chatMessages[index].mediaData ?? [], mediaData: state.chatMessages[index].mediaData ?? [],
), ),
); );
} else { },
return Padding( itemCount: state.chatMessages.length + (state.isLoading ? 1 : 0),
padding: const EdgeInsets.all(8), ),
child: const Loader(), SizedBox(height: 16),
); if (chosenPlan != null)
} OrderCard(
}, plan: chosenPlan.plan,
childCount: state.chatMessages.length + (state.isLoading ? 1 : 0), isUserView: !amIConsultant,
), optionType: chosenPlan.optionType,
onCancel: () async {
await context.read<ChatRoomCubit>().cancelChosenPlan(chatId: state.chatRoom.id, planId: chosenPlan.id);
},
),
],
), ),
), ),
], ),
),
Container(
padding: EdgeInsets.symmetric(vertical: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(width: 8),
InkWell(
onTap: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
allowMultiple: true,
type: FileType.custom,
allowedExtensions: [
'pdf',
'doc',
'docx',
'json',
'ppt',
'pptx',
'rtf',
'txt',
'xls',
'xlsx',
'csv',
'jpeg',
'jpg',
'png',
'gif',
'svg',
'xml',
'webp',
],
);
if (result != null) {
List<File> files = result.paths.map((path) => File(path!)).toList();
await chatRoomCubit.sendMessage(
chatId: widget.chatId,
files: files,
);
} else {
// User canceled the picker
}
},
customBorder: CircleBorder(),
child: Ink(
height: 40,
width: 40,
child: Transform.rotate(
angle: pi / 4,
child: Icon(
Icons.attach_file_rounded,
size: 30,
color: Color(0xFF858E99),
),
),
),
),
SizedBox(width: 8),
Expanded(
child: SizedBox(
height: 40,
child: TextFormField(
expands: true,
controller: textEditingController,
maxLines: null,
minLines: null,
keyboardType: TextInputType.multiline,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1),
decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
hintText: 'Сообщение',
hintStyle: 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,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(100),
borderSide: BorderSide(
color: Color(0xFFD1D1D6),
width: 1,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(100),
borderSide: BorderSide(
color: Color(0xFFD1D1D6),
width: 1,
),
),
),
),
),
),
SizedBox(width: 8),
InkWell(
customBorder: CircleBorder(),
onTap: () {
if (textEditingController.text.isNotEmpty) {
chatRoomCubit.sendMessage(
chatId: widget.chatId,
data: textEditingController.text.trim(),
);
setState(() {
textEditingController.clear();
});
}
},
child: Ink(
decoration: BoxDecoration(
color: appTheme.blueA400,
shape: BoxShape.circle,
),
height: 40,
width: 40,
child: Icon(
Icons.arrow_upward_rounded,
size: 24,
color: Colors.white,
),
),
),
SizedBox(width: 8),
],
),
),
],
),
if (showAboutOrderButton)
Positioned(
top: 8,
right: 15,
left: 16,
child: GestureDetector(
onTap: () {},
child: Container(
height: 44,
decoration: BoxDecoration(
color: appTheme.gray50,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox.shrink(),
Text(
S.current.more_about_order,
style: TextStyles.textSMedium.copyWith(color: appTheme.black),
),
Container(
margin: EdgeInsets.only(right: 4),
width: 36,
height: 36,
decoration: BoxDecoration(
color: appTheme.whiteA700,
shape: BoxShape.circle,
),
child: Center(
child: SvgPicture.asset(
'assets/icons/right_arrow.svg',
height: 14,
width: 8,
colorFilter: ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
),
),
),
),
],
),
),
), ),
), ),
),
Container(
padding: EdgeInsets.symmetric(vertical: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(width: 8),
InkWell(
onTap: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
allowMultiple: true,
type: FileType.custom,
allowedExtensions: [
'pdf',
'doc',
'docx',
'json',
'ppt',
'pptx',
'rtf',
'txt',
'xls',
'xlsx',
'csv',
'jpeg',
'jpg',
'png',
'gif',
'svg',
'xml',
'webp',
],
);
if (result != null) {
List<File> files = result.paths.map((path) => File(path!)).toList();
await chatRoomCubit.sendMessage(
chatId: widget.chatId,
files: files,
);
} else {
// User canceled the picker
}
},
customBorder: CircleBorder(),
child: Ink(
height: 40,
width: 40,
child: Transform.rotate(
angle: pi / 4,
child: Icon(
Icons.attach_file_rounded,
size: 30,
color: Color(0xFF858E99),
),
),
),
),
SizedBox(width: 8),
Expanded(
child: SizedBox(
height: 40,
child: TextFormField(
expands: true,
controller: textEditingController,
maxLines: null,
minLines: null,
keyboardType: TextInputType.multiline,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1),
decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
hintText: 'Сообщение',
hintStyle: 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,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(100),
borderSide: BorderSide(
color: Color(0xFFD1D1D6),
width: 1,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(100),
borderSide: BorderSide(
color: Color(0xFFD1D1D6),
width: 1,
),
),
),
),
),
),
SizedBox(width: 8),
InkWell(
customBorder: CircleBorder(),
onTap: () {
if (textEditingController.text.isNotEmpty) {
chatRoomCubit.sendMessage(
chatId: widget.chatId,
data: textEditingController.text.trim(),
);
setState(() {
textEditingController.clear();
});
}
},
child: Ink(
decoration: BoxDecoration(
color: appTheme.blueA400,
shape: BoxShape.circle,
),
height: 40,
width: 40,
child: Icon(
Icons.arrow_upward_rounded,
size: 24,
color: Colors.white,
),
),
),
SizedBox(width: 8),
],
),
),
], ],
), ),
), ),

View File

@@ -1,5 +1,6 @@
import 'package:easy_debounce/easy_debounce.dart'; import 'package:easy_debounce/easy_debounce.dart';
import 'package:eatvio_app/core/enums/base_state.dart'; import 'package:eatvio_app/core/enums/base_state.dart';
import 'package:eatvio_app/core/utils/pagination_utils.dart';
import 'package:eatvio_app/core/widgets/data_error_widget.dart'; import 'package:eatvio_app/core/widgets/data_error_widget.dart';
import 'package:eatvio_app/core/widgets/loader.dart'; import 'package:eatvio_app/core/widgets/loader.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart'; import 'package:eatvio_app/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart';
@@ -65,45 +66,40 @@ class _ChatsScreenState extends State<ChatsScreen> {
), ),
]; ];
}, },
body: stateBuilder(state), body: switch (state.state) {
BaseState.error => DataErrorWidget(onReload: () => context.read<ChatsCubit>().getChatRooms()),
BaseState.success => _buildChatList(context, state),
_ => const Loader(),
},
), ),
); );
}, },
); );
} }
stateBuilder(ChatsState state) {
if (state.state == BaseState.loading) {
return Scaffold(
body: const Loader(),
);
} else if (state.state == BaseState.success) {
return _buildChatList(context, state);
} else if (state.state == BaseState.error) {
return Scaffold(
body: DataErrorWidget(onReload: () => context.read<ChatsCubit>().getChatRooms()),
);
} else {
return Scaffold(
body: const Loader(),
);
}
}
_buildChatList(BuildContext context, ChatsState state) { _buildChatList(BuildContext context, ChatsState state) {
return ListView.separated( return NotificationListener<ScrollNotification>(
padding: EdgeInsets.all(16), onNotification: (notification) {
shrinkWrap: true, loadNewContent(notification, context.read<ChatsCubit>().loadMoreChatRooms);
physics: NeverScrollableScrollPhysics(), return false;
separatorBuilder: (context, index) {
return SizedBox(
height: 8,
);
},
itemCount: state.chatRooms.length,
itemBuilder: (context, index) {
return ChatEntryWidget(chatRoom: state.chatRooms[index]);
}, },
child: ListView.separated(
padding: EdgeInsets.all(16),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
separatorBuilder: (context, index) {
return 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 ChatEntryWidget(chatRoom: state.chatRooms[index]);
},
),
); );
} }
} }

View File

@@ -1,10 +1,8 @@
import 'package:eatvio_app/core/utils/date_time_utils.dart'; import 'package:eatvio_app/core/utils/date_time_utils.dart';
import 'package:eatvio_app/features/chat/models/chat_room_preview_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_pagination_model.dart';
import 'package:eatvio_app/core/theme/custom_text_style.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/theme/theme_helper.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
class ChatEntryWidget extends StatefulWidget { class ChatEntryWidget extends StatefulWidget {
@@ -28,7 +26,6 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
'chatScreen', 'chatScreen',
extra: { extra: {
'chatId': widget.chatRoom.id.toString(), 'chatId': widget.chatRoom.id.toString(),
'chatsCubit': context.read<ChatsCubit>(),
}, },
), ),
child: Ink( child: Ink(

View File

@@ -0,0 +1,77 @@
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';
import 'package:flutter_svg/svg.dart';
class NotificationBanner extends StatelessWidget {
const NotificationBanner({super.key, required this.bannerType});
final BannerType bannerType;
@override
Widget build(BuildContext context) {
final size = MediaQuery.sizeOf(context);
final s = S.of(context);
return Container(
decoration: BoxDecoration(
color: appTheme.gray50,
borderRadius: BorderRadius.circular(20),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 12, right: 8, left: 12),
child: SvgPicture.asset('assets/icons/reversed_exclamation_mark.svg', height: 68, width: 68),
),
Padding(
padding: const EdgeInsets.only(top: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: switch (bannerType) {
BannerType.date => [
SizedBox(
width: size.width * 0.6,
child: Text(s.can_not_choose_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)),
),
SizedBox(height: 12),
GestureDetector(
onTap: () {},
child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
),
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),
GestureDetector(
onTap: () {},
child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
),
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)),
),
SizedBox(height: 12),
GestureDetector(
onTap: () {},
child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
),
SizedBox(height: 16),
],
},
),
),
],
),
);
}
}
enum BannerType { date, card, payment }

View File

@@ -0,0 +1,138 @@
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/utils/localization_utils.dart';
import 'package:eatvio_app/core/utils/string_extentions.dart';
import 'package:eatvio_app/core/widgets/item_widget.dart';
import 'package:eatvio_app/core/widgets/loader.dart';
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
class OrderCard extends StatefulWidget {
final PlanModel plan;
final String optionType;
final bool isUserView;
final Future<void> Function() onCancel;
const OrderCard({super.key, required this.plan, required this.isUserView, required this.optionType, required this.onCancel});
@override
State<OrderCard> createState() => _OrderCardState();
}
class _OrderCardState extends State<OrderCard> {
bool isLoading = false;
@override
Widget build(BuildContext context) {
final optionIndex = int.parse(widget.optionType.characters.last);
final option = switch (optionIndex) {
1 => widget.plan.packet1Options,
2 => widget.plan.packet2Options,
3 => widget.plan.packet3Options,
_ => null,
};
final s = S.of(context);
return Container(
margin: EdgeInsets.symmetric(horizontal: 16),
padding: EdgeInsets.only(top: 8, bottom: 12, left: 8, right: 8),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: appTheme.gray60004),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 200,
width: double.infinity,
child: Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.network(
baseUrl + '/storage/' + widget.plan.image,
width: double.infinity,
fit: BoxFit.cover,
),
),
Positioned(
left: 0,
bottom: 44,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.only(
topRight: Radius.circular(12),
bottomRight: Radius.circular(12),
),
),
child: Text(
'${widget.plan.duration} ${getDayForm(widget.plan.duration, s).capitalize()}',
style: TextStyles.textSMedium.copyWith(color: appTheme.whiteA700),
),
),
),
Positioned(
left: 0,
bottom: 12,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: appTheme.greenA700,
borderRadius: BorderRadius.only(
topRight: Radius.circular(12),
bottomRight: Radius.circular(12),
),
),
child: Text(
'${s.from} ${widget.plan.minPriceOfOptions.toStringAsFixed(0)}₽',
style: TextStyles.textSMedium.copyWith(color: appTheme.whiteA700),
),
),
),
],
),
),
SizedBox(height: 12),
Text(
'${widget.plan.name}',
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 12),
Text(
'${s.option}: ${option?.short ?? ''}',
style: TextStyles.textMSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 8),
if (option != null)
...option.items
.map(
(element) => Padding(
padding: const EdgeInsets.only(bottom: 4),
child: ItemWidget(
reversed: true,
iconSize: 12,
text: element,
),
),
)
.toList(),
if (widget.isUserView) ...[
SizedBox(height: 8),
isLoading
? Loader()
: GestureDetector(
onTap: () async {
setState(() => isLoading = true);
await widget.onCancel();
setState(() => isLoading = false);
},
child: Text(
'${s.cancel_order}',
style: TextStyles.textSMedium.copyWith(color: appTheme.strongRed),
),
),
],
],
),
);
}
}

View File

@@ -5,7 +5,7 @@ import 'package:dio/dio.dart';
import 'package:eatvio_app/features/chat/models/chat_message_model.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_messages_model.dart';
import 'package:eatvio_app/features/chat/models/chat_room_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_model.dart';
import 'package:eatvio_app/features/chat/models/chat_room_preview_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_pagination_model.dart';
import 'package:eatvio_app/features/chat/services/chat_service.dart'; import 'package:eatvio_app/features/chat/services/chat_service.dart';
import 'package:http_parser/http_parser.dart'; import 'package:http_parser/http_parser.dart';
@@ -62,9 +62,9 @@ class ChatRepository {
} }
} }
Future<List<ChatRoom>> getChatRoomPreviews({String? query}) async { Future<ChatRoomPaginationModel> getChatRooms({String? query, int page = 1}) async {
try { try {
return (await chatService.getChatRoomPreviews(query: query)).chatRooms; return (await chatService.getChatRooms(query: query, page: page));
} catch (e) { } catch (e) {
rethrow; rethrow;
} }
@@ -93,4 +93,14 @@ class ChatRepository {
rethrow; rethrow;
} }
} }
Future<void> cancelChosenPlan({
required int id,
}) async {
try {
await chatService.cancelChosenPlan(id: id);
} catch (e) {
rethrow;
}
}
} }

View File

@@ -1,7 +1,7 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:eatvio_app/features/chat/models/chat_messages_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_model.dart';
import 'package:eatvio_app/features/chat/models/chat_room_preview_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_pagination_model.dart';
import 'package:retrofit/retrofit.dart'; import 'package:retrofit/retrofit.dart';
part 'chat_service.g.dart'; part 'chat_service.g.dart';
@@ -11,7 +11,8 @@ abstract class ChatService {
factory ChatService(Dio dio, {String baseUrl}) = _ChatService; factory ChatService(Dio dio, {String baseUrl}) = _ChatService;
@GET('/api/chat/index') @GET('/api/chat/index')
Future<ChatRoomPreviewModel> getChatRoomPreviews({ Future<ChatRoomPaginationModel> getChatRooms({
@Query('page') required int page,
@Query('find') String? query, @Query('find') String? query,
}); });
@@ -40,5 +41,13 @@ abstract class ChatService {
}); });
@POST('/api/chat/{id}/messages/markAsRead') @POST('/api/chat/{id}/messages/markAsRead')
Future<void> markMessagesAsRead({@Path() required String id, @Body() required Map<String, List<int>> body}); Future<void> markMessagesAsRead({
@Path() required String id,
@Body() required Map<String, List<int>> body,
});
@POST('/api/chosen_plans/{id}/cancel')
Future<void> cancelChosenPlan({
@Path() required int id,
});
} }

View File

@@ -18,13 +18,16 @@ class _ChatService implements ChatService {
final ParseErrorLogger? errorLogger; final ParseErrorLogger? errorLogger;
@override @override
Future<ChatRoomPreviewModel> getChatRoomPreviews({String? query}) async { Future<ChatRoomPaginationModel> getChatRooms({
required int page,
String? query,
}) async {
final _extra = <String, dynamic>{}; final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{r'find': query}; final queryParameters = <String, dynamic>{r'page': page, r'find': query};
queryParameters.removeWhere((k, v) => v == null); queryParameters.removeWhere((k, v) => v == null);
final _headers = <String, dynamic>{}; final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null; const Map<String, dynamic>? _data = null;
final _options = _setStreamType<ChatRoomPreviewModel>( final _options = _setStreamType<ChatRoomPaginationModel>(
Options(method: 'GET', headers: _headers, extra: _extra) Options(method: 'GET', headers: _headers, extra: _extra)
.compose( .compose(
_dio.options, _dio.options,
@@ -35,9 +38,9 @@ class _ChatService implements ChatService {
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
); );
final _result = await _dio.fetch<Map<String, dynamic>>(_options); final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late ChatRoomPreviewModel _value; late ChatRoomPaginationModel _value;
try { try {
_value = ChatRoomPreviewModel.fromJson(_result.data!); _value = ChatRoomPaginationModel.fromJson(_result.data!);
} on Object catch (e, s) { } on Object catch (e, s) {
errorLogger?.logError(e, s, _options); errorLogger?.logError(e, s, _options);
rethrow; rethrow;
@@ -190,6 +193,25 @@ class _ChatService implements ChatService {
await _dio.fetch<void>(_options); await _dio.fetch<void>(_options);
} }
@override
Future<void> cancelChosenPlan({required int id}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _options = _setStreamType<void>(
Options(method: 'POST', headers: _headers, extra: _extra)
.compose(
_dio.options,
'/api/chosen_plans/${id}/cancel',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
await _dio.fetch<void>(_options);
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) { RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic && if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes || !(requestOptions.responseType == ResponseType.bytes ||

View File

@@ -140,10 +140,10 @@ class GetChatRoomPreviews implements TestCases {
Future<bool> run({required String baseUrl}) async { Future<bool> run({required String baseUrl}) async {
try { try {
// get all of needed services // get all of needed services
final dio = sl<Dio>(); // final dio = sl<Dio>();
final chatService = ChatService(dio, baseUrl: baseUrl); // final chatService = ChatService(dio, baseUrl: baseUrl);
await chatService.getChatRoomPreviews(); // await chatService.getChatRooms();
return true; return true;
} catch (e) { } catch (e) {
return false; return false;
@@ -158,11 +158,11 @@ class GetChatRoom implements TestCases {
@override @override
Future<bool> run({required String baseUrl}) async { Future<bool> run({required String baseUrl}) async {
try { try {
final dio = sl<Dio>(); // final dio = sl<Dio>();
final chatService = ChatService(dio, baseUrl: baseUrl); // final chatService = ChatService(dio, baseUrl: baseUrl);
final chatRoomsModels = await chatService.getChatRoomPreviews(); // final chatRoomsModels = await chatService.getChatRoomPreviews();
await chatService.getChatRoom(id: chatRoomsModels.chatRooms.firstOrNull?.id ?? ''); // await chatService.getChatRoom(id: chatRoomsModels.chatRooms.firstOrNull?.id ?? '');
return true; return true;
} catch (e) { } catch (e) {
return false; return false;
@@ -177,11 +177,11 @@ class SendMessage implements TestCases {
@override @override
Future<bool> run({required String baseUrl}) async { Future<bool> run({required String baseUrl}) async {
try { try {
final dio = sl<Dio>(); // final dio = sl<Dio>();
final chatService = ChatService(dio, baseUrl: baseUrl); // final chatService = ChatService(dio, baseUrl: baseUrl);
final chatRoomsModels = await chatService.getChatRoomPreviews(); // final chatRoomsModels = await chatService.getChatRoomPreviews();
await chatService.sendMessage(id: chatRoomsModels.chatRooms.firstOrNull?.id ?? '', data: 'test message'); // await chatService.sendMessage(id: chatRoomsModels.chatRooms.firstOrNull?.id ?? '', data: 'test message');
return true; return true;
} catch (e) { } catch (e) {
return false; return false;
@@ -196,11 +196,11 @@ class GetChatMessages implements TestCases {
@override @override
Future<bool> run({required String baseUrl}) async { Future<bool> run({required String baseUrl}) async {
try { try {
final dio = sl<Dio>(); // final dio = sl<Dio>();
final chatService = ChatService(dio, baseUrl: baseUrl); // final chatService = ChatService(dio, baseUrl: baseUrl);
final chatRoomsModels = await chatService.getChatRoomPreviews(); // final chatRoomsModels = await chatService.getChatRoomPreviews();
await chatService.getChatMessages(id: chatRoomsModels.chatRooms.firstOrNull?.id ?? '', page: 1); // await chatService.getChatMessages(id: chatRoomsModels.chatRooms.firstOrNull?.id ?? '', page: 1);
return true; return true;
} catch (e) { } catch (e) {
return false; return false;

View File

@@ -115,7 +115,7 @@ class DietsCubit extends Cubit<DietsState> {
} }
} }
loadNextPage() async { Future<void> loadNextPage() async {
if (currentPage < lastPage && !isLoading) { if (currentPage < lastPage && !isLoading) {
isLoading = true; isLoading = true;

View File

@@ -47,7 +47,7 @@ class FeedCubit extends Cubit<FeedState> {
} }
} }
loadNextPage() async { Future<void> loadNextPage() async {
if (currentPage < lastPage && !isLoading) { if (currentPage < lastPage && !isLoading) {
isLoading = true; isLoading = true;

View File

@@ -174,7 +174,7 @@ class PlansCubit extends Cubit<PlansState> {
} }
} }
loadNextPage() async { Future<void> loadNextPage() async {
if (currentPage < lastPage && !isLoading) { if (currentPage < lastPage && !isLoading) {
isLoading = true; isLoading = true;

View File

@@ -67,7 +67,7 @@ class RecipesCubit extends Cubit<RecipesState> {
} }
} }
loadNextPage() async { Future<void> loadNextPage() async {
if (currentPage < lastPage && !isLoading) { if (currentPage < lastPage && !isLoading) {
isLoading = true; isLoading = true;

View File

@@ -78,37 +78,11 @@ class _FeedScreenContentState extends State<FeedScreenContent> {
@override @override
void initState() { void initState() {
blogPostsScrollController.addListener(_onScrollBlogPosts);
recipesScrollController.addListener(_onScrollRecipes);
dietsScrollController.addListener(_onScrollDiets);
plansScrollController.addListener(_onScrollPlans);
consultantsScrollController.addListener(_onScrollConsultants); consultantsScrollController.addListener(_onScrollConsultants);
super.initState(); super.initState();
} }
_onScrollBlogPosts() {
if (blogPostsScrollController.offset >= blogPostsScrollController.position.maxScrollExtent && !blogPostsScrollController.position.outOfRange) {
context.read<FeedCubit>().loadNextPage();
}
}
_onScrollRecipes() {
if (recipesScrollController.offset >= recipesScrollController.position.maxScrollExtent && !recipesScrollController.position.outOfRange) {
context.read<RecipesCubit>().loadNextPage();
}
}
_onScrollDiets() {
if (dietsScrollController.offset >= dietsScrollController.position.maxScrollExtent && !dietsScrollController.position.outOfRange) {
context.read<DietsCubit>().loadNextPage();
}
}
_onScrollPlans() {
if (plansScrollController.offset >= plansScrollController.position.maxScrollExtent && !plansScrollController.position.outOfRange) {
context.read<PlansCubit>().loadNextPage();
}
}
_onScrollConsultants() { _onScrollConsultants() {
if (consultantsScrollController.offset >= consultantsScrollController.position.maxScrollExtent && !consultantsScrollController.position.outOfRange) {} if (consultantsScrollController.offset >= consultantsScrollController.position.maxScrollExtent && !consultantsScrollController.position.outOfRange) {}

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/core/utils/pagination_utils.dart';
import 'package:eatvio_app/core/widgets/data_error_widget.dart'; import 'package:eatvio_app/core/widgets/data_error_widget.dart';
import 'package:eatvio_app/core/widgets/loader.dart'; import 'package:eatvio_app/core/widgets/loader.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart';
@@ -16,20 +17,26 @@ class BlogPosts extends StatelessWidget {
child: BlocBuilder<FeedCubit, FeedState>( child: BlocBuilder<FeedCubit, FeedState>(
builder: (BuildContext context, FeedState state) { builder: (BuildContext context, FeedState state) {
if (state is FeedStateLoaded) { if (state is FeedStateLoaded) {
return ListView.separated( return NotificationListener<ScrollNotification>(
padding: EdgeInsets.symmetric(vertical: 8), onNotification: (notification) {
shrinkWrap: true, loadNewContent(notification, context.read<FeedCubit>().loadNextPage);
physics: BouncingScrollPhysics(), return false;
itemBuilder: (context, index) {
if (index == state.feedBlogPostList.length) {
return const Loader();
}
return BlogPostWidget(index: index);
}, },
separatorBuilder: (context, index) { child: ListView.separated(
return SizedBox(height: 8); padding: EdgeInsets.symmetric(vertical: 8),
}, shrinkWrap: true,
itemCount: state.isLoading ? state.feedBlogPostList.length + 1 : state.feedBlogPostList.length, physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
if (index == state.feedBlogPostList.length) {
return const Loader();
}
return BlogPostWidget(index: index);
},
separatorBuilder: (context, index) {
return SizedBox(height: 8);
},
itemCount: state.isLoading ? state.feedBlogPostList.length + 1 : state.feedBlogPostList.length,
),
); );
} else if (state is FeedStateError) { } else if (state is FeedStateError) {
return DataErrorWidget( return DataErrorWidget(

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/core/utils/pagination_utils.dart';
import 'package:eatvio_app/core/widgets/data_error_widget.dart'; import 'package:eatvio_app/core/widgets/data_error_widget.dart';
import 'package:eatvio_app/core/widgets/loader.dart'; import 'package:eatvio_app/core/widgets/loader.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart';
@@ -28,17 +29,23 @@ class Diets extends StatelessWidget {
return Stack( return Stack(
children: [ children: [
SizedBox.expand(), SizedBox.expand(),
ListView.separated( NotificationListener<ScrollNotification>(
padding: EdgeInsets.symmetric(vertical: 8), onNotification: (notification) {
shrinkWrap: true, loadNewContent(notification, context.read<DietsCubit>().loadNextPage);
physics: BouncingScrollPhysics(), return false;
itemBuilder: (context, index) {
return DietsWidget(diet: state.dietsList[index], index: index);
}, },
separatorBuilder: (context, index) { child: ListView.separated(
return SizedBox(height: 8); padding: EdgeInsets.symmetric(vertical: 8),
}, shrinkWrap: true,
itemCount: state.dietsList.length, physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
return DietsWidget(diet: state.dietsList[index], index: index);
},
separatorBuilder: (context, index) {
return SizedBox(height: 8);
},
itemCount: state.dietsList.length,
),
), ),
Positioned( Positioned(
right: 0, right: 0,

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/core/utils/pagination_utils.dart';
import 'package:eatvio_app/core/widgets/data_error_widget.dart'; import 'package:eatvio_app/core/widgets/data_error_widget.dart';
import 'package:eatvio_app/core/widgets/loader.dart'; import 'package:eatvio_app/core/widgets/loader.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart';
@@ -28,20 +29,26 @@ class Plans extends StatelessWidget {
return Stack( return Stack(
children: [ children: [
SizedBox.expand(), SizedBox.expand(),
ListView.separated( NotificationListener<ScrollNotification>(
padding: EdgeInsets.symmetric(vertical: 8), onNotification: (notification) {
shrinkWrap: true, loadNewContent(notification, context.read<PlansCubit>().loadNextPage);
physics: BouncingScrollPhysics(), return false;
itemBuilder: (context, index) {
return PlanWidget(
plan: state.plans[index],
index: index,
);
}, },
separatorBuilder: (context, index) { child: ListView.separated(
return SizedBox(height: 8); padding: EdgeInsets.symmetric(vertical: 8),
}, shrinkWrap: true,
itemCount: state.plans.length, physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
return PlanWidget(
plan: state.plans[index],
index: index,
);
},
separatorBuilder: (context, index) {
return SizedBox(height: 8);
},
itemCount: state.plans.length,
),
), ),
Positioned( Positioned(
right: 0, right: 0,

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/core/utils/pagination_utils.dart';
import 'package:eatvio_app/core/widgets/data_error_widget.dart'; import 'package:eatvio_app/core/widgets/data_error_widget.dart';
import 'package:eatvio_app/core/widgets/loader.dart'; import 'package:eatvio_app/core/widgets/loader.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart';
@@ -29,20 +30,26 @@ class Recipes extends StatelessWidget {
); );
} }
return ListView.separated( return NotificationListener<ScrollNotification>(
padding: EdgeInsets.symmetric(vertical: 8), onNotification: (notification) {
shrinkWrap: true, loadNewContent(notification, context.read<RecipesCubit>().loadNextPage);
physics: BouncingScrollPhysics(), return false;
itemBuilder: (context, index) {
return RecipesWidget(
recipe: state.recipesList[index],
index: index,
);
}, },
separatorBuilder: (context, index) { child: ListView.separated(
return SizedBox(height: 8); padding: EdgeInsets.symmetric(vertical: 8),
}, shrinkWrap: true,
itemCount: state.recipesList.length, physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
return RecipesWidget(
recipe: state.recipesList[index],
index: index,
);
},
separatorBuilder: (context, index) {
return SizedBox(height: 8);
},
itemCount: state.recipesList.length,
),
); );
}, },
), ),

View File

@@ -0,0 +1,44 @@
import 'package:freezed_annotation/freezed_annotation.dart';
enum ChosenPlanStateEnum {
@JsonValue('initied')
stateInited,
@JsonValue('start_date_has_been_set')
stateStartDateHasBeenSet,
@JsonValue('in_coordination')
stateInCoordination,
@JsonValue('started')
stateStarted,
@JsonValue('in_progress')
stateInProgress,
@JsonValue('pending_payment')
statePendingPayment,
@JsonValue('confirmed_by_consultant')
stateConfirmedByConsultant,
@JsonValue('paid')
statePaid,
@JsonValue('canceled_by_the_initiator')
stateCanceledByTheInitiator,
@JsonValue('last_day_started')
stateLastDayStarted,
@JsonValue('last_day_finished')
stateLastDayFinished,
@JsonValue('complained')
stateComplained,
@JsonValue('done')
stateDone,
@JsonValue('charge_was_collected')
stateChargeWasCollected;
static List<ChosenPlanStateEnum> getShowableChatBadgeStates() {
return [
ChosenPlanStateEnum.stateInCoordination,
ChosenPlanStateEnum.stateStartDateHasBeenSet,
ChosenPlanStateEnum.statePendingPayment,
ChosenPlanStateEnum.statePaid,
ChosenPlanStateEnum.stateLastDayStarted,
ChosenPlanStateEnum.stateLastDayFinished,
ChosenPlanStateEnum.stateDone,
];
}
}

View File

@@ -0,0 +1,29 @@
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'chosen_plan_model.freezed.dart';
part 'chosen_plan_model.g.dart';
@freezed
class ChosenPlanModel with _$ChosenPlanModel {
factory ChosenPlanModel({
@JsonKey() required int id,
@JsonKey(name: 'option_type') required String optionType,
@JsonKey(name: 'start_date') required DateTime startDate,
@JsonKey(name: 'last_state') required ChosenPlanStateEnum chosenPlanState,
@JsonKey(name: 'chat_id') required String chatId,
@JsonKey(name: 'consultant_id') required int consultantId,
@JsonKey(name: 'plan') required PlanModel plan,
}) = _ChosenPlanModel;
factory ChosenPlanModel.fromJson(Map<String, dynamic> json) => _$ChosenPlanModelFromJson(json);
}
ChosenPlanModel? parseChosenPlan(json) {
if (json is Map<String, dynamic>) {
return ChosenPlanModel.fromJson(json);
}
return null;
}

View File

@@ -0,0 +1,332 @@
// 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 'chosen_plan_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(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');
ChosenPlanModel _$ChosenPlanModelFromJson(Map<String, dynamic> json) {
return _ChosenPlanModel.fromJson(json);
}
/// @nodoc
mixin _$ChosenPlanModel {
@JsonKey()
int get id => throw _privateConstructorUsedError;
@JsonKey(name: 'option_type')
String get optionType => throw _privateConstructorUsedError;
@JsonKey(name: 'start_date')
DateTime get startDate => throw _privateConstructorUsedError;
@JsonKey(name: 'last_state')
ChosenPlanStateEnum get chosenPlanState => throw _privateConstructorUsedError;
@JsonKey(name: 'chat_id')
String get chatId => throw _privateConstructorUsedError;
@JsonKey(name: 'consultant_id')
int get consultantId => throw _privateConstructorUsedError;
@JsonKey(name: 'plan')
PlanModel get plan => throw _privateConstructorUsedError;
/// Serializes this ChosenPlanModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChosenPlanModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChosenPlanModelCopyWith<ChosenPlanModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ChosenPlanModelCopyWith<$Res> {
factory $ChosenPlanModelCopyWith(
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});
$PlanModelCopyWith<$Res> get plan;
}
/// @nodoc
class _$ChosenPlanModelCopyWithImpl<$Res, $Val extends ChosenPlanModel>
implements $ChosenPlanModelCopyWith<$Res> {
_$ChosenPlanModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChosenPlanModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? optionType = null,
Object? startDate = null,
Object? chosenPlanState = null,
Object? chatId = null,
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);
}
/// Create a copy of ChosenPlanModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$PlanModelCopyWith<$Res> get plan {
return $PlanModelCopyWith<$Res>(_value.plan, (value) {
return _then(_value.copyWith(plan: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$ChosenPlanModelImplCopyWith<$Res>
implements $ChosenPlanModelCopyWith<$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});
@override
$PlanModelCopyWith<$Res> get plan;
}
/// @nodoc
class __$$ChosenPlanModelImplCopyWithImpl<$Res>
extends _$ChosenPlanModelCopyWithImpl<$Res, _$ChosenPlanModelImpl>
implements _$$ChosenPlanModelImplCopyWith<$Res> {
__$$ChosenPlanModelImplCopyWithImpl(
_$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.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? optionType = null,
Object? startDate = null,
Object? chosenPlanState = null,
Object? chatId = null,
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,
));
}
}
/// @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});
factory _$ChosenPlanModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChosenPlanModelImplFromJson(json);
@override
@JsonKey()
final int id;
@override
@JsonKey(name: 'option_type')
final String optionType;
@override
@JsonKey(name: 'start_date')
final DateTime startDate;
@override
@JsonKey(name: 'last_state')
final ChosenPlanStateEnum chosenPlanState;
@override
@JsonKey(name: 'chat_id')
final String chatId;
@override
@JsonKey(name: 'consultant_id')
final int consultantId;
@override
@JsonKey(name: 'plan')
final PlanModel plan;
@override
String toString() {
return 'ChosenPlanModel(id: $id, optionType: $optionType, startDate: $startDate, chosenPlanState: $chosenPlanState, chatId: $chatId, consultantId: $consultantId, plan: $plan)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ChosenPlanModelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.optionType, optionType) ||
other.optionType == optionType) &&
(identical(other.startDate, startDate) ||
other.startDate == startDate) &&
(identical(other.chosenPlanState, chosenPlanState) ||
other.chosenPlanState == chosenPlanState) &&
(identical(other.chatId, chatId) || other.chatId == chatId) &&
(identical(other.consultantId, consultantId) ||
other.consultantId == consultantId) &&
(identical(other.plan, plan) || other.plan == plan));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
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.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChosenPlanModelImplCopyWith<_$ChosenPlanModelImpl> get copyWith =>
__$$ChosenPlanModelImplCopyWithImpl<_$ChosenPlanModelImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
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.fromJson(Map<String, dynamic> json) =
_$ChosenPlanModelImpl.fromJson;
@override
@JsonKey()
int get id;
@override
@JsonKey(name: 'option_type')
String get optionType;
@override
@JsonKey(name: 'start_date')
DateTime get startDate;
@override
@JsonKey(name: 'last_state')
ChosenPlanStateEnum get chosenPlanState;
@override
@JsonKey(name: 'chat_id')
String get chatId;
@override
@JsonKey(name: 'consultant_id')
int get consultantId;
@override
@JsonKey(name: 'plan')
PlanModel get plan;
/// Create a copy of ChosenPlanModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChosenPlanModelImplCopyWith<_$ChosenPlanModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,49 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'chosen_plan_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$ChosenPlanModelImpl _$$ChosenPlanModelImplFromJson(
Map<String, dynamic> 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<String, dynamic>),
);
Map<String, dynamic> _$$ChosenPlanModelImplToJson(
_$ChosenPlanModelImpl instance) =>
<String, dynamic>{
'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',
ChosenPlanStateEnum.stateStartDateHasBeenSet: 'start_date_has_been_set',
ChosenPlanStateEnum.stateInCoordination: 'in_coordination',
ChosenPlanStateEnum.stateStarted: 'started',
ChosenPlanStateEnum.stateInProgress: 'in_progress',
ChosenPlanStateEnum.statePendingPayment: 'pending_payment',
ChosenPlanStateEnum.stateConfirmedByConsultant: 'confirmed_by_consultant',
ChosenPlanStateEnum.statePaid: 'paid',
ChosenPlanStateEnum.stateCanceledByTheInitiator: 'canceled_by_the_initiator',
ChosenPlanStateEnum.stateLastDayStarted: 'last_day_started',
ChosenPlanStateEnum.stateLastDayFinished: 'last_day_finished',
ChosenPlanStateEnum.stateComplained: 'complained',
ChosenPlanStateEnum.stateDone: 'done',
ChosenPlanStateEnum.stateChargeWasCollected: 'charge_was_collected',
};

View File

@@ -1,8 +1,10 @@
import 'dart:developer'; import 'dart:developer';
import 'package:dio/dio.dart';
import 'package:easy_debounce/easy_debounce.dart'; import 'package:easy_debounce/easy_debounce.dart';
import 'package:eatvio_app/core/utils/toasts.dart'; import 'package:eatvio_app/core/utils/toasts.dart';
import 'package:eatvio_app/features/diets/repositories/diet_repository.dart'; import 'package:eatvio_app/features/diets/repositories/diet_repository.dart';
import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart';
import 'package:eatvio_app/features/plans/presentation/cubit/about_plan_state.dart'; import 'package:eatvio_app/features/plans/presentation/cubit/about_plan_state.dart';
import 'package:eatvio_app/features/plans/repositories/plan_repository.dart'; import 'package:eatvio_app/features/plans/repositories/plan_repository.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
@@ -125,4 +127,27 @@ class AboutPlanCubit extends Cubit<AboutPlanState> {
}, },
); );
} }
Future<ChosenPlanModel?> chosePlan() async {
try {
final slug = state.planModel?.slug;
final optionIndex = state.chosenOptionIndex;
if (slug != null) {
final optionName = _getOptionNameFromIndex(optionIndex);
final body = {'options_type': optionName};
return await planRepository.chosePlan(slug, body);
}
} on DioException catch (e, st) {
log(e.toString(), stackTrace: st);
} catch (e, st) {
log(e.toString(), stackTrace: st);
}
return null;
}
String _getOptionNameFromIndex(int index) => switch (index) {
1 => 'options2',
2 => 'options3',
_ => 'options1',
};
} }

View File

@@ -10,6 +10,7 @@ import 'package:eatvio_app/core/widgets/bookmark_button.dart';
import 'package:eatvio_app/core/widgets/data_error_widget.dart'; import 'package:eatvio_app/core/widgets/data_error_widget.dart';
import 'package:eatvio_app/core/widgets/info_row.dart'; import 'package:eatvio_app/core/widgets/info_row.dart';
import 'package:eatvio_app/core/widgets/loader.dart'; import 'package:eatvio_app/core/widgets/loader.dart';
import 'package:eatvio_app/core/widgets/show_error_dialog.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/author_card.dart'; import 'package:eatvio_app/features/diets/presentation/widgets/author_card.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/expandable_text.dart'; import 'package:eatvio_app/features/diets/presentation/widgets/expandable_text.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart'; import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
@@ -30,6 +31,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_portal/flutter_portal.dart'; import 'package:flutter_portal/flutter_portal.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import '../widgets/option_widget.dart'; import '../widgets/option_widget.dart';
@@ -217,17 +219,21 @@ class _AboutPlanScreenState extends State<AboutPlanScreen> {
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
backgroundColor: appTheme.greenA700, backgroundColor: appTheme.greenA700,
onPressed: () { onPressed: () async {
/// TODO: добавить обработку покупки плана final chosenPlan = await context.read<AboutPlanCubit>().chosePlan();
// showModalBottomSheet( if (chosenPlan == null) {
// context: context, showErrorDialog(context, title: 'Не удалось заказать план');
// builder: (context) => StartDietBottomSheet( return;
// aboutDietCubit: context.read<AboutDietCubit>(), }
// ), GoRouter.of(context).pushReplacementNamed(
// ); 'chatScreen',
extra: {
'chatId': chosenPlan.chatId,
},
);
}, },
label: Text( label: Text(
s.startDiet, s.to_order,
style: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700), style: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
), ),
), ),

View File

@@ -1,27 +0,0 @@
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class ItemWidget extends StatelessWidget {
const ItemWidget({super.key, required this.text});
final String text;
@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
child: Text(
text,
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
SvgPicture.asset(
'assets/icons/ok.svg',
width: 20,
height: 20,
),
],
);
}
}

View File

@@ -3,7 +3,7 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/core/widgets/custom_divider.dart'; import 'package:eatvio_app/core/widgets/custom_divider.dart';
import 'package:eatvio_app/core/widgets/main_background_bouble.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/features/feed/models/plan_pagination_model.dart';
import 'package:eatvio_app/features/plans/presentation/widgets/item_widget.dart'; import 'package:eatvio_app/core/widgets/item_widget.dart';
import 'package:eatvio_app/features/plans/presentation/widgets/option_duration_widget.dart'; import 'package:eatvio_app/features/plans/presentation/widgets/option_duration_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

View File

@@ -1,9 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'package:eatvio_app/features/diets/repositories/diet_repository.dart'; import 'package:eatvio_app/features/diets/repositories/diet_repository.dart';
import 'package:eatvio_app/features/feed/models/plan_pagination_model.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/services/plan_service.dart'; import 'package:eatvio_app/features/plans/services/plan_service.dart';
class PlanRepository { class PlanRepository {
final PlanService planService; final PlanService planService;
@@ -48,9 +48,15 @@ class PlanRepository {
} }
} }
Future<ChosenPlanModel> chosePlan(String slug, Map<String, dynamic> option ) async {
try {
return await planService.chosePlan(slug: slug, option: option);
} catch (e) {
rethrow;
}
}
void emitLikesStateToFeed(LikesState state) => _planLikeStateStreamController.add(state); void emitLikesStateToFeed(LikesState state) => _planLikeStateStreamController.add(state);
void emitFavoriteStateToFeed(FavoriteState state) => _planFavoriteStateStreamController.add(state); void emitFavoriteStateToFeed(FavoriteState state) => _planFavoriteStateStreamController.add(state);
void emitCommentsStateToFeed(CommentsState state) => _planCommentsStateStreamController.add(state); void emitCommentsStateToFeed(CommentsState state) => _planCommentsStateStreamController.add(state);
} }

View File

@@ -1,20 +1,18 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:eatvio_app/features/feed/models/plan_pagination_model.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:retrofit/retrofit.dart'; import 'package:retrofit/retrofit.dart';
part 'plan_service.g.dart'; part 'plan_service.g.dart';
@RestApi() @RestApi()
abstract class PlanService { abstract class PlanService {
factory PlanService(Dio dio, {String baseUrl}) = _PlanService; factory PlanService(Dio dio, {String baseUrl}) = _PlanService;
@GET('/api/plans/show/{slug}') @GET('/api/plans/show/{slug}')
Future<PlanModel> getPlan(@Path('slug') String slug); Future<PlanModel> getPlan(@Path('slug') String slug);
@POST('/api/plans/{slug}/like') @POST('/api/plans/{slug}/like')
Future<void> likePlan({ Future<void> likePlan({
@Path() required String slug, @Path() required String slug,
}); });
@@ -28,4 +26,10 @@ abstract class PlanService {
Future<void> removeFromFavorite({ Future<void> removeFromFavorite({
@Path() required String slug, @Path() required String slug,
}); });
@POST('/api/plans/{slug}/choose')
Future<ChosenPlanModel> chosePlan({
@Path() required String slug,
@Body() required Map<String, dynamic> option,
});
} }

View File

@@ -101,6 +101,37 @@ class _PlanService implements PlanService {
await _dio.fetch<void>(_options); await _dio.fetch<void>(_options);
} }
@override
Future<ChosenPlanModel> chosePlan({
required String slug,
required Map<String, dynamic> option,
}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(option);
final _options = _setStreamType<ChosenPlanModel>(
Options(method: 'POST', headers: _headers, extra: _extra)
.compose(
_dio.options,
'/api/plans/${slug}/choose',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late ChosenPlanModel _value;
try {
_value = ChosenPlanModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) { RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic && if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes || !(requestOptions.responseType == ResponseType.bytes ||

View File

@@ -101,8 +101,9 @@ class ProfileCubit extends Cubit<ProfileState> {
}) async { }) async {
try { try {
return (await chatRepository.getChatRoomIdByUserSlug(slug: slug)).id; return (await chatRepository.getChatRoomIdByUserSlug(slug: slug)).id;
} catch (e) { } catch (e, st) {
rethrow; log(e.toString(), stackTrace: st);
return '';
} }
} }

View File

@@ -1079,7 +1079,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
onTap: () async { onTap: () async {
GoRouter.of(context).pushNamed( GoRouter.of(context).pushNamed(
'chatScreen', 'chatScreen',
extra: await profileCubit.getChatRoomIdBySlug(slug: widget.author!.authorSlug), extra: {
'chatId': await profileCubit.getChatRoomIdBySlug(slug: widget.author!.authorSlug),
},
); );
}, },
child: Container( child: Container(

View File

@@ -62,8 +62,10 @@ class _SubActionButtonWidgetState extends State<SubActionButtonWidget> {
return InkWell( return InkWell(
onTap: () async { onTap: () async {
GoRouter.of(context).pushNamed( GoRouter.of(context).pushNamed(
'chatScreen', 'chatScreen',
extra: await sl<ProfileCubit>().getChatRoomIdBySlug(slug: widget.slug), extra: {
'chatId': await sl<ProfileCubit>().getChatRoomIdBySlug(slug: widget.slug),
},
); );
}, },
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),

View File

@@ -39,10 +39,8 @@ MessageLookupByLibrary? _findExact(String localeName) {
/// User programs should call this before using [localeName] for messages. /// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) { Future<bool> initializeMessages(String localeName) {
var availableLocale = Intl.verifiedLocale( var availableLocale = Intl.verifiedLocale(
localeName, localeName, (locale) => _deferredLibraries[locale] != null,
(locale) => _deferredLibraries[locale] != null, onFailure: (_) => null);
onFailure: (_) => null,
);
if (availableLocale == null) { if (availableLocale == null) {
return new SynchronousFuture(false); return new SynchronousFuture(false);
} }
@@ -62,11 +60,8 @@ bool _messagesExistFor(String locale) {
} }
MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) { MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale( var actualLocale =
locale, Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
_messagesExistFor,
onFailure: (_) => null,
);
if (actualLocale == null) return null; if (actualLocale == null) return null;
return _findExact(actualLocale); return _findExact(actualLocale);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -22,353 +22,301 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages); final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{ static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"Moscow": MessageLookupByLibrary.simpleMessage("Москва"), "Moscow": MessageLookupByLibrary.simpleMessage("Москва"),
"Russia": MessageLookupByLibrary.simpleMessage("Россия"), "Russia": MessageLookupByLibrary.simpleMessage("Россия"),
"about_diet": MessageLookupByLibrary.simpleMessage("Об этой диете"), "about_diet": MessageLookupByLibrary.simpleMessage("Об этой диете"),
"about_plan": MessageLookupByLibrary.simpleMessage("Об этом плане"), "about_plan": MessageLookupByLibrary.simpleMessage("Об этом плане"),
"active": MessageLookupByLibrary.simpleMessage("Активен"), "active": MessageLookupByLibrary.simpleMessage("Активен"),
"active_diet_state": MessageLookupByLibrary.simpleMessage("Активная"), "active_diet_state": MessageLookupByLibrary.simpleMessage("Активная"),
"add": MessageLookupByLibrary.simpleMessage("Добавить"), "add": MessageLookupByLibrary.simpleMessage("Добавить"),
"add_cover": MessageLookupByLibrary.simpleMessage("Добавьте обложку"), "add_cover": MessageLookupByLibrary.simpleMessage("Добавьте обложку"),
"add_measure": MessageLookupByLibrary.simpleMessage("Добавить замер"), "add_measure": MessageLookupByLibrary.simpleMessage("Добавить замер"),
"adding_plan": MessageLookupByLibrary.simpleMessage("Добавление плана"), "adding_plan": MessageLookupByLibrary.simpleMessage("Добавление плана"),
"additional_information": MessageLookupByLibrary.simpleMessage( "additional_information":
"Дополнительная информация", MessageLookupByLibrary.simpleMessage("Дополнительная информация"),
), "admin": MessageLookupByLibrary.simpleMessage("Админ"),
"admin": MessageLookupByLibrary.simpleMessage("Админ"), "all": MessageLookupByLibrary.simpleMessage("Все"),
"all": MessageLookupByLibrary.simpleMessage("Все"), "allergies_presence":
"allergies_presence": MessageLookupByLibrary.simpleMessage( MessageLookupByLibrary.simpleMessage("Наличие аллергии"),
"Наличие аллергии", "another_form_of_comment":
), MessageLookupByLibrary.simpleMessage("комментария"),
"another_form_of_comment": MessageLookupByLibrary.simpleMessage( "another_form_of_day": MessageLookupByLibrary.simpleMessage("дня"),
"комментария", "answer": MessageLookupByLibrary.simpleMessage("Ответить"),
), "archived": MessageLookupByLibrary.simpleMessage("В архиве"),
"another_form_of_day": MessageLookupByLibrary.simpleMessage("дня"), "authentificate": MessageLookupByLibrary.simpleMessage("Войти"),
"answer": MessageLookupByLibrary.simpleMessage("Ответить"), "average_pressure": MessageLookupByLibrary.simpleMessage(
"archived": MessageLookupByLibrary.simpleMessage("В архиве"), "Средние показатели давления:"),
"authentificate": MessageLookupByLibrary.simpleMessage("Войти"), "bodymass_chart": MessageLookupByLibrary.simpleMessage("График ИМТ"),
"average_pressure": MessageLookupByLibrary.simpleMessage( "by_default": MessageLookupByLibrary.simpleMessage("По умолчянию"),
"Средние показатели давления:", "calories": MessageLookupByLibrary.simpleMessage("Калории"),
), "carb_type": MessageLookupByLibrary.simpleMessage("Мучное"),
"bodymass_chart": MessageLookupByLibrary.simpleMessage("График ИМТ"), "carb_type_desc": MessageLookupByLibrary.simpleMessage(
"by_default": MessageLookupByLibrary.simpleMessage("По умолчянию"), "Если вы любите мучные продукты, но хотите придерживаться диеты, вам подходит диета с добавленим мучных блюд на основе цельнозерновых вариантов. В них больше сложных углеводов и клетчатки, что способствует длительному чувству сытости и поддерживает здоровье пищеварительной системы."),
"calories": MessageLookupByLibrary.simpleMessage("Калории"), "carbohydrates": MessageLookupByLibrary.simpleMessage("Углеводы"),
"carb_type": MessageLookupByLibrary.simpleMessage("Мучное"), "chat": MessageLookupByLibrary.simpleMessage("Чат"),
"carb_type_desc": MessageLookupByLibrary.simpleMessage( "chest": MessageLookupByLibrary.simpleMessage("Грудь"),
"Если вы любите мучные продукты, но хотите придерживаться диеты, вам подходит диета с добавленим мучных блюд на основе цельнозерновых вариантов. В них больше сложных углеводов и клетчатки, что способствует длительному чувству сытости и поддерживает здоровье пищеварительной системы.", "chest_circumference":
), MessageLookupByLibrary.simpleMessage("Обхват груди"),
"carbohydrates": MessageLookupByLibrary.simpleMessage("Углеводы"), "choose_diet_duration":
"chat": MessageLookupByLibrary.simpleMessage("Чат"), MessageLookupByLibrary.simpleMessage("Выберите срок диеты"),
"chest": MessageLookupByLibrary.simpleMessage("Грудь"), "choose_plan_duration":
"chest_circumference": MessageLookupByLibrary.simpleMessage("Обхват груди"), MessageLookupByLibrary.simpleMessage("Выберите срок плана"),
"choose_diet_duration": MessageLookupByLibrary.simpleMessage( "choose_start_diet_date": MessageLookupByLibrary.simpleMessage(
"Выберите срок диеты", "Выберите дату старты диеты. Она отобразиться у Вас в дневнике"),
), "circumference_empty": MessageLookupByLibrary.simpleMessage(
"choose_plan_duration": MessageLookupByLibrary.simpleMessage( "Все замеры обязательны к заполнению"),
"Выберите срок плана", "circumference_is_not_a_number": MessageLookupByLibrary.simpleMessage(
), "Все замеры должны быть числами"),
"choose_start_diet_date": MessageLookupByLibrary.simpleMessage( "circumferences_chart":
"Выберите дату старты диеты. Она отобразиться у Вас в дневнике", MessageLookupByLibrary.simpleMessage("График обхватов"),
), "city": MessageLookupByLibrary.simpleMessage("Город"),
"circumference_empty": MessageLookupByLibrary.simpleMessage( "city_of_living":
"Все замеры обязательны к заполнению", MessageLookupByLibrary.simpleMessage("Город проживания"),
), "comfort": MessageLookupByLibrary.simpleMessage("Комфорт"),
"circumference_is_not_a_number": MessageLookupByLibrary.simpleMessage( "comment": MessageLookupByLibrary.simpleMessage("комментарий"),
"Все замеры должны быть числами", "comments": MessageLookupByLibrary.simpleMessage("Комментарии"),
), "comments_plural": MessageLookupByLibrary.simpleMessage("комментариев"),
"circumferences_chart": MessageLookupByLibrary.simpleMessage( "complain": MessageLookupByLibrary.simpleMessage("Пожаловаться"),
"График обхватов", "continueButton": MessageLookupByLibrary.simpleMessage("Продолжить"),
), "continue_": MessageLookupByLibrary.simpleMessage("Продолжить"),
"city": MessageLookupByLibrary.simpleMessage("Город"), "copied": MessageLookupByLibrary.simpleMessage("cкопирован"),
"city_of_living": MessageLookupByLibrary.simpleMessage("Город проживания"), "copy_link": MessageLookupByLibrary.simpleMessage("Скопировать ссылку"),
"comfort": MessageLookupByLibrary.simpleMessage("Комфорт"), "country": MessageLookupByLibrary.simpleMessage("Страна"),
"comment": MessageLookupByLibrary.simpleMessage("комментарий"), "create_diet": MessageLookupByLibrary.simpleMessage("Создание диеты"),
"comments": MessageLookupByLibrary.simpleMessage("Комментарии"), "customer_price":
"comments_plural": MessageLookupByLibrary.simpleMessage("комментариев"), MessageLookupByLibrary.simpleMessage("Цена для покупателя"),
"complain": MessageLookupByLibrary.simpleMessage("Пожаловаться"), "date_of_birth": MessageLookupByLibrary.simpleMessage("Дата рождения"),
"continueButton": MessageLookupByLibrary.simpleMessage("Продолжить"), "day": MessageLookupByLibrary.simpleMessage("День"),
"continue_": MessageLookupByLibrary.simpleMessage("Продолжить"), "days": MessageLookupByLibrary.simpleMessage("дней"),
"copied": MessageLookupByLibrary.simpleMessage("cкопирован"), "deleted": MessageLookupByLibrary.simpleMessage("Удалена"),
"copy_link": MessageLookupByLibrary.simpleMessage("Скопировать ссылку"), "diary": MessageLookupByLibrary.simpleMessage("Дневник"),
"country": MessageLookupByLibrary.simpleMessage("Страна"), "diet": MessageLookupByLibrary.simpleMessage("Диета"),
"create_diet": MessageLookupByLibrary.simpleMessage("Создание диеты"), "diet_author": MessageLookupByLibrary.simpleMessage("Автор диеты"),
"customer_price": MessageLookupByLibrary.simpleMessage( "diet_plan": MessageLookupByLibrary.simpleMessage("План диеты"),
"Цена для покупателя", "diet_state": MessageLookupByLibrary.simpleMessage("Статус диеты"),
), "diet_type": MessageLookupByLibrary.simpleMessage("Тип диеты"),
"date_of_birth": MessageLookupByLibrary.simpleMessage("Дата рождения"), "do_you_have_hypertension_tendency":
"day": MessageLookupByLibrary.simpleMessage("День"), MessageLookupByLibrary.simpleMessage("Есть ли у вас гипертония?"),
"days": MessageLookupByLibrary.simpleMessage("дней"), "do_you_have_hypotension_tendency":
"deleted": MessageLookupByLibrary.simpleMessage("Удалена"), MessageLookupByLibrary.simpleMessage("Есть ли у вас гипотония?"),
"diary": MessageLookupByLibrary.simpleMessage("Дневник"), "do_you_take_pills": MessageLookupByLibrary.simpleMessage(
"diet": MessageLookupByLibrary.simpleMessage("Диета"), "Принимаете ли вы лекарства или бады?"),
"diet_author": MessageLookupByLibrary.simpleMessage("Автор диеты"), "down_pressure":
"diet_plan": MessageLookupByLibrary.simpleMessage("План диеты"), MessageLookupByLibrary.simpleMessage("Нижние показатели давления:"),
"diet_state": MessageLookupByLibrary.simpleMessage("Статус диеты"), "draft": MessageLookupByLibrary.simpleMessage("Черновик"),
"diet_type": MessageLookupByLibrary.simpleMessage("Тип диеты"), "drafted": MessageLookupByLibrary.simpleMessage("Черновики"),
"do_you_have_hypertension_tendency": MessageLookupByLibrary.simpleMessage( "eating_behavior":
"Есть ли у вас гипертония?", MessageLookupByLibrary.simpleMessage("Пищевое поведение"),
), "eating_behavior_type": MessageLookupByLibrary.simpleMessage(
"do_you_have_hypotension_tendency": MessageLookupByLibrary.simpleMessage( "Формирование пищевого поведения"),
"Есть ли у вас гипотония?", "eating_behavior_type_desc": MessageLookupByLibrary.simpleMessage(
), "Формирование здорового пищевого поведения — это процесс, который включает в себя изменение привычек и отношения к еде. Он направлен на то, чтобы помочь людям научиться правильно питаться и поддерживать здоровый образ жизни.Основные принципы формирования здорового пищевого поведения: \n● Разнообразие продуктов; \n● Сбалансированный рацион; \n● Питьевой режим; \n● Ограничение вредных продуктов; \n● Регулярные приёмы пищи; \n● Умеренность;Осознанное питание; \n● Физическая активность;"),
"do_you_take_pills": MessageLookupByLibrary.simpleMessage( "economy": MessageLookupByLibrary.simpleMessage("Эконом"),
"Принимаете ли вы лекарства или бады?", "edit": MessageLookupByLibrary.simpleMessage("Редактировать"),
), "email": MessageLookupByLibrary.simpleMessage("Электронная почта"),
"down_pressure": MessageLookupByLibrary.simpleMessage( "email_empty": MessageLookupByLibrary.simpleMessage(
"Нижние показатели давления:", "Необходимо ввести адрес электронной почты"),
), "email_invalid": MessageLookupByLibrary.simpleMessage(
"draft": MessageLookupByLibrary.simpleMessage("Черновик"), "Некорректный адрес электронной почты"),
"drafted": MessageLookupByLibrary.simpleMessage("Черновики"), "enter_additional_information": MessageLookupByLibrary.simpleMessage(
"eating_behavior": MessageLookupByLibrary.simpleMessage( "Введите любую дополнительную информацию на своё усмотрение:"),
"Пищевое поведение", "enter_diet_description":
), MessageLookupByLibrary.simpleMessage("Введите описание диеты"),
"eating_behavior_type": MessageLookupByLibrary.simpleMessage( "enter_diet_name":
"Формирование пищевого поведения", MessageLookupByLibrary.simpleMessage("Выведите название диеты"),
), "enter_information":
"eating_behavior_type_desc": MessageLookupByLibrary.simpleMessage( MessageLookupByLibrary.simpleMessage("Введите информацию..."),
"Формирование здорового пищевого поведения — это процесс, который включает в себя изменение привычек и отношения к еде. Он направлен на то, чтобы помочь людям научиться правильно питаться и поддерживать здоровый образ жизни.Основные принципы формирования здорового пищевого поведения: \n● Разнообразие продуктов; \n● Сбалансированный рацион; \n● Питьевой режим; \n● Ограничение вредных продуктов; \n● Регулярные приёмы пищи; \n● Умеренность;Осознанное питание; \n● Физическая активность;", "exit": MessageLookupByLibrary.simpleMessage("Выйти"),
), "expand": MessageLookupByLibrary.simpleMessage("Показать полностью"),
"economy": MessageLookupByLibrary.simpleMessage("Эконом"), "fats": MessageLookupByLibrary.simpleMessage("Жиры"),
"edit": MessageLookupByLibrary.simpleMessage("Редактировать"), "favorite_foods":
"email": MessageLookupByLibrary.simpleMessage("Электронная почта"), MessageLookupByLibrary.simpleMessage("Любимые продукты"),
"email_empty": MessageLookupByLibrary.simpleMessage( "favorite_unfavorite_foods": MessageLookupByLibrary.simpleMessage(
"Необходимо ввести адрес электронной почты", "Ваши любимые/нелюбимые продукты питания?"),
), "female": MessageLookupByLibrary.simpleMessage("Женский"),
"email_invalid": MessageLookupByLibrary.simpleMessage( "fill_in_information":
"Некорректный адрес электронной почты", MessageLookupByLibrary.simpleMessage("Заполните информацию:"),
), "finish": MessageLookupByLibrary.simpleMessage("Завершить"),
"enter_additional_information": MessageLookupByLibrary.simpleMessage( "first_name": MessageLookupByLibrary.simpleMessage("Имя"),
"Введите любую дополнительную информацию на своё усмотрение:", "first_name_empty": MessageLookupByLibrary.simpleMessage(
), "Имя обязательно для заполнения"),
"enter_diet_description": MessageLookupByLibrary.simpleMessage( "first_name_short": MessageLookupByLibrary.simpleMessage(
"Введите описание диеты", "В имени должен быть минимум 1 символ"),
), "fit_type": MessageLookupByLibrary.simpleMessage("Поддержание формы"),
"enter_diet_name": MessageLookupByLibrary.simpleMessage( "fit_type_desc": MessageLookupByLibrary.simpleMessage(
"Выведите название диеты", "План питания для поддержания формы сбалансированный и разнообразный, чтобы обеспечить организм всеми необходимыми питательными веществами. Общие принципы: \n● Дробное питание; \n● Разнообразие продуктов; \n● Контроль порций; \n● Питьевой режим; \n● Ограничение вредных продуктов;"),
), "fitness": MessageLookupByLibrary.simpleMessage("Поддержка формы"),
"enter_information": MessageLookupByLibrary.simpleMessage( "from": MessageLookupByLibrary.simpleMessage("от"),
"Введите информацию...", "from_a_to_z": MessageLookupByLibrary.simpleMessage("Название: А-Я"),
), "from_z_to_a": MessageLookupByLibrary.simpleMessage("Название: Я-А"),
"exit": MessageLookupByLibrary.simpleMessage("Выйти"), "gallery": MessageLookupByLibrary.simpleMessage("Галерея"),
"expand": MessageLookupByLibrary.simpleMessage("Показать полностью"), "gr": MessageLookupByLibrary.simpleMessage("гр"),
"fats": MessageLookupByLibrary.simpleMessage("Жиры"), "grams": MessageLookupByLibrary.simpleMessage("гр"),
"favorite_foods": MessageLookupByLibrary.simpleMessage("Любимые продукты"), "height_measurements":
"favorite_unfavorite_foods": MessageLookupByLibrary.simpleMessage( MessageLookupByLibrary.simpleMessage("Замер роста"),
"Ваши любимые/нелюбимые продукты питания?", "hide": MessageLookupByLibrary.simpleMessage("Свернуть"),
), "hip_circumference":
"female": MessageLookupByLibrary.simpleMessage("Женский"), MessageLookupByLibrary.simpleMessage("Обхват бедер"),
"fill_in_information": MessageLookupByLibrary.simpleMessage( "hips": MessageLookupByLibrary.simpleMessage("Бедра"),
"Заполните информацию:", "in_progress": MessageLookupByLibrary.simpleMessage("В процессе"),
), "inactive_diet_state": MessageLookupByLibrary.simpleMessage("Черновик"),
"finish": MessageLookupByLibrary.simpleMessage("Завершить"), "infoAboutOrder":
"first_name": MessageLookupByLibrary.simpleMessage("Имя"), MessageLookupByLibrary.simpleMessage("Информация о заказе"),
"first_name_empty": MessageLookupByLibrary.simpleMessage( "initial_measurements":
"Имя обязательно для заполнения", MessageLookupByLibrary.simpleMessage("Первичные замеры"),
), "label": MessageLookupByLibrary.simpleMessage("Название"),
"first_name_short": MessageLookupByLibrary.simpleMessage( "language": MessageLookupByLibrary.simpleMessage("Язык"),
"В имени должен быть минимум 1 символ", "last_name": MessageLookupByLibrary.simpleMessage("Фамилия"),
), "last_name_empty": MessageLookupByLibrary.simpleMessage(
"fit_type": MessageLookupByLibrary.simpleMessage("Поддержание формы"), "Фамилия обязательна для заполнения"),
"fit_type_desc": MessageLookupByLibrary.simpleMessage( "last_name_short": MessageLookupByLibrary.simpleMessage(
"План питания для поддержания формы сбалансированный и разнообразный, чтобы обеспечить организм всеми необходимыми питательными веществами. Общие принципы: \n● Дробное питание; \n● Разнообразие продуктов; \n● Контроль порций; \n● Питьевой режим; \n● Ограничение вредных продуктов;", "В фамилии должен быть минимум 6 символов"),
), "lbl_english": MessageLookupByLibrary.simpleMessage("English"),
"fitness": MessageLookupByLibrary.simpleMessage("Поддержка формы"), "light_type": MessageLookupByLibrary.simpleMessage("Легкая"),
"from": MessageLookupByLibrary.simpleMessage("от"), "light_type_desc": MessageLookupByLibrary.simpleMessage(
"from_a_to_z": MessageLookupByLibrary.simpleMessage("Название: А-Я"), "С некоторыми видами диет можно употреблять алкоголь в умеренных количествах. Рекомендуется совмещать вместе с низкокалорийными закусками."),
"from_z_to_a": MessageLookupByLibrary.simpleMessage("Название: Я-А"), "link_was_copied":
"gallery": MessageLookupByLibrary.simpleMessage("Галерея"), MessageLookupByLibrary.simpleMessage("Ссылка успешно скопирована"),
"gr": MessageLookupByLibrary.simpleMessage("гр"), "loading": MessageLookupByLibrary.simpleMessage("Загрузка..."),
"grams": MessageLookupByLibrary.simpleMessage("гр"), "male": MessageLookupByLibrary.simpleMessage("Мужской"),
"height_measurements": MessageLookupByLibrary.simpleMessage("Замер роста"), "meal": MessageLookupByLibrary.simpleMessage("Приём пищи"),
"hide": MessageLookupByLibrary.simpleMessage("Свернуть"), "meat": MessageLookupByLibrary.simpleMessage("Мясо"),
"hip_circumference": MessageLookupByLibrary.simpleMessage("Обхват бедер"), "meat_type": MessageLookupByLibrary.simpleMessage("С мясом"),
"hips": MessageLookupByLibrary.simpleMessage("Бедра"), "meat_type_desc": MessageLookupByLibrary.simpleMessage(
"in_progress": MessageLookupByLibrary.simpleMessage("В процессе"), "Диета с мясом полезная и сбалансированная. Включает в себя нежирное мясо: курицу, индейку, кролика или говядину. В сочетании с овощами получаете все необходимые витамины и минералы. Не забывайте о порциях и старайтесь есть медленно, прислушиваясь к своему организму."),
"inactive_diet_state": MessageLookupByLibrary.simpleMessage("Черновик"), "milliliter": MessageLookupByLibrary.simpleMessage("мл"),
"infoAboutOrder": MessageLookupByLibrary.simpleMessage( "minimal_customer_price": MessageLookupByLibrary.simpleMessage(
"Информация о заказе", "Минимальная цена для покупателя: 1200₽"),
), "most_new": MessageLookupByLibrary.simpleMessage("Самые новые"),
"initial_measurements": MessageLookupByLibrary.simpleMessage( "most_old": MessageLookupByLibrary.simpleMessage("Самые старые"),
"Первичные замеры", "msg_network_err":
), MessageLookupByLibrary.simpleMessage("Сетевая ошибка!"),
"label": MessageLookupByLibrary.simpleMessage("Название"), "msg_something_went_wrong":
"language": MessageLookupByLibrary.simpleMessage("Язык"), MessageLookupByLibrary.simpleMessage("Что то пошло не так!"),
"last_name": MessageLookupByLibrary.simpleMessage("Фамилия"), "my_blog": MessageLookupByLibrary.simpleMessage("Мой блог"),
"last_name_empty": MessageLookupByLibrary.simpleMessage( "my_diets": MessageLookupByLibrary.simpleMessage("Мои диеты"),
"Фамилия обязательна для заполнения", "my_plans": MessageLookupByLibrary.simpleMessage("Мои планы"),
), "my_settings": MessageLookupByLibrary.simpleMessage("Мои настройки"),
"last_name_short": MessageLookupByLibrary.simpleMessage( "name_empty": MessageLookupByLibrary.simpleMessage(
"В фамилии должен быть минимум 6 символов", "Имя пользователя обязательно для заполнения"),
), "name_short": MessageLookupByLibrary.simpleMessage(
"lbl_english": MessageLookupByLibrary.simpleMessage("English"), "В имени пользователя должно быть минимум 6 символов"),
"light_type": MessageLookupByLibrary.simpleMessage("Легкая"), "no": MessageLookupByLibrary.simpleMessage("Нет"),
"light_type_desc": MessageLookupByLibrary.simpleMessage( "no_account":
"С некоторыми видами диет можно употреблять алкоголь в умеренных количествах. Рекомендуется совмещать вместе с низкокалорийными закусками.", MessageLookupByLibrary.simpleMessage("У меня нет аккаунта"),
), "one_option": MessageLookupByLibrary.simpleMessage("1 опция"),
"link_was_copied": MessageLookupByLibrary.simpleMessage( "option": MessageLookupByLibrary.simpleMessage("Опция"),
"Ссылка успешно скопирована", "option_content":
), MessageLookupByLibrary.simpleMessage("Содержание опции"),
"loading": MessageLookupByLibrary.simpleMessage("Загрузка..."), "option_content_hint_text":
"male": MessageLookupByLibrary.simpleMessage("Мужской"), MessageLookupByLibrary.simpleMessage("На связи 7 дней в неделю"),
"meal": MessageLookupByLibrary.simpleMessage("Приём пищи"), "option_desc": MessageLookupByLibrary.simpleMessage("Описание опции"),
"meat": MessageLookupByLibrary.simpleMessage("Мясо"), "option_desc_hint_text": MessageLookupByLibrary.simpleMessage(
"meat_type": MessageLookupByLibrary.simpleMessage("С мясом"), "Этот план питания для похудения на 7 дней сбалансированный и разнообразный"),
"meat_type_desc": MessageLookupByLibrary.simpleMessage( "option_duration":
"Диета с мясом полезная и сбалансированная. Включает в себя нежирное мясо: курицу, индейку, кролика или говядину. В сочетании с овощами получаете все необходимые витамины и минералы. Не забывайте о порциях и старайтесь есть медленно, прислушиваясь к своему организму.", MessageLookupByLibrary.simpleMessage("Продолжительность опции"),
), "option_personal_diet_desc": MessageLookupByLibrary.simpleMessage(
"milliliter": MessageLookupByLibrary.simpleMessage("мл"), "Опция подразумевает создание индивидуальной диеты"),
"minimal_customer_price": MessageLookupByLibrary.simpleMessage( "option_title": MessageLookupByLibrary.simpleMessage("Заголовок опции"),
"Минимальная цена для покупателя: 1200₽", "order": MessageLookupByLibrary.simpleMessage("Порядок"),
), "password": MessageLookupByLibrary.simpleMessage("Пароль"),
"most_new": MessageLookupByLibrary.simpleMessage("Самые новые"), "password_confirmation":
"most_old": MessageLookupByLibrary.simpleMessage("Самые старые"), MessageLookupByLibrary.simpleMessage("Подтвердите пароль"),
"msg_network_err": MessageLookupByLibrary.simpleMessage("Сетевая ошибка!"), "password_confirmation_mismatch":
"msg_something_went_wrong": MessageLookupByLibrary.simpleMessage( MessageLookupByLibrary.simpleMessage("Пароли не совпадают"),
"Что то пошло не так!", "password_empty": MessageLookupByLibrary.simpleMessage(
), "Пароль обязателен для заполнения"),
"my_blog": MessageLookupByLibrary.simpleMessage("Мой блог"), "password_short": MessageLookupByLibrary.simpleMessage(
"my_diets": MessageLookupByLibrary.simpleMessage("Мои диеты"), "В пароле должно быть минимум 6 символов"),
"my_plans": MessageLookupByLibrary.simpleMessage("Мои планы"), "pcs": MessageLookupByLibrary.simpleMessage("шт"),
"my_settings": MessageLookupByLibrary.simpleMessage("Мои настройки"), "personal": MessageLookupByLibrary.simpleMessage("Персональные"),
"name_empty": MessageLookupByLibrary.simpleMessage( "personal_diet_state":
"Имя пользователя обязательно для заполнения", MessageLookupByLibrary.simpleMessage("Персональная"),
), "photo": MessageLookupByLibrary.simpleMessage("Фото"),
"name_short": MessageLookupByLibrary.simpleMessage( "place_of_living":
"В имени пользователя должно быть минимум 6 символов", MessageLookupByLibrary.simpleMessage("Место проживания"),
), "plan_author": MessageLookupByLibrary.simpleMessage("Автор плана"),
"no": MessageLookupByLibrary.simpleMessage("Нет"), "plan_desc": MessageLookupByLibrary.simpleMessage("Описание плана"),
"no_account": MessageLookupByLibrary.simpleMessage("У меня нет аккаунта"), "plan_desc_example": MessageLookupByLibrary.simpleMessage(
"one_option": MessageLookupByLibrary.simpleMessage("1 опция"), "Большое подробное, привлекательное описание плана"),
"option": MessageLookupByLibrary.simpleMessage("Опция"), "plan_duration": MessageLookupByLibrary.simpleMessage("Срок плана"),
"option_content": MessageLookupByLibrary.simpleMessage("Содержание опции"), "plan_label_desc":
"option_content_hint_text": MessageLookupByLibrary.simpleMessage( MessageLookupByLibrary.simpleMessage("План для поддержания формы"),
"На связи 7 дней в неделю", "plans_complete":
), MessageLookupByLibrary.simpleMessage("Пройденные планы"),
"option_desc": MessageLookupByLibrary.simpleMessage("Описание опции"), "popular": MessageLookupByLibrary.simpleMessage("Популярные"),
"option_desc_hint_text": MessageLookupByLibrary.simpleMessage( "preferred_language":
"Этот план питания для похудения на 7 дней сбалансированный и разнообразный", MessageLookupByLibrary.simpleMessage("Предпочитаемый язык общения"),
), "pressure_empty": MessageLookupByLibrary.simpleMessage(
"option_duration": MessageLookupByLibrary.simpleMessage( "Все показатели давления обязательны к заполнению"),
"Продолжительность опции", "pressure_is_not_a_number": MessageLookupByLibrary.simpleMessage(
), "Все показатели давления должны быть числами"),
"option_personal_diet_desc": MessageLookupByLibrary.simpleMessage( "preview": MessageLookupByLibrary.simpleMessage("Превью"),
"Опция подразумевает создание индивидуальной диеты", "price": MessageLookupByLibrary.simpleMessage("Цена"),
), "price_explanation": MessageLookupByLibrary.simpleMessage(
"option_title": MessageLookupByLibrary.simpleMessage("Заголовок опции"), "Разница в ценах, это комиссия Итвио"),
"order": MessageLookupByLibrary.simpleMessage("Порядок"), "profile": MessageLookupByLibrary.simpleMessage("Профиль"),
"password": MessageLookupByLibrary.simpleMessage("Пароль"), "proteins": MessageLookupByLibrary.simpleMessage("Белки"),
"password_confirmation": MessageLookupByLibrary.simpleMessage( "publish": MessageLookupByLibrary.simpleMessage("Опубликовать"),
"Подтвердите пароль", "published": MessageLookupByLibrary.simpleMessage("Опубликованные"),
), "removeFromActive":
"password_confirmation_mismatch": MessageLookupByLibrary.simpleMessage( MessageLookupByLibrary.simpleMessage("Снять с публикации"),
"Пароли не совпадают", "save": MessageLookupByLibrary.simpleMessage("Сохранить"),
), "services": MessageLookupByLibrary.simpleMessage("Оказание услуг"),
"password_empty": MessageLookupByLibrary.simpleMessage( "settings": MessageLookupByLibrary.simpleMessage("Настройки"),
"Пароль обязателен для заполнения", "share": MessageLookupByLibrary.simpleMessage("Поделиться"),
), "skip": MessageLookupByLibrary.simpleMessage("Пропустить"),
"password_short": MessageLookupByLibrary.simpleMessage( "slim": MessageLookupByLibrary.simpleMessage("Похудение"),
"В пароле должно быть минимум 6 символов", "slim_type": MessageLookupByLibrary.simpleMessage("Похудение"),
), "slim_type_desc": MessageLookupByLibrary.simpleMessage(
"pcs": MessageLookupByLibrary.simpleMessage("шт"), "План питания для похудения должен быть разработан с учётом индивидуальных особенностей организма, возраста, пола, уровня физической активности и состояния здоровья. Общие принципы: \n● Снижение калорийности; \n● Сбалансированный рацион; \n● Разнообразие продуктов; \n● Питьевой режим; \n● Ограничение вредных продуктов;"),
"personal": MessageLookupByLibrary.simpleMessage("Персональные"), "standard": MessageLookupByLibrary.simpleMessage("Стандарт"),
"personal_diet_state": MessageLookupByLibrary.simpleMessage("Персональная"), "startDiet": MessageLookupByLibrary.simpleMessage("Начать диету"),
"photo": MessageLookupByLibrary.simpleMessage("Фото"), "tell_your_schedule": MessageLookupByLibrary.simpleMessage(
"place_of_living": MessageLookupByLibrary.simpleMessage("Место проживания"), "Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:"),
"plan_author": MessageLookupByLibrary.simpleMessage("Автор плана"), "three_options": MessageLookupByLibrary.simpleMessage("3 опции"),
"plan_desc": MessageLookupByLibrary.simpleMessage("Описание плана"), "toOffer": MessageLookupByLibrary.simpleMessage("Предложить"),
"plan_desc_example": MessageLookupByLibrary.simpleMessage( "to_draft": MessageLookupByLibrary.simpleMessage("В черновик"),
"Большое подробное, привлекательное описание плана", "unfavorite_foods":
), MessageLookupByLibrary.simpleMessage("Нелюбимые продукты"),
"plan_duration": MessageLookupByLibrary.simpleMessage("Срок плана"), "up_pressure": MessageLookupByLibrary.simpleMessage(
"plan_label_desc": MessageLookupByLibrary.simpleMessage( "Верхние показатели давления:"),
"План для поддержания формы", "user_authorization":
), MessageLookupByLibrary.simpleMessage("Аутентификация"),
"plans_complete": MessageLookupByLibrary.simpleMessage("Пройденные планы"), "user_data":
"popular": MessageLookupByLibrary.simpleMessage("Популярные"), MessageLookupByLibrary.simpleMessage("Данные пользователя"),
"preferred_language": MessageLookupByLibrary.simpleMessage( "user_registration":
"Предпочитаемый язык общения", MessageLookupByLibrary.simpleMessage("Регистрация пользователя"),
), "username": MessageLookupByLibrary.simpleMessage("Имя пользователя"),
"pressure_empty": MessageLookupByLibrary.simpleMessage( "vegan": MessageLookupByLibrary.simpleMessage("Веган."),
"Все показатели давления обязательны к заполнению", "vegan_type": MessageLookupByLibrary.simpleMessage("Вегетарианская"),
), "vegan_type_desc": MessageLookupByLibrary.simpleMessage(
"pressure_is_not_a_number": MessageLookupByLibrary.simpleMessage( "Диета основана на потреблении растительной пищи и отказе от продуктов животного происхождения. Такой тип питания может быть разнообразным и вкусным, а также полезным для здоровья."),
"Все показатели давления должны быть числами", "waist": MessageLookupByLibrary.simpleMessage("Талия"),
), "waist_circumference":
"preview": MessageLookupByLibrary.simpleMessage("Превью"), MessageLookupByLibrary.simpleMessage("Обхват талии"),
"price": MessageLookupByLibrary.simpleMessage("Цена"), "weight": MessageLookupByLibrary.simpleMessage("Вес"),
"price_explanation": MessageLookupByLibrary.simpleMessage( "weight_chart": MessageLookupByLibrary.simpleMessage("График веса"),
"Разница в ценах, это комиссия Итвио", "weight_measurements":
), MessageLookupByLibrary.simpleMessage("Замер веса"),
"profile": MessageLookupByLibrary.simpleMessage("Профиль"), "wellness":
"proteins": MessageLookupByLibrary.simpleMessage("Белки"), MessageLookupByLibrary.simpleMessage("Улучшение самочувствия"),
"publish": MessageLookupByLibrary.simpleMessage("Опубликовать"), "wellness_type":
"published": MessageLookupByLibrary.simpleMessage("Опубликованные"), MessageLookupByLibrary.simpleMessage("Улучшение самочувствия"),
"removeFromActive": MessageLookupByLibrary.simpleMessage( "wellness_type_desc": MessageLookupByLibrary.simpleMessage(
"Снять с публикации", "Если вы любите мучные продукты, но хотите придерживаться диеты, вам подходит диета с добавленим мучных блюд на основе цельнозерновых вариантов. В них больше сложных углеводов и клетчатки, что способствует длительному чувству сытости и поддерживает здоровье пищеварительной системы."),
), "what_is_your_name":
"save": MessageLookupByLibrary.simpleMessage("Сохранить"), MessageLookupByLibrary.simpleMessage("Как вас зовут?"),
"services": MessageLookupByLibrary.simpleMessage("Оказание услуг"), "wrong_credentials": MessageLookupByLibrary.simpleMessage(
"settings": MessageLookupByLibrary.simpleMessage("Настройки"), "Неверные данные пользователя"),
"share": MessageLookupByLibrary.simpleMessage("Поделиться"), "you_will_get": MessageLookupByLibrary.simpleMessage("Вы получите"),
"skip": MessageLookupByLibrary.simpleMessage("Пропустить"), "your_blood_pressure":
"slim": MessageLookupByLibrary.simpleMessage("Похудение"), MessageLookupByLibrary.simpleMessage("Ваше артериальное давление?"),
"slim_type": MessageLookupByLibrary.simpleMessage("Похудение"), "your_favorite_sports":
"slim_type_desc": MessageLookupByLibrary.simpleMessage( MessageLookupByLibrary.simpleMessage("Ваши спортивные увлечения?"),
"План питания для похудения должен быть разработан с учётом индивидуальных особенностей организма, возраста, пола, уровня физической активности и состояния здоровья. Общие принципы: \n● Снижение калорийности; \n● Сбалансированный рацион; \n● Разнообразие продуктов; \n● Питьевой режим; \n● Ограничение вредных продуктов;", "your_gender": MessageLookupByLibrary.simpleMessage("Ваш пол?"),
), "your_height": MessageLookupByLibrary.simpleMessage("Ваш рост:"),
"standard": MessageLookupByLibrary.simpleMessage("Стандарт"), "your_schedule": MessageLookupByLibrary.simpleMessage("Ваш режим дня?"),
"startDiet": MessageLookupByLibrary.simpleMessage("Начать диету"), "your_weight": MessageLookupByLibrary.simpleMessage("Ваш вес:")
"tell_your_schedule": MessageLookupByLibrary.simpleMessage( };
"Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:",
),
"three_options": MessageLookupByLibrary.simpleMessage("3 опции"),
"toOffer": MessageLookupByLibrary.simpleMessage("Предложить"),
"to_draft": MessageLookupByLibrary.simpleMessage("В черновик"),
"unfavorite_foods": MessageLookupByLibrary.simpleMessage(
"Нелюбимые продукты",
),
"up_pressure": MessageLookupByLibrary.simpleMessage(
"Верхние показатели давления:",
),
"user_authorization": MessageLookupByLibrary.simpleMessage(
"Аутентификация",
),
"user_data": MessageLookupByLibrary.simpleMessage("Данные пользователя"),
"user_registration": MessageLookupByLibrary.simpleMessage(
"Регистрация пользователя",
),
"username": MessageLookupByLibrary.simpleMessage("Имя пользователя"),
"vegan": MessageLookupByLibrary.simpleMessage("Веган."),
"vegan_type": MessageLookupByLibrary.simpleMessage("Вегетарианская"),
"vegan_type_desc": MessageLookupByLibrary.simpleMessage(
"Диета основана на потреблении растительной пищи и отказе от продуктов животного происхождения. Такой тип питания может быть разнообразным и вкусным, а также полезным для здоровья.",
),
"waist": MessageLookupByLibrary.simpleMessage("Талия"),
"waist_circumference": MessageLookupByLibrary.simpleMessage("Обхват талии"),
"weight": MessageLookupByLibrary.simpleMessage("Вес"),
"weight_chart": MessageLookupByLibrary.simpleMessage("График веса"),
"weight_measurements": MessageLookupByLibrary.simpleMessage("Замер веса"),
"wellness": MessageLookupByLibrary.simpleMessage("Улучшение самочувствия"),
"wellness_type": MessageLookupByLibrary.simpleMessage(
"Улучшение самочувствия",
),
"wellness_type_desc": MessageLookupByLibrary.simpleMessage(
"Если вы любите мучные продукты, но хотите придерживаться диеты, вам подходит диета с добавленим мучных блюд на основе цельнозерновых вариантов. В них больше сложных углеводов и клетчатки, что способствует длительному чувству сытости и поддерживает здоровье пищеварительной системы.",
),
"what_is_your_name": MessageLookupByLibrary.simpleMessage("Как вас зовут?"),
"wrong_credentials": MessageLookupByLibrary.simpleMessage(
"Неверные данные пользователя",
),
"you_will_get": MessageLookupByLibrary.simpleMessage("Вы получите"),
"your_blood_pressure": MessageLookupByLibrary.simpleMessage(
"Ваше артериальное давление?",
),
"your_favorite_sports": MessageLookupByLibrary.simpleMessage(
"Ваши спортивные увлечения?",
),
"your_gender": MessageLookupByLibrary.simpleMessage("Ваш пол?"),
"your_height": MessageLookupByLibrary.simpleMessage("Ваш рост:"),
"your_schedule": MessageLookupByLibrary.simpleMessage("Ваш режим дня?"),
"your_weight": MessageLookupByLibrary.simpleMessage("Ваш вес:"),
};
} }

File diff suppressed because it is too large Load Diff

View File

@@ -312,6 +312,18 @@
"could_not_publish_blog_post": "Не удалось опубликовать пост", "could_not_publish_blog_post": "Не удалось опубликовать пост",
"could_not_update_blog_post": "Не удалось обновить пост", "could_not_update_blog_post": "Не удалось обновить пост",
"could_not_delete_blog_post": "Не удалось удалить пост", "could_not_delete_blog_post": "Не удалось удалить пост",
"infoAboutOrder": "Информация о заказе" "infoAboutOrder": "Информация о заказе",
"to_order": "Заказать",
"can_not_choose_start_date": "Дату старта плана невозможно выбрать, пока Вы не привяжите карту",
"add_card": "Привязать карту",
"choose_plan_start_date": "Выберите дату старта плана питания",
"choose_date": "Выбрать дату",
"date_has_ben_set": "Дата старта начала консультации установлена",
"tap_on_link_to)pay": "Перейдите по ссылке для оплаты консультации",
"pay": "Оплатить",
"more_about_order": "Подробнее о заказе",
"cancel_order": "Отменить заказ",
"refuse_order":"Отказаться от заказа"
} }