From fbd20e537d2b4b5414e00ce959c659751cf03fb6 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Thu, 1 Feb 2024 16:03:27 +0300 Subject: [PATCH] PLans new format --- .../my_profile_screen/bloc/my_profile_bloc.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart b/lib/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart index 9865e381..a9118446 100644 --- a/lib/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart +++ b/lib/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart @@ -38,12 +38,18 @@ class MyProfileBloc extends Bloc { data.containsKey('user') && data.containsKey('userDetails') && data.containsKey('chartPoints') && - data.containsKey('plans') && data.containsKey('circumferences')) { // Все ключевые поля присутствуют, продолжаем обработку if (state is MyProfileLoadedState) { // Если текущее состояние уже загружено, обновляем его var currentState = state as MyProfileLoadedState; + var plans = [] + ..addAll(data["finishedPlans"]) + ..addAll(data["rejectedPlans"]) + ..addAll(data["startedPlan"]) + ..addAll(data["paidPlan"]) + ..addAll(data["requestedPlan"]) + ..addAll(data["initedPlan"]); // Обновляем значения контроллеров только если они уже были созданы emit((currentState).copyWith( @@ -51,7 +57,7 @@ class MyProfileBloc extends Bloc { circumferences: data['circumferences'], user: data['user'], userDetails: data['userDetails'], - plans: data['plans'], + plans: plans, token: token, chestCircumferenceController: TextEditingController(), waistCircumferenceController: TextEditingController(),