forked from eatvio/eatvio_app
feat(calendar): Diet days marked in calendar, diet preview page added
This commit is contained in:
@@ -5,14 +5,18 @@ class CalendarEntryModel {
|
|||||||
String? date;
|
String? date;
|
||||||
String? status;
|
String? status;
|
||||||
String id;
|
String id;
|
||||||
|
bool is_current_day_included_in_the_chosen_diet_progression;
|
||||||
|
|
||||||
CalendarEntryModel({
|
CalendarEntryModel({
|
||||||
this.date,
|
this.date,
|
||||||
this.status,
|
this.status,
|
||||||
required this.id,
|
required this.id,
|
||||||
|
required this.is_current_day_included_in_the_chosen_diet_progression,
|
||||||
}) {
|
}) {
|
||||||
date = date;
|
date = date;
|
||||||
status = status;
|
status = status;
|
||||||
id = id;
|
id = id;
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression =
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ part 'calendar_model.g.dart';
|
|||||||
class CalendarModel with _$CalendarModel {
|
class CalendarModel with _$CalendarModel {
|
||||||
const factory CalendarModel({
|
const factory CalendarModel({
|
||||||
required String date,
|
required String date,
|
||||||
|
required bool is_current_day_included_in_the_chosen_diet_progression,
|
||||||
Object? diary,
|
Object? diary,
|
||||||
}) = _CalendarModel;
|
}) = _CalendarModel;
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ CalendarModel _$CalendarModelFromJson(Map<String, dynamic> json) {
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$CalendarModel {
|
mixin _$CalendarModel {
|
||||||
String get date => throw _privateConstructorUsedError;
|
String get date => throw _privateConstructorUsedError;
|
||||||
|
bool get is_current_day_included_in_the_chosen_diet_progression =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
Object? get diary => throw _privateConstructorUsedError;
|
Object? get diary => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@@ -35,7 +37,10 @@ abstract class $CalendarModelCopyWith<$Res> {
|
|||||||
CalendarModel value, $Res Function(CalendarModel) then) =
|
CalendarModel value, $Res Function(CalendarModel) then) =
|
||||||
_$CalendarModelCopyWithImpl<$Res, CalendarModel>;
|
_$CalendarModelCopyWithImpl<$Res, CalendarModel>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({String date, Object? diary});
|
$Res call(
|
||||||
|
{String date,
|
||||||
|
bool is_current_day_included_in_the_chosen_diet_progression,
|
||||||
|
Object? diary});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -52,6 +57,7 @@ class _$CalendarModelCopyWithImpl<$Res, $Val extends CalendarModel>
|
|||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? date = null,
|
Object? date = null,
|
||||||
|
Object? is_current_day_included_in_the_chosen_diet_progression = null,
|
||||||
Object? diary = freezed,
|
Object? diary = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
@@ -59,6 +65,11 @@ class _$CalendarModelCopyWithImpl<$Res, $Val extends CalendarModel>
|
|||||||
? _value.date
|
? _value.date
|
||||||
: date // ignore: cast_nullable_to_non_nullable
|
: date // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression: null ==
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression
|
||||||
|
? _value.is_current_day_included_in_the_chosen_diet_progression
|
||||||
|
: is_current_day_included_in_the_chosen_diet_progression // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
diary: freezed == diary ? _value.diary : diary,
|
diary: freezed == diary ? _value.diary : diary,
|
||||||
) as $Val);
|
) as $Val);
|
||||||
}
|
}
|
||||||
@@ -72,7 +83,10 @@ abstract class _$$CalendarModelImplCopyWith<$Res>
|
|||||||
__$$CalendarModelImplCopyWithImpl<$Res>;
|
__$$CalendarModelImplCopyWithImpl<$Res>;
|
||||||
@override
|
@override
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({String date, Object? diary});
|
$Res call(
|
||||||
|
{String date,
|
||||||
|
bool is_current_day_included_in_the_chosen_diet_progression,
|
||||||
|
Object? diary});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -87,6 +101,7 @@ class __$$CalendarModelImplCopyWithImpl<$Res>
|
|||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? date = null,
|
Object? date = null,
|
||||||
|
Object? is_current_day_included_in_the_chosen_diet_progression = null,
|
||||||
Object? diary = freezed,
|
Object? diary = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$CalendarModelImpl(
|
return _then(_$CalendarModelImpl(
|
||||||
@@ -94,6 +109,11 @@ class __$$CalendarModelImplCopyWithImpl<$Res>
|
|||||||
? _value.date
|
? _value.date
|
||||||
: date // ignore: cast_nullable_to_non_nullable
|
: date // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression: null ==
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression
|
||||||
|
? _value.is_current_day_included_in_the_chosen_diet_progression
|
||||||
|
: is_current_day_included_in_the_chosen_diet_progression // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
diary: freezed == diary ? _value.diary : diary,
|
diary: freezed == diary ? _value.diary : diary,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -102,7 +122,10 @@ class __$$CalendarModelImplCopyWithImpl<$Res>
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class _$CalendarModelImpl implements _CalendarModel {
|
class _$CalendarModelImpl implements _CalendarModel {
|
||||||
const _$CalendarModelImpl({required this.date, this.diary});
|
const _$CalendarModelImpl(
|
||||||
|
{required this.date,
|
||||||
|
required this.is_current_day_included_in_the_chosen_diet_progression,
|
||||||
|
this.diary});
|
||||||
|
|
||||||
factory _$CalendarModelImpl.fromJson(Map<String, dynamic> json) =>
|
factory _$CalendarModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
_$$CalendarModelImplFromJson(json);
|
_$$CalendarModelImplFromJson(json);
|
||||||
@@ -110,11 +133,13 @@ class _$CalendarModelImpl implements _CalendarModel {
|
|||||||
@override
|
@override
|
||||||
final String date;
|
final String date;
|
||||||
@override
|
@override
|
||||||
|
final bool is_current_day_included_in_the_chosen_diet_progression;
|
||||||
|
@override
|
||||||
final Object? diary;
|
final Object? diary;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'CalendarModel(date: $date, diary: $diary)';
|
return 'CalendarModel(date: $date, is_current_day_included_in_the_chosen_diet_progression: $is_current_day_included_in_the_chosen_diet_progression, diary: $diary)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -123,13 +148,22 @@ class _$CalendarModelImpl implements _CalendarModel {
|
|||||||
(other.runtimeType == runtimeType &&
|
(other.runtimeType == runtimeType &&
|
||||||
other is _$CalendarModelImpl &&
|
other is _$CalendarModelImpl &&
|
||||||
(identical(other.date, date) || other.date == date) &&
|
(identical(other.date, date) || other.date == date) &&
|
||||||
|
(identical(
|
||||||
|
other
|
||||||
|
.is_current_day_included_in_the_chosen_diet_progression,
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression) ||
|
||||||
|
other.is_current_day_included_in_the_chosen_diet_progression ==
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression) &&
|
||||||
const DeepCollectionEquality().equals(other.diary, diary));
|
const DeepCollectionEquality().equals(other.diary, diary));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(
|
int get hashCode => Object.hash(
|
||||||
runtimeType, date, const DeepCollectionEquality().hash(diary));
|
runtimeType,
|
||||||
|
date,
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression,
|
||||||
|
const DeepCollectionEquality().hash(diary));
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
@@ -147,7 +181,10 @@ class _$CalendarModelImpl implements _CalendarModel {
|
|||||||
|
|
||||||
abstract class _CalendarModel implements CalendarModel {
|
abstract class _CalendarModel implements CalendarModel {
|
||||||
const factory _CalendarModel(
|
const factory _CalendarModel(
|
||||||
{required final String date, final Object? diary}) = _$CalendarModelImpl;
|
{required final String date,
|
||||||
|
required final bool
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression,
|
||||||
|
final Object? diary}) = _$CalendarModelImpl;
|
||||||
|
|
||||||
factory _CalendarModel.fromJson(Map<String, dynamic> json) =
|
factory _CalendarModel.fromJson(Map<String, dynamic> json) =
|
||||||
_$CalendarModelImpl.fromJson;
|
_$CalendarModelImpl.fromJson;
|
||||||
@@ -155,6 +192,8 @@ abstract class _CalendarModel implements CalendarModel {
|
|||||||
@override
|
@override
|
||||||
String get date;
|
String get date;
|
||||||
@override
|
@override
|
||||||
|
bool get is_current_day_included_in_the_chosen_diet_progression;
|
||||||
|
@override
|
||||||
Object? get diary;
|
Object? get diary;
|
||||||
@override
|
@override
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
|
|||||||
@@ -9,11 +9,16 @@ part of 'calendar_model.dart';
|
|||||||
_$CalendarModelImpl _$$CalendarModelImplFromJson(Map<String, dynamic> json) =>
|
_$CalendarModelImpl _$$CalendarModelImplFromJson(Map<String, dynamic> json) =>
|
||||||
_$CalendarModelImpl(
|
_$CalendarModelImpl(
|
||||||
date: json['date'] as String,
|
date: json['date'] as String,
|
||||||
|
is_current_day_included_in_the_chosen_diet_progression:
|
||||||
|
json['is_current_day_included_in_the_chosen_diet_progression']
|
||||||
|
as bool,
|
||||||
diary: json['diary'],
|
diary: json['diary'],
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$CalendarModelImplToJson(_$CalendarModelImpl instance) =>
|
Map<String, dynamic> _$$CalendarModelImplToJson(_$CalendarModelImpl instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'date': instance.date,
|
'date': instance.date,
|
||||||
|
'is_current_day_included_in_the_chosen_diet_progression':
|
||||||
|
instance.is_current_day_included_in_the_chosen_diet_progression,
|
||||||
'diary': instance.diary,
|
'diary': instance.diary,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,7 +102,10 @@ class CalendarScreen extends StatelessWidget {
|
|||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadiusStyle.circleBorder8,
|
borderRadius: BorderRadiusStyle.circleBorder8,
|
||||||
color: getBackgroundColor(diary['state']),
|
color: state.calendarList[index]
|
||||||
|
.is_current_day_included_in_the_chosen_diet_progression
|
||||||
|
? Color.fromRGBO(59, 130, 246, .2)
|
||||||
|
: Color.fromRGBO(126, 136, 151, .1),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -117,57 +120,24 @@ class CalendarScreen extends StatelessWidget {
|
|||||||
style: theme.textTheme.titleMedium,
|
style: theme.textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
SizedBox(height: 2.v),
|
SizedBox(height: 2.v),
|
||||||
if (diary['state'] != null)
|
if (state.calendarList[index]
|
||||||
Row(children: [
|
.is_current_day_included_in_the_chosen_diet_progression)
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(
|
padding: EdgeInsets.all(
|
||||||
4.0), // Отступы внутри контейнера
|
4.0), // Отступы внутри контейнера
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: diary['state'] == 'finished'
|
color: Color.fromRGBO(13, 110, 253, 1),
|
||||||
? Color.fromRGBO(1, 154, 62, 1)
|
borderRadius: BorderRadius.circular(
|
||||||
: Color.fromRGBO(154, 74, 1, 1),
|
24.0), // Закругленные углы
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
24.0), // Закругленные углы
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
_getStateText(diary['state'] ?? ''),
|
|
||||||
style: CustomTextStyles
|
|
||||||
.titleSmallBold, // Предполагается, что текст белый
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 4),
|
child: Text(
|
||||||
if (diary['state'] == 'started')
|
'Посмотреть диету на день',
|
||||||
Container(
|
style: CustomTextStyles
|
||||||
padding: EdgeInsets.all(
|
.titleSmallBold, // Предполагается, что текст белый
|
||||||
4.0), // Отступы внутри контейнера
|
),
|
||||||
decoration: BoxDecoration(
|
),
|
||||||
color: Color.fromRGBO(13, 110, 253, 1),
|
if (!state.calendarList[index]
|
||||||
borderRadius: BorderRadius.circular(
|
.is_current_day_included_in_the_chosen_diet_progression)
|
||||||
24.0), // Закругленные углы
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'Заполнить отчет',
|
|
||||||
style: CustomTextStyles
|
|
||||||
.titleSmallBold, // Предполагается, что текст белый
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (diary['state'] == 'finished')
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(
|
|
||||||
4.0), // Отступы внутри контейнера
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color.fromRGBO(13, 110, 253, 1),
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
24.0), // Закругленные углы
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'Изменить отчет',
|
|
||||||
style: CustomTextStyles
|
|
||||||
.titleSmallBold, // Предполагается, что текст белый
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
if (state.calendarList[index].diary is List<dynamic>)
|
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(
|
padding: EdgeInsets.all(
|
||||||
4.0), // Отступы внутри контейнера
|
4.0), // Отступы внутри контейнера
|
||||||
@@ -191,6 +161,7 @@ class CalendarScreen extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
diary = state.calendarList[index].diary as Map<String, dynamic>;
|
diary = state.calendarList[index].diary as Map<String, dynamic>;
|
||||||
|
print(state.calendarList[index]);
|
||||||
return InkWell(
|
return InkWell(
|
||||||
borderRadius: BorderRadiusStyle.circleBorder8,
|
borderRadius: BorderRadiusStyle.circleBorder8,
|
||||||
onTap: () => GoRouter.of(context).go(
|
onTap: () => GoRouter.of(context).go(
|
||||||
@@ -216,71 +187,55 @@ class CalendarScreen extends StatelessWidget {
|
|||||||
style: theme.textTheme.titleMedium,
|
style: theme.textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
SizedBox(height: 2.v),
|
SizedBox(height: 2.v),
|
||||||
if (diary['state'] != null)
|
Row(children: [
|
||||||
Row(children: [
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(
|
|
||||||
4.0), // Отступы внутри контейнера
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: diary['state'] == 'finished'
|
|
||||||
? Color.fromRGBO(1, 154, 62, 1)
|
|
||||||
: Color.fromRGBO(154, 74, 1, 1),
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
24.0), // Закругленные углы
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
_getStateText(diary['state'] ?? ''),
|
|
||||||
style: CustomTextStyles
|
|
||||||
.titleSmallBold, // Предполагается, что текст белый
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 4),
|
|
||||||
if (diary['state'] == 'started')
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(
|
|
||||||
4.0), // Отступы внутри контейнера
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color.fromRGBO(13, 110, 253, 1),
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
24.0), // Закругленные углы
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'Заполнить отчет',
|
|
||||||
style: CustomTextStyles
|
|
||||||
.titleSmallBold, // Предполагается, что текст белый
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (diary['state'] == 'finished')
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(
|
|
||||||
4.0), // Отступы внутри контейнера
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color.fromRGBO(13, 110, 253, 1),
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
24.0), // Закругленные углы
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'Изменить отчет',
|
|
||||||
style: CustomTextStyles
|
|
||||||
.titleSmallBold, // Предполагается, что текст белый
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
if (state.calendarList[index].diary is List<dynamic>)
|
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(
|
padding: EdgeInsets.all(
|
||||||
4.0), // Отступы внутри контейнера
|
4.0), // Отступы внутри контейнера
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color.fromRGBO(108, 117, 125, 1),
|
color: diary['state'] == 'finished'
|
||||||
|
? Color.fromRGBO(1, 154, 62, 1)
|
||||||
|
: Color.fromRGBO(154, 74, 1, 1),
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
24.0), // Закругленные углы
|
24.0), // Закругленные углы
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Cкоро',
|
_getStateText(diary['state'] ?? ''),
|
||||||
style: CustomTextStyles
|
style: CustomTextStyles
|
||||||
.titleSmallBold, // Предполагается, что текст белый
|
.titleSmallBold, // Предполагается, что текст белый
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 4),
|
||||||
|
if (diary['state'] == 'started')
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(
|
||||||
|
4.0), // Отступы внутри контейнера
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color.fromRGBO(13, 110, 253, 1),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
24.0), // Закругленные углы
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Заполнить отчет',
|
||||||
|
style: CustomTextStyles
|
||||||
|
.titleSmallBold, // Предполагается, что текст белый
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (diary['state'] == 'finished')
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(
|
||||||
|
4.0), // Отступы внутри контейнера
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color.fromRGBO(13, 110, 253, 1),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
24.0), // Закругленные углы
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Изменить отчет',
|
||||||
|
style: CustomTextStyles
|
||||||
|
.titleSmallBold, // Предполагается, что текст белый
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
// ignore_for_file: unused_local_variable
|
||||||
|
|
||||||
|
import 'package:eatvio_app/features/diary/presentation/bloc/diary_bloc.dart';
|
||||||
|
import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart';
|
||||||
|
import 'package:eatvio_app/core/app_export.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class DiaryRecommendationsScreen extends StatelessWidget {
|
||||||
|
final String? diary_recommendationsID;
|
||||||
|
|
||||||
|
const DiaryRecommendationsScreen({
|
||||||
|
this.diary_recommendationsID,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (diary_recommendationsID != "0") {
|
||||||
|
context.read<DiaryBloc>().add(LoadDiaryById(diary_recommendationsID));
|
||||||
|
}
|
||||||
|
return BlocBuilder<DiaryBloc, DiaryState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is DiaryStateLoaded) {
|
||||||
|
return _buildDiaryRecommendations(context, state);
|
||||||
|
} else if (state is DiaryStateLoading) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Center(
|
||||||
|
child: CupertinoActivityIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (state is DiaryStateError) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Center(
|
||||||
|
child: Text(state.errorMessage),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else
|
||||||
|
return Scaffold(
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Center(
|
||||||
|
child: Text("Неопределенная ошибка"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildDiaryRecommendations(
|
||||||
|
BuildContext context, DiaryStateLoaded state) {
|
||||||
|
return Stack(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
children: [
|
||||||
|
FormBuilder(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
toolbarHeight: 0,
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
),
|
||||||
|
backgroundColor: Color.fromARGB(255, 240, 242, 245),
|
||||||
|
resizeToAvoidBottomInset: true,
|
||||||
|
body: SizedBox(
|
||||||
|
width: double.maxFinite,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: 5.v),
|
||||||
|
child: Column(
|
||||||
|
children: [],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -250,11 +250,6 @@ class DiaryScreen extends StatelessWidget {
|
|||||||
style: CustomTextStyles.titleMediumBlack,
|
style: CustomTextStyles.titleMediumBlack,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 2.v),
|
|
||||||
Text(
|
|
||||||
state.diary.date.toString(),
|
|
||||||
style: CustomTextStyles.bodyMediumBluegray800,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user