diff --git a/lib/core/const.dart b/lib/core/const.dart index 4f38a54e..31c47e9c 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,5 +1,5 @@ -// String baseUrl = 'https://eatvio.ru'; -String baseUrl = 'https://dev2.eatvio.com'; +String baseUrl = 'https://eatvio.ru'; +// String baseUrl = 'https://dev2.eatvio.com'; const List durationValues = [7, 14, 21]; diff --git a/lib/features/blog_post/presentation/pages/blog_post_screen.dart b/lib/features/blog_post/presentation/pages/blog_post_screen.dart index 4f6a0ad0..63f87233 100644 --- a/lib/features/blog_post/presentation/pages/blog_post_screen.dart +++ b/lib/features/blog_post/presentation/pages/blog_post_screen.dart @@ -104,8 +104,10 @@ class _BlogPostScreenState extends State { height: 1.2, ), decoration: InputDecoration( - isDense: false, // убираем true, чтобы padding учитывался корректно - contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен + isDense: false, + // убираем true, чтобы padding учитывался корректно + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), + // вертикальный паддинг увеличен hintText: 'Комментарий', hintStyle: const TextStyle( fontSize: 16, @@ -209,7 +211,13 @@ class _BlogPostScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [ - CircleAvatar(radius: 16, backgroundImage: NetworkImage(widget.blogPost.author.authorProfileIcon)), + CircleAvatar( + radius: 16, + foregroundImage: NetworkImage( + widget.blogPost.author.authorProfileIcon, + ), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), + ), const SizedBox(width: 8), Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart b/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart index 5fdf10c0..c0b5e16a 100644 --- a/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart +++ b/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart @@ -81,7 +81,8 @@ class _BottomNavigationBarWidgetState extends State { BottomNavigationBarItem( label: '', icon: CircleAvatar( - backgroundImage: NetworkImage(widget.profileModel.profilePhotoUrl), + foregroundImage: NetworkImage(widget.profileModel.profilePhotoUrl), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), radius: 16, ), ), diff --git a/lib/features/cancel_plan_bottom_sheet/cubit/cancel_plan_state.freezed.dart b/lib/features/cancel_plan_bottom_sheet/cubit/cancel_plan_state.freezed.dart deleted file mode 100644 index 90f3350c..00000000 --- a/lib/features/cancel_plan_bottom_sheet/cubit/cancel_plan_state.freezed.dart +++ /dev/null @@ -1,82 +0,0 @@ -// 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 'cancel_plan_state.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -/// @nodoc -mixin _$CancelPlanState {} - -/// @nodoc -abstract class $CancelPlanStateCopyWith<$Res> { - factory $CancelPlanStateCopyWith( - CancelPlanState value, $Res Function(CancelPlanState) then) = - _$CancelPlanStateCopyWithImpl<$Res, CancelPlanState>; -} - -/// @nodoc -class _$CancelPlanStateCopyWithImpl<$Res, $Val extends CancelPlanState> - implements $CancelPlanStateCopyWith<$Res> { - _$CancelPlanStateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of CancelPlanState - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc -abstract class _$$CancelPlanStateImplCopyWith<$Res> { - factory _$$CancelPlanStateImplCopyWith(_$CancelPlanStateImpl value, - $Res Function(_$CancelPlanStateImpl) then) = - __$$CancelPlanStateImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$CancelPlanStateImplCopyWithImpl<$Res> - extends _$CancelPlanStateCopyWithImpl<$Res, _$CancelPlanStateImpl> - implements _$$CancelPlanStateImplCopyWith<$Res> { - __$$CancelPlanStateImplCopyWithImpl( - _$CancelPlanStateImpl _value, $Res Function(_$CancelPlanStateImpl) _then) - : super(_value, _then); - - /// Create a copy of CancelPlanState - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc - -class _$CancelPlanStateImpl implements _CancelPlanState { - _$CancelPlanStateImpl(); - - @override - String toString() { - return 'CancelPlanState()'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$CancelPlanStateImpl); - } - - @override - int get hashCode => runtimeType.hashCode; -} - -abstract class _CancelPlanState implements CancelPlanState { - factory _CancelPlanState() = _$CancelPlanStateImpl; -} diff --git a/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.freezed.dart b/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.freezed.dart deleted file mode 100644 index d68a42ba..00000000 --- a/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.freezed.dart +++ /dev/null @@ -1,184 +0,0 @@ -// 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 'cancelation_model.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -CancelationModel _$CancelationModelFromJson(Map json) { - return _CancelationModel.fromJson(json); -} - -/// @nodoc -mixin _$CancelationModel { - String get description => throw _privateConstructorUsedError; - int get price => throw _privateConstructorUsedError; - - /// Serializes this CancelationModel to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of CancelationModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $CancelationModelCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $CancelationModelCopyWith<$Res> { - factory $CancelationModelCopyWith( - CancelationModel value, $Res Function(CancelationModel) then) = - _$CancelationModelCopyWithImpl<$Res, CancelationModel>; - @useResult - $Res call({String description, int price}); -} - -/// @nodoc -class _$CancelationModelCopyWithImpl<$Res, $Val extends CancelationModel> - implements $CancelationModelCopyWith<$Res> { - _$CancelationModelCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of CancelationModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? description = null, - Object? price = null, - }) { - return _then(_value.copyWith( - description: null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - price: null == price - ? _value.price - : price // ignore: cast_nullable_to_non_nullable - as int, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$CancelationModelImplCopyWith<$Res> - implements $CancelationModelCopyWith<$Res> { - factory _$$CancelationModelImplCopyWith(_$CancelationModelImpl value, - $Res Function(_$CancelationModelImpl) then) = - __$$CancelationModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String description, int price}); -} - -/// @nodoc -class __$$CancelationModelImplCopyWithImpl<$Res> - extends _$CancelationModelCopyWithImpl<$Res, _$CancelationModelImpl> - implements _$$CancelationModelImplCopyWith<$Res> { - __$$CancelationModelImplCopyWithImpl(_$CancelationModelImpl _value, - $Res Function(_$CancelationModelImpl) _then) - : super(_value, _then); - - /// Create a copy of CancelationModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? description = null, - Object? price = null, - }) { - return _then(_$CancelationModelImpl( - description: null == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String, - price: null == price - ? _value.price - : price // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$CancelationModelImpl implements _CancelationModel { - _$CancelationModelImpl({required this.description, required this.price}); - - factory _$CancelationModelImpl.fromJson(Map json) => - _$$CancelationModelImplFromJson(json); - - @override - final String description; - @override - final int price; - - @override - String toString() { - return 'CancelationModel(description: $description, price: $price)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$CancelationModelImpl && - (identical(other.description, description) || - other.description == description) && - (identical(other.price, price) || other.price == price)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, description, price); - - /// Create a copy of CancelationModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$CancelationModelImplCopyWith<_$CancelationModelImpl> get copyWith => - __$$CancelationModelImplCopyWithImpl<_$CancelationModelImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$CancelationModelImplToJson( - this, - ); - } -} - -abstract class _CancelationModel implements CancelationModel { - factory _CancelationModel( - {required final String description, - required final int price}) = _$CancelationModelImpl; - - factory _CancelationModel.fromJson(Map json) = - _$CancelationModelImpl.fromJson; - - @override - String get description; - @override - int get price; - - /// Create a copy of CancelationModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$CancelationModelImplCopyWith<_$CancelationModelImpl> get copyWith => - throw _privateConstructorUsedError; -} diff --git a/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.g.dart b/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.g.dart deleted file mode 100644 index d7bd21e9..00000000 --- a/lib/features/cancel_plan_bottom_sheet/models/cancelation_model.g.dart +++ /dev/null @@ -1,21 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'cancelation_model.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_$CancelationModelImpl _$$CancelationModelImplFromJson( - Map json) => - _$CancelationModelImpl( - description: json['description'] as String, - price: (json['price'] as num).toInt(), - ); - -Map _$$CancelationModelImplToJson( - _$CancelationModelImpl instance) => - { - 'description': instance.description, - 'price': instance.price, - }; diff --git a/lib/features/cancel_plan_bottom_sheet/service/cancel_plan_service.g.dart b/lib/features/cancel_plan_bottom_sheet/service/cancel_plan_service.g.dart deleted file mode 100644 index 943e9d25..00000000 --- a/lib/features/cancel_plan_bottom_sheet/service/cancel_plan_service.g.dart +++ /dev/null @@ -1,69 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'cancel_plan_service.dart'; - -// ************************************************************************** -// RetrofitGenerator -// ************************************************************************** - -// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations - -class _CancelPlanService implements CancelPlanService { - _CancelPlanService(this._dio, {this.baseUrl, this.errorLogger}); - - final Dio _dio; - - String? baseUrl; - - final ParseErrorLogger? errorLogger; - - @override - Future cancelChosenPlan({ - required int id, - CancelationModel? body, - }) async { - final _extra = {}; - final queryParameters = {}; - queryParameters.removeWhere((k, v) => v == null); - final _headers = {}; - final _data = body; - final _options = _setStreamType( - 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(_options); - } - - RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && - !(requestOptions.responseType == ResponseType.bytes || - requestOptions.responseType == ResponseType.stream)) { - if (T == String) { - requestOptions.responseType = ResponseType.plain; - } else { - requestOptions.responseType = ResponseType.json; - } - } - return requestOptions; - } - - String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { - if (baseUrl == null || baseUrl.trim().isEmpty) { - return dioBaseUrl; - } - - final url = Uri.parse(baseUrl); - - if (url.isAbsolute) { - return url.toString(); - } - - return Uri.parse(dioBaseUrl).resolveUri(url).toString(); - } -} diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index a9403849..250c86fe 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -141,6 +141,7 @@ class _ChatScreenState extends State { CircleAvatar( radius: 20, foregroundImage: NetworkImage(state.chatRoom.users.receiver.profilePhotoUrl!), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), ), if (state.chatRoom.users.receiver.profilePhotoUrl == null) Container( diff --git a/lib/features/chat/presentation/widgets/chat_entry_widget.dart b/lib/features/chat/presentation/widgets/chat_entry_widget.dart index bde4f8fd..1338c60b 100644 --- a/lib/features/chat/presentation/widgets/chat_entry_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_entry_widget.dart @@ -40,9 +40,10 @@ class _ChatEntryWidgetState extends State { children: [ CircleAvatar( radius: 24, - backgroundImage: NetworkImage( + foregroundImage: NetworkImage( widget.chatRoom.users.toChatUser.profilePhotoUrl, ), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), backgroundColor: Colors.white, ), const SizedBox(width: 12), diff --git a/lib/features/consultations/models/consultation_model.freezed.dart b/lib/features/consultations/models/consultation_model.freezed.dart deleted file mode 100644 index 0fba8726..00000000 --- a/lib/features/consultations/models/consultation_model.freezed.dart +++ /dev/null @@ -1,799 +0,0 @@ -// 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 'consultation_model.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -ConsultationModel _$ConsultationModelFromJson(Map json) { - return _ConsultationModel.fromJson(json); -} - -/// @nodoc -mixin _$ConsultationModel { - int get id => throw _privateConstructorUsedError; - @JsonKey(name: 'last_state') - ChosenPlanStateEnum get chosenPlanState => throw _privateConstructorUsedError; - String get planTitle => throw _privateConstructorUsedError; - String get userName => throw _privateConstructorUsedError; - String get userSlug => throw _privateConstructorUsedError; - double get consultantPayment => throw _privateConstructorUsedError; - int get duration => throw _privateConstructorUsedError; - int get currentDiaryDay => throw _privateConstructorUsedError; - @JsonKey(name: 'start_date', fromJson: parseDate) - DateTime get startDate => throw _privateConstructorUsedError; - @JsonKey(name: 'end_date', fromJson: parseDate) - DateTime get endDate => throw _privateConstructorUsedError; - @JsonKey(name: 'consultant_id') - int get consultantId => throw _privateConstructorUsedError; - List get diaries => throw _privateConstructorUsedError; - - /// Serializes this ConsultationModel to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of ConsultationModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $ConsultationModelCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ConsultationModelCopyWith<$Res> { - factory $ConsultationModelCopyWith( - ConsultationModel value, $Res Function(ConsultationModel) then) = - _$ConsultationModelCopyWithImpl<$Res, ConsultationModel>; - @useResult - $Res call( - {int id, - @JsonKey(name: 'last_state') ChosenPlanStateEnum chosenPlanState, - String planTitle, - String userName, - String userSlug, - double consultantPayment, - int duration, - int currentDiaryDay, - @JsonKey(name: 'start_date', fromJson: parseDate) DateTime startDate, - @JsonKey(name: 'end_date', fromJson: parseDate) DateTime endDate, - @JsonKey(name: 'consultant_id') int consultantId, - List diaries}); -} - -/// @nodoc -class _$ConsultationModelCopyWithImpl<$Res, $Val extends ConsultationModel> - implements $ConsultationModelCopyWith<$Res> { - _$ConsultationModelCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of ConsultationModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? chosenPlanState = null, - Object? planTitle = null, - Object? userName = null, - Object? userSlug = null, - Object? consultantPayment = null, - Object? duration = null, - Object? currentDiaryDay = null, - Object? startDate = null, - Object? endDate = null, - Object? consultantId = null, - Object? diaries = null, - }) { - return _then(_value.copyWith( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - chosenPlanState: null == chosenPlanState - ? _value.chosenPlanState - : chosenPlanState // ignore: cast_nullable_to_non_nullable - as ChosenPlanStateEnum, - planTitle: null == planTitle - ? _value.planTitle - : planTitle // ignore: cast_nullable_to_non_nullable - as String, - userName: null == userName - ? _value.userName - : userName // ignore: cast_nullable_to_non_nullable - as String, - userSlug: null == userSlug - ? _value.userSlug - : userSlug // ignore: cast_nullable_to_non_nullable - as String, - consultantPayment: null == consultantPayment - ? _value.consultantPayment - : consultantPayment // ignore: cast_nullable_to_non_nullable - as double, - duration: null == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int, - currentDiaryDay: null == currentDiaryDay - ? _value.currentDiaryDay - : currentDiaryDay // ignore: cast_nullable_to_non_nullable - as int, - startDate: null == startDate - ? _value.startDate - : startDate // ignore: cast_nullable_to_non_nullable - as DateTime, - endDate: null == endDate - ? _value.endDate - : endDate // ignore: cast_nullable_to_non_nullable - as DateTime, - consultantId: null == consultantId - ? _value.consultantId - : consultantId // ignore: cast_nullable_to_non_nullable - as int, - diaries: null == diaries - ? _value.diaries - : diaries // ignore: cast_nullable_to_non_nullable - as List, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$ConsultationModelImplCopyWith<$Res> - implements $ConsultationModelCopyWith<$Res> { - factory _$$ConsultationModelImplCopyWith(_$ConsultationModelImpl value, - $Res Function(_$ConsultationModelImpl) then) = - __$$ConsultationModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {int id, - @JsonKey(name: 'last_state') ChosenPlanStateEnum chosenPlanState, - String planTitle, - String userName, - String userSlug, - double consultantPayment, - int duration, - int currentDiaryDay, - @JsonKey(name: 'start_date', fromJson: parseDate) DateTime startDate, - @JsonKey(name: 'end_date', fromJson: parseDate) DateTime endDate, - @JsonKey(name: 'consultant_id') int consultantId, - List diaries}); -} - -/// @nodoc -class __$$ConsultationModelImplCopyWithImpl<$Res> - extends _$ConsultationModelCopyWithImpl<$Res, _$ConsultationModelImpl> - implements _$$ConsultationModelImplCopyWith<$Res> { - __$$ConsultationModelImplCopyWithImpl(_$ConsultationModelImpl _value, - $Res Function(_$ConsultationModelImpl) _then) - : super(_value, _then); - - /// Create a copy of ConsultationModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? chosenPlanState = null, - Object? planTitle = null, - Object? userName = null, - Object? userSlug = null, - Object? consultantPayment = null, - Object? duration = null, - Object? currentDiaryDay = null, - Object? startDate = null, - Object? endDate = null, - Object? consultantId = null, - Object? diaries = null, - }) { - return _then(_$ConsultationModelImpl( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - chosenPlanState: null == chosenPlanState - ? _value.chosenPlanState - : chosenPlanState // ignore: cast_nullable_to_non_nullable - as ChosenPlanStateEnum, - planTitle: null == planTitle - ? _value.planTitle - : planTitle // ignore: cast_nullable_to_non_nullable - as String, - userName: null == userName - ? _value.userName - : userName // ignore: cast_nullable_to_non_nullable - as String, - userSlug: null == userSlug - ? _value.userSlug - : userSlug // ignore: cast_nullable_to_non_nullable - as String, - consultantPayment: null == consultantPayment - ? _value.consultantPayment - : consultantPayment // ignore: cast_nullable_to_non_nullable - as double, - duration: null == duration - ? _value.duration - : duration // ignore: cast_nullable_to_non_nullable - as int, - currentDiaryDay: null == currentDiaryDay - ? _value.currentDiaryDay - : currentDiaryDay // ignore: cast_nullable_to_non_nullable - as int, - startDate: null == startDate - ? _value.startDate - : startDate // ignore: cast_nullable_to_non_nullable - as DateTime, - endDate: null == endDate - ? _value.endDate - : endDate // ignore: cast_nullable_to_non_nullable - as DateTime, - consultantId: null == consultantId - ? _value.consultantId - : consultantId // ignore: cast_nullable_to_non_nullable - as int, - diaries: null == diaries - ? _value._diaries - : diaries // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$ConsultationModelImpl implements _ConsultationModel { - _$ConsultationModelImpl( - {required this.id, - @JsonKey(name: 'last_state') required this.chosenPlanState, - required this.planTitle, - required this.userName, - required this.userSlug, - required this.consultantPayment, - required this.duration, - required this.currentDiaryDay, - @JsonKey(name: 'start_date', fromJson: parseDate) required this.startDate, - @JsonKey(name: 'end_date', fromJson: parseDate) required this.endDate, - @JsonKey(name: 'consultant_id') required this.consultantId, - required final List diaries}) - : _diaries = diaries; - - factory _$ConsultationModelImpl.fromJson(Map json) => - _$$ConsultationModelImplFromJson(json); - - @override - final int id; - @override - @JsonKey(name: 'last_state') - final ChosenPlanStateEnum chosenPlanState; - @override - final String planTitle; - @override - final String userName; - @override - final String userSlug; - @override - final double consultantPayment; - @override - final int duration; - @override - final int currentDiaryDay; - @override - @JsonKey(name: 'start_date', fromJson: parseDate) - final DateTime startDate; - @override - @JsonKey(name: 'end_date', fromJson: parseDate) - final DateTime endDate; - @override - @JsonKey(name: 'consultant_id') - final int consultantId; - final List _diaries; - @override - List get diaries { - if (_diaries is EqualUnmodifiableListView) return _diaries; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_diaries); - } - - @override - String toString() { - return 'ConsultationModel(id: $id, chosenPlanState: $chosenPlanState, planTitle: $planTitle, userName: $userName, userSlug: $userSlug, consultantPayment: $consultantPayment, duration: $duration, currentDiaryDay: $currentDiaryDay, startDate: $startDate, endDate: $endDate, consultantId: $consultantId, diaries: $diaries)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ConsultationModelImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.chosenPlanState, chosenPlanState) || - other.chosenPlanState == chosenPlanState) && - (identical(other.planTitle, planTitle) || - other.planTitle == planTitle) && - (identical(other.userName, userName) || - other.userName == userName) && - (identical(other.userSlug, userSlug) || - other.userSlug == userSlug) && - (identical(other.consultantPayment, consultantPayment) || - other.consultantPayment == consultantPayment) && - (identical(other.duration, duration) || - other.duration == duration) && - (identical(other.currentDiaryDay, currentDiaryDay) || - other.currentDiaryDay == currentDiaryDay) && - (identical(other.startDate, startDate) || - other.startDate == startDate) && - (identical(other.endDate, endDate) || other.endDate == endDate) && - (identical(other.consultantId, consultantId) || - other.consultantId == consultantId) && - const DeepCollectionEquality().equals(other._diaries, _diaries)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - id, - chosenPlanState, - planTitle, - userName, - userSlug, - consultantPayment, - duration, - currentDiaryDay, - startDate, - endDate, - consultantId, - const DeepCollectionEquality().hash(_diaries)); - - /// Create a copy of ConsultationModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ConsultationModelImplCopyWith<_$ConsultationModelImpl> get copyWith => - __$$ConsultationModelImplCopyWithImpl<_$ConsultationModelImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$ConsultationModelImplToJson( - this, - ); - } -} - -abstract class _ConsultationModel implements ConsultationModel { - factory _ConsultationModel( - {required final int id, - @JsonKey(name: 'last_state') - required final ChosenPlanStateEnum chosenPlanState, - required final String planTitle, - required final String userName, - required final String userSlug, - required final double consultantPayment, - required final int duration, - required final int currentDiaryDay, - @JsonKey(name: 'start_date', fromJson: parseDate) - required final DateTime startDate, - @JsonKey(name: 'end_date', fromJson: parseDate) - required final DateTime endDate, - @JsonKey(name: 'consultant_id') required final int consultantId, - required final List diaries}) = _$ConsultationModelImpl; - - factory _ConsultationModel.fromJson(Map json) = - _$ConsultationModelImpl.fromJson; - - @override - int get id; - @override - @JsonKey(name: 'last_state') - ChosenPlanStateEnum get chosenPlanState; - @override - String get planTitle; - @override - String get userName; - @override - String get userSlug; - @override - double get consultantPayment; - @override - int get duration; - @override - int get currentDiaryDay; - @override - @JsonKey(name: 'start_date', fromJson: parseDate) - DateTime get startDate; - @override - @JsonKey(name: 'end_date', fromJson: parseDate) - DateTime get endDate; - @override - @JsonKey(name: 'consultant_id') - int get consultantId; - @override - List get diaries; - - /// Create a copy of ConsultationModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ConsultationModelImplCopyWith<_$ConsultationModelImpl> get copyWith => - throw _privateConstructorUsedError; -} - -DiaryModel _$DiaryModelFromJson(Map json) { - return _DiaryModel.fromJson(json); -} - -/// @nodoc -mixin _$DiaryModel { - int get id => throw _privateConstructorUsedError; - DiaryStateEnum get state => throw _privateConstructorUsedError; - @JsonKey(fromJson: parseUnformattedDate) - DateTime get date => throw _privateConstructorUsedError; - - /// Serializes this DiaryModel to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of DiaryModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $DiaryModelCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $DiaryModelCopyWith<$Res> { - factory $DiaryModelCopyWith( - DiaryModel value, $Res Function(DiaryModel) then) = - _$DiaryModelCopyWithImpl<$Res, DiaryModel>; - @useResult - $Res call( - {int id, - DiaryStateEnum state, - @JsonKey(fromJson: parseUnformattedDate) DateTime date}); -} - -/// @nodoc -class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel> - implements $DiaryModelCopyWith<$Res> { - _$DiaryModelCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of DiaryModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? state = null, - Object? date = null, - }) { - return _then(_value.copyWith( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - state: null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as DiaryStateEnum, - date: null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as DateTime, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$DiaryModelImplCopyWith<$Res> - implements $DiaryModelCopyWith<$Res> { - factory _$$DiaryModelImplCopyWith( - _$DiaryModelImpl value, $Res Function(_$DiaryModelImpl) then) = - __$$DiaryModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {int id, - DiaryStateEnum state, - @JsonKey(fromJson: parseUnformattedDate) DateTime date}); -} - -/// @nodoc -class __$$DiaryModelImplCopyWithImpl<$Res> - extends _$DiaryModelCopyWithImpl<$Res, _$DiaryModelImpl> - implements _$$DiaryModelImplCopyWith<$Res> { - __$$DiaryModelImplCopyWithImpl( - _$DiaryModelImpl _value, $Res Function(_$DiaryModelImpl) _then) - : super(_value, _then); - - /// Create a copy of DiaryModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? state = null, - Object? date = null, - }) { - return _then(_$DiaryModelImpl( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - state: null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as DiaryStateEnum, - date: null == date - ? _value.date - : date // ignore: cast_nullable_to_non_nullable - as DateTime, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$DiaryModelImpl implements _DiaryModel { - _$DiaryModelImpl( - {required this.id, - required this.state, - @JsonKey(fromJson: parseUnformattedDate) required this.date}); - - factory _$DiaryModelImpl.fromJson(Map json) => - _$$DiaryModelImplFromJson(json); - - @override - final int id; - @override - final DiaryStateEnum state; - @override - @JsonKey(fromJson: parseUnformattedDate) - final DateTime date; - - @override - String toString() { - return 'DiaryModel(id: $id, state: $state, date: $date)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$DiaryModelImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.state, state) || other.state == state) && - (identical(other.date, date) || other.date == date)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, id, state, date); - - /// Create a copy of DiaryModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => - __$$DiaryModelImplCopyWithImpl<_$DiaryModelImpl>(this, _$identity); - - @override - Map toJson() { - return _$$DiaryModelImplToJson( - this, - ); - } -} - -abstract class _DiaryModel implements DiaryModel { - factory _DiaryModel( - {required final int id, - required final DiaryStateEnum state, - @JsonKey(fromJson: parseUnformattedDate) - required final DateTime date}) = _$DiaryModelImpl; - - factory _DiaryModel.fromJson(Map json) = - _$DiaryModelImpl.fromJson; - - @override - int get id; - @override - DiaryStateEnum get state; - @override - @JsonKey(fromJson: parseUnformattedDate) - DateTime get date; - - /// Create a copy of DiaryModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => - throw _privateConstructorUsedError; -} - -ConsultationPaginationModel _$ConsultationPaginationModelFromJson( - Map json) { - return _ConsultationPaginationModel.fromJson(json); -} - -/// @nodoc -mixin _$ConsultationPaginationModel { - List get data => throw _privateConstructorUsedError; - - /// Serializes this ConsultationPaginationModel to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of ConsultationPaginationModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $ConsultationPaginationModelCopyWith - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ConsultationPaginationModelCopyWith<$Res> { - factory $ConsultationPaginationModelCopyWith( - ConsultationPaginationModel value, - $Res Function(ConsultationPaginationModel) then) = - _$ConsultationPaginationModelCopyWithImpl<$Res, - ConsultationPaginationModel>; - @useResult - $Res call({List data}); -} - -/// @nodoc -class _$ConsultationPaginationModelCopyWithImpl<$Res, - $Val extends ConsultationPaginationModel> - implements $ConsultationPaginationModelCopyWith<$Res> { - _$ConsultationPaginationModelCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of ConsultationPaginationModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? data = null, - }) { - return _then(_value.copyWith( - data: null == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as List, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$ConsultationPaginationModelImplCopyWith<$Res> - implements $ConsultationPaginationModelCopyWith<$Res> { - factory _$$ConsultationPaginationModelImplCopyWith( - _$ConsultationPaginationModelImpl value, - $Res Function(_$ConsultationPaginationModelImpl) then) = - __$$ConsultationPaginationModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({List data}); -} - -/// @nodoc -class __$$ConsultationPaginationModelImplCopyWithImpl<$Res> - extends _$ConsultationPaginationModelCopyWithImpl<$Res, - _$ConsultationPaginationModelImpl> - implements _$$ConsultationPaginationModelImplCopyWith<$Res> { - __$$ConsultationPaginationModelImplCopyWithImpl( - _$ConsultationPaginationModelImpl _value, - $Res Function(_$ConsultationPaginationModelImpl) _then) - : super(_value, _then); - - /// Create a copy of ConsultationPaginationModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? data = null, - }) { - return _then(_$ConsultationPaginationModelImpl( - data: null == data - ? _value._data - : data // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$ConsultationPaginationModelImpl - implements _ConsultationPaginationModel { - _$ConsultationPaginationModelImpl( - {required final List data}) - : _data = data; - - factory _$ConsultationPaginationModelImpl.fromJson( - Map json) => - _$$ConsultationPaginationModelImplFromJson(json); - - final List _data; - @override - List get data { - if (_data is EqualUnmodifiableListView) return _data; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_data); - } - - @override - String toString() { - return 'ConsultationPaginationModel(data: $data)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ConsultationPaginationModelImpl && - const DeepCollectionEquality().equals(other._data, _data)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(_data)); - - /// Create a copy of ConsultationPaginationModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ConsultationPaginationModelImplCopyWith<_$ConsultationPaginationModelImpl> - get copyWith => __$$ConsultationPaginationModelImplCopyWithImpl< - _$ConsultationPaginationModelImpl>(this, _$identity); - - @override - Map toJson() { - return _$$ConsultationPaginationModelImplToJson( - this, - ); - } -} - -abstract class _ConsultationPaginationModel - implements ConsultationPaginationModel { - factory _ConsultationPaginationModel( - {required final List data}) = - _$ConsultationPaginationModelImpl; - - factory _ConsultationPaginationModel.fromJson(Map json) = - _$ConsultationPaginationModelImpl.fromJson; - - @override - List get data; - - /// Create a copy of ConsultationPaginationModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ConsultationPaginationModelImplCopyWith<_$ConsultationPaginationModelImpl> - get copyWith => throw _privateConstructorUsedError; -} diff --git a/lib/features/consultations/models/consultation_model.g.dart b/lib/features/consultations/models/consultation_model.g.dart deleted file mode 100644 index ff93e365..00000000 --- a/lib/features/consultations/models/consultation_model.g.dart +++ /dev/null @@ -1,100 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'consultation_model.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_$ConsultationModelImpl _$$ConsultationModelImplFromJson( - Map json) => - _$ConsultationModelImpl( - id: (json['id'] as num).toInt(), - chosenPlanState: - $enumDecode(_$ChosenPlanStateEnumEnumMap, json['last_state']), - planTitle: json['planTitle'] as String, - userName: json['userName'] as String, - userSlug: json['userSlug'] as String, - consultantPayment: (json['consultantPayment'] as num).toDouble(), - duration: (json['duration'] as num).toInt(), - currentDiaryDay: (json['currentDiaryDay'] as num).toInt(), - startDate: parseDate(json['start_date'] as String), - endDate: parseDate(json['end_date'] as String), - consultantId: (json['consultant_id'] as num).toInt(), - diaries: (json['diaries'] as List) - .map((e) => DiaryModel.fromJson(e as Map)) - .toList(), - ); - -Map _$$ConsultationModelImplToJson( - _$ConsultationModelImpl instance) => - { - 'id': instance.id, - 'last_state': _$ChosenPlanStateEnumEnumMap[instance.chosenPlanState]!, - 'planTitle': instance.planTitle, - 'userName': instance.userName, - 'userSlug': instance.userSlug, - 'consultantPayment': instance.consultantPayment, - 'duration': instance.duration, - 'currentDiaryDay': instance.currentDiaryDay, - 'start_date': instance.startDate.toIso8601String(), - 'end_date': instance.endDate.toIso8601String(), - 'consultant_id': instance.consultantId, - 'diaries': instance.diaries, - }; - -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', -}; - -_$DiaryModelImpl _$$DiaryModelImplFromJson(Map json) => - _$DiaryModelImpl( - id: (json['id'] as num).toInt(), - state: $enumDecode(_$DiaryStateEnumEnumMap, json['state']), - date: parseUnformattedDate(json['date'] as String), - ); - -Map _$$DiaryModelImplToJson(_$DiaryModelImpl instance) => - { - 'id': instance.id, - 'state': _$DiaryStateEnumEnumMap[instance.state]!, - 'date': instance.date.toIso8601String(), - }; - -const _$DiaryStateEnumEnumMap = { - DiaryStateEnum.init: 'init', - DiaryStateEnum.started: 'started', - DiaryStateEnum.finished: 'finished', - DiaryStateEnum.commented: 'commented', - DiaryStateEnum.reviewedByUser: 'reviewed_by_user', - DiaryStateEnum.lastDayStarted: 'last_day_started', - DiaryStateEnum.lastDayFinished: 'last_day_finished', - DiaryStateEnum.lastDayCommented: 'last_day_commented', -}; - -_$ConsultationPaginationModelImpl _$$ConsultationPaginationModelImplFromJson( - Map json) => - _$ConsultationPaginationModelImpl( - data: (json['data'] as List) - .map((e) => ConsultationModel.fromJson(e as Map)) - .toList(), - ); - -Map _$$ConsultationPaginationModelImplToJson( - _$ConsultationPaginationModelImpl instance) => - { - 'data': instance.data, - }; diff --git a/lib/features/consultations/presentation/cubit/consultations_state.freezed.dart b/lib/features/consultations/presentation/cubit/consultations_state.freezed.dart deleted file mode 100644 index 7d4203e5..00000000 --- a/lib/features/consultations/presentation/cubit/consultations_state.freezed.dart +++ /dev/null @@ -1,175 +0,0 @@ -// 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 'consultations_state.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -/// @nodoc -mixin _$ConsultationsState { - BaseState get state => throw _privateConstructorUsedError; - List get consultations => - throw _privateConstructorUsedError; - - /// Create a copy of ConsultationsState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $ConsultationsStateCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ConsultationsStateCopyWith<$Res> { - factory $ConsultationsStateCopyWith( - ConsultationsState value, $Res Function(ConsultationsState) then) = - _$ConsultationsStateCopyWithImpl<$Res, ConsultationsState>; - @useResult - $Res call({BaseState state, List consultations}); -} - -/// @nodoc -class _$ConsultationsStateCopyWithImpl<$Res, $Val extends ConsultationsState> - implements $ConsultationsStateCopyWith<$Res> { - _$ConsultationsStateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of ConsultationsState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? state = null, - Object? consultations = null, - }) { - return _then(_value.copyWith( - state: null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as BaseState, - consultations: null == consultations - ? _value.consultations - : consultations // ignore: cast_nullable_to_non_nullable - as List, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$ConsultationsStateImplCopyWith<$Res> - implements $ConsultationsStateCopyWith<$Res> { - factory _$$ConsultationsStateImplCopyWith(_$ConsultationsStateImpl value, - $Res Function(_$ConsultationsStateImpl) then) = - __$$ConsultationsStateImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({BaseState state, List consultations}); -} - -/// @nodoc -class __$$ConsultationsStateImplCopyWithImpl<$Res> - extends _$ConsultationsStateCopyWithImpl<$Res, _$ConsultationsStateImpl> - implements _$$ConsultationsStateImplCopyWith<$Res> { - __$$ConsultationsStateImplCopyWithImpl(_$ConsultationsStateImpl _value, - $Res Function(_$ConsultationsStateImpl) _then) - : super(_value, _then); - - /// Create a copy of ConsultationsState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? state = null, - Object? consultations = null, - }) { - return _then(_$ConsultationsStateImpl( - state: null == state - ? _value.state - : state // ignore: cast_nullable_to_non_nullable - as BaseState, - consultations: null == consultations - ? _value._consultations - : consultations // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc - -class _$ConsultationsStateImpl implements _ConsultationsState { - _$ConsultationsStateImpl( - {this.state = BaseState.initial, - final List consultations = const []}) - : _consultations = consultations; - - @override - @JsonKey() - final BaseState state; - final List _consultations; - @override - @JsonKey() - List get consultations { - if (_consultations is EqualUnmodifiableListView) return _consultations; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_consultations); - } - - @override - String toString() { - return 'ConsultationsState(state: $state, consultations: $consultations)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ConsultationsStateImpl && - (identical(other.state, state) || other.state == state) && - const DeepCollectionEquality() - .equals(other._consultations, _consultations)); - } - - @override - int get hashCode => Object.hash( - runtimeType, state, const DeepCollectionEquality().hash(_consultations)); - - /// Create a copy of ConsultationsState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ConsultationsStateImplCopyWith<_$ConsultationsStateImpl> get copyWith => - __$$ConsultationsStateImplCopyWithImpl<_$ConsultationsStateImpl>( - this, _$identity); -} - -abstract class _ConsultationsState implements ConsultationsState { - factory _ConsultationsState( - {final BaseState state, - final List consultations}) = _$ConsultationsStateImpl; - - @override - BaseState get state; - @override - List get consultations; - - /// Create a copy of ConsultationsState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ConsultationsStateImplCopyWith<_$ConsultationsStateImpl> get copyWith => - throw _privateConstructorUsedError; -} diff --git a/lib/features/consultations/services/consultation_service.g.dart b/lib/features/consultations/services/consultation_service.g.dart deleted file mode 100644 index ff0edd2b..00000000 --- a/lib/features/consultations/services/consultation_service.g.dart +++ /dev/null @@ -1,73 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'consultation_service.dart'; - -// ************************************************************************** -// RetrofitGenerator -// ************************************************************************** - -// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations - -class _ConsultationService implements ConsultationService { - _ConsultationService(this._dio, {this.baseUrl, this.errorLogger}); - - final Dio _dio; - - String? baseUrl; - - final ParseErrorLogger? errorLogger; - - @override - Future getConsultations() async { - final _extra = {}; - final queryParameters = {}; - final _headers = {}; - const Map? _data = null; - final _options = _setStreamType( - Options(method: 'GET', headers: _headers, extra: _extra) - .compose( - _dio.options, - '/api/consultations', - queryParameters: queryParameters, - data: _data, - ) - .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), - ); - final _result = await _dio.fetch>(_options); - late ConsultationPaginationModel _value; - try { - _value = ConsultationPaginationModel.fromJson(_result.data!); - } on Object catch (e, s) { - errorLogger?.logError(e, s, _options); - rethrow; - } - return _value; - } - - RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && - !(requestOptions.responseType == ResponseType.bytes || - requestOptions.responseType == ResponseType.stream)) { - if (T == String) { - requestOptions.responseType = ResponseType.plain; - } else { - requestOptions.responseType = ResponseType.json; - } - } - return requestOptions; - } - - String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { - if (baseUrl == null || baseUrl.trim().isEmpty) { - return dioBaseUrl; - } - - final url = Uri.parse(baseUrl); - - if (url.isAbsolute) { - return url.toString(); - } - - return Uri.parse(dioBaseUrl).resolveUri(url).toString(); - } -} diff --git a/lib/features/diary/models/consultant_comment_model.freezed.dart b/lib/features/diary/models/consultant_comment_model.freezed.dart deleted file mode 100644 index 93b59f59..00000000 --- a/lib/features/diary/models/consultant_comment_model.freezed.dart +++ /dev/null @@ -1,581 +0,0 @@ -// 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 'consultant_comment_model.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -ConsultantCommentModel _$ConsultantCommentModelFromJson( - Map json) { - return _ConsultantCommentModel.fromJson(json); -} - -/// @nodoc -mixin _$ConsultantCommentModel { - String? get comment => throw _privateConstructorUsedError; - @JsonKey(name: 'meals') - Map get mealsComments => - throw _privateConstructorUsedError; - List get portions => throw _privateConstructorUsedError; - - /// Serializes this ConsultantCommentModel to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of ConsultantCommentModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $ConsultantCommentModelCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ConsultantCommentModelCopyWith<$Res> { - factory $ConsultantCommentModelCopyWith(ConsultantCommentModel value, - $Res Function(ConsultantCommentModel) then) = - _$ConsultantCommentModelCopyWithImpl<$Res, ConsultantCommentModel>; - @useResult - $Res call( - {String? comment, - @JsonKey(name: 'meals') Map mealsComments, - List portions}); -} - -/// @nodoc -class _$ConsultantCommentModelCopyWithImpl<$Res, - $Val extends ConsultantCommentModel> - implements $ConsultantCommentModelCopyWith<$Res> { - _$ConsultantCommentModelCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of ConsultantCommentModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? comment = freezed, - Object? mealsComments = null, - Object? portions = null, - }) { - return _then(_value.copyWith( - comment: freezed == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String?, - mealsComments: null == mealsComments - ? _value.mealsComments - : mealsComments // ignore: cast_nullable_to_non_nullable - as Map, - portions: null == portions - ? _value.portions - : portions // ignore: cast_nullable_to_non_nullable - as List, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$ConsultantCommentModelImplCopyWith<$Res> - implements $ConsultantCommentModelCopyWith<$Res> { - factory _$$ConsultantCommentModelImplCopyWith( - _$ConsultantCommentModelImpl value, - $Res Function(_$ConsultantCommentModelImpl) then) = - __$$ConsultantCommentModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? comment, - @JsonKey(name: 'meals') Map mealsComments, - List portions}); -} - -/// @nodoc -class __$$ConsultantCommentModelImplCopyWithImpl<$Res> - extends _$ConsultantCommentModelCopyWithImpl<$Res, - _$ConsultantCommentModelImpl> - implements _$$ConsultantCommentModelImplCopyWith<$Res> { - __$$ConsultantCommentModelImplCopyWithImpl( - _$ConsultantCommentModelImpl _value, - $Res Function(_$ConsultantCommentModelImpl) _then) - : super(_value, _then); - - /// Create a copy of ConsultantCommentModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? comment = freezed, - Object? mealsComments = null, - Object? portions = null, - }) { - return _then(_$ConsultantCommentModelImpl( - comment: freezed == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String?, - mealsComments: null == mealsComments - ? _value._mealsComments - : mealsComments // ignore: cast_nullable_to_non_nullable - as Map, - portions: null == portions - ? _value._portions - : portions // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$ConsultantCommentModelImpl implements _ConsultantCommentModel { - _$ConsultantCommentModelImpl( - {this.comment, - @JsonKey(name: 'meals') - final Map mealsComments = const {}, - final List portions = const []}) - : _mealsComments = mealsComments, - _portions = portions; - - factory _$ConsultantCommentModelImpl.fromJson(Map json) => - _$$ConsultantCommentModelImplFromJson(json); - - @override - final String? comment; - final Map _mealsComments; - @override - @JsonKey(name: 'meals') - Map get mealsComments { - if (_mealsComments is EqualUnmodifiableMapView) return _mealsComments; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_mealsComments); - } - - final List _portions; - @override - @JsonKey() - List get portions { - if (_portions is EqualUnmodifiableListView) return _portions; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_portions); - } - - @override - String toString() { - return 'ConsultantCommentModel(comment: $comment, mealsComments: $mealsComments, portions: $portions)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ConsultantCommentModelImpl && - (identical(other.comment, comment) || other.comment == comment) && - const DeepCollectionEquality() - .equals(other._mealsComments, _mealsComments) && - const DeepCollectionEquality().equals(other._portions, _portions)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - comment, - const DeepCollectionEquality().hash(_mealsComments), - const DeepCollectionEquality().hash(_portions)); - - /// Create a copy of ConsultantCommentModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ConsultantCommentModelImplCopyWith<_$ConsultantCommentModelImpl> - get copyWith => __$$ConsultantCommentModelImplCopyWithImpl< - _$ConsultantCommentModelImpl>(this, _$identity); - - @override - Map toJson() { - return _$$ConsultantCommentModelImplToJson( - this, - ); - } -} - -abstract class _ConsultantCommentModel implements ConsultantCommentModel { - factory _ConsultantCommentModel( - {final String? comment, - @JsonKey(name: 'meals') final Map mealsComments, - final List portions}) = _$ConsultantCommentModelImpl; - - factory _ConsultantCommentModel.fromJson(Map json) = - _$ConsultantCommentModelImpl.fromJson; - - @override - String? get comment; - @override - @JsonKey(name: 'meals') - Map get mealsComments; - @override - List get portions; - - /// Create a copy of ConsultantCommentModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ConsultantCommentModelImplCopyWith<_$ConsultantCommentModelImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PortionCommentModel _$PortionCommentModelFromJson(Map json) { - return _PortionCommentModel.fromJson(json); -} - -/// @nodoc -mixin _$PortionCommentModel { - String get comment => throw _privateConstructorUsedError; - int get id => throw _privateConstructorUsedError; - - /// Serializes this PortionCommentModel to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PortionCommentModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PortionCommentModelCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PortionCommentModelCopyWith<$Res> { - factory $PortionCommentModelCopyWith( - PortionCommentModel value, $Res Function(PortionCommentModel) then) = - _$PortionCommentModelCopyWithImpl<$Res, PortionCommentModel>; - @useResult - $Res call({String comment, int id}); -} - -/// @nodoc -class _$PortionCommentModelCopyWithImpl<$Res, $Val extends PortionCommentModel> - implements $PortionCommentModelCopyWith<$Res> { - _$PortionCommentModelCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PortionCommentModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? comment = null, - Object? id = null, - }) { - return _then(_value.copyWith( - comment: null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PortionCommentModelImplCopyWith<$Res> - implements $PortionCommentModelCopyWith<$Res> { - factory _$$PortionCommentModelImplCopyWith(_$PortionCommentModelImpl value, - $Res Function(_$PortionCommentModelImpl) then) = - __$$PortionCommentModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String comment, int id}); -} - -/// @nodoc -class __$$PortionCommentModelImplCopyWithImpl<$Res> - extends _$PortionCommentModelCopyWithImpl<$Res, _$PortionCommentModelImpl> - implements _$$PortionCommentModelImplCopyWith<$Res> { - __$$PortionCommentModelImplCopyWithImpl(_$PortionCommentModelImpl _value, - $Res Function(_$PortionCommentModelImpl) _then) - : super(_value, _then); - - /// Create a copy of PortionCommentModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? comment = null, - Object? id = null, - }) { - return _then(_$PortionCommentModelImpl( - comment: null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PortionCommentModelImpl implements _PortionCommentModel { - _$PortionCommentModelImpl({required this.comment, required this.id}); - - factory _$PortionCommentModelImpl.fromJson(Map json) => - _$$PortionCommentModelImplFromJson(json); - - @override - final String comment; - @override - final int id; - - @override - String toString() { - return 'PortionCommentModel(comment: $comment, id: $id)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PortionCommentModelImpl && - (identical(other.comment, comment) || other.comment == comment) && - (identical(other.id, id) || other.id == id)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, comment, id); - - /// Create a copy of PortionCommentModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PortionCommentModelImplCopyWith<_$PortionCommentModelImpl> get copyWith => - __$$PortionCommentModelImplCopyWithImpl<_$PortionCommentModelImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$PortionCommentModelImplToJson( - this, - ); - } -} - -abstract class _PortionCommentModel implements PortionCommentModel { - factory _PortionCommentModel( - {required final String comment, - required final int id}) = _$PortionCommentModelImpl; - - factory _PortionCommentModel.fromJson(Map json) = - _$PortionCommentModelImpl.fromJson; - - @override - String get comment; - @override - int get id; - - /// Create a copy of PortionCommentModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PortionCommentModelImplCopyWith<_$PortionCommentModelImpl> get copyWith => - throw _privateConstructorUsedError; -} - -MealCommentModel _$MealCommentModelFromJson(Map json) { - return _MealCommentModel.fromJson(json); -} - -/// @nodoc -mixin _$MealCommentModel { - String get comment => throw _privateConstructorUsedError; - @JsonKey(name: 'type_no') - int get typeNumber => throw _privateConstructorUsedError; - - /// Serializes this MealCommentModel to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of MealCommentModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $MealCommentModelCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $MealCommentModelCopyWith<$Res> { - factory $MealCommentModelCopyWith( - MealCommentModel value, $Res Function(MealCommentModel) then) = - _$MealCommentModelCopyWithImpl<$Res, MealCommentModel>; - @useResult - $Res call({String comment, @JsonKey(name: 'type_no') int typeNumber}); -} - -/// @nodoc -class _$MealCommentModelCopyWithImpl<$Res, $Val extends MealCommentModel> - implements $MealCommentModelCopyWith<$Res> { - _$MealCommentModelCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of MealCommentModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? comment = null, - Object? typeNumber = null, - }) { - return _then(_value.copyWith( - comment: null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeNumber: null == typeNumber - ? _value.typeNumber - : typeNumber // ignore: cast_nullable_to_non_nullable - as int, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$MealCommentModelImplCopyWith<$Res> - implements $MealCommentModelCopyWith<$Res> { - factory _$$MealCommentModelImplCopyWith(_$MealCommentModelImpl value, - $Res Function(_$MealCommentModelImpl) then) = - __$$MealCommentModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String comment, @JsonKey(name: 'type_no') int typeNumber}); -} - -/// @nodoc -class __$$MealCommentModelImplCopyWithImpl<$Res> - extends _$MealCommentModelCopyWithImpl<$Res, _$MealCommentModelImpl> - implements _$$MealCommentModelImplCopyWith<$Res> { - __$$MealCommentModelImplCopyWithImpl(_$MealCommentModelImpl _value, - $Res Function(_$MealCommentModelImpl) _then) - : super(_value, _then); - - /// Create a copy of MealCommentModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? comment = null, - Object? typeNumber = null, - }) { - return _then(_$MealCommentModelImpl( - comment: null == comment - ? _value.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeNumber: null == typeNumber - ? _value.typeNumber - : typeNumber // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$MealCommentModelImpl implements _MealCommentModel { - _$MealCommentModelImpl( - {required this.comment, - @JsonKey(name: 'type_no') required this.typeNumber}); - - factory _$MealCommentModelImpl.fromJson(Map json) => - _$$MealCommentModelImplFromJson(json); - - @override - final String comment; - @override - @JsonKey(name: 'type_no') - final int typeNumber; - - @override - String toString() { - return 'MealCommentModel(comment: $comment, typeNumber: $typeNumber)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MealCommentModelImpl && - (identical(other.comment, comment) || other.comment == comment) && - (identical(other.typeNumber, typeNumber) || - other.typeNumber == typeNumber)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, comment, typeNumber); - - /// Create a copy of MealCommentModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$MealCommentModelImplCopyWith<_$MealCommentModelImpl> get copyWith => - __$$MealCommentModelImplCopyWithImpl<_$MealCommentModelImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$MealCommentModelImplToJson( - this, - ); - } -} - -abstract class _MealCommentModel implements MealCommentModel { - factory _MealCommentModel( - {required final String comment, - @JsonKey(name: 'type_no') required final int typeNumber}) = - _$MealCommentModelImpl; - - factory _MealCommentModel.fromJson(Map json) = - _$MealCommentModelImpl.fromJson; - - @override - String get comment; - @override - @JsonKey(name: 'type_no') - int get typeNumber; - - /// Create a copy of MealCommentModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$MealCommentModelImplCopyWith<_$MealCommentModelImpl> get copyWith => - throw _privateConstructorUsedError; -} diff --git a/lib/features/diary/models/consultant_comment_model.g.dart b/lib/features/diary/models/consultant_comment_model.g.dart deleted file mode 100644 index 4ea3943a..00000000 --- a/lib/features/diary/models/consultant_comment_model.g.dart +++ /dev/null @@ -1,59 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'consultant_comment_model.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_$ConsultantCommentModelImpl _$$ConsultantCommentModelImplFromJson( - Map json) => - _$ConsultantCommentModelImpl( - comment: json['comment'] as String?, - mealsComments: (json['meals'] as Map?)?.map( - (k, e) => MapEntry( - k, MealCommentModel.fromJson(e as Map)), - ) ?? - const {}, - portions: (json['portions'] as List?) - ?.map((e) => - PortionCommentModel.fromJson(e as Map)) - .toList() ?? - const [], - ); - -Map _$$ConsultantCommentModelImplToJson( - _$ConsultantCommentModelImpl instance) => - { - 'comment': instance.comment, - 'meals': instance.mealsComments, - 'portions': instance.portions, - }; - -_$PortionCommentModelImpl _$$PortionCommentModelImplFromJson( - Map json) => - _$PortionCommentModelImpl( - comment: json['comment'] as String, - id: (json['id'] as num).toInt(), - ); - -Map _$$PortionCommentModelImplToJson( - _$PortionCommentModelImpl instance) => - { - 'comment': instance.comment, - 'id': instance.id, - }; - -_$MealCommentModelImpl _$$MealCommentModelImplFromJson( - Map json) => - _$MealCommentModelImpl( - comment: json['comment'] as String, - typeNumber: (json['type_no'] as num).toInt(), - ); - -Map _$$MealCommentModelImplToJson( - _$MealCommentModelImpl instance) => - { - 'comment': instance.comment, - 'type_no': instance.typeNumber, - }; diff --git a/lib/features/diary/presentation/bloc/consultant_comments_cubit/consultant_comments_state.freezed.dart b/lib/features/diary/presentation/bloc/consultant_comments_cubit/consultant_comments_state.freezed.dart deleted file mode 100644 index 2f527110..00000000 --- a/lib/features/diary/presentation/bloc/consultant_comments_cubit/consultant_comments_state.freezed.dart +++ /dev/null @@ -1,190 +0,0 @@ -// 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 'consultant_comments_state.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -/// @nodoc -mixin _$ConsultantCommentsState { - ConsultantCommentModel get commentsModel => - throw _privateConstructorUsedError; - bool get dayCommentNeedsToBeFilled => throw _privateConstructorUsedError; - - /// Create a copy of ConsultantCommentsState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $ConsultantCommentsStateCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ConsultantCommentsStateCopyWith<$Res> { - factory $ConsultantCommentsStateCopyWith(ConsultantCommentsState value, - $Res Function(ConsultantCommentsState) then) = - _$ConsultantCommentsStateCopyWithImpl<$Res, ConsultantCommentsState>; - @useResult - $Res call( - {ConsultantCommentModel commentsModel, bool dayCommentNeedsToBeFilled}); - - $ConsultantCommentModelCopyWith<$Res> get commentsModel; -} - -/// @nodoc -class _$ConsultantCommentsStateCopyWithImpl<$Res, - $Val extends ConsultantCommentsState> - implements $ConsultantCommentsStateCopyWith<$Res> { - _$ConsultantCommentsStateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of ConsultantCommentsState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? commentsModel = null, - Object? dayCommentNeedsToBeFilled = null, - }) { - return _then(_value.copyWith( - commentsModel: null == commentsModel - ? _value.commentsModel - : commentsModel // ignore: cast_nullable_to_non_nullable - as ConsultantCommentModel, - dayCommentNeedsToBeFilled: null == dayCommentNeedsToBeFilled - ? _value.dayCommentNeedsToBeFilled - : dayCommentNeedsToBeFilled // ignore: cast_nullable_to_non_nullable - as bool, - ) as $Val); - } - - /// Create a copy of ConsultantCommentsState - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ConsultantCommentModelCopyWith<$Res> get commentsModel { - return $ConsultantCommentModelCopyWith<$Res>(_value.commentsModel, (value) { - return _then(_value.copyWith(commentsModel: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$ConsultantCommentsStateImplCopyWith<$Res> - implements $ConsultantCommentsStateCopyWith<$Res> { - factory _$$ConsultantCommentsStateImplCopyWith( - _$ConsultantCommentsStateImpl value, - $Res Function(_$ConsultantCommentsStateImpl) then) = - __$$ConsultantCommentsStateImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {ConsultantCommentModel commentsModel, bool dayCommentNeedsToBeFilled}); - - @override - $ConsultantCommentModelCopyWith<$Res> get commentsModel; -} - -/// @nodoc -class __$$ConsultantCommentsStateImplCopyWithImpl<$Res> - extends _$ConsultantCommentsStateCopyWithImpl<$Res, - _$ConsultantCommentsStateImpl> - implements _$$ConsultantCommentsStateImplCopyWith<$Res> { - __$$ConsultantCommentsStateImplCopyWithImpl( - _$ConsultantCommentsStateImpl _value, - $Res Function(_$ConsultantCommentsStateImpl) _then) - : super(_value, _then); - - /// Create a copy of ConsultantCommentsState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? commentsModel = null, - Object? dayCommentNeedsToBeFilled = null, - }) { - return _then(_$ConsultantCommentsStateImpl( - commentsModel: null == commentsModel - ? _value.commentsModel - : commentsModel // ignore: cast_nullable_to_non_nullable - as ConsultantCommentModel, - dayCommentNeedsToBeFilled: null == dayCommentNeedsToBeFilled - ? _value.dayCommentNeedsToBeFilled - : dayCommentNeedsToBeFilled // ignore: cast_nullable_to_non_nullable - as bool, - )); - } -} - -/// @nodoc - -class _$ConsultantCommentsStateImpl implements _ConsultantCommentsState { - _$ConsultantCommentsStateImpl( - {required this.commentsModel, this.dayCommentNeedsToBeFilled = false}); - - @override - final ConsultantCommentModel commentsModel; - @override - @JsonKey() - final bool dayCommentNeedsToBeFilled; - - @override - String toString() { - return 'ConsultantCommentsState(commentsModel: $commentsModel, dayCommentNeedsToBeFilled: $dayCommentNeedsToBeFilled)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ConsultantCommentsStateImpl && - (identical(other.commentsModel, commentsModel) || - other.commentsModel == commentsModel) && - (identical(other.dayCommentNeedsToBeFilled, - dayCommentNeedsToBeFilled) || - other.dayCommentNeedsToBeFilled == dayCommentNeedsToBeFilled)); - } - - @override - int get hashCode => - Object.hash(runtimeType, commentsModel, dayCommentNeedsToBeFilled); - - /// Create a copy of ConsultantCommentsState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ConsultantCommentsStateImplCopyWith<_$ConsultantCommentsStateImpl> - get copyWith => __$$ConsultantCommentsStateImplCopyWithImpl< - _$ConsultantCommentsStateImpl>(this, _$identity); -} - -abstract class _ConsultantCommentsState implements ConsultantCommentsState { - factory _ConsultantCommentsState( - {required final ConsultantCommentModel commentsModel, - final bool dayCommentNeedsToBeFilled}) = _$ConsultantCommentsStateImpl; - - @override - ConsultantCommentModel get commentsModel; - @override - bool get dayCommentNeedsToBeFilled; - - /// Create a copy of ConsultantCommentsState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ConsultantCommentsStateImplCopyWith<_$ConsultantCommentsStateImpl> - get copyWith => throw _privateConstructorUsedError; -} diff --git a/lib/features/diets/presentation/widgets/author_card.dart b/lib/features/diets/presentation/widgets/author_card.dart index 9e00d1dd..c1113f93 100644 --- a/lib/features/diets/presentation/widgets/author_card.dart +++ b/lib/features/diets/presentation/widgets/author_card.dart @@ -12,75 +12,78 @@ class AuthorCard extends StatelessWidget { final String title; final Color? backgroundColor; final TextStyle? titleStyle; + @override Widget build(BuildContext context) { - return Container( - width: MediaQuery.sizeOf(context).width, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: backgroundColor ?? appTheme.cardBackground), - child: Stack( - children: [ - Padding( - padding: const EdgeInsets.only(left: 16, top: 16, bottom: 24), - child: Column( - children: [ - ListTile( - contentPadding: EdgeInsets.zero, - leading: Container( - width: 64, - height: 64, - decoration: BoxDecoration( - shape: BoxShape.circle, - image: DecorationImage( - image: NetworkImage(author.authorProfileIcon), - fit: BoxFit.cover, + return GestureDetector( + onTap: () { + GoRouter.of(context).pushNamed('profileScreen', extra: author); + }, + child: Container( + width: MediaQuery.sizeOf(context).width, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: backgroundColor ?? appTheme.cardBackground), + child: Stack( + children: [ + Padding( + padding: const EdgeInsets.only(left: 16, top: 16, bottom: 24), + child: Column( + children: [ + ListTile( + contentPadding: EdgeInsets.zero, + leading: Container( + width: 64, + height: 64, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: NetworkImage(author.authorProfileIcon), + fit: BoxFit.cover, + ), ), ), - ), - subtitle: Text( - author.authorName, - style: TextStyles.textLSemibold.copyWith( - color: appTheme.black, - ), - ), - title: Text( - title, - style: titleStyle ?? TextStyles.textSSemibold.copyWith( - color: appTheme.gray, - ), - ), - ), - Row( - children: [ - Text( - 'Консультант', - style: TextStyles.textMMedium.copyWith( + subtitle: Text( + author.authorName, + style: TextStyles.textLSemibold.copyWith( color: appTheme.black, ), ), - const SizedBox(width: 10), - if (author.authorPlaceInRating != null) - InfoBouble( - radius: 12, - backgroundColor: appTheme.whiteA700, - children: [ - Text( - '${author.authorPlaceInRating}-й в рейтинге', - style: TextStyles.textMMediumAuto.copyWith( - color: appTheme.blueA400, - ), - ), - ], + title: Text( + title, + style: titleStyle ?? TextStyles.textSSemibold.copyWith( + color: appTheme.gray, ), - ], - ), - ], + ), + ), + Row( + children: [ + Text( + 'Консультант', + style: TextStyles.textMMedium.copyWith( + color: appTheme.black, + ), + ), + const SizedBox(width: 10), + if (author.authorPlaceInRating != null) + InfoBouble( + radius: 12, + backgroundColor: appTheme.whiteA700, + children: [ + Text( + '${author.authorPlaceInRating}-й в рейтинге', + style: TextStyles.textMMediumAuto.copyWith( + color: appTheme.blueA400, + ), + ), + ], + ), + ], + ), + ], + ), ), - ), - Positioned( - right: 8, - top: 8, - child: GestureDetector( - onTap: () => GoRouter.of(context).pushNamed('profileScreen', extra: author), + Positioned( + right: 8, + top: 8, child: Container( width: 28, height: 28, @@ -98,8 +101,8 @@ class AuthorCard extends StatelessWidget { ), ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index 819d8c62..605df679 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -81,6 +81,7 @@ class _BlogPostWidgetState extends State { foregroundImage: NetworkImage( state.feedBlogPostList[widget.index].author.authorProfileIcon, ), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), ), const SizedBox(width: 8), Column( diff --git a/lib/features/feed/presentation/widgets/comments_widget.dart b/lib/features/feed/presentation/widgets/comments_widget.dart index 109bfb91..338e4f5a 100644 --- a/lib/features/feed/presentation/widgets/comments_widget.dart +++ b/lib/features/feed/presentation/widgets/comments_widget.dart @@ -42,6 +42,7 @@ class _CommentsWidgetState extends State { ), const SizedBox(height: 8), ], + const SizedBox(height: 48), ], ); } @@ -60,6 +61,7 @@ class _CommentsWidgetState extends State { children: [ CircleAvatar( foregroundImage: NetworkImage(comment.authorProfileIcon), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), radius: radius, ), const SizedBox(width: 8), diff --git a/lib/features/feed/presentation/widgets/consultant_widget.dart b/lib/features/feed/presentation/widgets/consultant_widget.dart index c9d26e47..061bc0db 100644 --- a/lib/features/feed/presentation/widgets/consultant_widget.dart +++ b/lib/features/feed/presentation/widgets/consultant_widget.dart @@ -64,6 +64,7 @@ class ConsultantWidget extends StatelessWidget { const SizedBox(width: 8), CircleAvatar( foregroundImage: NetworkImage(consultant.photo), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), ), const SizedBox(width: 8), Column( @@ -80,7 +81,7 @@ class ConsultantWidget extends StatelessWidget { ), const SizedBox(height: 4), Text( - 'Рейтинг: RATING', + 'Рейтинг: ${consultant.totalScores}', style: TextStyle( color: appTheme.blueA400, height: 1, @@ -105,7 +106,10 @@ class ConsultantWidget extends StatelessWidget { ], ), const SizedBox(height: 8), - const Text('description'), + Text( + consultant.description, + maxLines: 2, + ), if (consultant.badges.isNotEmpty) const SizedBox(height: 8), _badges(consultant.badges, context), ], diff --git a/lib/features/feed/presentation/widgets/diets_widget.dart b/lib/features/feed/presentation/widgets/diets_widget.dart index ef406b3b..fa9dce69 100644 --- a/lib/features/feed/presentation/widgets/diets_widget.dart +++ b/lib/features/feed/presentation/widgets/diets_widget.dart @@ -153,6 +153,19 @@ class _DietsWidgetState extends State { ), ), ], + if (widget.diet.details.length > 200) + const Padding( + padding: EdgeInsets.only(left: 16, top: 8), + child: Text( + 'Показать ещё', + style: TextStyle( + height: 1, + color: Color(0xFF8B8B8B), + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + ), ], ), Padding( diff --git a/lib/features/feed/presentation/widgets/plan_widget.dart b/lib/features/feed/presentation/widgets/plan_widget.dart index 56fcd4e5..2951d90a 100644 --- a/lib/features/feed/presentation/widgets/plan_widget.dart +++ b/lib/features/feed/presentation/widgets/plan_widget.dart @@ -156,6 +156,19 @@ class _PlanWidgetState extends State { }, ), ), + if (widget.plan.details.length > 200) + const Padding( + padding: EdgeInsets.only(left: 16, top: 8), + child: Text( + 'Показать ещё', + style: TextStyle( + height: 1, + color: Color(0xFF8B8B8B), + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + ), ], ], ), diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart index 8d51da7c..2a586190 100644 --- a/lib/features/feed/presentation/widgets/recipes_widget.dart +++ b/lib/features/feed/presentation/widgets/recipes_widget.dart @@ -187,7 +187,7 @@ class _RecipesWidgetState extends State { ), if (widget.recipe.description.length > 200) const Padding( - padding: EdgeInsets.symmetric(horizontal: 12), + padding: EdgeInsets.only(left: 16, top: 8), child: Text( 'Показать ещё', style: TextStyle( diff --git a/lib/features/my_finance/entities/consultant_finance_entity.dart b/lib/features/my_finance/entities/consultant_finance_entity.dart index 7bcf86ef..77568937 100644 --- a/lib/features/my_finance/entities/consultant_finance_entity.dart +++ b/lib/features/my_finance/entities/consultant_finance_entity.dart @@ -1,6 +1,7 @@ enum ConsultationStatus { completed, canceled, + inProgress } class ConsultantFinanceEntity { diff --git a/lib/features/my_finance/presentation/pages/user_finance_screen.dart b/lib/features/my_finance/presentation/pages/user_finance_screen.dart index 3eecb395..d9f56ef6 100644 --- a/lib/features/my_finance/presentation/pages/user_finance_screen.dart +++ b/lib/features/my_finance/presentation/pages/user_finance_screen.dart @@ -3,9 +3,12 @@ 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/date_time_utils.dart'; import 'package:eatvio_app/core/widgets/custom_drop_down_button.dart'; +import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart'; +import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart'; import 'package:eatvio_app/features/my_finance/entities/consultant_finance_entity.dart'; import 'package:eatvio_app/features/my_finance/presentation/pages/card_settings.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; class UserFinanceScreen extends StatefulWidget { @@ -20,162 +23,179 @@ class _UserFinanceScreenState extends State { @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: const Color(0xFFF0F2F5), - appBar: AppBar( - shape: const RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.vertical(bottom: Radius.circular(12))), - title: const Text('Финансы'), - centerTitle: true, - ), - body: SingleChildScrollView( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Column( - children: [ - const SizedBox(height: 8), - InkWell( - onTap: () { - GoRouter.of(context).pushNamed(CardSettingsScreen.name); - }, - borderRadius: BorderRadius.circular(20), - child: Ink( - decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: appTheme.blueA400), - width: MediaQuery.of(context).size.width - 32, - child: const Center( - child: Padding( - padding: EdgeInsets.all(16), - child: Text('Управление картами', style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600)), - ), - ), - ), + return BlocBuilder( + builder: (BuildContext context, ProfileAvatarState state) { + if (state is ProfileAvatarStateLoaded) { + return Scaffold( + backgroundColor: const Color(0xFFF0F2F5), + appBar: AppBar( + shape: const RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.vertical(bottom: Radius.circular(12))), + title: const Text('Финансы'), + centerTitle: true, ), - const SizedBox(height: 16), - Material( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - child: Padding( - padding: const EdgeInsets.only(left: 16, right: 16, top: 16), - child: SingleChildScrollView( - physics: const NeverScrollableScrollPhysics(), - child: Column( - children: [ - CustomDropDownButton( - items: periods - .mapIndexed( - (index, value) => DropdownMenuItem( - value: periods[index], - child: Text( - periods[index], - style: TextStyles.textMMedium.copyWith(color: appTheme.black), - ), - ), - ) - .toList(), - onChanged: (value) {}, - value: periods.first, - ), - const SizedBox(height: 12), - ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (context, index) => Material( - color: const Color(0xFFF6F6F6), - borderRadius: BorderRadius.circular(20), + body: SingleChildScrollView( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Column( + children: [ + if (state.profile.roles.contains('consultant')) ...[ + const SizedBox(height: 8), + InkWell( + onTap: () { + GoRouter.of(context).pushNamed(CardSettingsScreen.name); + }, + borderRadius: BorderRadius.circular(20), + child: Ink( + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: appTheme.blueA400), + width: MediaQuery.of(context).size.width - 32, + child: const Center( child: Padding( - padding: const EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Tooltip( - message: testFinanceEntity.consultationsList[index].id, - triggerMode: TooltipTriggerMode.tap, - textStyle: const TextStyle( - color: Colors.black, - fontSize: 16, - fontWeight: FontWeight.w500, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha((255 * 0.2).toInt()), - blurRadius: 32, - ) - ], - ), - child: Text( - testFinanceEntity.consultationsList[index].id, - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontWeight: FontWeight.w500), - ), - ), - Text( - testFinanceEntity.consultationsList[index].date.format('dd.MM.yyy', 'RU'), - style: const TextStyle(color: Color(0xFF6D6F71), height: 1, fontWeight: FontWeight.w500), - ), - ], - ), - const SizedBox(height: 8), - Text( - testFinanceEntity.consultationsList[index].title, - style: TextStyle(color: appTheme.blueA400, height: 1, fontSize: 18, fontWeight: FontWeight.w600), - ), - const SizedBox(height: 8), - Text( - 'Покупатель: ${testFinanceEntity.consultationsList[index].clientName}', - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), - ), - const SizedBox(height: 8), - Text( - '${testFinanceEntity.consultationsList[index].planDuration} дней', - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), - ), - const SizedBox(height: 8), - Container( - height: 1, - width: double.infinity, - decoration: const BoxDecoration( - color: Color(0xFFDEDEDF), - ), - ), - const SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '${testFinanceEntity.consultationsList[index].price} ₽', - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 18, fontWeight: FontWeight.w600), - ), - Material( - color: const Color(0xFF0BB450).withAlpha(11), - borderRadius: BorderRadius.circular(8), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), - child: Text( - testFinanceEntity.consultationsList[index].status.name, - style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFF0BB450), height: 1), - ), - ), - ), - ], - ), - ], - ), + padding: EdgeInsets.all(16), + child: Text('Управление картами', style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600)), ), ), - separatorBuilder: (context, index) => const SizedBox(height: 12), - itemCount: testFinanceEntity.consultationsList.length, ), - ], + ), + const SizedBox(height: 16), + ], + Material( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + child: Padding( + padding: const EdgeInsets.only(left: 16, right: 16, top: 16), + child: SingleChildScrollView( + physics: const NeverScrollableScrollPhysics(), + child: Column( + children: [ + CustomDropDownButton( + items: periods + .mapIndexed( + (index, value) => DropdownMenuItem( + value: periods[index], + child: Text( + periods[index], + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + ), + ) + .toList(), + onChanged: (value) {}, + value: periods.first, + ), + const SizedBox(height: 12), + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => Material( + color: const Color(0xFFF6F6F6), + borderRadius: BorderRadius.circular(20), + child: Padding( + padding: const EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Tooltip( + message: testFinanceEntity.consultationsList[index].id, + triggerMode: TooltipTriggerMode.tap, + textStyle: const TextStyle( + color: Colors.black, + fontSize: 16, + fontWeight: FontWeight.w500, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha((255 * 0.2).toInt()), + blurRadius: 32, + ) + ], + ), + child: Text( + testFinanceEntity.consultationsList[index].id, + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontWeight: FontWeight.w500), + ), + ), + Text( + testFinanceEntity.consultationsList[index].date.format('dd.MM.yyy', 'RU'), + style: const TextStyle(color: Color(0xFF6D6F71), height: 1, fontWeight: FontWeight.w500), + ), + ], + ), + const SizedBox(height: 8), + Text( + testFinanceEntity.consultationsList[index].title, + style: TextStyle(color: appTheme.blueA400, height: 1, fontSize: 18, fontWeight: FontWeight.w600), + ), + const SizedBox(height: 8), + Text( + 'Покупатель: ${testFinanceEntity.consultationsList[index].clientName}', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), + ), + const SizedBox(height: 8), + Text( + '${testFinanceEntity.consultationsList[index].planDuration} дней', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), + ), + const SizedBox(height: 8), + Container( + height: 1, + width: double.infinity, + decoration: const BoxDecoration( + color: Color(0xFFDEDEDF), + ), + ), + const SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '${testFinanceEntity.consultationsList[index].price} ₽', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 18, fontWeight: FontWeight.w600), + ), + Material( + color: testFinanceEntity.consultationsList[index].status == ConsultationStatus.canceled + ? const Color(0xFDD01717).withAlpha((255 * 0.1).toInt()) + : const Color(0xFF0BB450).withAlpha(11), + borderRadius: BorderRadius.circular(8), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + child: Text( + testFinanceEntity.consultationsList[index].status.name, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: testFinanceEntity.consultationsList[index].status == ConsultationStatus.canceled + ? const Color(0xFDD01717) + : const Color(0xFF0BB450), + height: 1), + ), + ), + ), + ], + ), + ], + ), + ), + ), + separatorBuilder: (context, index) => const SizedBox(height: 12), + itemCount: testFinanceEntity.consultationsList.length, + ), + ], + ), + ), + ), ), - ), + ], ), ), - ], - ), - ), + ); + } + return Container(); + }, ); } } diff --git a/lib/features/notifications/models/notification_model.freezed.dart b/lib/features/notifications/models/notification_model.freezed.dart deleted file mode 100644 index 2ea9b158..00000000 --- a/lib/features/notifications/models/notification_model.freezed.dart +++ /dev/null @@ -1,166 +0,0 @@ -// 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 'notification_model.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -NotificationModel _$NotificationModelFromJson(Map json) { - return _NotificationModel.fromJson(json); -} - -/// @nodoc -mixin _$NotificationModel { - NotificationType get type => throw _privateConstructorUsedError; - - /// Serializes this NotificationModel to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of NotificationModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $NotificationModelCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $NotificationModelCopyWith<$Res> { - factory $NotificationModelCopyWith( - NotificationModel value, $Res Function(NotificationModel) then) = - _$NotificationModelCopyWithImpl<$Res, NotificationModel>; - @useResult - $Res call({NotificationType type}); -} - -/// @nodoc -class _$NotificationModelCopyWithImpl<$Res, $Val extends NotificationModel> - implements $NotificationModelCopyWith<$Res> { - _$NotificationModelCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of NotificationModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? type = null, - }) { - return _then(_value.copyWith( - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as NotificationType, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$NotificationModelImplCopyWith<$Res> - implements $NotificationModelCopyWith<$Res> { - factory _$$NotificationModelImplCopyWith(_$NotificationModelImpl value, - $Res Function(_$NotificationModelImpl) then) = - __$$NotificationModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({NotificationType type}); -} - -/// @nodoc -class __$$NotificationModelImplCopyWithImpl<$Res> - extends _$NotificationModelCopyWithImpl<$Res, _$NotificationModelImpl> - implements _$$NotificationModelImplCopyWith<$Res> { - __$$NotificationModelImplCopyWithImpl(_$NotificationModelImpl _value, - $Res Function(_$NotificationModelImpl) _then) - : super(_value, _then); - - /// Create a copy of NotificationModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? type = null, - }) { - return _then(_$NotificationModelImpl( - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as NotificationType, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$NotificationModelImpl implements _NotificationModel { - _$NotificationModelImpl({required this.type}); - - factory _$NotificationModelImpl.fromJson(Map json) => - _$$NotificationModelImplFromJson(json); - - @override - final NotificationType type; - - @override - String toString() { - return 'NotificationModel(type: $type)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$NotificationModelImpl && - (identical(other.type, type) || other.type == type)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, type); - - /// Create a copy of NotificationModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$NotificationModelImplCopyWith<_$NotificationModelImpl> get copyWith => - __$$NotificationModelImplCopyWithImpl<_$NotificationModelImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$NotificationModelImplToJson( - this, - ); - } -} - -abstract class _NotificationModel implements NotificationModel { - factory _NotificationModel({required final NotificationType type}) = - _$NotificationModelImpl; - - factory _NotificationModel.fromJson(Map json) = - _$NotificationModelImpl.fromJson; - - @override - NotificationType get type; - - /// Create a copy of NotificationModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$NotificationModelImplCopyWith<_$NotificationModelImpl> get copyWith => - throw _privateConstructorUsedError; -} diff --git a/lib/features/notifications/models/notification_model.g.dart b/lib/features/notifications/models/notification_model.g.dart deleted file mode 100644 index 9d68bb8d..00000000 --- a/lib/features/notifications/models/notification_model.g.dart +++ /dev/null @@ -1,28 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'notification_model.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_$NotificationModelImpl _$$NotificationModelImplFromJson( - Map json) => - _$NotificationModelImpl( - type: $enumDecode(_$NotificationTypeEnumMap, json['type']), - ); - -Map _$$NotificationModelImplToJson( - _$NotificationModelImpl instance) => - { - 'type': _$NotificationTypeEnumMap[instance.type]!, - }; - -const _$NotificationTypeEnumMap = { - NotificationType.userSubscribedNotification: - 'App\\Notifications\\UserSubscribedNotification', - NotificationType.planSubscriptionStartedToAuthor: - 'App\\Notifications\\Plan\\PlanSubscriptionStartedToAuthor', - NotificationType.planSubscriptionCanceledToAuthor: - 'App\\Notifications\\Plan\\PlanSubscriptionCanceledToAuthor', -}; diff --git a/lib/features/profile/models/sub_model.dart b/lib/features/profile/models/sub_model.dart index 4623e198..c4a04bd7 100644 --- a/lib/features/profile/models/sub_model.dart +++ b/lib/features/profile/models/sub_model.dart @@ -19,18 +19,14 @@ class SubPaginationModel with _$SubPaginationModel { @freezed class SubModel with _$SubModel { const factory SubModel({ - required int id, required String slug, required String name, required String city, required DateTime birthdate, @JsonKey(name: 'is_entity_subscribed_by_me') required bool isEntitySubscribedByMe, - required String email, @JsonKey(name: 'profile_photo_url') required String profilePhotoUrl, - required String role, + required List roles, @JsonKey(name: 'is_public_profile') required bool isPublicProfile, - @JsonKey(name: 'created_at') required DateTime createdAt, - @JsonKey(name: 'updated_at') required DateTime updatedAt, }) = _SubModel; factory SubModel.fromJson(Map json) => _$SubModelFromJson(json); diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index 2acd9bac..e127d68c 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -658,15 +658,53 @@ class _ProfileScreenState extends State { children: [ for (int i = 0; i < state.profile.badges.length; i++) ...[ state.profile.badges[i].image.contains('svg') - ? SvgPicture.network( - '$baseUrl/storage/${state.profile.badges[i].image}', - width: 40, - height: 40, + ? Tooltip( + message: state.profile.badges[i].description, + triggerMode: TooltipTriggerMode.tap, + textStyle: const TextStyle( + color: Colors.black, + fontSize: 16, + fontWeight: FontWeight.w500, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha((255 * 0.2).toInt()), + blurRadius: 32, + ) + ], + ), + child: SvgPicture.network( + '$baseUrl/storage/${state.profile.badges[i].image}', + width: 40, + height: 40, + ), ) - : CachedNetworkImage( - imageUrl: '$baseUrl/storage/${state.profile.badges[i].image}', - width: 40, - height: 40, + : Tooltip( + message: state.profile.badges[i].description, + triggerMode: TooltipTriggerMode.tap, + textStyle: const TextStyle( + color: Colors.black, + fontSize: 16, + fontWeight: FontWeight.w500, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha((255 * 0.2).toInt()), + blurRadius: 32, + ) + ], + ), + child: CachedNetworkImage( + imageUrl: '$baseUrl/storage/${state.profile.badges[i].image}', + width: 40, + height: 40, + ), ), i < state.profile.badges.length - 1 ? const SizedBox(width: 8) : const SizedBox.shrink(), ], @@ -799,9 +837,10 @@ class _ProfileScreenState extends State { widthFactor: 0.8, child: CircleAvatar( radius: 14, - backgroundImage: NetworkImage( + foregroundImage: NetworkImage( urls[i], ), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), ), ), ], diff --git a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart index 06bcc85d..ab920ea2 100644 --- a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart +++ b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart @@ -68,6 +68,7 @@ class _ProfileBlogPostWidgetState extends State { foregroundImage: NetworkImage( state.blogPosts[widget.index].author.authorProfileIcon, ), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), ), const SizedBox(width: 8), Column( diff --git a/lib/features/profile/presentation/widgets/sub_widget.dart b/lib/features/profile/presentation/widgets/sub_widget.dart index 429772d3..c8342077 100644 --- a/lib/features/profile/presentation/widgets/sub_widget.dart +++ b/lib/features/profile/presentation/widgets/sub_widget.dart @@ -35,7 +35,8 @@ class _SubWidgetState extends State { child: Row( children: [ CircleAvatar( - backgroundImage: NetworkImage(widget.subModel.profilePhotoUrl), + foregroundImage: NetworkImage(widget.subModel.profilePhotoUrl), + backgroundImage: const AssetImage('assets/images/no_avatar.png'), radius: 28, ), const SizedBox(width: 12), diff --git a/lib/features/support/presentation/pages/support_screen.dart b/lib/features/support/presentation/pages/support_screen.dart index a5a298e2..5a80e62b 100644 --- a/lib/features/support/presentation/pages/support_screen.dart +++ b/lib/features/support/presentation/pages/support_screen.dart @@ -1,4 +1,7 @@ +import 'package:eatvio_app/core/utils/toasts.dart'; +import 'package:eatvio_app/generated/l10n.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -7,6 +10,8 @@ class SupportScreen extends StatelessWidget { @override Widget build(BuildContext context) { + final s = S.of(context); + return Scaffold( appBar: AppBar( title: const Text('Поддержка'), @@ -44,7 +49,7 @@ class SupportScreen extends StatelessWidget { ), const SizedBox(width: 12), const Text( - 'Telegram', + 'Telegram: t.me/eatvio', style: TextStyle( fontSize: 16, ), @@ -56,10 +61,8 @@ class SupportScreen extends StatelessWidget { const SizedBox(height: 8), InkWell( onTap: () { - launchUrl( - Uri.parse('mailto:help@eatv.io'), - mode: LaunchMode.externalApplication, - ); + Clipboard.setData(const ClipboardData(text: 'help@eatv.io')); + showInfoToast(s.mail_was_copied); }, borderRadius: BorderRadius.circular(16), child: Ink( @@ -73,7 +76,7 @@ class SupportScreen extends StatelessWidget { Icon(Icons.alternate_email_rounded), SizedBox(width: 12), Text( - 'E-mail', + 'E-mail: help@eatv.io', style: TextStyle( fontSize: 16, ), diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index d27fa8ee..84b4d90e 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -389,6 +389,9 @@ class MessageLookup extends MessageLookupByLibrary { ), "loading": MessageLookupByLibrary.simpleMessage("Загрузка..."), "lower": MessageLookupByLibrary.simpleMessage("Нижнее"), + "mail_was_copied": MessageLookupByLibrary.simpleMessage( + "Почта успешно скопирована", + ), "male": MessageLookupByLibrary.simpleMessage("Мужской"), "meal": MessageLookupByLibrary.simpleMessage("Приём пищи"), "mealComment": MessageLookupByLibrary.simpleMessage( diff --git a/lib/generated/intl/messages_ru.dart b/lib/generated/intl/messages_ru.dart index 91355290..82821c9a 100644 --- a/lib/generated/intl/messages_ru.dart +++ b/lib/generated/intl/messages_ru.dart @@ -209,6 +209,9 @@ class MessageLookup extends MessageLookupByLibrary { "Ссылка успешно скопирована", ), "loading": MessageLookupByLibrary.simpleMessage("Загрузка..."), + "mail_was_copied": MessageLookupByLibrary.simpleMessage( + "Почта успешно скопирована", + ), "male": MessageLookupByLibrary.simpleMessage("Мужской"), "meal": MessageLookupByLibrary.simpleMessage("Приём пищи"), "meat": MessageLookupByLibrary.simpleMessage("Мясо"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 441ca764..92f85b98 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -1055,6 +1055,16 @@ class S { ); } + /// `Почта успешно скопирована` + String get mail_was_copied { + return Intl.message( + 'Почта успешно скопирована', + name: 'mail_was_copied', + desc: '', + args: [], + ); + } + /// `Выберите дату старты диеты. Она отобразиться у Вас в дневнике` String get choose_start_diet_date { return Intl.message( diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index c8e5a2c6..7d09e039 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -129,6 +129,7 @@ "carbohydrates": "Углеводы", "answer": "Ответить", "link_was_copied": "Ссылка успешно скопирована", + "mail_was_copied": "Почта успешно скопирована", "choose_start_diet_date": "Выберите дату старты диеты. Она отобразиться у Вас в дневнике", "continue_": "Продолжить", "order": "Порядок", diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index 1f1259f0..221d36ff 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -129,6 +129,7 @@ "carbohydrates": "Углеводы", "answer": "Ответить", "link_was_copied": "Ссылка успешно скопирована", + "mail_was_copied": "Почта успешно скопирована", "choose_start_diet_date": "Выберите дату старты диеты. Она отобразиться у Вас в дневнике", "continue_": "Продолжить", "order": "Порядок",