forked from eatvio/eatvio_app
feat(order info): added order info screen
This commit is contained in:
@@ -49,7 +49,7 @@ class DiaryCubit extends Cubit<DiaryState> {
|
||||
);
|
||||
} catch (e) {
|
||||
emit(DiaryState.error(errorMessage: e.toString()));
|
||||
throw e;
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class DiaryCubit extends Cubit<DiaryState> {
|
||||
int? productNutritionalValueId,
|
||||
required PortionState portionState,
|
||||
}) async {
|
||||
if (portionState == PortionState.filled_diet || portionState == PortionState.eaten_from_diet) {
|
||||
if (portionState == PortionState.filledDiet || portionState == PortionState.eatenFromDiet) {
|
||||
await diaryRepository.addPortionToMeal(
|
||||
diaryId: diaryId,
|
||||
mealId: mealId,
|
||||
|
||||
@@ -12,8 +12,7 @@ part of 'diary_state.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$DiaryState {
|
||||
@@ -22,55 +21,48 @@ mixin _$DiaryState {
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String errorMessage) error,
|
||||
required TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)
|
||||
loaded,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)
|
||||
loaded,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
TResult? Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(String errorMessage)? error,
|
||||
TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_DiaryState value) $default, {
|
||||
required TResult Function(DiaryStateLoading value) loading,
|
||||
required TResult Function(DiaryStateError value) error,
|
||||
required TResult Function(DiaryStateLoaded value) loaded,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_DiaryState value)? $default, {
|
||||
TResult? Function(DiaryStateLoading value)? loading,
|
||||
TResult? Function(DiaryStateError value)? error,
|
||||
TResult? Function(DiaryStateLoaded value)? loaded,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_DiaryState value)? $default, {
|
||||
@@ -78,15 +70,15 @@ mixin _$DiaryState {
|
||||
TResult Function(DiaryStateError value)? error,
|
||||
TResult Function(DiaryStateLoaded value)? loaded,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $DiaryStateCopyWith<$Res> {
|
||||
factory $DiaryStateCopyWith(
|
||||
DiaryState value,
|
||||
$Res Function(DiaryState) then,
|
||||
) = _$DiaryStateCopyWithImpl<$Res, DiaryState>;
|
||||
DiaryState value, $Res Function(DiaryState) then) =
|
||||
_$DiaryStateCopyWithImpl<$Res, DiaryState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -106,9 +98,8 @@ class _$DiaryStateCopyWithImpl<$Res, $Val extends DiaryState>
|
||||
/// @nodoc
|
||||
abstract class _$$DiaryStateImplCopyWith<$Res> {
|
||||
factory _$$DiaryStateImplCopyWith(
|
||||
_$DiaryStateImpl value,
|
||||
$Res Function(_$DiaryStateImpl) then,
|
||||
) = __$$DiaryStateImplCopyWithImpl<$Res>;
|
||||
_$DiaryStateImpl value, $Res Function(_$DiaryStateImpl) then) =
|
||||
__$$DiaryStateImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -116,9 +107,8 @@ class __$$DiaryStateImplCopyWithImpl<$Res>
|
||||
extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateImpl>
|
||||
implements _$$DiaryStateImplCopyWith<$Res> {
|
||||
__$$DiaryStateImplCopyWithImpl(
|
||||
_$DiaryStateImpl _value,
|
||||
$Res Function(_$DiaryStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
_$DiaryStateImpl _value, $Res Function(_$DiaryStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DiaryState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -149,13 +139,9 @@ class _$DiaryStateImpl implements _DiaryState {
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String errorMessage) error,
|
||||
required TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)
|
||||
loaded,
|
||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)
|
||||
loaded,
|
||||
}) {
|
||||
return $default();
|
||||
}
|
||||
@@ -166,13 +152,9 @@ class _$DiaryStateImpl implements _DiaryState {
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
TResult? Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
}) {
|
||||
return $default?.call();
|
||||
}
|
||||
@@ -183,13 +165,9 @@ class _$DiaryStateImpl implements _DiaryState {
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(String errorMessage)? error,
|
||||
TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
@@ -242,20 +220,18 @@ abstract class _DiaryState implements DiaryState {
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DiaryStateLoadingImplCopyWith<$Res> {
|
||||
factory _$$DiaryStateLoadingImplCopyWith(
|
||||
_$DiaryStateLoadingImpl value,
|
||||
$Res Function(_$DiaryStateLoadingImpl) then,
|
||||
) = __$$DiaryStateLoadingImplCopyWithImpl<$Res>;
|
||||
factory _$$DiaryStateLoadingImplCopyWith(_$DiaryStateLoadingImpl value,
|
||||
$Res Function(_$DiaryStateLoadingImpl) then) =
|
||||
__$$DiaryStateLoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DiaryStateLoadingImplCopyWithImpl<$Res>
|
||||
extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateLoadingImpl>
|
||||
implements _$$DiaryStateLoadingImplCopyWith<$Res> {
|
||||
__$$DiaryStateLoadingImplCopyWithImpl(
|
||||
_$DiaryStateLoadingImpl _value,
|
||||
$Res Function(_$DiaryStateLoadingImpl) _then,
|
||||
) : super(_value, _then);
|
||||
__$$DiaryStateLoadingImplCopyWithImpl(_$DiaryStateLoadingImpl _value,
|
||||
$Res Function(_$DiaryStateLoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DiaryState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -286,13 +262,9 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String errorMessage) error,
|
||||
required TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)
|
||||
loaded,
|
||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)
|
||||
loaded,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
@@ -303,13 +275,9 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
TResult? Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
@@ -320,13 +288,9 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(String errorMessage)? error,
|
||||
TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
@@ -379,10 +343,9 @@ abstract class DiaryStateLoading implements DiaryState {
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DiaryStateErrorImplCopyWith<$Res> {
|
||||
factory _$$DiaryStateErrorImplCopyWith(
|
||||
_$DiaryStateErrorImpl value,
|
||||
$Res Function(_$DiaryStateErrorImpl) then,
|
||||
) = __$$DiaryStateErrorImplCopyWithImpl<$Res>;
|
||||
factory _$$DiaryStateErrorImplCopyWith(_$DiaryStateErrorImpl value,
|
||||
$Res Function(_$DiaryStateErrorImpl) then) =
|
||||
__$$DiaryStateErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String errorMessage});
|
||||
}
|
||||
@@ -392,24 +355,22 @@ class __$$DiaryStateErrorImplCopyWithImpl<$Res>
|
||||
extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateErrorImpl>
|
||||
implements _$$DiaryStateErrorImplCopyWith<$Res> {
|
||||
__$$DiaryStateErrorImplCopyWithImpl(
|
||||
_$DiaryStateErrorImpl _value,
|
||||
$Res Function(_$DiaryStateErrorImpl) _then,
|
||||
) : super(_value, _then);
|
||||
_$DiaryStateErrorImpl _value, $Res Function(_$DiaryStateErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DiaryState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? errorMessage = null}) {
|
||||
return _then(
|
||||
_$DiaryStateErrorImpl(
|
||||
errorMessage:
|
||||
null == errorMessage
|
||||
? _value.errorMessage
|
||||
: errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
$Res call({
|
||||
Object? errorMessage = null,
|
||||
}) {
|
||||
return _then(_$DiaryStateErrorImpl(
|
||||
errorMessage: null == errorMessage
|
||||
? _value.errorMessage
|
||||
: errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,9 +406,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$DiaryStateErrorImplCopyWith<_$DiaryStateErrorImpl> get copyWith =>
|
||||
__$$DiaryStateErrorImplCopyWithImpl<_$DiaryStateErrorImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
@@ -455,13 +414,9 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String errorMessage) error,
|
||||
required TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)
|
||||
loaded,
|
||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)
|
||||
loaded,
|
||||
}) {
|
||||
return error(errorMessage);
|
||||
}
|
||||
@@ -472,13 +427,9 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
TResult? Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
}) {
|
||||
return error?.call(errorMessage);
|
||||
}
|
||||
@@ -489,13 +440,9 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(String errorMessage)? error,
|
||||
TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
@@ -557,17 +504,15 @@ abstract class DiaryStateError implements DiaryState {
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DiaryStateLoadedImplCopyWith<$Res> {
|
||||
factory _$$DiaryStateLoadedImplCopyWith(
|
||||
_$DiaryStateLoadedImpl value,
|
||||
$Res Function(_$DiaryStateLoadedImpl) then,
|
||||
) = __$$DiaryStateLoadedImplCopyWithImpl<$Res>;
|
||||
factory _$$DiaryStateLoadedImplCopyWith(_$DiaryStateLoadedImpl value,
|
||||
$Res Function(_$DiaryStateLoadedImpl) then) =
|
||||
__$$DiaryStateLoadedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
});
|
||||
$Res call(
|
||||
{DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal});
|
||||
|
||||
$DiaryDayModelCopyWith<$Res> get diary;
|
||||
$NutritionDataModelCopyWith<$Res> get nutrition;
|
||||
@@ -577,10 +522,9 @@ abstract class _$$DiaryStateLoadedImplCopyWith<$Res> {
|
||||
class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
|
||||
extends _$DiaryStateCopyWithImpl<$Res, _$DiaryStateLoadedImpl>
|
||||
implements _$$DiaryStateLoadedImplCopyWith<$Res> {
|
||||
__$$DiaryStateLoadedImplCopyWithImpl(
|
||||
_$DiaryStateLoadedImpl _value,
|
||||
$Res Function(_$DiaryStateLoadedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
__$$DiaryStateLoadedImplCopyWithImpl(_$DiaryStateLoadedImpl _value,
|
||||
$Res Function(_$DiaryStateLoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DiaryState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -592,30 +536,24 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
|
||||
Object? selectedDay = null,
|
||||
Object? selectedMeal = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$DiaryStateLoadedImpl(
|
||||
diary:
|
||||
null == diary
|
||||
? _value.diary
|
||||
: diary // ignore: cast_nullable_to_non_nullable
|
||||
as DiaryDayModel,
|
||||
nutrition:
|
||||
null == nutrition
|
||||
? _value.nutrition
|
||||
: nutrition // ignore: cast_nullable_to_non_nullable
|
||||
as NutritionDataModel,
|
||||
selectedDay:
|
||||
null == selectedDay
|
||||
? _value.selectedDay
|
||||
: selectedDay // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
selectedMeal:
|
||||
null == selectedMeal
|
||||
? _value.selectedMeal
|
||||
: selectedMeal // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
),
|
||||
);
|
||||
return _then(_$DiaryStateLoadedImpl(
|
||||
diary: null == diary
|
||||
? _value.diary
|
||||
: diary // ignore: cast_nullable_to_non_nullable
|
||||
as DiaryDayModel,
|
||||
nutrition: null == nutrition
|
||||
? _value.nutrition
|
||||
: nutrition // ignore: cast_nullable_to_non_nullable
|
||||
as NutritionDataModel,
|
||||
selectedDay: null == selectedDay
|
||||
? _value.selectedDay
|
||||
: selectedDay // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
selectedMeal: null == selectedMeal
|
||||
? _value.selectedMeal
|
||||
: selectedMeal // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of DiaryState
|
||||
@@ -642,12 +580,11 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
|
||||
class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
||||
const _$DiaryStateLoadedImpl({
|
||||
required this.diary,
|
||||
required this.nutrition,
|
||||
required this.selectedDay,
|
||||
required this.selectedMeal,
|
||||
});
|
||||
const _$DiaryStateLoadedImpl(
|
||||
{required this.diary,
|
||||
required this.nutrition,
|
||||
required this.selectedDay,
|
||||
required this.selectedMeal});
|
||||
|
||||
@override
|
||||
final DiaryDayModel diary;
|
||||
@@ -688,9 +625,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$DiaryStateLoadedImplCopyWith<_$DiaryStateLoadedImpl> get copyWith =>
|
||||
__$$DiaryStateLoadedImplCopyWithImpl<_$DiaryStateLoadedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
@@ -698,13 +633,9 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(String errorMessage) error,
|
||||
required TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)
|
||||
loaded,
|
||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)
|
||||
loaded,
|
||||
}) {
|
||||
return loaded(diary, nutrition, selectedDay, selectedMeal);
|
||||
}
|
||||
@@ -715,13 +646,9 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
TResult? Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
}) {
|
||||
return loaded?.call(diary, nutrition, selectedDay, selectedMeal);
|
||||
}
|
||||
@@ -732,13 +659,9 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(String errorMessage)? error,
|
||||
TResult Function(
|
||||
DiaryDayModel diary,
|
||||
NutritionDataModel nutrition,
|
||||
DateTime selectedDay,
|
||||
int selectedMeal,
|
||||
)?
|
||||
loaded,
|
||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||
DateTime selectedDay, int selectedMeal)?
|
||||
loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
@@ -786,12 +709,11 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
||||
}
|
||||
|
||||
abstract class DiaryStateLoaded implements DiaryState {
|
||||
const factory DiaryStateLoaded({
|
||||
required final DiaryDayModel diary,
|
||||
required final NutritionDataModel nutrition,
|
||||
required final DateTime selectedDay,
|
||||
required final int selectedMeal,
|
||||
}) = _$DiaryStateLoadedImpl;
|
||||
const factory DiaryStateLoaded(
|
||||
{required final DiaryDayModel diary,
|
||||
required final NutritionDataModel nutrition,
|
||||
required final DateTime selectedDay,
|
||||
required final int selectedMeal}) = _$DiaryStateLoadedImpl;
|
||||
|
||||
DiaryDayModel get diary;
|
||||
NutritionDataModel get nutrition;
|
||||
|
||||
@@ -46,14 +46,14 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
||||
physics: const BouncingScrollPhysics(),
|
||||
child: Column(
|
||||
children: [
|
||||
CalendarWidget(),
|
||||
const CalendarWidget(),
|
||||
if (state is DiaryStateLoading) const Loader(),
|
||||
if (state is DiaryStateLoaded) WakeupAndRetireWidget(),
|
||||
if (state is DiaryStateLoaded) const WakeupAndRetireWidget(),
|
||||
const SizedBox(height: 12),
|
||||
if (state is DiaryStateLoaded) MealWidget(),
|
||||
if (state is DiaryStateLoaded) CaloriesChartWidget(),
|
||||
if (state is DiaryStateLoaded) const MealWidget(),
|
||||
if (state is DiaryStateLoaded) const CaloriesChartWidget(),
|
||||
const SizedBox(height: 12),
|
||||
if (state is DiaryStateLoaded) CommentForConsultantWidget(),
|
||||
if (state is DiaryStateLoaded) const CommentForConsultantWidget(),
|
||||
if (state is DiaryStateLoaded && state.diary.closed == 0)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
|
||||
@@ -25,7 +25,7 @@ class _AddProductButtonWidgetState extends State<AddProductButtonWidget> {
|
||||
return showModalBottomSheet(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
|
||||
),
|
||||
isScrollControlled: true,
|
||||
@@ -45,16 +45,16 @@ class _AddProductButtonWidgetState extends State<AddProductButtonWidget> {
|
||||
onTap: () => addProductInMeal(state),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
width: MediaQuery.of(context).size.width - 32,
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Добавить',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
|
||||
@@ -66,7 +66,7 @@ class _AddProductModalState extends State<AddProductModal> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Добавление блюда',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
@@ -87,7 +87,7 @@ class _AddProductModalState extends State<AddProductModal> {
|
||||
onChanged: (query) {
|
||||
EasyDebounce.debounce(
|
||||
'glossary-search',
|
||||
Duration(milliseconds: 250),
|
||||
const Duration(milliseconds: 250),
|
||||
() async {
|
||||
selectedGlossary = null;
|
||||
if (query.isEmpty) {
|
||||
@@ -124,7 +124,7 @@ class _AddProductModalState extends State<AddProductModal> {
|
||||
),
|
||||
glossariesList.isEmpty ? const SizedBox(height: 16) : const SizedBox.shrink(),
|
||||
Container(
|
||||
constraints: BoxConstraints(
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: 256,
|
||||
),
|
||||
child: ListView.separated(
|
||||
@@ -146,7 +146,7 @@ class _AddProductModalState extends State<AddProductModal> {
|
||||
),
|
||||
title: Text(
|
||||
glossariesList[i].name,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
@@ -163,12 +163,12 @@ class _AddProductModalState extends State<AddProductModal> {
|
||||
Icons.add_rounded,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
contentPadding: EdgeInsets.only(left: 12),
|
||||
contentPadding: const EdgeInsets.only(left: 12),
|
||||
);
|
||||
},
|
||||
itemCount: glossariesList.length,
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return CustomDivider();
|
||||
return const CustomDivider();
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -190,9 +190,9 @@ class _AddProductModalState extends State<AddProductModal> {
|
||||
height: 52,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: Color(0xFFF6F6F6),
|
||||
color: const Color(0xFFF6F6F6),
|
||||
),
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.delete_outline_rounded,
|
||||
color: Colors.red,
|
||||
),
|
||||
@@ -259,7 +259,7 @@ class _AddProductModalState extends State<AddProductModal> {
|
||||
child: Center(
|
||||
child: Text(
|
||||
widget.portion == null ? 'Добавить' : 'Сохранить',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
|
||||
@@ -40,7 +40,7 @@ class _CalendarWidgetState extends State<CalendarWidget> {
|
||||
locale: 'ru_RU',
|
||||
startingDayOfWeek: StartingDayOfWeek.monday,
|
||||
calendarFormat: _calendarFormat,
|
||||
headerStyle: HeaderStyle(
|
||||
headerStyle: const HeaderStyle(
|
||||
titleCentered: true,
|
||||
formatButtonVisible: false,
|
||||
leftChevronVisible: false,
|
||||
@@ -69,11 +69,11 @@ class _CalendarWidgetState extends State<CalendarWidget> {
|
||||
}
|
||||
},
|
||||
calendarStyle: CalendarStyle(
|
||||
weekendDecoration: BoxDecoration(
|
||||
weekendDecoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
defaultDecoration: BoxDecoration(
|
||||
defaultDecoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
@@ -81,7 +81,7 @@ class _CalendarWidgetState extends State<CalendarWidget> {
|
||||
color: appTheme.blueA400,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
todayTextStyle: TextStyle(
|
||||
todayTextStyle: const TextStyle(
|
||||
color: Colors.black,
|
||||
),
|
||||
todayDecoration: BoxDecoration(
|
||||
|
||||
@@ -6,6 +6,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncfusion_flutter_gauges/gauges.dart';
|
||||
|
||||
class CaloriesChartWidget extends StatelessWidget {
|
||||
const CaloriesChartWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<DiaryCubit, DiaryState>(
|
||||
@@ -26,7 +28,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
builder: (context) => const AlertDialog(
|
||||
content: Text(
|
||||
'График отображает сколько калорий вам нужно ежедневно для похуденияи поддержания веса, согласно формуле Харриса-Бенедикта.\nИзменить коэффициент физической нагрузки можно в настройках.',
|
||||
style: TextStyle(
|
||||
@@ -60,7 +62,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
radiusFactor: 0.7,
|
||||
showAxisLine: false,
|
||||
pointers: <GaugePointer>[
|
||||
RangePointer(
|
||||
const RangePointer(
|
||||
value: 100,
|
||||
width: 0.16,
|
||||
animationDuration: 2000,
|
||||
@@ -79,7 +81,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
enableAnimation: true,
|
||||
cornerStyle: CornerStyle.bothCurve,
|
||||
),
|
||||
RangePointer(
|
||||
const RangePointer(
|
||||
value: 100,
|
||||
width: 0.16,
|
||||
animationDuration: 2000,
|
||||
@@ -100,7 +102,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
cornerStyle: CornerStyle.bothCurve,
|
||||
pointerOffset: -0.18,
|
||||
),
|
||||
RangePointer(
|
||||
const RangePointer(
|
||||
value: 100,
|
||||
width: 0.16,
|
||||
animationDuration: 2000,
|
||||
@@ -121,7 +123,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
cornerStyle: CornerStyle.bothCurve,
|
||||
pointerOffset: -0.36,
|
||||
),
|
||||
RangePointer(
|
||||
const RangePointer(
|
||||
value: 100,
|
||||
width: 0.16,
|
||||
animationDuration: 2000,
|
||||
@@ -147,7 +149,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
GaugeAnnotation(
|
||||
widget: Transform.rotate(
|
||||
angle: 30.1,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Углеводы',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -161,7 +163,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
GaugeAnnotation(
|
||||
widget: Transform.rotate(
|
||||
angle: 30,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Жиры',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -175,7 +177,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
GaugeAnnotation(
|
||||
widget: Transform.rotate(
|
||||
angle: 30,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Белки',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -189,7 +191,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
GaugeAnnotation(
|
||||
widget: Transform.rotate(
|
||||
angle: 30,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Калории',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -246,7 +248,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF323F4B),
|
||||
@@ -254,7 +256,7 @@ class CaloriesChartWidget extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF323F4B),
|
||||
|
||||
@@ -22,7 +22,7 @@ class _CommentForConsultantWidgetState extends State<CommentForConsultantWidget>
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Дополнительная информация для консультанта',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Color(0xFF323F4B), height: 1),
|
||||
@@ -30,7 +30,7 @@ class _CommentForConsultantWidgetState extends State<CommentForConsultantWidget>
|
||||
const SizedBox(height: 12),
|
||||
CustomTextFormField(
|
||||
onChanged: (value) {
|
||||
EasyDebounce.debounce('client-typing', Duration(seconds: 3), () => context.read<DiaryCubit>().fillComment(value));
|
||||
EasyDebounce.debounce('client-typing', const Duration(seconds: 3), () => context.read<DiaryCubit>().fillComment(value));
|
||||
},
|
||||
hintText: 'Укажите дополнительную информацию',
|
||||
minLines: 4,
|
||||
|
||||
@@ -26,13 +26,13 @@ class _FinishDayButtonWidgetState extends State<FinishDayButtonWidget> {
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
width: MediaQuery.of(context).size.width - 16,
|
||||
decoration: BoxDecoration(color: appTheme.blueA400, borderRadius: BorderRadius.circular(20)),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
alignment: Alignment.center,
|
||||
child: Text('Закончить день', style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600)),
|
||||
child: const Text('Закончить день', style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -52,7 +52,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Добавление нового продукта',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
@@ -62,7 +62,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
const Text(
|
||||
'Оу... а у нас нет в базе калорийности такого продукта. Если вы знаете, давайте её запишем?',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
@@ -83,13 +83,13 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF6F6F6),
|
||||
color: const Color(0xFFF6F6F6),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'В другой раз',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF6D6F71),
|
||||
@@ -116,9 +116,9 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Записать',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -139,11 +139,11 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
|
||||
_success() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Продукт успешно отправлен\nна модерацию',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
@@ -170,9 +170,9 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Закрыть',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -195,7 +195,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Добавление нового продукта',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
@@ -205,7 +205,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
const Text(
|
||||
'Если у вас данные по нему\nпросим заполнить значения на 100гр.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
@@ -227,7 +227,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
child: CustomTextFormField(
|
||||
hintText: 'Калории',
|
||||
controller: energyController,
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -235,7 +235,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
child: CustomTextFormField(
|
||||
hintText: 'Белки',
|
||||
controller: proteinsController,
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -248,7 +248,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
child: CustomTextFormField(
|
||||
hintText: 'Жиры',
|
||||
controller: fatsController,
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -256,7 +256,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
child: CustomTextFormField(
|
||||
hintText: 'Углеводы',
|
||||
controller: carbohydratesController,
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -278,15 +278,15 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
},
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Сохранить',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
|
||||
@@ -32,13 +32,13 @@ class _MealButtonWidgetState extends State<MealButtonWidget> {
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
color: state.selectedMeal == widget.mealNumber ? appTheme.blueA400 : Color(0xFFF1F2F6),
|
||||
color: state.selectedMeal == widget.mealNumber ? appTheme.blueA400 : const Color(0xFFF1F2F6),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${widget.mealNumber}',
|
||||
style: TextStyle(
|
||||
color: state.selectedMeal == widget.mealNumber ? Colors.white : Color(0xFF6D6F71),
|
||||
color: state.selectedMeal == widget.mealNumber ? Colors.white : const Color(0xFF6D6F71),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
|
||||
@@ -20,8 +20,8 @@ class _MealWidgetState extends State<MealWidget> {
|
||||
return Material(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -33,7 +33,7 @@ class _MealWidgetState extends State<MealWidget> {
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -44,17 +44,17 @@ class _MealWidgetState extends State<MealWidget> {
|
||||
MealButtonWidget(mealNumber: 5),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(height: 12),
|
||||
TimeOfMealPickerWidget(),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(height: 12),
|
||||
ProductsListWidget(),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(height: 12),
|
||||
AddProductButtonWidget(),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(height: 12),
|
||||
PhotoGalleryWidget(),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(height: 12),
|
||||
SatietyRatingWidget(),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(height: 12),
|
||||
MoodRatingWidget(),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -7,6 +7,8 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class MoodRatingWidget extends StatefulWidget {
|
||||
const MoodRatingWidget({super.key});
|
||||
|
||||
@override
|
||||
State<MoodRatingWidget> createState() => _MoodRatingWidgetState();
|
||||
}
|
||||
@@ -29,7 +31,7 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Ваше настроение после приёма пищи',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
@@ -54,22 +56,22 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 1 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 1 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFC82222),
|
||||
color: const Color(0xFFC82222),
|
||||
border: currentSelectedRating == 1
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFAA3333),
|
||||
color: const Color(0xFFAA3333),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: currentSelectedRating == 1
|
||||
? BorderRadius.horizontal(
|
||||
? const BorderRadius.horizontal(
|
||||
left: Radius.circular(8),
|
||||
right: Radius.circular(2),
|
||||
)
|
||||
: BorderRadius.horizontal(
|
||||
: const BorderRadius.horizontal(
|
||||
left: Radius.circular(8),
|
||||
),
|
||||
),
|
||||
@@ -78,13 +80,13 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 2 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 2 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFF3E3E),
|
||||
color: const Color(0xFFFF3E3E),
|
||||
border: currentSelectedRating == 2
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF550000),
|
||||
color: const Color(0xFF550000),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
@@ -95,13 +97,13 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 3 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 3 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF8C926),
|
||||
color: const Color(0xFFF8C926),
|
||||
border: currentSelectedRating == 3
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF8C5D00),
|
||||
color: const Color(0xFF8C5D00),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
@@ -112,13 +114,13 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 4 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 4 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFFF3BF),
|
||||
color: const Color(0xFFFFF3BF),
|
||||
border: currentSelectedRating == 4
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFB5911B),
|
||||
color: const Color(0xFFB5911B),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
@@ -129,13 +131,13 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 5 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 5 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF62E833),
|
||||
color: const Color(0xFF62E833),
|
||||
border: currentSelectedRating == 5
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF276918),
|
||||
color: const Color(0xFF276918),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
@@ -146,22 +148,22 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 6 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 6 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF4DCE20),
|
||||
color: const Color(0xFF4DCE20),
|
||||
border: currentSelectedRating == 6
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF184D12),
|
||||
color: const Color(0xFF184D12),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: currentSelectedRating == 6
|
||||
? BorderRadius.horizontal(
|
||||
? const BorderRadius.horizontal(
|
||||
left: Radius.circular(2),
|
||||
right: Radius.circular(8),
|
||||
)
|
||||
: BorderRadius.horizontal(
|
||||
: const BorderRadius.horizontal(
|
||||
right: Radius.circular(8),
|
||||
),
|
||||
),
|
||||
@@ -174,7 +176,7 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
|
||||
});
|
||||
EasyDebounce.debounce(
|
||||
'change-satiety',
|
||||
Duration(milliseconds: 250),
|
||||
const Duration(milliseconds: 250),
|
||||
() {
|
||||
context.read<DiaryCubit>().fillMood(diaryId: state.diary.id, mood: currentSelectedRating.toInt() - 1);
|
||||
},
|
||||
|
||||
@@ -39,14 +39,15 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
|
||||
Navigator.of(context).pop();
|
||||
final picker = ImagePicker();
|
||||
XFile? image = await picker.pickImage(source: ImageSource.camera);
|
||||
if (image != null)
|
||||
if (image != null) {
|
||||
diaryCubit.uploadPhotos(
|
||||
files: [File(image.path)],
|
||||
diaryId: diaryDay.id,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Row(
|
||||
children: const [
|
||||
children: [
|
||||
Icon(Icons.photo_camera),
|
||||
SizedBox(width: 8),
|
||||
Text('Фото'),
|
||||
@@ -58,14 +59,15 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
|
||||
Navigator.of(context).pop();
|
||||
final picker = ImagePicker();
|
||||
List<XFile>? images = await picker.pickMultiImage();
|
||||
if (images.isNotEmpty)
|
||||
if (images.isNotEmpty) {
|
||||
diaryCubit.uploadPhotos(
|
||||
files: images.map((f) => File(f.path)).toList(),
|
||||
diaryId: diaryDay.id,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Row(
|
||||
children: const [
|
||||
children: [
|
||||
Icon(Icons.photo),
|
||||
SizedBox(width: 8),
|
||||
Text('Галерея'),
|
||||
@@ -107,7 +109,7 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: baseUrl + '/storage/' + state.diary.meals[mealIndex].photos[currentSelectedPhotoIndex].path,
|
||||
imageUrl: '$baseUrl/storage/${state.diary.meals[mealIndex].photos[currentSelectedPhotoIndex].path}',
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
@@ -128,7 +130,7 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
|
||||
}
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
icon: const Icon(
|
||||
Icons.close_rounded,
|
||||
color: Colors.grey,
|
||||
),
|
||||
@@ -156,7 +158,7 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
|
||||
width: 52,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Color(0xFFF1F2F6),
|
||||
color: const Color(0xFFF1F2F6),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add_rounded,
|
||||
@@ -178,7 +180,7 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
|
||||
height: 52,
|
||||
width: 52,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: baseUrl + '/storage/' + state.diary.meals[mealIndex].photos[i].path,
|
||||
imageUrl: '$baseUrl/storage/${state.diary.meals[mealIndex].photos[i].path}',
|
||||
fit: BoxFit.fitWidth,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -29,15 +29,16 @@ class _ProductWidgetState extends State<ProductWidget> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
diaryCubit = context.read<DiaryCubit>();
|
||||
portionName = widget.portion == 'gr' ? 'гр' : 'шт';
|
||||
isEaten = widget.portion.portionState == PortionState.eaten_from_diet ? true : false;
|
||||
portionName = widget.portion.portion == 'gr' ? 'гр' : 'шт';
|
||||
|
||||
isEaten = widget.portion.portionState == PortionState.eatenFromDiet ? true : false;
|
||||
}
|
||||
|
||||
updateProductInMeal(DiaryStateLoaded state, PortionModel portion) {
|
||||
return showModalBottomSheet(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
|
||||
),
|
||||
isScrollControlled: true,
|
||||
@@ -54,14 +55,14 @@ class _ProductWidgetState extends State<ProductWidget> {
|
||||
return BlocBuilder<DiaryCubit, DiaryState>(
|
||||
builder: (context, state) {
|
||||
if (state is DiaryStateLoaded) {
|
||||
if (widget.portion.portionState == PortionState.eaten_deleted) {
|
||||
if (widget.portion.portionState == PortionState.eatenDeleted) {
|
||||
return DottedBorder(
|
||||
dashPattern: [6, 6],
|
||||
dashPattern: const [6, 6],
|
||||
padding: EdgeInsets.zero,
|
||||
borderPadding: EdgeInsets.zero,
|
||||
borderType: BorderType.RRect,
|
||||
radius: Radius.circular(20),
|
||||
color: Color(0xFF6D6F71),
|
||||
radius: const Radius.circular(20),
|
||||
color: const Color(0xFF6D6F71),
|
||||
child: ListTile(
|
||||
onTap: () => diaryCubit.restore(
|
||||
diaryId: state.diary.id,
|
||||
@@ -72,19 +73,20 @@ class _ProductWidgetState extends State<ProductWidget> {
|
||||
'assets/icons/revert_product.svg',
|
||||
),
|
||||
horizontalTitleGap: 0,
|
||||
contentPadding: widget.portion.fromDiet ? EdgeInsets.only(right: 24, left: 4) : null,
|
||||
contentPadding: widget.portion.fromDiet ? const EdgeInsets.only(right: 24, left: 4) : null,
|
||||
title: Text(widget.portion.productName),
|
||||
subtitle: Text('${widget.portion.quantity} ${widget.portion.portion == 'gr' ? 'гр' : 'шт'}'),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
tileColor: Color(0xFFF6FAFF03).withValues(alpha: 0.01),
|
||||
// ignore: use_full_hex_values_for_flutter_colors
|
||||
tileColor: const Color(0xfff6faff03).withValues(alpha: 0.01),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return ListTile(
|
||||
onTap: () => updateProductInMeal(state, widget.portion),
|
||||
trailing: Icon(Icons.more_vert_rounded),
|
||||
trailing: const Icon(Icons.more_vert_rounded),
|
||||
leading: widget.portion.fromDiet
|
||||
? Transform.scale(
|
||||
scale: 1.2,
|
||||
@@ -112,20 +114,20 @@ class _ProductWidgetState extends State<ProductWidget> {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
side: BorderSide(
|
||||
side: const BorderSide(
|
||||
color: Color(0xFF809CB9),
|
||||
),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
horizontalTitleGap: 0,
|
||||
contentPadding: widget.portion.fromDiet ? EdgeInsets.only(right: 24, left: 4) : null,
|
||||
contentPadding: widget.portion.fromDiet ? const EdgeInsets.only(right: 24, left: 4) : null,
|
||||
title: Text(widget.portion.productName),
|
||||
subtitle: Text('${widget.portion.quantity} ${widget.portion.portion == 'gr' ? 'гр' : 'шт'}'),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
tileColor: Color(0xFFF6FAFF),
|
||||
tileColor: const Color(0xFFF6FAFF),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class SatietyRatingWidget extends StatefulWidget {
|
||||
const SatietyRatingWidget({super.key});
|
||||
|
||||
@override
|
||||
State<SatietyRatingWidget> createState() => _SatietyRatingWidgetState();
|
||||
}
|
||||
@@ -29,7 +31,7 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Ваша сытость после приёма пищи',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
@@ -54,22 +56,22 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 1 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 1 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFC82222),
|
||||
color: const Color(0xFFC82222),
|
||||
border: currentSelectedRating == 1
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFAA3333),
|
||||
color: const Color(0xFFAA3333),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: currentSelectedRating == 1
|
||||
? BorderRadius.horizontal(
|
||||
? const BorderRadius.horizontal(
|
||||
left: Radius.circular(8),
|
||||
right: Radius.circular(2),
|
||||
)
|
||||
: BorderRadius.horizontal(
|
||||
: const BorderRadius.horizontal(
|
||||
left: Radius.circular(8),
|
||||
),
|
||||
),
|
||||
@@ -78,13 +80,13 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 2 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 2 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFF3E3E),
|
||||
color: const Color(0xFFFF3E3E),
|
||||
border: currentSelectedRating == 2
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF550000),
|
||||
color: const Color(0xFF550000),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
@@ -95,13 +97,13 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 3 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 3 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF8C926),
|
||||
color: const Color(0xFFF8C926),
|
||||
border: currentSelectedRating == 3
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF8C5D00),
|
||||
color: const Color(0xFF8C5D00),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
@@ -112,13 +114,13 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 4 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 4 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFFF3BF),
|
||||
color: const Color(0xFFFFF3BF),
|
||||
border: currentSelectedRating == 4
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFB5911B),
|
||||
color: const Color(0xFFB5911B),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
@@ -129,13 +131,13 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 5 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 5 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF62E833),
|
||||
color: const Color(0xFF62E833),
|
||||
border: currentSelectedRating == 5
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF276918),
|
||||
color: const Color(0xFF276918),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
@@ -146,22 +148,22 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: currentSelectedRating == 6 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: currentSelectedRating == 6 ? const EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF4DCE20),
|
||||
color: const Color(0xFF4DCE20),
|
||||
border: currentSelectedRating == 6
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF184D12),
|
||||
color: const Color(0xFF184D12),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: currentSelectedRating == 6
|
||||
? BorderRadius.horizontal(
|
||||
? const BorderRadius.horizontal(
|
||||
left: Radius.circular(2),
|
||||
right: Radius.circular(8),
|
||||
)
|
||||
: BorderRadius.horizontal(
|
||||
: const BorderRadius.horizontal(
|
||||
right: Radius.circular(8),
|
||||
),
|
||||
),
|
||||
@@ -174,7 +176,7 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
});
|
||||
EasyDebounce.debounce(
|
||||
'change-satiety',
|
||||
Duration(milliseconds: 250),
|
||||
const Duration(milliseconds: 250),
|
||||
() {
|
||||
context.read<DiaryCubit>().fillSatiety(diaryId: state.diary.id, satiety: currentSelectedRating.toInt() - 1);
|
||||
},
|
||||
|
||||
@@ -57,7 +57,7 @@ class _TimeOfMealPickerWidgetState extends State<TimeOfMealPickerWidget> {
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
child: Center(
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'Сохранить',
|
||||
style: TextStyle(
|
||||
@@ -82,13 +82,13 @@ class _TimeOfMealPickerWidgetState extends State<TimeOfMealPickerWidget> {
|
||||
if (state is DiaryStateLoaded) {
|
||||
return Column(
|
||||
children: [
|
||||
CustomDivider(),
|
||||
const CustomDivider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Время приема пищи',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF323F4B),
|
||||
@@ -103,14 +103,14 @@ class _TimeOfMealPickerWidgetState extends State<TimeOfMealPickerWidget> {
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
color: Color(0xFFF1F2F6),
|
||||
color: const Color(0xFFF1F2F6),
|
||||
),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
state.diary.meals[state.selectedMeal - 1].time.substring(0, state.diary.meals[state.selectedMeal - 1].time.length - 3),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF6D6F71),
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -122,7 +122,7 @@ class _TimeOfMealPickerWidgetState extends State<TimeOfMealPickerWidget> {
|
||||
],
|
||||
),
|
||||
),
|
||||
CustomDivider(),
|
||||
const CustomDivider(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
child: Center(
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'Сохранить',
|
||||
style: TextStyle(
|
||||
@@ -116,7 +116,7 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
|
||||
children: [
|
||||
SvgPicture.asset('assets/icons/wakeup.svg'),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
const Text(
|
||||
'Подъём',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
@@ -134,17 +134,17 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
color: Color(0xFFF1F2F6),
|
||||
color: const Color(0xFFF1F2F6),
|
||||
),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
state.diary.wakeup.toString().substring(
|
||||
0,
|
||||
state.diary.wakeup.toString().length - 3,
|
||||
),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF6D6F71),
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -175,7 +175,7 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
|
||||
children: [
|
||||
SvgPicture.asset('assets/icons/retire.svg'),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
const Text(
|
||||
'Уход ко сну',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
@@ -193,17 +193,17 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
color: Color(0xFFF1F2F6),
|
||||
color: const Color(0xFFF1F2F6),
|
||||
),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
state.diary.retire.toString().substring(
|
||||
0,
|
||||
state.diary.retire.toString().length - 3,
|
||||
),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF6D6F71),
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -221,7 +221,7 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user