Merge pull request 'consultant registration' (#135) from mso7nueh/eatvio_app:main into main

Reviewed-on: eatvio/eatvio_app#135
This commit is contained in:
mso7nueh
2024-10-14 14:55:36 +00:00
28 changed files with 761 additions and 431 deletions

View File

@@ -7,7 +7,7 @@ plugins {
android {
namespace = "com.eatvioapp.app"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
ndkVersion = "25.1.8937393"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dismissible_page/dismissible_page.dart';
import 'package:eatvio_app/core/const.dart';
@@ -11,11 +13,13 @@ import 'package:url_launcher/url_launcher.dart';
class PhotoViewScreen extends StatefulWidget {
final List<String> imageUrls;
final int index;
final bool isLocal;
const PhotoViewScreen({
super.key,
required this.imageUrls,
required this.index,
this.isLocal = false,
});
@override
@@ -47,9 +51,13 @@ class _PhotoViewScreenState extends State<PhotoViewScreen> {
scrollPhysics: const BouncingScrollPhysics(),
builder: (BuildContext context, int index) {
return PhotoViewGalleryPageOptions(
imageProvider: CachedNetworkImageProvider(
widget.imageUrls[index],
),
imageProvider: widget.isLocal
? FileImage(
File(widget.imageUrls[index]),
) as ImageProvider
: CachedNetworkImageProvider(
widget.imageUrls[index],
),
initialScale: PhotoViewComputedScale.contained,
minScale: PhotoViewComputedScale.contained,
heroAttributes: PhotoViewHeroAttributes(

View File

@@ -7,10 +7,10 @@ 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,
@JsonKey(name: 'has_medical_education', includeIfNull: false) bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false) SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false) List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false) List<CertificatesModel>? certificates,
}) = _ConsultantProfileModel;
factory ConsultantProfileModel.fromJson(Map<String, Object?> json) => _$ConsultantProfileModelFromJson(json);
@@ -19,11 +19,11 @@ class ConsultantProfileModel with _$ConsultantProfileModel {
@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,
@JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false) String? personalSiteLink,
}) = _SocialLinksModel;
factory SocialLinksModel.fromJson(Map<String, Object?> json) => _$SocialLinksModelFromJson(json);

View File

@@ -21,13 +21,13 @@ ConsultantProfileModel _$ConsultantProfileModelFromJson(
/// @nodoc
mixin _$ConsultantProfileModel {
@JsonKey(name: 'has_medical_education')
@JsonKey(name: 'has_medical_education', includeIfNull: false)
bool? get hasMedicalEducation => throw _privateConstructorUsedError;
@JsonKey(name: 'social_links')
@JsonKey(name: 'social_links', includeIfNull: false)
SocialLinksModel? get socialLinks => throw _privateConstructorUsedError;
@JsonKey(name: 'cert_photos')
@JsonKey(name: 'cert_photos', includeIfNull: false)
List<String>? get photos => throw _privateConstructorUsedError;
@JsonKey(name: 'completed_courses')
@JsonKey(name: 'completed_courses', includeIfNull: false)
List<CertificatesModel>? get certificates =>
throw _privateConstructorUsedError;
@@ -48,10 +48,12 @@ abstract class $ConsultantProfileModelCopyWith<$Res> {
_$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')
{@JsonKey(name: 'has_medical_education', includeIfNull: false)
bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false)
SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false) List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
List<CertificatesModel>? certificates});
$SocialLinksModelCopyWith<$Res>? get socialLinks;
@@ -123,10 +125,12 @@ abstract class _$$ConsultantProfileModelImplCopyWith<$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')
{@JsonKey(name: 'has_medical_education', includeIfNull: false)
bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false)
SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false) List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
List<CertificatesModel>? certificates});
@override
@@ -178,10 +182,12 @@ class __$$ConsultantProfileModelImplCopyWithImpl<$Res>
@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')
{@JsonKey(name: 'has_medical_education', includeIfNull: false)
this.hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false) this.socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false)
final List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
final List<CertificatesModel>? certificates})
: _photos = photos,
_certificates = certificates;
@@ -190,14 +196,14 @@ class _$ConsultantProfileModelImpl implements _ConsultantProfileModel {
_$$ConsultantProfileModelImplFromJson(json);
@override
@JsonKey(name: 'has_medical_education')
@JsonKey(name: 'has_medical_education', includeIfNull: false)
final bool? hasMedicalEducation;
@override
@JsonKey(name: 'social_links')
@JsonKey(name: 'social_links', includeIfNull: false)
final SocialLinksModel? socialLinks;
final List<String>? _photos;
@override
@JsonKey(name: 'cert_photos')
@JsonKey(name: 'cert_photos', includeIfNull: false)
List<String>? get photos {
final value = _photos;
if (value == null) return null;
@@ -208,7 +214,7 @@ class _$ConsultantProfileModelImpl implements _ConsultantProfileModel {
final List<CertificatesModel>? _certificates;
@override
@JsonKey(name: 'completed_courses')
@JsonKey(name: 'completed_courses', includeIfNull: false)
List<CertificatesModel>? get certificates {
final value = _certificates;
if (value == null) return null;
@@ -264,27 +270,30 @@ class _$ConsultantProfileModelImpl implements _ConsultantProfileModel {
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;
{@JsonKey(name: 'has_medical_education', includeIfNull: false)
final bool? hasMedicalEducation,
@JsonKey(name: 'social_links', includeIfNull: false)
final SocialLinksModel? socialLinks,
@JsonKey(name: 'cert_photos', includeIfNull: false)
final List<String>? photos,
@JsonKey(name: 'completed_courses', includeIfNull: false)
final List<CertificatesModel>? certificates}) =
_$ConsultantProfileModelImpl;
factory _ConsultantProfileModel.fromJson(Map<String, dynamic> json) =
_$ConsultantProfileModelImpl.fromJson;
@override
@JsonKey(name: 'has_medical_education')
@JsonKey(name: 'has_medical_education', includeIfNull: false)
bool? get hasMedicalEducation;
@override
@JsonKey(name: 'social_links')
@JsonKey(name: 'social_links', includeIfNull: false)
SocialLinksModel? get socialLinks;
@override
@JsonKey(name: 'cert_photos')
@JsonKey(name: 'cert_photos', includeIfNull: false)
List<String>? get photos;
@override
@JsonKey(name: 'completed_courses')
@JsonKey(name: 'completed_courses', includeIfNull: false)
List<CertificatesModel>? get certificates;
/// Create a copy of ConsultantProfileModel
@@ -301,15 +310,15 @@ SocialLinksModel _$SocialLinksModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$SocialLinksModel {
@JsonKey(name: 'vk_link')
@JsonKey(name: 'vk_link', includeIfNull: false)
String? get vkLink => throw _privateConstructorUsedError;
@JsonKey(name: 'tg_link')
@JsonKey(name: 'tg_link', includeIfNull: false)
String? get tgLink => throw _privateConstructorUsedError;
@JsonKey(name: 'fb_link')
@JsonKey(name: 'fb_link', includeIfNull: false)
String? get fbLink => throw _privateConstructorUsedError;
@JsonKey(name: 'insta_link')
@JsonKey(name: 'insta_link', includeIfNull: false)
String? get instaLink => throw _privateConstructorUsedError;
@JsonKey(name: 'personal_site_link')
@JsonKey(name: 'personal_site_link', includeIfNull: false)
String? get personalSiteLink => throw _privateConstructorUsedError;
/// Serializes this SocialLinksModel to a JSON map.
@@ -329,11 +338,12 @@ abstract class $SocialLinksModelCopyWith<$Res> {
_$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});
{@JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
String? personalSiteLink});
}
/// @nodoc
@@ -391,11 +401,12 @@ abstract class _$$SocialLinksModelImplCopyWith<$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});
{@JsonKey(name: 'vk_link', includeIfNull: false) String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
String? personalSiteLink});
}
/// @nodoc
@@ -446,29 +457,30 @@ class __$$SocialLinksModelImplCopyWithImpl<$Res>
@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});
{@JsonKey(name: 'vk_link', includeIfNull: false) this.vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) this.tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) this.fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false) this.instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
this.personalSiteLink});
factory _$SocialLinksModelImpl.fromJson(Map<String, dynamic> json) =>
_$$SocialLinksModelImplFromJson(json);
@override
@JsonKey(name: 'vk_link')
@JsonKey(name: 'vk_link', includeIfNull: false)
final String? vkLink;
@override
@JsonKey(name: 'tg_link')
@JsonKey(name: 'tg_link', includeIfNull: false)
final String? tgLink;
@override
@JsonKey(name: 'fb_link')
@JsonKey(name: 'fb_link', includeIfNull: false)
final String? fbLink;
@override
@JsonKey(name: 'insta_link')
@JsonKey(name: 'insta_link', includeIfNull: false)
final String? instaLink;
@override
@JsonKey(name: 'personal_site_link')
@JsonKey(name: 'personal_site_link', includeIfNull: false)
final String? personalSiteLink;
@override
@@ -514,30 +526,31 @@ class _$SocialLinksModelImpl implements _SocialLinksModel {
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')
{@JsonKey(name: 'vk_link', includeIfNull: false) final String? vkLink,
@JsonKey(name: 'tg_link', includeIfNull: false) final String? tgLink,
@JsonKey(name: 'fb_link', includeIfNull: false) final String? fbLink,
@JsonKey(name: 'insta_link', includeIfNull: false)
final String? instaLink,
@JsonKey(name: 'personal_site_link', includeIfNull: false)
final String? personalSiteLink}) = _$SocialLinksModelImpl;
factory _SocialLinksModel.fromJson(Map<String, dynamic> json) =
_$SocialLinksModelImpl.fromJson;
@override
@JsonKey(name: 'vk_link')
@JsonKey(name: 'vk_link', includeIfNull: false)
String? get vkLink;
@override
@JsonKey(name: 'tg_link')
@JsonKey(name: 'tg_link', includeIfNull: false)
String? get tgLink;
@override
@JsonKey(name: 'fb_link')
@JsonKey(name: 'fb_link', includeIfNull: false)
String? get fbLink;
@override
@JsonKey(name: 'insta_link')
@JsonKey(name: 'insta_link', includeIfNull: false)
String? get instaLink;
@override
@JsonKey(name: 'personal_site_link')
@JsonKey(name: 'personal_site_link', includeIfNull: false)
String? get personalSiteLink;
/// Create a copy of SocialLinksModel

