forked from eatvio/eatvio_app
feat(consultant): add requests for upload photo, register consultant profile, state manager
This commit is contained in:
@@ -7,8 +7,8 @@ import 'package:eatvio_app/features/calendar/presentation/pages/calendar_screen.
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_screen.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/pages/become_consultant_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/pages/stepper_become_consultant_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/pages/diary_screen.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/pages/about_diet_screen.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
|
||||
@@ -89,7 +89,9 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
|
||||
onPressed: () => _submitForm(context, state.title!.text, state.description!.text, state.youtubeURL!.text),
|
||||
label: Text(
|
||||
'Создать',
|
||||
style: theme.textTheme.titleSmall,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'consultant_profile_model.freezed.dart';
|
||||
|
||||
part 'consultant_profile_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class ConsultantProfileModel with _$ConsultantProfileModel {
|
||||
const factory ConsultantProfileModel({
|
||||
@JsonKey(name: 'has_medical_education') bool? hasMedicalEducation,
|
||||
@JsonKey(name: 'social_links') SocialLinksModel? socialLinks,
|
||||
@JsonKey(name: 'cert_photos') List<String>? photos,
|
||||
@JsonKey(name: 'completed_courses') List<CertificatesModel>? certificates,
|
||||
}) = _ConsultantProfileModel;
|
||||
|
||||
factory ConsultantProfileModel.fromJson(Map<String, Object?> json) => _$ConsultantProfileModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class SocialLinksModel with _$SocialLinksModel {
|
||||
const factory SocialLinksModel({
|
||||
@JsonKey(name: 'vk_link') String? vkLink,
|
||||
@JsonKey(name: 'tg_link') String? tgLink,
|
||||
@JsonKey(name: 'fb_link') String? fbLink,
|
||||
@JsonKey(name: 'insta_link') String? instaLink,
|
||||
@JsonKey(name: 'personal_site_link') String? personalSiteLink,
|
||||
}) = _SocialLinksModel;
|
||||
|
||||
factory SocialLinksModel.fromJson(Map<String, Object?> json) => _$SocialLinksModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class CertificatesModel with _$CertificatesModel {
|
||||
const factory CertificatesModel({
|
||||
required String title,
|
||||
required String date,
|
||||
}) = _CertificatesModel;
|
||||
|
||||
factory CertificatesModel.fromJson(Map<String, Object?> json) => _$CertificatesModelFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,717 @@
|
||||
// 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_profile_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
ConsultantProfileModel _$ConsultantProfileModelFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _ConsultantProfileModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ConsultantProfileModel {
|
||||
@JsonKey(name: 'has_medical_education')
|
||||
bool? get hasMedicalEducation => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'social_links')
|
||||
SocialLinksModel? get socialLinks => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'cert_photos')
|
||||
List<String>? get photos => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'completed_courses')
|
||||
List<CertificatesModel>? get certificates =>
|
||||
throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this ConsultantProfileModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ConsultantProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ConsultantProfileModelCopyWith<ConsultantProfileModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ConsultantProfileModelCopyWith<$Res> {
|
||||
factory $ConsultantProfileModelCopyWith(ConsultantProfileModel value,
|
||||
$Res Function(ConsultantProfileModel) then) =
|
||||
_$ConsultantProfileModelCopyWithImpl<$Res, ConsultantProfileModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'has_medical_education') bool? hasMedicalEducation,
|
||||
@JsonKey(name: 'social_links') SocialLinksModel? socialLinks,
|
||||
@JsonKey(name: 'cert_photos') List<String>? photos,
|
||||
@JsonKey(name: 'completed_courses')
|
||||
List<CertificatesModel>? certificates});
|
||||
|
||||
$SocialLinksModelCopyWith<$Res>? get socialLinks;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ConsultantProfileModelCopyWithImpl<$Res,
|
||||
$Val extends ConsultantProfileModel>
|
||||
implements $ConsultantProfileModelCopyWith<$Res> {
|
||||
_$ConsultantProfileModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ConsultantProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? hasMedicalEducation = freezed,
|
||||
Object? socialLinks = freezed,
|
||||
Object? photos = freezed,
|
||||
Object? certificates = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
hasMedicalEducation: freezed == hasMedicalEducation
|
||||
? _value.hasMedicalEducation
|
||||
: hasMedicalEducation // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
socialLinks: freezed == socialLinks
|
||||
? _value.socialLinks
|
||||
: socialLinks // ignore: cast_nullable_to_non_nullable
|
||||
as SocialLinksModel?,
|
||||
photos: freezed == photos
|
||||
? _value.photos
|
||||
: photos // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
certificates: freezed == certificates
|
||||
? _value.certificates
|
||||
: certificates // ignore: cast_nullable_to_non_nullable
|
||||
as List<CertificatesModel>?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of ConsultantProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$SocialLinksModelCopyWith<$Res>? get socialLinks {
|
||||
if (_value.socialLinks == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $SocialLinksModelCopyWith<$Res>(_value.socialLinks!, (value) {
|
||||
return _then(_value.copyWith(socialLinks: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ConsultantProfileModelImplCopyWith<$Res>
|
||||
implements $ConsultantProfileModelCopyWith<$Res> {
|
||||
factory _$$ConsultantProfileModelImplCopyWith(
|
||||
_$ConsultantProfileModelImpl value,
|
||||
$Res Function(_$ConsultantProfileModelImpl) then) =
|
||||
__$$ConsultantProfileModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'has_medical_education') bool? hasMedicalEducation,
|
||||
@JsonKey(name: 'social_links') SocialLinksModel? socialLinks,
|
||||
@JsonKey(name: 'cert_photos') List<String>? photos,
|
||||
@JsonKey(name: 'completed_courses')
|
||||
List<CertificatesModel>? certificates});
|
||||
|
||||
@override
|
||||
$SocialLinksModelCopyWith<$Res>? get socialLinks;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ConsultantProfileModelImplCopyWithImpl<$Res>
|
||||
extends _$ConsultantProfileModelCopyWithImpl<$Res,
|
||||
_$ConsultantProfileModelImpl>
|
||||
implements _$$ConsultantProfileModelImplCopyWith<$Res> {
|
||||
__$$ConsultantProfileModelImplCopyWithImpl(
|
||||
_$ConsultantProfileModelImpl _value,
|
||||
$Res Function(_$ConsultantProfileModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ConsultantProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? hasMedicalEducation = freezed,
|
||||
Object? socialLinks = freezed,
|
||||
Object? photos = freezed,
|
||||
Object? certificates = freezed,
|
||||
}) {
|
||||
return _then(_$ConsultantProfileModelImpl(
|
||||
hasMedicalEducation: freezed == hasMedicalEducation
|
||||
? _value.hasMedicalEducation
|
||||
: hasMedicalEducation // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
socialLinks: freezed == socialLinks
|
||||
? _value.socialLinks
|
||||
: socialLinks // ignore: cast_nullable_to_non_nullable
|
||||
as SocialLinksModel?,
|
||||
photos: freezed == photos
|
||||
? _value._photos
|
||||
: photos // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
certificates: freezed == certificates
|
||||
? _value._certificates
|
||||
: certificates // ignore: cast_nullable_to_non_nullable
|
||||
as List<CertificatesModel>?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$ConsultantProfileModelImpl implements _ConsultantProfileModel {
|
||||
const _$ConsultantProfileModelImpl(
|
||||
{@JsonKey(name: 'has_medical_education') this.hasMedicalEducation,
|
||||
@JsonKey(name: 'social_links') this.socialLinks,
|
||||
@JsonKey(name: 'cert_photos') final List<String>? photos,
|
||||
@JsonKey(name: 'completed_courses')
|
||||
final List<CertificatesModel>? certificates})
|
||||
: _photos = photos,
|
||||
_certificates = certificates;
|
||||
|
||||
factory _$ConsultantProfileModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ConsultantProfileModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'has_medical_education')
|
||||
final bool? hasMedicalEducation;
|
||||
@override
|
||||
@JsonKey(name: 'social_links')
|
||||
final SocialLinksModel? socialLinks;
|
||||
final List<String>? _photos;
|
||||
@override
|
||||
@JsonKey(name: 'cert_photos')
|
||||
List<String>? get photos {
|
||||
final value = _photos;
|
||||
if (value == null) return null;
|
||||
if (_photos is EqualUnmodifiableListView) return _photos;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
final List<CertificatesModel>? _certificates;
|
||||
@override
|
||||
@JsonKey(name: 'completed_courses')
|
||||
List<CertificatesModel>? get certificates {
|
||||
final value = _certificates;
|
||||
if (value == null) return null;
|
||||
if (_certificates is EqualUnmodifiableListView) return _certificates;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ConsultantProfileModel(hasMedicalEducation: $hasMedicalEducation, socialLinks: $socialLinks, photos: $photos, certificates: $certificates)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ConsultantProfileModelImpl &&
|
||||
(identical(other.hasMedicalEducation, hasMedicalEducation) ||
|
||||
other.hasMedicalEducation == hasMedicalEducation) &&
|
||||
(identical(other.socialLinks, socialLinks) ||
|
||||
other.socialLinks == socialLinks) &&
|
||||
const DeepCollectionEquality().equals(other._photos, _photos) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._certificates, _certificates));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
hasMedicalEducation,
|
||||
socialLinks,
|
||||
const DeepCollectionEquality().hash(_photos),
|
||||
const DeepCollectionEquality().hash(_certificates));
|
||||
|
||||
/// Create a copy of ConsultantProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ConsultantProfileModelImplCopyWith<_$ConsultantProfileModelImpl>
|
||||
get copyWith => __$$ConsultantProfileModelImplCopyWithImpl<
|
||||
_$ConsultantProfileModelImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$ConsultantProfileModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ConsultantProfileModel implements ConsultantProfileModel {
|
||||
const factory _ConsultantProfileModel(
|
||||
{@JsonKey(name: 'has_medical_education') final bool? hasMedicalEducation,
|
||||
@JsonKey(name: 'social_links') final SocialLinksModel? socialLinks,
|
||||
@JsonKey(name: 'cert_photos') final List<String>? photos,
|
||||
@JsonKey(name: 'completed_courses')
|
||||
final List<CertificatesModel>?
|
||||
certificates}) = _$ConsultantProfileModelImpl;
|
||||
|
||||
factory _ConsultantProfileModel.fromJson(Map<String, dynamic> json) =
|
||||
_$ConsultantProfileModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'has_medical_education')
|
||||
bool? get hasMedicalEducation;
|
||||
@override
|
||||
@JsonKey(name: 'social_links')
|
||||
SocialLinksModel? get socialLinks;
|
||||
@override
|
||||
@JsonKey(name: 'cert_photos')
|
||||
List<String>? get photos;
|
||||
@override
|
||||
@JsonKey(name: 'completed_courses')
|
||||
List<CertificatesModel>? get certificates;
|
||||
|
||||
/// Create a copy of ConsultantProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ConsultantProfileModelImplCopyWith<_$ConsultantProfileModelImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
SocialLinksModel _$SocialLinksModelFromJson(Map<String, dynamic> json) {
|
||||
return _SocialLinksModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SocialLinksModel {
|
||||
@JsonKey(name: 'vk_link')
|
||||
String? get vkLink => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'tg_link')
|
||||
String? get tgLink => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'fb_link')
|
||||
String? get fbLink => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'insta_link')
|
||||
String? get instaLink => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'personal_site_link')
|
||||
String? get personalSiteLink => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this SocialLinksModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of SocialLinksModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$SocialLinksModelCopyWith<SocialLinksModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SocialLinksModelCopyWith<$Res> {
|
||||
factory $SocialLinksModelCopyWith(
|
||||
SocialLinksModel value, $Res Function(SocialLinksModel) then) =
|
||||
_$SocialLinksModelCopyWithImpl<$Res, SocialLinksModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'vk_link') String? vkLink,
|
||||
@JsonKey(name: 'tg_link') String? tgLink,
|
||||
@JsonKey(name: 'fb_link') String? fbLink,
|
||||
@JsonKey(name: 'insta_link') String? instaLink,
|
||||
@JsonKey(name: 'personal_site_link') String? personalSiteLink});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SocialLinksModelCopyWithImpl<$Res, $Val extends SocialLinksModel>
|
||||
implements $SocialLinksModelCopyWith<$Res> {
|
||||
_$SocialLinksModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SocialLinksModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? vkLink = freezed,
|
||||
Object? tgLink = freezed,
|
||||
Object? fbLink = freezed,
|
||||
Object? instaLink = freezed,
|
||||
Object? personalSiteLink = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
vkLink: freezed == vkLink
|
||||
? _value.vkLink
|
||||
: vkLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
tgLink: freezed == tgLink
|
||||
? _value.tgLink
|
||||
: tgLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
fbLink: freezed == fbLink
|
||||
? _value.fbLink
|
||||
: fbLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
instaLink: freezed == instaLink
|
||||
? _value.instaLink
|
||||
: instaLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
personalSiteLink: freezed == personalSiteLink
|
||||
? _value.personalSiteLink
|
||||
: personalSiteLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SocialLinksModelImplCopyWith<$Res>
|
||||
implements $SocialLinksModelCopyWith<$Res> {
|
||||
factory _$$SocialLinksModelImplCopyWith(_$SocialLinksModelImpl value,
|
||||
$Res Function(_$SocialLinksModelImpl) then) =
|
||||
__$$SocialLinksModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'vk_link') String? vkLink,
|
||||
@JsonKey(name: 'tg_link') String? tgLink,
|
||||
@JsonKey(name: 'fb_link') String? fbLink,
|
||||
@JsonKey(name: 'insta_link') String? instaLink,
|
||||
@JsonKey(name: 'personal_site_link') String? personalSiteLink});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SocialLinksModelImplCopyWithImpl<$Res>
|
||||
extends _$SocialLinksModelCopyWithImpl<$Res, _$SocialLinksModelImpl>
|
||||
implements _$$SocialLinksModelImplCopyWith<$Res> {
|
||||
__$$SocialLinksModelImplCopyWithImpl(_$SocialLinksModelImpl _value,
|
||||
$Res Function(_$SocialLinksModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SocialLinksModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? vkLink = freezed,
|
||||
Object? tgLink = freezed,
|
||||
Object? fbLink = freezed,
|
||||
Object? instaLink = freezed,
|
||||
Object? personalSiteLink = freezed,
|
||||
}) {
|
||||
return _then(_$SocialLinksModelImpl(
|
||||
vkLink: freezed == vkLink
|
||||
? _value.vkLink
|
||||
: vkLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
tgLink: freezed == tgLink
|
||||
? _value.tgLink
|
||||
: tgLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
fbLink: freezed == fbLink
|
||||
? _value.fbLink
|
||||
: fbLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
instaLink: freezed == instaLink
|
||||
? _value.instaLink
|
||||
: instaLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
personalSiteLink: freezed == personalSiteLink
|
||||
? _value.personalSiteLink
|
||||
: personalSiteLink // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$SocialLinksModelImpl implements _SocialLinksModel {
|
||||
const _$SocialLinksModelImpl(
|
||||
{@JsonKey(name: 'vk_link') this.vkLink,
|
||||
@JsonKey(name: 'tg_link') this.tgLink,
|
||||
@JsonKey(name: 'fb_link') this.fbLink,
|
||||
@JsonKey(name: 'insta_link') this.instaLink,
|
||||
@JsonKey(name: 'personal_site_link') this.personalSiteLink});
|
||||
|
||||
factory _$SocialLinksModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$SocialLinksModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'vk_link')
|
||||
final String? vkLink;
|
||||
@override
|
||||
@JsonKey(name: 'tg_link')
|
||||
final String? tgLink;
|
||||
@override
|
||||
@JsonKey(name: 'fb_link')
|
||||
final String? fbLink;
|
||||
@override
|
||||
@JsonKey(name: 'insta_link')
|
||||
final String? instaLink;
|
||||
@override
|
||||
@JsonKey(name: 'personal_site_link')
|
||||
final String? personalSiteLink;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SocialLinksModel(vkLink: $vkLink, tgLink: $tgLink, fbLink: $fbLink, instaLink: $instaLink, personalSiteLink: $personalSiteLink)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SocialLinksModelImpl &&
|
||||
(identical(other.vkLink, vkLink) || other.vkLink == vkLink) &&
|
||||
(identical(other.tgLink, tgLink) || other.tgLink == tgLink) &&
|
||||
(identical(other.fbLink, fbLink) || other.fbLink == fbLink) &&
|
||||
(identical(other.instaLink, instaLink) ||
|
||||
other.instaLink == instaLink) &&
|
||||
(identical(other.personalSiteLink, personalSiteLink) ||
|
||||
other.personalSiteLink == personalSiteLink));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, vkLink, tgLink, fbLink, instaLink, personalSiteLink);
|
||||
|
||||
/// Create a copy of SocialLinksModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SocialLinksModelImplCopyWith<_$SocialLinksModelImpl> get copyWith =>
|
||||
__$$SocialLinksModelImplCopyWithImpl<_$SocialLinksModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$SocialLinksModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _SocialLinksModel implements SocialLinksModel {
|
||||
const factory _SocialLinksModel(
|
||||
{@JsonKey(name: 'vk_link') final String? vkLink,
|
||||
@JsonKey(name: 'tg_link') final String? tgLink,
|
||||
@JsonKey(name: 'fb_link') final String? fbLink,
|
||||
@JsonKey(name: 'insta_link') final String? instaLink,
|
||||
@JsonKey(name: 'personal_site_link')
|
||||
final String? personalSiteLink}) = _$SocialLinksModelImpl;
|
||||
|
||||
factory _SocialLinksModel.fromJson(Map<String, dynamic> json) =
|
||||
_$SocialLinksModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'vk_link')
|
||||
String? get vkLink;
|
||||
@override
|
||||
@JsonKey(name: 'tg_link')
|
||||
String? get tgLink;
|
||||
@override
|
||||
@JsonKey(name: 'fb_link')
|
||||
String? get fbLink;
|
||||
@override
|
||||
@JsonKey(name: 'insta_link')
|
||||
String? get instaLink;
|
||||
@override
|
||||
@JsonKey(name: 'personal_site_link')
|
||||
String? get personalSiteLink;
|
||||
|
||||
/// Create a copy of SocialLinksModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SocialLinksModelImplCopyWith<_$SocialLinksModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
CertificatesModel _$CertificatesModelFromJson(Map<String, dynamic> json) {
|
||||
return _CertificatesModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CertificatesModel {
|
||||
String get title => throw _privateConstructorUsedError;
|
||||
String get date => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this CertificatesModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CertificatesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CertificatesModelCopyWith<CertificatesModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CertificatesModelCopyWith<$Res> {
|
||||
factory $CertificatesModelCopyWith(
|
||||
CertificatesModel value, $Res Function(CertificatesModel) then) =
|
||||
_$CertificatesModelCopyWithImpl<$Res, CertificatesModel>;
|
||||
@useResult
|
||||
$Res call({String title, String date});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CertificatesModelCopyWithImpl<$Res, $Val extends CertificatesModel>
|
||||
implements $CertificatesModelCopyWith<$Res> {
|
||||
_$CertificatesModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CertificatesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? title = null,
|
||||
Object? date = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
date: null == date
|
||||
? _value.date
|
||||
: date // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CertificatesModelImplCopyWith<$Res>
|
||||
implements $CertificatesModelCopyWith<$Res> {
|
||||
factory _$$CertificatesModelImplCopyWith(_$CertificatesModelImpl value,
|
||||
$Res Function(_$CertificatesModelImpl) then) =
|
||||
__$$CertificatesModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String title, String date});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CertificatesModelImplCopyWithImpl<$Res>
|
||||
extends _$CertificatesModelCopyWithImpl<$Res, _$CertificatesModelImpl>
|
||||
implements _$$CertificatesModelImplCopyWith<$Res> {
|
||||
__$$CertificatesModelImplCopyWithImpl(_$CertificatesModelImpl _value,
|
||||
$Res Function(_$CertificatesModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CertificatesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? title = null,
|
||||
Object? date = null,
|
||||
}) {
|
||||
return _then(_$CertificatesModelImpl(
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
date: null == date
|
||||
? _value.date
|
||||
: date // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$CertificatesModelImpl implements _CertificatesModel {
|
||||
const _$CertificatesModelImpl({required this.title, required this.date});
|
||||
|
||||
factory _$CertificatesModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$CertificatesModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String title;
|
||||
@override
|
||||
final String date;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CertificatesModel(title: $title, date: $date)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CertificatesModelImpl &&
|
||||
(identical(other.title, title) || other.title == title) &&
|
||||
(identical(other.date, date) || other.date == date));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, title, date);
|
||||
|
||||
/// Create a copy of CertificatesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CertificatesModelImplCopyWith<_$CertificatesModelImpl> get copyWith =>
|
||||
__$$CertificatesModelImplCopyWithImpl<_$CertificatesModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$CertificatesModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _CertificatesModel implements CertificatesModel {
|
||||
const factory _CertificatesModel(
|
||||
{required final String title,
|
||||
required final String date}) = _$CertificatesModelImpl;
|
||||
|
||||
factory _CertificatesModel.fromJson(Map<String, dynamic> json) =
|
||||
_$CertificatesModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get title;
|
||||
@override
|
||||
String get date;
|
||||
|
||||
/// Create a copy of CertificatesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CertificatesModelImplCopyWith<_$CertificatesModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'consultant_profile_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$ConsultantProfileModelImpl _$$ConsultantProfileModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$ConsultantProfileModelImpl(
|
||||
hasMedicalEducation: json['has_medical_education'] as bool?,
|
||||
socialLinks: json['social_links'] == null
|
||||
? null
|
||||
: SocialLinksModel.fromJson(
|
||||
json['social_links'] as Map<String, dynamic>),
|
||||
photos: (json['cert_photos'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
certificates: (json['completed_courses'] as List<dynamic>?)
|
||||
?.map((e) => CertificatesModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ConsultantProfileModelImplToJson(
|
||||
_$ConsultantProfileModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'has_medical_education': instance.hasMedicalEducation,
|
||||
'social_links': instance.socialLinks,
|
||||
'cert_photos': instance.photos,
|
||||
'completed_courses': instance.certificates,
|
||||
};
|
||||
|
||||
_$SocialLinksModelImpl _$$SocialLinksModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$SocialLinksModelImpl(
|
||||
vkLink: json['vk_link'] as String?,
|
||||
tgLink: json['tg_link'] as String?,
|
||||
fbLink: json['fb_link'] as String?,
|
||||
instaLink: json['insta_link'] as String?,
|
||||
personalSiteLink: json['personal_site_link'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SocialLinksModelImplToJson(
|
||||
_$SocialLinksModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'vk_link': instance.vkLink,
|
||||
'tg_link': instance.tgLink,
|
||||
'fb_link': instance.fbLink,
|
||||
'insta_link': instance.instaLink,
|
||||
'personal_site_link': instance.personalSiteLink,
|
||||
};
|
||||
|
||||
_$CertificatesModelImpl _$$CertificatesModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$CertificatesModelImpl(
|
||||
title: json['title'] as String,
|
||||
date: json['date'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$CertificatesModelImplToJson(
|
||||
_$CertificatesModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'title': instance.title,
|
||||
'date': instance.date,
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/models/consultant_profile_model.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_state.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/repositories/consultant_repository.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class RegisterConsultantCubit extends Cubit<RegisterConsultantState> {
|
||||
final ConsultantRepository consultantRepository;
|
||||
|
||||
RegisterConsultantCubit({
|
||||
required this.consultantRepository,
|
||||
}) : super(
|
||||
RegisterConsultantState(
|
||||
consultant: ConsultantProfileModel(),
|
||||
),
|
||||
);
|
||||
|
||||
updateConsultantProfileModel(ConsultantProfileModel consultant) {
|
||||
emit(RegisterConsultantState(consultant: consultant));
|
||||
}
|
||||
|
||||
registerConsultant() async {
|
||||
await consultantRepository.registerConsultant(consultant: state.consultant);
|
||||
}
|
||||
|
||||
uploadPhotos(List<File> files) async {
|
||||
await consultantRepository.uploadPhotos(files: files);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/models/consultant_profile_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'register_consultant_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class RegisterConsultantState with _$RegisterConsultantState {
|
||||
const factory RegisterConsultantState({
|
||||
required ConsultantProfileModel consultant,
|
||||
}) = _RegisterConsultantState;
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
// 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 'register_consultant_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$RegisterConsultantState {
|
||||
ConsultantProfileModel get consultant => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of RegisterConsultantState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$RegisterConsultantStateCopyWith<RegisterConsultantState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $RegisterConsultantStateCopyWith<$Res> {
|
||||
factory $RegisterConsultantStateCopyWith(RegisterConsultantState value,
|
||||
$Res Function(RegisterConsultantState) then) =
|
||||
_$RegisterConsultantStateCopyWithImpl<$Res, RegisterConsultantState>;
|
||||
@useResult
|
||||
$Res call({ConsultantProfileModel consultant});
|
||||
|
||||
$ConsultantProfileModelCopyWith<$Res> get consultant;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$RegisterConsultantStateCopyWithImpl<$Res,
|
||||
$Val extends RegisterConsultantState>
|
||||
implements $RegisterConsultantStateCopyWith<$Res> {
|
||||
_$RegisterConsultantStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of RegisterConsultantState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? consultant = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
consultant: null == consultant
|
||||
? _value.consultant
|
||||
: consultant // ignore: cast_nullable_to_non_nullable
|
||||
as ConsultantProfileModel,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of RegisterConsultantState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ConsultantProfileModelCopyWith<$Res> get consultant {
|
||||
return $ConsultantProfileModelCopyWith<$Res>(_value.consultant, (value) {
|
||||
return _then(_value.copyWith(consultant: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RegisterConsultantStateImplCopyWith<$Res>
|
||||
implements $RegisterConsultantStateCopyWith<$Res> {
|
||||
factory _$$RegisterConsultantStateImplCopyWith(
|
||||
_$RegisterConsultantStateImpl value,
|
||||
$Res Function(_$RegisterConsultantStateImpl) then) =
|
||||
__$$RegisterConsultantStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({ConsultantProfileModel consultant});
|
||||
|
||||
@override
|
||||
$ConsultantProfileModelCopyWith<$Res> get consultant;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RegisterConsultantStateImplCopyWithImpl<$Res>
|
||||
extends _$RegisterConsultantStateCopyWithImpl<$Res,
|
||||
_$RegisterConsultantStateImpl>
|
||||
implements _$$RegisterConsultantStateImplCopyWith<$Res> {
|
||||
__$$RegisterConsultantStateImplCopyWithImpl(
|
||||
_$RegisterConsultantStateImpl _value,
|
||||
$Res Function(_$RegisterConsultantStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of RegisterConsultantState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? consultant = null,
|
||||
}) {
|
||||
return _then(_$RegisterConsultantStateImpl(
|
||||
consultant: null == consultant
|
||||
? _value.consultant
|
||||
: consultant // ignore: cast_nullable_to_non_nullable
|
||||
as ConsultantProfileModel,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RegisterConsultantStateImpl implements _RegisterConsultantState {
|
||||
const _$RegisterConsultantStateImpl({required this.consultant});
|
||||
|
||||
@override
|
||||
final ConsultantProfileModel consultant;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterConsultantState(consultant: $consultant)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RegisterConsultantStateImpl &&
|
||||
(identical(other.consultant, consultant) ||
|
||||
other.consultant == consultant));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, consultant);
|
||||
|
||||
/// Create a copy of RegisterConsultantState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RegisterConsultantStateImplCopyWith<_$RegisterConsultantStateImpl>
|
||||
get copyWith => __$$RegisterConsultantStateImplCopyWithImpl<
|
||||
_$RegisterConsultantStateImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _RegisterConsultantState implements RegisterConsultantState {
|
||||
const factory _RegisterConsultantState(
|
||||
{required final ConsultantProfileModel consultant}) =
|
||||
_$RegisterConsultantStateImpl;
|
||||
|
||||
@override
|
||||
ConsultantProfileModel get consultant;
|
||||
|
||||
/// Create a copy of RegisterConsultantState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RegisterConsultantStateImplCopyWith<_$RegisterConsultantStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'package:eatvio_app/core/utils/image_constant.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/pages/additional_settings_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/pages/certificates_and_diploms_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/pages/last_step_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/pages/photo_or_scans_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/pages/registration_as_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/pages/social_networks_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/certificates_and_diploms_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/last_step_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/photo_or_scans_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/registration_as_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -0,0 +1,51 @@
|
||||
import 'dart:io';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/models/consultant_profile_model.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/services/consultant_service.dart';
|
||||
import 'package:http_parser/http_parser.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class ConsultantRepository {
|
||||
final ConsultantService consultantService;
|
||||
|
||||
const ConsultantRepository({
|
||||
required this.consultantService,
|
||||
});
|
||||
|
||||
Future<void> registerConsultant({
|
||||
required ConsultantProfileModel consultant,
|
||||
}) async {
|
||||
try {
|
||||
return await consultantService.consultantRegistration(
|
||||
consultantModel: consultant.toJson(),
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<String>> uploadPhotos({
|
||||
required List<File> files,
|
||||
}) async {
|
||||
try {
|
||||
final multipartFiles = <MultipartFile>[];
|
||||
|
||||
for (final file in files) {
|
||||
final fileBytes = await file.readAsBytes();
|
||||
final multipartFile = MultipartFile.fromBytes(
|
||||
fileBytes,
|
||||
filename: file.path.split('/').last,
|
||||
contentType: MediaType('application', 'octet-stream'),
|
||||
);
|
||||
multipartFiles.add(multipartFile);
|
||||
}
|
||||
|
||||
return await consultantService.uploadPhotos(
|
||||
photos: multipartFiles.isEmpty ? null : multipartFiles,
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:retrofit/retrofit.dart';
|
||||
|
||||
part 'consultant_service.g.dart';
|
||||
|
||||
@RestApi()
|
||||
abstract class ConsultantService {
|
||||
factory ConsultantService(Dio dio, {String baseUrl}) = _ConsultantService;
|
||||
|
||||
@POST('/api/consultant_request/registration')
|
||||
Future<void> consultantRegistration({
|
||||
@Body() required Map<String, dynamic> consultantModel,
|
||||
});
|
||||
|
||||
@POST('/api/consultant_request/photos/upload')
|
||||
@MultiPart()
|
||||
Future<List<String>> uploadPhotos({
|
||||
@Part(name: 'photos[]', contentType: 'multipart/form-data') List<MultipartFile>? photos,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'consultant_service.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RetrofitGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element
|
||||
|
||||
class _ConsultantService implements ConsultantService {
|
||||
_ConsultantService(
|
||||
this._dio, {
|
||||
this.baseUrl,
|
||||
this.errorLogger,
|
||||
});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
String? baseUrl;
|
||||
|
||||
final ParseErrorLogger? errorLogger;
|
||||
|
||||
@override
|
||||
Future<void> consultantRegistration(
|
||||
{required Map<String, dynamic> consultantModel}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(consultantModel);
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/consultant_request/registration',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> uploadPhotos({List<MultipartFile>? photos}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
if (photos != null) {
|
||||
_data.files.addAll(photos.map((i) => MapEntry('photos[]', i)));
|
||||
}
|
||||
final _options = _setStreamType<List<String>>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
contentType: 'multipart/form-data',
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/consultant_request/photos/upload',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<String> _value;
|
||||
try {
|
||||
_value = _result.data!.cast<String>();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
RequestOptions _setStreamType<T>(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();
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,9 @@ import 'package:go_router/go_router.dart';
|
||||
class RegistrationCubit extends Cubit<RegistrationState> {
|
||||
final RegistrationRepository registrationRepository;
|
||||
|
||||
RegistrationCubit({required this.registrationRepository})
|
||||
: super(
|
||||
RegistrationCubit({
|
||||
required this.registrationRepository,
|
||||
}) : super(
|
||||
RegistrationState(
|
||||
sheet: UserRegistrationSheet(
|
||||
firstName: '',
|
||||
|
||||
@@ -11,6 +11,9 @@ import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/chat_select_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
|
||||
import 'package:eatvio_app/features/chat/services/chat_service.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/repositories/consultant_repository.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/services/consultant_service.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/bloc/diary_bloc.dart';
|
||||
import 'package:eatvio_app/features/diary/repositories/diary_repository.dart';
|
||||
import 'package:eatvio_app/features/diary/services/diary_service.dart';
|
||||
@@ -60,6 +63,7 @@ Future<void> init() async {
|
||||
sl.registerFactory<ChatSelectCubit>(() => ChatSelectCubit(chatRepository: sl()));
|
||||
sl.registerFactory<PlansCubit>(() => PlansCubit(plansRepository: sl()));
|
||||
sl.registerFactory<SettingsCubit>(() => SettingsCubit(profileRepository: sl(), settingsRepository: sl()));
|
||||
sl.registerFactory<RegisterConsultantCubit>(() => RegisterConsultantCubit(consultantRepository: sl()));
|
||||
|
||||
// Repository
|
||||
sl.registerLazySingleton<ChatRepository>(() => ChatRepository(chatService: sl()));
|
||||
@@ -71,6 +75,7 @@ Future<void> init() async {
|
||||
sl.registerLazySingleton<RecipeRepository>(() => RecipeRepository(recipeService: sl()));
|
||||
sl.registerLazySingleton<PlansRepository>(() => PlansRepository(plansService: sl()));
|
||||
sl.registerLazySingleton<SettingsRepository>(() => SettingsRepository(settingsService: sl()));
|
||||
sl.registerLazySingleton<ConsultantRepository>(() => ConsultantRepository(consultantService: sl()));
|
||||
|
||||
// Services
|
||||
sl.registerLazySingleton<ChatService>(() => ChatService(sl()));
|
||||
@@ -82,6 +87,7 @@ Future<void> init() async {
|
||||
sl.registerLazySingleton<RecipeService>(() => RecipeService(sl()));
|
||||
sl.registerLazySingleton<PlansService>(() => PlansService(sl()));
|
||||
sl.registerLazySingleton<SettingsService>(() => SettingsService(sl()));
|
||||
sl.registerLazySingleton<ConsultantService>(() => ConsultantService(sl()));
|
||||
|
||||
// External
|
||||
sl.registerLazySingleton(
|
||||
|
||||
@@ -81,8 +81,8 @@ class BlogPostCreateBloc extends Bloc<BlogPostCreateEvent, BlogPostCreateState>
|
||||
FormData formData = FormData.fromMap({
|
||||
'title': title,
|
||||
'description': description,
|
||||
'youtube_url': youtubeURL,
|
||||
'state': 'active',
|
||||
'youtube_url': youtubeURL,
|
||||
'image': await MultipartFile.fromFile(image!.path, filename: image.name),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user