diff --git a/lib/features/diary/presentation/bloc/diary_bloc.dart b/lib/features/diary/presentation/bloc/diary_bloc.dart index 379aaeae..78031171 100644 --- a/lib/features/diary/presentation/bloc/diary_bloc.dart +++ b/lib/features/diary/presentation/bloc/diary_bloc.dart @@ -110,7 +110,8 @@ class DiaryBloc extends Bloc { portionList: portionList, portionController: portionList[0], mealList: mealList, - chartData: chartDataCounted, + chartData: chartData, + chartDataCounted: chartDataCounted, selectedMood: currentMeal.mood, selectedSatiety: currentMeal.satiety, wakeupController: TimeOfDay.now(), @@ -200,7 +201,8 @@ class DiaryBloc extends Bloc { portionList: portionList, portionController: portionList[0], mealList: mealList, - chartData: chartDataCounted, + chartData: chartData, + chartDataCounted: chartDataCounted, selectedMood: currentMeal.mood, selectedSatiety: currentMeal.satiety, wakeupController: TimeOfDay.now(), diff --git a/lib/features/diary/presentation/bloc/diary_state.dart b/lib/features/diary/presentation/bloc/diary_state.dart index 07259914..b0aebfb2 100644 --- a/lib/features/diary/presentation/bloc/diary_state.dart +++ b/lib/features/diary/presentation/bloc/diary_state.dart @@ -26,6 +26,7 @@ abstract class DiaryState with _$DiaryState { required List mealList, required List portionList, required List autocompleteList, + required Map chartData, required Meal currentMeal, required SelectionPopupModel portionController, required TimeOfDay wakeupController, @@ -45,7 +46,7 @@ abstract class DiaryState with _$DiaryState { required bool moodExpanded, required bool isLoading, required bool isAdded, - List? chartData, + List? chartDataCounted, }) = DiaryStateLoaded; const factory DiaryState.error({ diff --git a/lib/features/diary/presentation/bloc/diary_state.freezed.dart b/lib/features/diary/presentation/bloc/diary_state.freezed.dart index 24dbb0a9..5a9bbc12 100644 --- a/lib/features/diary/presentation/bloc/diary_state.freezed.dart +++ b/lib/features/diary/presentation/bloc/diary_state.freezed.dart @@ -29,6 +29,7 @@ mixin _$DiaryState { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -48,7 +49,7 @@ mixin _$DiaryState { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData) + List? chartDataCounted) loaded, required TResult Function(String errorMessage) error, }) => @@ -66,6 +67,7 @@ mixin _$DiaryState { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -85,7 +87,7 @@ mixin _$DiaryState { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult? Function(String errorMessage)? error, }) => @@ -103,6 +105,7 @@ mixin _$DiaryState { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -122,7 +125,7 @@ mixin _$DiaryState { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), @@ -222,6 +225,7 @@ class _$DiaryStateImpl implements _DiaryState { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -241,7 +245,7 @@ class _$DiaryStateImpl implements _DiaryState { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData) + List? chartDataCounted) loaded, required TResult Function(String errorMessage) error, }) { @@ -262,6 +266,7 @@ class _$DiaryStateImpl implements _DiaryState { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -281,7 +286,7 @@ class _$DiaryStateImpl implements _DiaryState { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult? Function(String errorMessage)? error, }) { @@ -302,6 +307,7 @@ class _$DiaryStateImpl implements _DiaryState { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -321,7 +327,7 @@ class _$DiaryStateImpl implements _DiaryState { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), @@ -450,6 +456,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -469,7 +476,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData) + List? chartDataCounted) loaded, required TResult Function(String errorMessage) error, }) { @@ -490,6 +497,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -509,7 +517,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult? Function(String errorMessage)? error, }) { @@ -530,6 +538,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -549,7 +558,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), @@ -622,6 +631,7 @@ abstract class _$$DiaryStateLoadedImplCopyWith<$Res> { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -641,7 +651,7 @@ abstract class _$$DiaryStateLoadedImplCopyWith<$Res> { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData}); + List? chartDataCounted}); $DiaryModelCopyWith<$Res> get diary; $MealCopyWith<$Res> get currentMeal; @@ -667,6 +677,7 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res> Object? mealList = null, Object? portionList = null, Object? autocompleteList = null, + Object? chartData = null, Object? currentMeal = null, Object? portionController = null, Object? wakeupController = null, @@ -686,7 +697,7 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res> Object? moodExpanded = null, Object? isLoading = null, Object? isAdded = null, - Object? chartData = freezed, + Object? chartDataCounted = freezed, }) { return _then(_$DiaryStateLoadedImpl( diary: null == diary @@ -721,6 +732,10 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res> ? _value._autocompleteList : autocompleteList // ignore: cast_nullable_to_non_nullable as List, + chartData: null == chartData + ? _value._chartData + : chartData // ignore: cast_nullable_to_non_nullable + as Map, currentMeal: null == currentMeal ? _value.currentMeal : currentMeal // ignore: cast_nullable_to_non_nullable @@ -797,9 +812,9 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res> ? _value.isAdded : isAdded // ignore: cast_nullable_to_non_nullable as bool, - chartData: freezed == chartData - ? _value._chartData - : chartData // ignore: cast_nullable_to_non_nullable + chartDataCounted: freezed == chartDataCounted + ? _value._chartDataCounted + : chartDataCounted // ignore: cast_nullable_to_non_nullable as List?, )); } @@ -842,6 +857,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { required final List mealList, required final List portionList, required final List autocompleteList, + required final Map chartData, required this.currentMeal, required this.portionController, required this.wakeupController, @@ -861,14 +877,15 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { required this.moodExpanded, required this.isLoading, required this.isAdded, - final List? chartData}) + final List? chartDataCounted}) : _recommendedChartValues = recommendedChartValues, _consumedChartValues = consumedChartValues, _portions = portions, _mealList = mealList, _portionList = portionList, _autocompleteList = autocompleteList, - _chartData = chartData; + _chartData = chartData, + _chartDataCounted = chartDataCounted; @override final DiaryModel diary; @@ -925,6 +942,14 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { return EqualUnmodifiableListView(_autocompleteList); } + final Map _chartData; + @override + Map get chartData { + if (_chartData is EqualUnmodifiableMapView) return _chartData; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_chartData); + } + @override final Meal currentMeal; @override @@ -963,19 +988,20 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { final bool isLoading; @override final bool isAdded; - final List? _chartData; + final List? _chartDataCounted; @override - List? get chartData { - final value = _chartData; + List? get chartDataCounted { + final value = _chartDataCounted; if (value == null) return null; - if (_chartData is EqualUnmodifiableListView) return _chartData; + if (_chartDataCounted is EqualUnmodifiableListView) + return _chartDataCounted; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } @override String toString() { - return 'DiaryState.loaded(diary: $diary, diaryDate: $diaryDate, recommendedChartValues: $recommendedChartValues, consumedChartValues: $consumedChartValues, portions: $portions, mealList: $mealList, portionList: $portionList, autocompleteList: $autocompleteList, currentMeal: $currentMeal, portionController: $portionController, wakeupController: $wakeupController, retireController: $retireController, mealTimeController: $mealTimeController, commentController: $commentController, product_nameController: $product_nameController, productQuantityController: $productQuantityController, caloriesController: $caloriesController, fatsController: $fatsController, proteinsController: $proteinsController, carbsController: $carbsController, selectedMood: $selectedMood, selectedSatiety: $selectedSatiety, wakeupExpanded: $wakeupExpanded, moderationExpanded: $moderationExpanded, moodExpanded: $moodExpanded, isLoading: $isLoading, isAdded: $isAdded, chartData: $chartData)'; + return 'DiaryState.loaded(diary: $diary, diaryDate: $diaryDate, recommendedChartValues: $recommendedChartValues, consumedChartValues: $consumedChartValues, portions: $portions, mealList: $mealList, portionList: $portionList, autocompleteList: $autocompleteList, chartData: $chartData, currentMeal: $currentMeal, portionController: $portionController, wakeupController: $wakeupController, retireController: $retireController, mealTimeController: $mealTimeController, commentController: $commentController, product_nameController: $product_nameController, productQuantityController: $productQuantityController, caloriesController: $caloriesController, fatsController: $fatsController, proteinsController: $proteinsController, carbsController: $carbsController, selectedMood: $selectedMood, selectedSatiety: $selectedSatiety, wakeupExpanded: $wakeupExpanded, moderationExpanded: $moderationExpanded, moodExpanded: $moodExpanded, isLoading: $isLoading, isAdded: $isAdded, chartDataCounted: $chartDataCounted)'; } @override @@ -996,6 +1022,8 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { .equals(other._portionList, _portionList) && const DeepCollectionEquality() .equals(other._autocompleteList, _autocompleteList) && + const DeepCollectionEquality() + .equals(other._chartData, _chartData) && (identical(other.currentMeal, currentMeal) || other.currentMeal == currentMeal) && (identical(other.portionController, portionController) || @@ -1035,7 +1063,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { other.isLoading == isLoading) && (identical(other.isAdded, isAdded) || other.isAdded == isAdded) && const DeepCollectionEquality() - .equals(other._chartData, _chartData)); + .equals(other._chartDataCounted, _chartDataCounted)); } @override @@ -1049,6 +1077,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { const DeepCollectionEquality().hash(_mealList), const DeepCollectionEquality().hash(_portionList), const DeepCollectionEquality().hash(_autocompleteList), + const DeepCollectionEquality().hash(_chartData), currentMeal, portionController, wakeupController, @@ -1068,7 +1097,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { moodExpanded, isLoading, isAdded, - const DeepCollectionEquality().hash(_chartData) + const DeepCollectionEquality().hash(_chartDataCounted) ]); @JsonKey(ignore: true) @@ -1092,6 +1121,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -1111,7 +1141,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData) + List? chartDataCounted) loaded, required TResult Function(String errorMessage) error, }) { @@ -1124,6 +1154,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { mealList, portionList, autocompleteList, + chartData, currentMeal, portionController, wakeupController, @@ -1143,7 +1174,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { moodExpanded, isLoading, isAdded, - chartData); + chartDataCounted); } @override @@ -1160,6 +1191,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -1179,7 +1211,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult? Function(String errorMessage)? error, }) { @@ -1192,6 +1224,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { mealList, portionList, autocompleteList, + chartData, currentMeal, portionController, wakeupController, @@ -1211,7 +1244,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { moodExpanded, isLoading, isAdded, - chartData); + chartDataCounted); } @override @@ -1228,6 +1261,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -1247,7 +1281,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), @@ -1262,6 +1296,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { mealList, portionList, autocompleteList, + chartData, currentMeal, portionController, wakeupController, @@ -1281,7 +1316,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded { moodExpanded, isLoading, isAdded, - chartData); + chartDataCounted); } return orElse(); } @@ -1334,6 +1369,7 @@ abstract class DiaryStateLoaded implements DiaryState { required final List mealList, required final List portionList, required final List autocompleteList, + required final Map chartData, required final Meal currentMeal, required final SelectionPopupModel portionController, required final TimeOfDay wakeupController, @@ -1353,7 +1389,7 @@ abstract class DiaryStateLoaded implements DiaryState { required final bool moodExpanded, required final bool isLoading, required final bool isAdded, - final List? chartData}) = _$DiaryStateLoadedImpl; + final List? chartDataCounted}) = _$DiaryStateLoadedImpl; DiaryModel get diary; String? get diaryDate; @@ -1363,6 +1399,7 @@ abstract class DiaryStateLoaded implements DiaryState { List get mealList; List get portionList; List get autocompleteList; + Map get chartData; Meal get currentMeal; SelectionPopupModel get portionController; TimeOfDay get wakeupController; @@ -1382,7 +1419,7 @@ abstract class DiaryStateLoaded implements DiaryState { bool get moodExpanded; bool get isLoading; bool get isAdded; - List? get chartData; + List? get chartDataCounted; @JsonKey(ignore: true) _$$DiaryStateLoadedImplCopyWith<_$DiaryStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; @@ -1465,6 +1502,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -1484,7 +1522,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData) + List? chartDataCounted) loaded, required TResult Function(String errorMessage) error, }) { @@ -1505,6 +1543,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -1524,7 +1563,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult? Function(String errorMessage)? error, }) { @@ -1545,6 +1584,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError { List mealList, List portionList, List autocompleteList, + Map chartData, Meal currentMeal, SelectionPopupModel portionController, TimeOfDay wakeupController, @@ -1564,7 +1604,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError { bool moodExpanded, bool isLoading, bool isAdded, - List? chartData)? + List? chartDataCounted)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), diff --git a/lib/features/diary/presentation/pages/diary_screen.dart b/lib/features/diary/presentation/pages/diary_screen.dart index 2b9cf6e9..fc964c07 100644 --- a/lib/features/diary/presentation/pages/diary_screen.dart +++ b/lib/features/diary/presentation/pages/diary_screen.dart @@ -11,7 +11,6 @@ import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart'; import 'package:eatvio_app/widgets/custom_edit_drop_down.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_scale_element.dart'; import 'package:flutter/material.dart'; @@ -91,16 +90,18 @@ class DiaryScreen extends StatelessWidget { child: Column( children: [ _buildHeaderRow(context, state), - SizedBox(height: 30.v), + SizedBox(height: 8.v), _buildWakupRetire(context, state), - SizedBox(height: 30.v), + SizedBox(height: 8.v), _buildMeal(context, state), - SizedBox(height: 20.v), + SizedBox(height: 8.v), _buildMood(context, state), - SizedBox(height: 20.v), + SizedBox(height: 8.v), _buildNutritionChart(context, state), - SizedBox(height: 30.v), - _buildComment(context, state), + SizedBox(height: 8.v), + // _buildComment(context, state), + // SizedBox(height: 8.v), + _buildEndDay(context), ], ), ), @@ -111,7 +112,6 @@ class DiaryScreen extends StatelessWidget { ), ), ), - _buildEndDay(context), ], ), ); @@ -119,30 +119,24 @@ class DiaryScreen extends StatelessWidget { _buildNutritionChart(BuildContext context, DiaryStateLoaded state) { return Container( - margin: EdgeInsets.symmetric(horizontal: 16.h, vertical: 16.h), padding: EdgeInsets.symmetric( horizontal: 24.h, vertical: 12.v, ), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], + borderRadius: const BorderRadius.all(Radius.circular(8)), ), child: Column( children: [ Text( - "График КБЖУ", + "Ваш КБЖУ", style: theme.textTheme.titleMedium, textAlign: TextAlign.center, ), + Text( + "от дневной суточной нормы", + ), Transform.rotate( angle: -1.5708, child: ClipRect( @@ -152,7 +146,7 @@ class DiaryScreen extends StatelessWidget { child: SfCircularChart( series: [ RadialBarSeries( - dataSource: state.chartData, + dataSource: state.chartDataCounted, xValueMapper: (NutritionData data, _) => data.category, yValueMapper: (NutritionData data, _) => data.nutrition, pointColorMapper: (NutritionData data, _) => data.color, @@ -167,23 +161,26 @@ class DiaryScreen extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('Углеводы'), - Text('Жиры'), - Text('Белки'), - Text('Калории'), + Text(style: theme.textTheme.titleMedium, 'Углеводы'), + Text(style: theme.textTheme.titleMedium, 'Жиры'), + Text(style: theme.textTheme.titleMedium, 'Белки'), + Text(style: theme.textTheme.titleMedium, 'Калории'), ], ), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - '${state.chartData![3].nutrition.toStringAsFixed(0)}%'), // Калории + '${state.chartData['dailyNutritionIntake']['carbohydrates'].toStringAsFixed(1)} из ${state.chartData['dailyNutritionRecommendation']['carbohydrates'].toStringAsFixed(1)} грамм'), + SizedBox(height: 8.v), Text( - '${state.chartData![2].nutrition.toStringAsFixed(0)}%'), // Белки + '${state.chartData['dailyNutritionIntake']['fats'].toStringAsFixed(1)} из ${state.chartData['dailyNutritionRecommendation']['fats'].toStringAsFixed(1)} грамм'), + SizedBox(height: 8.v), Text( - '${state.chartData![1].nutrition.toStringAsFixed(0)}%'), // Жиры + '${state.chartData['dailyNutritionIntake']['proteins'].toStringAsFixed(1)} из ${state.chartData['dailyNutritionRecommendation']['proteins'].toStringAsFixed(1)} грамм'), + SizedBox(height: 8.v), Text( - '${state.chartData![0].nutrition.toStringAsFixed(0)}% '), // Углеводы + '${state.chartData['dailyNutritionIntake']['energy'].toStringAsFixed(1)} из ${state.chartData['dailyNutritionRecommendation']['energy'].toStringAsFixed(1)} Ккал'), ], ), ], @@ -194,18 +191,24 @@ class DiaryScreen extends StatelessWidget { } _buildEndDay(BuildContext context) { - return CustomOutlinedButton( - text: "Закончить день", - margin: EdgeInsets.only( - left: 16.h, - right: 16.h, - bottom: 16.v, + return Container( + height: 48, + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.only(left: 4, right: 4), + child: FloatingActionButton.extended( + highlightElevation: 0, + elevation: 0, + focusElevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + backgroundColor: appTheme.blueA400, + onPressed: () => onFinishDayPressed, + label: Text( + 'Закончить день', + style: theme.textTheme.titleSmall, + ), ), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - decoration: BoxDecoration( - color: Colors.transparent, - ), - onPressed: onFinishDayPressed(context), ); } @@ -219,22 +222,13 @@ class DiaryScreen extends StatelessWidget { _buildHeaderRow(BuildContext context, DiaryStateLoaded state) { final day = state.diary.id; return Container( - margin: EdgeInsets.symmetric(horizontal: 16.h, vertical: 16.h), padding: EdgeInsets.symmetric( horizontal: 24.h, vertical: 12.v, ), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], + borderRadius: const BorderRadius.all(Radius.circular(8)), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -260,11 +254,24 @@ class DiaryScreen extends StatelessWidget { /// Section Widget _buildAddProduct(BuildContext context, DiaryState state) { - return CustomOutlinedButton( - text: "Добавить продукт", - margin: EdgeInsets.symmetric(horizontal: 10.h), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: addProduct(context), + return Container( + height: 48, + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.only(left: 4, right: 4), + child: FloatingActionButton.extended( + highlightElevation: 0, + elevation: 0, + focusElevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + backgroundColor: appTheme.blueA400, + onPressed: () => addProduct, + label: Text( + 'Добавить продукт', + style: theme.textTheme.titleSmall, + ), + ), ); } @@ -354,22 +361,13 @@ class DiaryScreen extends StatelessWidget { state.autocompleteList.map((Product item) => item.name).toList(); FocusNode focusNodeName = FocusNode(); return Container( - margin: EdgeInsets.symmetric(horizontal: 16.h), padding: EdgeInsets.symmetric( horizontal: 24.h, vertical: 12.v, ), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], + borderRadius: const BorderRadius.all(Radius.circular(8)), ), child: Column( mainAxisSize: MainAxisSize.min, @@ -530,17 +528,17 @@ class DiaryScreen extends StatelessWidget { ), ), ), - SizedBox(height: 30.v), + SizedBox(height: 24.v), _buildAddProduct(context, state), - SizedBox(height: 30.v), + SizedBox(height: 24.v), ...state.portions .map((portion) => _buildProduct(context, portion)) .toList(), - SizedBox(height: 30.v), + SizedBox(height: 24.v), _buildCarousel(context, state), - SizedBox(height: 20.v), + SizedBox(height: 24.v), _buildAddPhoto(context, state), - SizedBox(height: 30.v), + SizedBox(height: 24.v), Text( "Ваша сытость после приёма пищи", style: CustomTextStyles.bodyMediumBlack900, @@ -736,7 +734,7 @@ class DiaryScreen extends StatelessWidget { return Text("Фото нет"); } else { return CarouselSlider( - options: CarouselOptions(height: 340.0), + options: CarouselOptions(height: 200.0), items: state.currentMeal.photos.map((photo) { return _buildPhoto(context, photo); }).toList(), @@ -846,22 +844,13 @@ class DiaryScreen extends StatelessWidget { _buildComment(BuildContext context, DiaryStateLoaded state) { return Container( - margin: EdgeInsets.symmetric(horizontal: 16.h), padding: EdgeInsets.symmetric( horizontal: 24.h, vertical: 12.v, ), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], + borderRadius: const BorderRadius.all(Radius.circular(8)), ), child: Column( mainAxisSize: MainAxisSize.min, @@ -890,22 +879,13 @@ class DiaryScreen extends StatelessWidget { _buildWakupRetire(BuildContext context, DiaryStateLoaded state) { return Container( - margin: EdgeInsets.symmetric(horizontal: 16.h), padding: EdgeInsets.symmetric( horizontal: 24.h, vertical: 12.v, ), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], + borderRadius: const BorderRadius.all(Radius.circular(8)), ), child: Column( children: [ @@ -1010,22 +990,13 @@ class DiaryScreen extends StatelessWidget { _buildMood(BuildContext context, DiaryStateLoaded state) { return Container( - margin: EdgeInsets.symmetric(horizontal: 16.h), padding: EdgeInsets.symmetric( horizontal: 24.h, vertical: 12.v, ), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], + borderRadius: const BorderRadius.all(Radius.circular(8)), ), child: Column( children: [