View File

@@ -23,13 +23,21 @@ _$ConsultantProfileModelImpl _$$ConsultantProfileModelImplFromJson(
);
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,
};
_$ConsultantProfileModelImpl instance) {
final val = <String, dynamic>{};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('has_medical_education', instance.hasMedicalEducation);
writeNotNull('social_links', instance.socialLinks);
writeNotNull('cert_photos', instance.photos);
writeNotNull('completed_courses', instance.certificates);
return val;
}
_$SocialLinksModelImpl _$$SocialLinksModelImplFromJson(
Map<String, dynamic> json) =>
@@ -42,14 +50,22 @@ _$SocialLinksModelImpl _$$SocialLinksModelImplFromJson(
);
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,
};
_$SocialLinksModelImpl instance) {
final val = <String, dynamic>{};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('vk_link', instance.vkLink);
writeNotNull('tg_link', instance.tgLink);
writeNotNull('fb_link', instance.fbLink);
writeNotNull('insta_link', instance.instaLink);
writeNotNull('personal_site_link', instance.personalSiteLink);
return val;
}
_$CertificatesModelImpl _$$CertificatesModelImplFromJson(
Map<String, dynamic> json) =>

View File

@@ -12,19 +12,32 @@ class RegisterConsultantCubit extends Cubit<RegisterConsultantState> {
required this.consultantRepository,
}) : super(
RegisterConsultantState(
consultant: ConsultantProfileModel(),
consultant: ConsultantProfileModel(
socialLinks: SocialLinksModel(),
hasMedicalEducation: true,
),
acceptOffer: false,
),
);
updateConsultantProfileModel(ConsultantProfileModel consultant) {
emit(RegisterConsultantState(consultant: consultant));
updateConsultantProfileModel(ConsultantProfileModel consultant, [bool acceptOffer = false]) {
emit(RegisterConsultantState(consultant: consultant, acceptOffer: acceptOffer));
}
registerConsultant() async {
if (state.consultant.photos != null) {
updateConsultantProfileModel(
state.consultant.copyWith(
photos: await uploadPhotos(
state.consultant.photos!.map((e) => File(e)).toList(),
),
),
);
}
await consultantRepository.registerConsultant(consultant: state.consultant);
}
uploadPhotos(List<File> files) async {
await consultantRepository.uploadPhotos(files: files);
Future<List<String>> uploadPhotos(List<File> files) async {
return await consultantRepository.uploadPhotos(files: files);
}
}

View File

@@ -7,5 +7,6 @@ part 'register_consultant_state.freezed.dart';
abstract class RegisterConsultantState with _$RegisterConsultantState {
const factory RegisterConsultantState({
required ConsultantProfileModel consultant,
required bool acceptOffer,
}) = _RegisterConsultantState;
}

View File

@@ -17,6 +17,7 @@ final _privateConstructorUsedError = UnsupportedError(
/// @nodoc
mixin _$RegisterConsultantState {
ConsultantProfileModel get consultant => throw _privateConstructorUsedError;
bool get acceptOffer => throw _privateConstructorUsedError;
/// Create a copy of RegisterConsultantState
/// with the given fields replaced by the non-null parameter values.
@@ -31,7 +32,7 @@ abstract class $RegisterConsultantStateCopyWith<$Res> {
$Res Function(RegisterConsultantState) then) =
_$RegisterConsultantStateCopyWithImpl<$Res, RegisterConsultantState>;
@useResult
$Res call({ConsultantProfileModel consultant});
$Res call({ConsultantProfileModel consultant, bool acceptOffer});
$ConsultantProfileModelCopyWith<$Res> get consultant;
}
@@ -53,12 +54,17 @@ class _$RegisterConsultantStateCopyWithImpl<$Res,
@override
$Res call({
Object? consultant = null,
Object? acceptOffer = null,
}) {
return _then(_value.copyWith(
consultant: null == consultant
? _value.consultant
: consultant // ignore: cast_nullable_to_non_nullable
as ConsultantProfileModel,
acceptOffer: null == acceptOffer
? _value.acceptOffer
: acceptOffer // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
@@ -82,7 +88,7 @@ abstract class _$$RegisterConsultantStateImplCopyWith<$Res>
__$$RegisterConsultantStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({ConsultantProfileModel consultant});
$Res call({ConsultantProfileModel consultant, bool acceptOffer});
@override
$ConsultantProfileModelCopyWith<$Res> get consultant;
@@ -104,12 +110,17 @@ class __$$RegisterConsultantStateImplCopyWithImpl<$Res>
@override
$Res call({
Object? consultant = null,
Object? acceptOffer = null,
}) {
return _then(_$RegisterConsultantStateImpl(
consultant: null == consultant
? _value.consultant
: consultant // ignore: cast_nullable_to_non_nullable
as ConsultantProfileModel,
acceptOffer: null == acceptOffer
? _value.acceptOffer
: acceptOffer // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
@@ -117,14 +128,17 @@ class __$$RegisterConsultantStateImplCopyWithImpl<$Res>
/// @nodoc
class _$RegisterConsultantStateImpl implements _RegisterConsultantState {
const _$RegisterConsultantStateImpl({required this.consultant});
const _$RegisterConsultantStateImpl(
{required this.consultant, required this.acceptOffer});
@override
final ConsultantProfileModel consultant;
@override
final bool acceptOffer;
@override
String toString() {
return 'RegisterConsultantState(consultant: $consultant)';
return 'RegisterConsultantState(consultant: $consultant, acceptOffer: $acceptOffer)';
}
@override
@@ -133,11 +147,13 @@ class _$RegisterConsultantStateImpl implements _RegisterConsultantState {
(other.runtimeType == runtimeType &&
other is _$RegisterConsultantStateImpl &&
(identical(other.consultant, consultant) ||
other.consultant == consultant));
other.consultant == consultant) &&
(identical(other.acceptOffer, acceptOffer) ||
other.acceptOffer == acceptOffer));
}
@override
int get hashCode => Object.hash(runtimeType, consultant);
int get hashCode => Object.hash(runtimeType, consultant, acceptOffer);
/// Create a copy of RegisterConsultantState
/// with the given fields replaced by the non-null parameter values.
@@ -151,11 +167,13 @@ class _$RegisterConsultantStateImpl implements _RegisterConsultantState {
abstract class _RegisterConsultantState implements RegisterConsultantState {
const factory _RegisterConsultantState(
{required final ConsultantProfileModel consultant}) =
_$RegisterConsultantStateImpl;
{required final ConsultantProfileModel consultant,
required final bool acceptOffer}) = _$RegisterConsultantStateImpl;
@override
ConsultantProfileModel get consultant;
@override
bool get acceptOffer;
/// Create a copy of RegisterConsultantState
/// with the given fields replaced by the non-null parameter values.

View File

@@ -1,6 +1,8 @@
import 'package:eatvio_app/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class AdditionalSettingsScreen extends StatefulWidget {
const AdditionalSettingsScreen({super.key});
@@ -13,6 +15,18 @@ class _AdditionalSettingsScreenState extends State<AdditionalSettingsScreen> {
bool publishDiplomasAndCertificatesInProfile = true;
bool haveMedicalDegree = true;
@override
void initState() {
if (context.read<RegisterConsultantCubit>().state.consultant.hasMedicalEducation != null) {
haveMedicalDegree = context
.read<RegisterConsultantCubit>()
.state
.consultant
.hasMedicalEducation!;
}
super.initState();
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
@@ -50,6 +64,11 @@ class _AdditionalSettingsScreenState extends State<AdditionalSettingsScreen> {
setState(() {
haveMedicalDegree = !haveMedicalDegree;
});
context.read<RegisterConsultantCubit>().updateConsultantProfileModel(
context.read<RegisterConsultantCubit>().state.consultant.copyWith(
hasMedicalEducation: haveMedicalDegree,
),
);
},
),
],

View File

@@ -24,7 +24,12 @@ class _BecomeConsultantScreenState extends State<BecomeConsultantScreen> {
),
body: Padding(
padding: const EdgeInsets.all(16),
child: Text('Для регистрации потребуется следующий список документов, подготовьте их заранее'),
child: Text(
' Чтобы стать консультантом необходимо пройти короткую регистрацию. Подготовьте свои дипломы и/или сертификаты в формате jpg, они Вам пригодятся для проверки и подтверждения. Также необходимо будет указать ссылки на Ваши соц. сети и указать тип лица (физ. лицо или юр. лицо). На данный момент доступна регистрация в качестве физ. лица.\n\n Внутри Итвио разница между обычным пользователем и консультантом заключается в дополнительных возможностях последнего создавать публичные диеты, рецепты и планы питания; участвовать в ежемесячных рейтингах.',
style: TextStyle(
fontSize: 16,
),
),
),
bottomSheet: _startRegistrationButton(),
);

View File

@@ -1,10 +1,12 @@
import 'package:eatvio_app/features/consultant/become_consultant/entities/diploma_entity.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
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_cubit.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:eatvio_app/core/utils/date_time_utils.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class CertificatesAndDiplomasScreen extends StatefulWidget {
const CertificatesAndDiplomasScreen({super.key});
@@ -24,6 +26,27 @@ class _CertificatesAndDiplomasScreenState extends State<CertificatesAndDiplomasS
),
];
@override
void initState() {
super.initState();
if (context.read<RegisterConsultantCubit>().state.consultant.certificates != null) {
diplomasList = context
.read<RegisterConsultantCubit>()
.state
.consultant
.certificates!
.map(
(e) => DiplomaEntity(
date: DateTime.tryParse(e.date),
textEditingController: TextEditingController(text: e.title),
enableDeleteButton: true,
),
)
.toList();
diplomasList.last.enableDeleteButton = false;
}
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
@@ -113,6 +136,7 @@ class _CertificatesAndDiplomasScreenState extends State<CertificatesAndDiplomasS
onTap: () {
setState(() {
diplomasList.remove(diploma);
_saveState();
});
},
borderRadius: BorderRadius.circular(20),
@@ -155,6 +179,7 @@ class _CertificatesAndDiplomasScreenState extends State<CertificatesAndDiplomasS
}
void _showDialog(Widget child) {
FocusManager.instance.primaryFocus?.unfocus();
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) => Container(
@@ -166,34 +191,7 @@ class _CertificatesAndDiplomasScreenState extends State<CertificatesAndDiplomasS
color: CupertinoColors.systemBackground.resolveFrom(context),
child: SafeArea(
top: false,
child: Column(
children: [
child,
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Ink(
width: MediaQuery.of(context).size.width - 32,
height: 52,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
child: Center(
child: Text(
'Закрыть',
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
),
),
],
),
child: child,
),
),
);
@@ -226,5 +224,17 @@ class _CertificatesAndDiplomasScreenState extends State<CertificatesAndDiplomasS
diplomasList[diplomasList.indexOf(diploma)].enableDeleteButton = true;
});
}
_saveState();
}
_saveState() {
context.read<RegisterConsultantCubit>().updateConsultantProfileModel(
context.read<RegisterConsultantCubit>().state.consultant.copyWith(
certificates: diplomasList.map((e) => CertificatesModel(title: e.textEditingController.text, date: e.date.toString())).toList().sublist(
0,
diplomasList.length - 1,
),
),
);
}
}

View File

@@ -1,6 +1,8 @@
import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:url_launcher/url_launcher.dart';
class LastStepScreen extends StatefulWidget {
@@ -46,6 +48,7 @@ class _LastStepScreenState extends State<LastStepScreen> {
setState(() {
checkboxState = !checkboxState;
});
context.read<RegisterConsultantCubit>().updateConsultantProfileModel(context.read<RegisterConsultantCubit>().state.consultant, checkboxState);
},
activeColor: appTheme.blueA400,
contentPadding: const EdgeInsets.symmetric(horizontal: 16),

View File

@@ -1,7 +1,11 @@
import 'dart:io';
import 'package:dismissible_page/dismissible_page.dart';
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
import 'package:eatvio_app/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:image_picker/image_picker.dart';
class PhotoOrScansScreen extends StatefulWidget {
@@ -12,7 +16,14 @@ class PhotoOrScansScreen extends StatefulWidget {
}
class _PhotoOrScansScreenState extends State<PhotoOrScansScreen> {
List<XFile> images = [];
List<String> imagesPaths = [];
@override
void initState() {
super.initState();
imagesPaths =
context.read<RegisterConsultantCubit>().state.consultant.photos != null ? [...context.read<RegisterConsultantCubit>().state.consultant.photos!] : [];
}
@override
Widget build(BuildContext context) {
@@ -42,15 +53,17 @@ class _PhotoOrScansScreenState extends State<PhotoOrScansScreen> {
mainAxisSpacing: 8,
),
itemBuilder: (BuildContext context, int index) {
if (index == images.length) {
if (index == imagesPaths.length) {
return InkWell(
borderRadius: BorderRadius.circular(20),
onTap: () async {
final picker = ImagePicker();
List<XFile>? newImages = await picker.pickMultiImage();
List<String> newImagesPaths = newImages.map((e) => e.path).toList();
setState(() {
images = [...images, ...newImages];
imagesPaths = [...imagesPaths, ...newImagesPaths];
});
_saveState();
},
child: Ink(
decoration: BoxDecoration(
@@ -64,58 +77,82 @@ class _PhotoOrScansScreenState extends State<PhotoOrScansScreen> {
),
);
} else {
return InkWell(
onTap: () {},
borderRadius: BorderRadius.circular(20),
child: Stack(
clipBehavior: Clip.none,
children: [
Ink(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(20),
return Hero(
tag: imagesPaths[index],
child: Material(
borderRadius: BorderRadius.circular(20),
child: InkWell(
onTap: () {
context.pushTransparentRoute(
rootNavigator: true,
PhotoViewScreen(
imageUrls: imagesPaths,
isLocal: true,
index: index,
),
image: DecorationImage(
fit: BoxFit.fitHeight,
image: FileImage(
File(images[index].path),
),
),
),
),
Positioned(
right: -12,
top: -12,
child: InkWell(
onTap: () {
setState(() {
images.removeAt(index);
});
},
customBorder: CircleBorder(),
child: Ink(
padding: EdgeInsets.all(4),
);
},
borderRadius: BorderRadius.circular(20),
child: Stack(
clipBehavior: Clip.none,
children: [
Ink(
decoration: BoxDecoration(
color: Color(0xFFF1F2F6),
shape: BoxShape.circle,
),
child: Icon(
size: 20,
Icons.close,
color: Colors.black,
borderRadius: BorderRadius.all(
Radius.circular(20),
),
image: DecorationImage(
fit: BoxFit.fitHeight,
image: FileImage(
File(imagesPaths[index]),
),
),
),
),
),
Positioned(
right: -12,
top: -12,
child: InkWell(
onTap: () {
setState(() {
imagesPaths.removeAt(index);
});
_saveState();
},
customBorder: CircleBorder(),
child: Ink(
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xFFF1F2F6),
shape: BoxShape.circle,
),
child: Icon(
size: 20,
Icons.close,
color: Colors.black,
),
),
),
),
],
),
],
),
),
);
}
},
itemCount: images.length + 1,
itemCount: imagesPaths.length + 1,
),
],
),
);
}
_saveState() {
context.read<RegisterConsultantCubit>().updateConsultantProfileModel(
context.read<RegisterConsultantCubit>().state.consultant.copyWith(
photos: imagesPaths,
),
);
}
}

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
class RegistrationAsScreen extends StatefulWidget {
@@ -42,6 +43,7 @@ class _RegistrationAsScreenState extends State<RegistrationAsScreen> {
height: 1,
),
),
activeColor: appTheme.blueA400,
onChanged: (value) {},
contentPadding: EdgeInsets.symmetric(horizontal: 8),
),

View File

@@ -1,6 +1,9 @@
import 'package:eatvio_app/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
class SocialNetworksScreen extends StatefulWidget {
const SocialNetworksScreen({super.key});
@@ -10,6 +13,40 @@ class SocialNetworksScreen extends StatefulWidget {
}
class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
final vkController = TextEditingController();
final telegramController = TextEditingController();
final webSiteController = TextEditingController();
var maskFormatter = new MaskTextInputFormatter(
mask: 'https://########################################',
filter: {
'#': RegExp(r"[a-zA-Z. ]+"),
},
type: MaskAutoCompletionType.lazy,
);
var maskTgFormatter = new MaskTextInputFormatter(
mask: 'https://tg.me/########################################',
filter: {
'#': RegExp(r"[a-zA-Z. ]+"),
},
type: MaskAutoCompletionType.lazy,
);
var maskVkFormatter = new MaskTextInputFormatter(
mask: 'https://vk.com/########################################',
filter: {
'#': RegExp(r"[a-zA-Z. ]+"),
},
type: MaskAutoCompletionType.lazy,
);
@override
void initState() {
super.initState();
vkController.text = context.read<RegisterConsultantCubit>().state.consultant.socialLinks!.vkLink ?? '';
telegramController.text = context.read<RegisterConsultantCubit>().state.consultant.socialLinks!.tgLink ?? '';
webSiteController.text = context.read<RegisterConsultantCubit>().state.consultant.socialLinks!.personalSiteLink ?? '';
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
@@ -46,7 +83,12 @@ class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
SizedBox(
width: MediaQuery.of(context).size.width - 92,
child: CustomTextFormField(
hintText: 'ВКонтакте',
hintText: 'vk.com/',
controller: vkController,
inputFormatters: [maskVkFormatter],
onChanged: (value) {
setLinksState(vkLink: value);
},
),
),
],
@@ -71,7 +113,12 @@ class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
SizedBox(
width: MediaQuery.of(context).size.width - 92,
child: CustomTextFormField(
hintText: 'Telegram',
hintText: 'tg.me/',
inputFormatters: [maskTgFormatter],
controller: telegramController,
onChanged: (value) {
setLinksState(tgLink: value);
},
),
),
],
@@ -96,7 +143,12 @@ class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
SizedBox(
width: MediaQuery.of(context).size.width - 92,
child: CustomTextFormField(
hintText: 'Личный сайт',
hintText: 'https://',
inputFormatters: [maskFormatter],
controller: webSiteController,
onChanged: (value) {
setLinksState(personalSiteLink: value);
},
),
),
],
@@ -105,4 +157,32 @@ class _SocialNetworksScreenState extends State<SocialNetworksScreen> {
),
);
}
setLinksState({
String? tgLink,
String? vkLink,
String? personalSiteLink,
}) {
context.read<RegisterConsultantCubit>().updateConsultantProfileModel(
context.read<RegisterConsultantCubit>().state.consultant.copyWith(
socialLinks: context.read<RegisterConsultantCubit>().state.consultant.socialLinks?.copyWith(
tgLink: tgLink == null
? context.read<RegisterConsultantCubit>().state.consultant.socialLinks?.tgLink
: tgLink.isEmpty
? null
: tgLink,
vkLink: vkLink == null
? context.read<RegisterConsultantCubit>().state.consultant.socialLinks?.vkLink
: vkLink.isEmpty
? null
: vkLink,
personalSiteLink: personalSiteLink == null
? context.read<RegisterConsultantCubit>().state.consultant.socialLinks?.personalSiteLink
: personalSiteLink.isEmpty
? null
: personalSiteLink,
),
),
);
}
}

