forked from eatvio/eatvio_app
refactor(diary): New apk compile
This commit is contained in:
@@ -72,7 +72,7 @@ class AuthScreen extends StatelessWidget {
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapDiaryTest(context)),
|
||||
NextStepButton(
|
||||
text: "Тест профиля".toUpperCase(),
|
||||
text: "Тест чата".toUpperCase(),
|
||||
margin:
|
||||
EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
|
||||
@@ -47,13 +47,15 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
final token =
|
||||
"9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a";
|
||||
|
||||
final int diaryId = fetchDiaryId(token);
|
||||
//print(await fetchDiaryId(token));
|
||||
final int diaryId = await fetchDiaryId(token);
|
||||
try {
|
||||
final diary = fetchDiaryData(token, diaryId);
|
||||
print("Diary ID fetched");
|
||||
final diary = await fetchDiaryData(token, diaryId);
|
||||
print("Screen load success");
|
||||
if (diary is Map<String, dynamic>) {
|
||||
//final String diaryDate = diary['date'] ?? DateTime.now().toString();
|
||||
final chartValues = fetchChartValues(token, diaryId);
|
||||
final String diaryDate = diary['date'] ?? DateTime.now().toString();
|
||||
final chartValues = await fetchChartValues(token, diaryId);
|
||||
if (state is DiaryEditLoadedState) {
|
||||
// Если текущее состояние уже загружено, обновляем его
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
@@ -116,7 +118,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
fatsController: TextEditingController(),
|
||||
carbsController: TextEditingController(),
|
||||
diaryId: diaryId,
|
||||
//diaryDate: diaryDate,
|
||||
diaryDate: diaryDate,
|
||||
autocompleteList: [],
|
||||
diaryEditModelObj: state.diaryEditModelObj?.copyWith(
|
||||
mealList: fillMealList(), portionList: fillPortions())));
|
||||
@@ -144,7 +146,6 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
final data = jsonDecode(response.body);
|
||||
if (data is Map<String, dynamic> && data.containsKey('id')) {
|
||||
final int diaryId = data['id'];
|
||||
print("id");
|
||||
return diaryId;
|
||||
} else {
|
||||
emit(DiaryEditErrorState('Некоторые необходимые данные отсутствуют.'));
|
||||
@@ -167,7 +168,6 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
},
|
||||
);
|
||||
final diary = jsonDecode(response.body)['diary'];
|
||||
print("data");
|
||||
|
||||
return diary;
|
||||
}
|
||||
@@ -192,7 +192,6 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
.values
|
||||
.map<int>((value) => value as int)
|
||||
.toList();
|
||||
print('chart');
|
||||
return [recommendedChartValues, consumedChartValues];
|
||||
} else {
|
||||
emit(DiaryEditErrorState('Ошибка при декодировании данных КБЖУ'));
|
||||
@@ -401,6 +400,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
var response = await sendWakeupData(
|
||||
currentState.token, event.selectedTime, currentState.diaryId);
|
||||
if (response.statusCode == 200) {
|
||||
await reloadScreen(event, emit);
|
||||
var updatedState =
|
||||
currentState.copyWith(wakeupController: event.selectedTime);
|
||||
print("Wakeup time changed to ${event.selectedTime}");
|
||||
@@ -417,6 +417,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
var response = await sendRetireData(
|
||||
currentState.token, event.selectedTime, currentState.diaryId);
|
||||
if (response.statusCode == 200) {
|
||||
await reloadScreen(event, emit);
|
||||
var updatedState =
|
||||
currentState.copyWith(retireController: event.selectedTime);
|
||||
print("Retire time changed to ${event.selectedTime}");
|
||||
@@ -741,7 +742,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print("finished");
|
||||
await reloadScreen(event, emit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user