updated error handling, consultant rating layout and complaining logic

This commit is contained in:
Username1548
2025-02-28 19:18:01 +07:00
parent e5b293db79
commit 0cdd40102f
86 changed files with 3853 additions and 279 deletions

View File

@@ -323,7 +323,7 @@ class CreateDietCubit extends Cubit<CreateDietState> {
Future<String?> createDiet() async {
emit(state.copyWith(isDietPublishing: true));
if (!_isFromValid()) return null;
if (!_isFromValid()) return 'validation';
try {
final image = await ImageCompressUtility.compressFile(File(state.dietData.image!.path));
final dietState = state.dietData.state!;
@@ -342,16 +342,16 @@ class CreateDietCubit extends Cubit<CreateDietState> {
);
emit(state.copyWith(published: dietState != DietState.draft, drafted: dietState == DietState.draft));
return state.dietData.name;
return null;
} on DioException catch (e, stackTrace) {
log(e.toString(), stackTrace: stackTrace);
}
emit(state.copyWith(isDietPublishing: false));
return null;
return 'error';
}
Future<String?> updateDiet(int dietId) async {
if (!_isFromValid()) return null;
if (!_isFromValid()) return 'error';
try {
File? image;
if (state.dietData.image != null) {
@@ -373,7 +373,7 @@ class CreateDietCubit extends Cubit<CreateDietState> {
return null;
} catch (e, st) {
log(e.toString(), stackTrace: st);
return 'Произошла непредвиденная ошибка';
return 'error';
}
}