View File

@@ -1,14 +1,18 @@
import 'package:eatvio_app/core/utils/image_constant.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/presentation/pages/additional_settings_screen.dart';
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/certificates_and_diplomas_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/locator_service.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';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:lottie/lottie.dart';
class StepperBecomeConsultantScreen extends StatefulWidget {
const StepperBecomeConsultantScreen({super.key});
@@ -21,197 +25,243 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
double progressValue = 1 / 6;
int step = 1;
final pageController = PageController();
final registrationConsultantCubit = sl<RegisterConsultantCubit>();
bool isLoading = false;
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: Row(
children: [
Container(
height: 48,
width: MediaQuery.of(context).size.width * 0.2,
padding: EdgeInsets.only(left: 16, right: 4),
child: FloatingActionButton.extended(
heroTag: 'backButtonRegistration',
highlightElevation: 0,
focusElevation: 0,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
backgroundColor: Color(0xFFEAF2FD),
onPressed: () async {
setState(() {
pageController.previousPage(
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
);
});
},
label: Icon(
Icons.arrow_back_ios_new_rounded,
color: appTheme.blueA400,
),
),
),
Container(
height: 48,
width: MediaQuery.of(context).size.width * 0.8,
padding: EdgeInsets.only(left: 4, right: 16),
child: FloatingActionButton.extended(
heroTag: 'nextButtonRegistration',
highlightElevation: 0,
elevation: 0,
focusElevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
backgroundColor: appTheme.blueA400,
onPressed: () async {
if (step == 6) {
await showModalBottomSheet(
useRootNavigator: true,
showDragHandle: true,
context: context,
builder: (context) => Container(
padding: EdgeInsets.all(16),
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Спасибо!\nВаши данные отправлены на модерацию',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
height: 1,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: appTheme.blueA400,
shape: BoxShape.circle,
),
child: Icon(
size: 32,
Icons.done,
color: Colors.white,
),
),
const SizedBox(height: 16),
Text(
'В течении трех рабочих дней Вам придет уведомление о смене статуса',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
height: 1,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 16),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Ink(
width: MediaQuery.of(context).size.width - 32,
height: 52,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
child: Center(
child: Text(
'Закрыть',
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
),
),
],
),
),
);
} else {
return BlocProvider<RegisterConsultantCubit>(
create: (context) => registrationConsultantCubit,
child: Scaffold(
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: Row(
children: [
Container(
height: 48,
width: MediaQuery.of(context).size.width * 0.2,
padding: EdgeInsets.only(left: 16, right: 4),
child: FloatingActionButton.extended(
heroTag: 'backButtonRegistration',
highlightElevation: 0,
focusElevation: 0,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
backgroundColor: Color(0xFFEAF2FD),
onPressed: () async {
setState(() {
pageController.nextPage(
pageController.previousPage(
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
);
});
}
},
label: Text(
'Продолжить',
style: theme.textTheme.titleSmall!.copyWith(color: Colors.white),
},
label: Icon(
Icons.arrow_back_ios_new_rounded,
color: appTheme.blueA400,
),
),
),
),
],
),
appBar: AppBar(
automaticallyImplyLeading: false,
leading: Builder(
builder: (context) => IconButton(
icon: Icon(Icons.close_rounded),
onPressed: () => GoRouter.of(context).pop(),
),
),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),
actions: [
Padding(
padding: const EdgeInsets.only(right: 16),
child: Text('шаг $step из 6'),
),
],
bottom: PreferredSize(
preferredSize: Size(MediaQuery.of(context).size.width, 32),
child: Padding(
padding: const EdgeInsets.all(16),
child: TweenAnimationBuilder<double>(
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
tween: Tween<double>(
begin: 1 / 6,
end: progressValue,
Container(
height: 48,
width: MediaQuery.of(context).size.width * 0.8,
padding: EdgeInsets.only(left: 4, right: 16),
child: FloatingActionButton.extended(
heroTag: 'nextButtonRegistration',
highlightElevation: 0,
elevation: 0,
focusElevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
backgroundColor: isLoading ? Colors.grey : appTheme.blueA400,
onPressed: isLoading
? null
: () async {
if (step == 6) {
if (registrationConsultantCubit.state.acceptOffer) {
setState(() {
isLoading = true;
});
try {
await registrationConsultantCubit.registerConsultant();
await showModalBottomSheet(
useRootNavigator: true,
showDragHandle: true,
context: context,
builder: (context) => Container(
padding: EdgeInsets.all(16),
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Спасибо!\nВаши данные отправлены на модерацию',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
height: 1,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 16),
Lottie.asset(
'assets/lottie_animations/success.json',
width: 160,
height: 160,
),
const SizedBox(height: 16),
Text(
'В течении трех рабочих дней Вам придет уведомление о смене статуса',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
height: 1,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 16),
InkWell(
onTap: () {
Navigator.of(context).pop();
GoRouter.of(context).pop();
},
child: Ink(
width: MediaQuery.of(context).size.width - 32,
height: 52,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
child: Center(
child: Text(
'Закрыть',
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
),
),
],
),
),
);
} catch (e) {
showDialog(
context: context,
builder: (context) => AlertDialog(
actionsPadding: const EdgeInsets.symmetric(horizontal: 4),
content: Text(e.toString()),
actions: [
TextButton(
child: const Text('Ок'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
),
);
} finally {
setState(() {
isLoading = false;
});
}
} else {
showDialog(
context: context,
builder: (context) => AlertDialog(
actionsPadding: const EdgeInsets.symmetric(horizontal: 4),
content: Text('Примите договор публичной офёрты'),
actions: [
TextButton(
child: const Text('Ок'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
),
);
}
} else {
FocusManager.instance.primaryFocus?.unfocus();
setState(() {
pageController.nextPage(
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
);
});
}
},
label: isLoading ? CircularProgressIndicator() : Text(
'Продолжить',
style: theme.textTheme.titleSmall!.copyWith(color: Colors.white),
),
),
builder: (context, value, _) => LinearProgressIndicator(
value: value,
borderRadius: BorderRadius.circular(16),
minHeight: 8,
backgroundColor: Colors.grey.shade100,
valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),
),
],
),
appBar: AppBar(
automaticallyImplyLeading: false,
leading: Builder(
builder: (context) => IconButton(
icon: Icon(Icons.close_rounded),
onPressed: () => GoRouter.of(context).pop(),
),
),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),
actions: [
Padding(
padding: const EdgeInsets.only(right: 16),
child: Text('шаг $step из 6'),
),
],
bottom: PreferredSize(
preferredSize: Size(MediaQuery.of(context).size.width, 32),
child: Padding(
padding: const EdgeInsets.all(16),
child: TweenAnimationBuilder<double>(
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
tween: Tween<double>(
begin: 1 / 6,
end: progressValue,
),
builder: (context, value, _) => LinearProgressIndicator(
value: value,
borderRadius: BorderRadius.circular(16),
minHeight: 8,
backgroundColor: Colors.grey.shade100,
valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),
),
),
),
),
),
),
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
onPageChanged: (index) {
setState(() {
step = index + 1;
progressValue = step / 6;
});
},
children: [
CertificatesAndDiplomasScreen(),
PhotoOrScansScreen(),
AdditionalSettingsScreen(),
SocialNetworksScreen(),
RegistrationAsScreen(),
LastStepScreen(),
],
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
onPageChanged: (index) {
setState(() {
step = index + 1;
progressValue = step / 6;
});
},
children: [
CertificatesAndDiplomasScreen(),
PhotoOrScansScreen(),
AdditionalSettingsScreen(),
SocialNetworksScreen(),
RegistrationAsScreen(),
LastStepScreen(),
],
),
),
);
}

View File

@@ -16,7 +16,7 @@ class ConsultantRepository {
}) async {
try {
return await consultantService.consultantRegistration(
consultantModel: consultant.toJson(),
consultantModel: consultant,
);
} catch (e) {
print(e);

View File

@@ -1,4 +1,5 @@
import 'package:dio/dio.dart';
import 'package:eatvio_app/features/consultant/become_consultant/models/consultant_profile_model.dart';
import 'package:retrofit/retrofit.dart';
part 'consultant_service.g.dart';
@@ -9,7 +10,7 @@ abstract class ConsultantService {
@POST('/api/consultant_request/registration')
Future<void> consultantRegistration({
@Body() required Map<String, dynamic> consultantModel,
@Body() required ConsultantProfileModel consultantModel,
});
@POST('/api/consultant_request/photos/upload')

View File

@@ -23,12 +23,11 @@ class _ConsultantService implements ConsultantService {
@override
Future<void> consultantRegistration(
{required Map<String, dynamic> consultantModel}) async {
{required ConsultantProfileModel consultantModel}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(consultantModel);
final _data = consultantModel;
final _options = _setStreamType<void>(Options(
method: 'POST',
headers: _headers,

View File

@@ -16,6 +16,7 @@ class ProfileModel with _$ProfileModel {
@JsonKey(name: "is_public_profile") required bool isPublicProfile,
@JsonKey(name: "slug") required String slug,
@JsonKey(name: "profile_photo_url") required String profilePhotoUrl,
required String role,
}) = _ProfileModel;
factory ProfileModel.fromJson(Map<String, dynamic> json) => _$ProfileModelFromJson(json);

View File

@@ -38,6 +38,7 @@ mixin _$ProfileModel {
String get slug => throw _privateConstructorUsedError;
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl => throw _privateConstructorUsedError;
String get role => throw _privateConstructorUsedError;
/// Serializes this ProfileModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -64,7 +65,8 @@ abstract class $ProfileModelCopyWith<$Res> {
@JsonKey(name: "updated_at") DateTime? updatedAt,
@JsonKey(name: "is_public_profile") bool isPublicProfile,
@JsonKey(name: "slug") String slug,
@JsonKey(name: "profile_photo_url") String profilePhotoUrl});
@JsonKey(name: "profile_photo_url") String profilePhotoUrl,
String role});
}
/// @nodoc
@@ -91,6 +93,7 @@ class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel>
Object? isPublicProfile = null,
Object? slug = null,
Object? profilePhotoUrl = null,
Object? role = null,
}) {
return _then(_value.copyWith(
id: null == id
@@ -129,6 +132,10 @@ class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel>
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String,
role: null == role
? _value.role
: role // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
@@ -150,7 +157,8 @@ abstract class _$$ProfileModelImplCopyWith<$Res>
@JsonKey(name: "updated_at") DateTime? updatedAt,
@JsonKey(name: "is_public_profile") bool isPublicProfile,
@JsonKey(name: "slug") String slug,
@JsonKey(name: "profile_photo_url") String profilePhotoUrl});
@JsonKey(name: "profile_photo_url") String profilePhotoUrl,
String role});
}
/// @nodoc
@@ -175,6 +183,7 @@ class __$$ProfileModelImplCopyWithImpl<$Res>
Object? isPublicProfile = null,
Object? slug = null,
Object? profilePhotoUrl = null,
Object? role = null,
}) {
return _then(_$ProfileModelImpl(
id: null == id
@@ -213,6 +222,10 @@ class __$$ProfileModelImplCopyWithImpl<$Res>
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String,
role: null == role
? _value.role
: role // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -229,7 +242,8 @@ class _$ProfileModelImpl implements _ProfileModel {
@JsonKey(name: "updated_at") this.updatedAt,
@JsonKey(name: "is_public_profile") required this.isPublicProfile,
@JsonKey(name: "slug") required this.slug,
@JsonKey(name: "profile_photo_url") required this.profilePhotoUrl});
@JsonKey(name: "profile_photo_url") required this.profilePhotoUrl,
required this.role});
factory _$ProfileModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ProfileModelImplFromJson(json);
@@ -261,10 +275,12 @@ class _$ProfileModelImpl implements _ProfileModel {
@override
@JsonKey(name: "profile_photo_url")
final String profilePhotoUrl;
@override
final String role;
@override
String toString() {
return 'ProfileModel(id: $id, name: $name, email: $email, emailVerifiedAt: $emailVerifiedAt, createdAt: $createdAt, updatedAt: $updatedAt, isPublicProfile: $isPublicProfile, slug: $slug, profilePhotoUrl: $profilePhotoUrl)';
return 'ProfileModel(id: $id, name: $name, email: $email, emailVerifiedAt: $emailVerifiedAt, createdAt: $createdAt, updatedAt: $updatedAt, isPublicProfile: $isPublicProfile, slug: $slug, profilePhotoUrl: $profilePhotoUrl, role: $role)';
}
@override
@@ -285,13 +301,14 @@ class _$ProfileModelImpl implements _ProfileModel {
other.isPublicProfile == isPublicProfile) &&
(identical(other.slug, slug) || other.slug == slug) &&
(identical(other.profilePhotoUrl, profilePhotoUrl) ||
other.profilePhotoUrl == profilePhotoUrl));
other.profilePhotoUrl == profilePhotoUrl) &&
(identical(other.role, role) || other.role == role));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, name, email, emailVerifiedAt,
createdAt, updatedAt, isPublicProfile, slug, profilePhotoUrl);
createdAt, updatedAt, isPublicProfile, slug, profilePhotoUrl, role);
/// Create a copy of ProfileModel
/// with the given fields replaced by the non-null parameter values.
@@ -319,8 +336,8 @@ abstract class _ProfileModel implements ProfileModel {
@JsonKey(name: "updated_at") final DateTime? updatedAt,
@JsonKey(name: "is_public_profile") required final bool isPublicProfile,
@JsonKey(name: "slug") required final String slug,
@JsonKey(name: "profile_photo_url")
required final String profilePhotoUrl}) = _$ProfileModelImpl;
@JsonKey(name: "profile_photo_url") required final String profilePhotoUrl,
required final String role}) = _$ProfileModelImpl;
factory _ProfileModel.fromJson(Map<String, dynamic> json) =
_$ProfileModelImpl.fromJson;
@@ -352,6 +369,8 @@ abstract class _ProfileModel implements ProfileModel {
@override
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl;
@override
String get role;
/// Create a copy of ProfileModel
/// with the given fields replaced by the non-null parameter values.

View File

@@ -23,6 +23,7 @@ _$ProfileModelImpl _$$ProfileModelImplFromJson(Map<String, dynamic> json) =>
isPublicProfile: json['is_public_profile'] as bool,
slug: json['slug'] as String,
profilePhotoUrl: json['profile_photo_url'] as String,
role: json['role'] as String,
);
Map<String, dynamic> _$$ProfileModelImplToJson(_$ProfileModelImpl instance) =>
@@ -36,6 +37,7 @@ Map<String, dynamic> _$$ProfileModelImplToJson(_$ProfileModelImpl instance) =>
'is_public_profile': instance.isPublicProfile,
'slug': instance.slug,
'profile_photo_url': instance.profilePhotoUrl,
'role': instance.role,
};
_$ProfileDetailsModelImpl _$$ProfileDetailsModelImplFromJson(

View File

@@ -19,6 +19,7 @@ class SettingsCubit extends Cubit<SettingsState> {
emit(SettingsState.loaded(
profileSettings: await settingsRepository.getProfileSettings(),
profileDetails: await profileRepository.getMyProfileDetails(),
profile: await profileRepository.getMyProfile(),
));
} catch (e) {
emit(SettingsState.error(errorMessage: e.toString()));

View File

@@ -13,6 +13,7 @@ abstract class SettingsState with _$SettingsState {
const factory SettingsState.loaded({
required ProfileSettingsModel profileSettings,
required ProfileDetailsModel profileDetails,
required ProfileModel profile,
}) = SettingsStateLoaded;
const factory SettingsState.error({

View File

@@ -21,7 +21,7 @@ mixin _$SettingsState {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)
ProfileDetailsModel profileDetails, ProfileModel profile)
loaded,
required TResult Function(String errorMessage) error,
}) =>
@@ -31,7 +31,7 @@ mixin _$SettingsState {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult? Function(String errorMessage)? error,
}) =>
@@ -41,7 +41,7 @@ mixin _$SettingsState {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
@@ -139,7 +139,7 @@ class _$SettingsStateImpl implements _SettingsState {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)
ProfileDetailsModel profileDetails, ProfileModel profile)
loaded,
required TResult Function(String errorMessage) error,
}) {
@@ -152,7 +152,7 @@ class _$SettingsStateImpl implements _SettingsState {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
@@ -165,7 +165,7 @@ class _$SettingsStateImpl implements _SettingsState {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
@@ -263,7 +263,7 @@ class _$SettingsStateLoadingImpl implements SettingsStateLoading {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)
ProfileDetailsModel profileDetails, ProfileModel profile)
loaded,
required TResult Function(String errorMessage) error,
}) {
@@ -276,7 +276,7 @@ class _$SettingsStateLoadingImpl implements SettingsStateLoading {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
@@ -289,7 +289,7 @@ class _$SettingsStateLoadingImpl implements SettingsStateLoading {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
@@ -350,10 +350,12 @@ abstract class _$$SettingsStateLoadedImplCopyWith<$Res> {
@useResult
$Res call(
{ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails});
ProfileDetailsModel profileDetails,
ProfileModel profile});
$ProfileSettingsModelCopyWith<$Res> get profileSettings;
$ProfileDetailsModelCopyWith<$Res> get profileDetails;
$ProfileModelCopyWith<$Res> get profile;
}
/// @nodoc
@@ -371,6 +373,7 @@ class __$$SettingsStateLoadedImplCopyWithImpl<$Res>
$Res call({
Object? profileSettings = null,
Object? profileDetails = null,
Object? profile = null,
}) {
return _then(_$SettingsStateLoadedImpl(
profileSettings: null == profileSettings
@@ -381,6 +384,10 @@ class __$$SettingsStateLoadedImplCopyWithImpl<$Res>
? _value.profileDetails
: profileDetails // ignore: cast_nullable_to_non_nullable
as ProfileDetailsModel,
profile: null == profile
? _value.profile
: profile // ignore: cast_nullable_to_non_nullable
as ProfileModel,
));
}
@@ -403,22 +410,36 @@ class __$$SettingsStateLoadedImplCopyWithImpl<$Res>
return _then(_value.copyWith(profileDetails: value));
});
}
/// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ProfileModelCopyWith<$Res> get profile {
return $ProfileModelCopyWith<$Res>(_value.profile, (value) {
return _then(_value.copyWith(profile: value));
});
}
}
/// @nodoc
class _$SettingsStateLoadedImpl implements SettingsStateLoaded {
const _$SettingsStateLoadedImpl(
{required this.profileSettings, required this.profileDetails});
{required this.profileSettings,
required this.profileDetails,
required this.profile});
@override
final ProfileSettingsModel profileSettings;
@override
final ProfileDetailsModel profileDetails;
@override
final ProfileModel profile;
@override
String toString() {
return 'SettingsState.loaded(profileSettings: $profileSettings, profileDetails: $profileDetails)';
return 'SettingsState.loaded(profileSettings: $profileSettings, profileDetails: $profileDetails, profile: $profile)';
}
@override
@@ -429,11 +450,13 @@ class _$SettingsStateLoadedImpl implements SettingsStateLoaded {
(identical(other.profileSettings, profileSettings) ||
other.profileSettings == profileSettings) &&
(identical(other.profileDetails, profileDetails) ||
other.profileDetails == profileDetails));
other.profileDetails == profileDetails) &&
(identical(other.profile, profile) || other.profile == profile));
}
@override
int get hashCode => Object.hash(runtimeType, profileSettings, profileDetails);
int get hashCode =>
Object.hash(runtimeType, profileSettings, profileDetails, profile);
/// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values.
@@ -450,11 +473,11 @@ class _$SettingsStateLoadedImpl implements SettingsStateLoaded {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)
ProfileDetailsModel profileDetails, ProfileModel profile)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(profileSettings, profileDetails);
return loaded(profileSettings, profileDetails, profile);
}
@override
@@ -463,11 +486,11 @@ class _$SettingsStateLoadedImpl implements SettingsStateLoaded {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(profileSettings, profileDetails);
return loaded?.call(profileSettings, profileDetails, profile);
}
@override
@@ -476,13 +499,13 @@ class _$SettingsStateLoadedImpl implements SettingsStateLoaded {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(profileSettings, profileDetails);
return loaded(profileSettings, profileDetails, profile);
}
return orElse();
}
@@ -527,12 +550,13 @@ class _$SettingsStateLoadedImpl implements SettingsStateLoaded {
abstract class SettingsStateLoaded implements SettingsState {
const factory SettingsStateLoaded(
{required final ProfileSettingsModel profileSettings,
required final ProfileDetailsModel profileDetails}) =
_$SettingsStateLoadedImpl;
{required final ProfileSettingsModel profileSettings,
required final ProfileDetailsModel profileDetails,
required final ProfileModel profile}) = _$SettingsStateLoadedImpl;
ProfileSettingsModel get profileSettings;
ProfileDetailsModel get profileDetails;
ProfileModel get profile;
/// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values.
@@ -614,7 +638,7 @@ class _$SettingsStateErrorImpl implements SettingsStateError {
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)
ProfileDetailsModel profileDetails, ProfileModel profile)
loaded,
required TResult Function(String errorMessage) error,
}) {
@@ -627,7 +651,7 @@ class _$SettingsStateErrorImpl implements SettingsStateError {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
@@ -640,7 +664,7 @@ class _$SettingsStateErrorImpl implements SettingsStateError {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileSettingsModel profileSettings,
ProfileDetailsModel profileDetails)?
ProfileDetailsModel profileDetails, ProfileModel profile)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),

