PLans new format

This commit is contained in:
2024-02-01 16:03:27 +03:00
parent fb2a169276
commit fbd20e537d

View File

@@ -38,12 +38,18 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
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<MyProfileEvent, MyProfileState> {
circumferences: data['circumferences'],
user: data['user'],
userDetails: data['userDetails'],
plans: data['plans'],
plans: plans,
token: token,
chestCircumferenceController: TextEditingController(),
waistCircumferenceController: TextEditingController(),