feat(setting): added profile data apdating for sttings screen, added validation for general info form

This commit is contained in:
misha
2026-04-14 09:28:02 +03:00
parent 631ceb2b7a
commit 684415ef5b
7 changed files with 291 additions and 189 deletions

View File

@@ -7,7 +7,19 @@ import 'package:eatvio_app/core/error_reporting/report_from.dart';
class MenuCubit extends Cubit<MenuState> {
final ProfileRepository profileRepository;
MenuCubit(this.profileRepository) : super(MenuState());
MenuCubit(this.profileRepository) : super(const MenuState.initial());
Future<void> getMyProfile() async {
emit(const MenuState.loading());
try {
final profile = await profileRepository.getMyProfile();
emit(MenuState.loaded(profileModel: profile));
} catch (e, st) {
await reportFrom(e, st, this);
log(e.toString());
emit(const MenuState.error());
}
}
Future<String?> makePassKey() async {
try {

View File

@@ -1 +1,17 @@
class MenuState {}
import 'package:eatvio_app/features/profile/models/profile_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'menu_state.freezed.dart';
@freezed
abstract class MenuState with _$MenuState {
const factory MenuState.initial() = MenuStateInitial;
const factory MenuState.loading() = MenuStateLoading;
const factory MenuState.loaded({
required ProfileModel profileModel,
}) = MenuStateLoaded;
const factory MenuState.error() = MenuStateError;
}