View File

@@ -56,8 +56,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
const SizedBox(height: 12),
_aboutEatvio(state),
const SizedBox(height: 12),
_becomeConsultantButton(state),
const SizedBox(height: 8),
if (state.profile.role != 'consultant')
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: _becomeConsultantButton(state),
),
_deleteAccountButton(state),
],
),
@@ -213,10 +216,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
updatesNotificationsSwitchState = !updatesNotificationsSwitchState;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
newUpdatesNotifications: updatesNotificationsSwitchState,
),
);
profileSettingsModel: state.profileSettings.copyWith(
newUpdatesNotifications: updatesNotificationsSwitchState,
),
);
},
title: 'Уведомление о новых обновлениях',
trailing: CupertinoSwitch(
@@ -227,10 +230,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
updatesNotificationsSwitchState = newValue;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
newUpdatesNotifications: updatesNotificationsSwitchState,
),
);
profileSettingsModel: state.profileSettings.copyWith(
newUpdatesNotifications: updatesNotificationsSwitchState,
),
);
},
),
),
@@ -242,10 +245,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
fillDiaryNotificationsSwitchState = !fillDiaryNotificationsSwitchState;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
),
);
profileSettingsModel: state.profileSettings.copyWith(
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
),
);
},
title: 'Напоминание о заполнении дневника',
trailing: CupertinoSwitch(
@@ -256,10 +259,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
fillDiaryNotificationsSwitchState = newValue;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
),
);
profileSettingsModel: state.profileSettings.copyWith(
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
),
);
},
),
),
@@ -271,10 +274,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
moodSwitchState = !moodSwitchState;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
isMoodFillable: moodSwitchState,
),
);
profileSettingsModel: state.profileSettings.copyWith(
isMoodFillable: moodSwitchState,
),
);
},
title: 'Указывать “настроение” в заполнение дневника',
trailing: CupertinoSwitch(
@@ -285,10 +288,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
moodSwitchState = newValue;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
isMoodFillable: moodSwitchState,
),
);
profileSettingsModel: state.profileSettings.copyWith(
isMoodFillable: moodSwitchState,
),
);
},
),
),
@@ -300,10 +303,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
bedTimeSwitchState = !bedTimeSwitchState;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
isBedtimeFillable: bedTimeSwitchState,
),
);
profileSettingsModel: state.profileSettings.copyWith(
isBedtimeFillable: bedTimeSwitchState,
),
);
},
title: 'Указывать “отход ко сну” в заполнение дневника',
trailing: CupertinoSwitch(
@@ -314,10 +317,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
bedTimeSwitchState = newValue;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
isBedtimeFillable: bedTimeSwitchState,
),
);
profileSettingsModel: state.profileSettings.copyWith(
isBedtimeFillable: bedTimeSwitchState,
),
);
},
),
),

View File

@@ -48,6 +48,8 @@ dependencies:
audioplayers: ^6.1.0
intl: ^0.19.0
rive: ^0.13.14
mask_text_input_formatter: ^2.9.0
lottie: ^3.1.3
dev_dependencies:
build_runner: ^2.4.13
@@ -66,6 +68,7 @@ flutter:
- assets/audio/
- assets/icons/
- assets/rive_animations/
- assets/lottie_animations/
flutter_intl:
enabled: true