Merge remote-tracking branch 'refs/remotes/origin/calendar'

# Conflicts:
#	lib/app_router.dart
#	lib/features/calendar/services/calendar_service.dart
#	lib/features/diary/presentation/bloc/diary_bloc.dart
#	lib/features/diary/services/diary_service.dart
#	lib/locator_service.dart
#	lib/main.dart
This commit is contained in:
mso7nueh
2024-07-31 13:49:24 +03:00
18 changed files with 312 additions and 627 deletions

View File

@@ -842,228 +842,6 @@ class DiaryScreen extends StatelessWidget {
};
}
/*_buildNutritionChart(BuildContext context, DiaryStateLoaded state) {
final List<int> recommendedValues = state
.recommendedChartValues; // Рекомендуемые значения: калории, жиры, белки, углеводы
final List<int> consumedValues = state.consumedChartValues; //
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.h),
padding: EdgeInsets.symmetric(
horizontal: 10.h,
vertical: 16.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),
),
],
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 3.v),
Text(
"Ваш КБЖУ",
style: theme.textTheme.titleMedium,
),
SizedBox(height: 8.v),
Text(
"От дневной суточной нормы",
style: CustomTextStyles.bodyMediumBluegray800,
),
SizedBox(height: 19.v),
Align(
alignment: Alignment.centerRight,
child: Padding(
padding: EdgeInsets.only(
left: 30.h,
right: 12.h,
),
child: AspectRatio(
aspectRatio: 1.5,
child: BarChart(
BarChartData(
alignment: BarChartAlignment.spaceAround,
barTouchData: BarTouchData(enabled: false),
titlesData: FlTitlesData(
show: true,
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
//getTitlesWidget: (value, meta) => newMethod(value),
),
),
),
borderData: FlBorderData(show: false),
barGroups: [
BarChartGroupData(
x: 0,
barRods: [
BarChartRodData(
toY: consumedValues[0] / recommendedValues[0] * 100,
color: checkConsumedValues(
[recommendedValues[0]], [consumedValues[1]])
? Colors.red
: Colors.blue,
),
],
),
BarChartGroupData(
x: 1,
barRods: [
BarChartRodData(
toY: consumedValues[1] / recommendedValues[1] * 100,
color: checkConsumedValues(
[recommendedValues[1]], [consumedValues[1]])
? Colors.red
: Colors.blue,
),
],
),
BarChartGroupData(
x: 2,
barRods: [
BarChartRodData(
toY: consumedValues[2] / recommendedValues[2] * 100,
color: checkConsumedValues(
[recommendedValues[2]], [consumedValues[2]])
? Colors.red
: Colors.blue,
),
],
),
BarChartGroupData(
x: 3,
barRods: [
BarChartRodData(
toY: consumedValues[3] / recommendedValues[3] * 100,
color: checkConsumedValues(
[recommendedValues[3]], [consumedValues[3]])
? Colors.red
: Colors.blue,
),
],
),
],
),
),
),
),
),
SizedBox(height: 8.v),
SizedBox(height: 2.v),
Padding(
padding: EdgeInsets.only(
left: 10.h,
right: 2.h,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Калорий",
style: theme.textTheme.bodySmall,
),
Padding(
padding: EdgeInsets.only(
left: 25.h,
bottom: 11.v,
),
child: Text(
"Белков",
style: theme.textTheme.bodySmall,
),
),
Padding(
padding: EdgeInsets.only(
left: 19.h,
bottom: 11.v,
),
child: Text(
"Жиров",
style: theme.textTheme.bodySmall,
),
),
Padding(
padding: EdgeInsets.only(
left: 14.h,
bottom: 11.v,
),
child: Text(
"Углеводов",
style: theme.textTheme.bodySmall,
),
),
],
),
),
SizedBox(height: 2.v),
Padding(
padding: EdgeInsets.only(
left: 10.h,
right: 2.h,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${consumedValues[0].toInt()} из ${recommendedValues[0].toInt()}",
style: theme.textTheme.bodySmall,
),
Padding(
padding: EdgeInsets.only(
left: 25.h,
bottom: 11.v,
),
child: Text(
"${consumedValues[1].toInt()} из ${recommendedValues[1].toInt()}",
style: theme.textTheme.bodySmall,
),
),
Padding(
padding: EdgeInsets.only(
left: 19.h,
bottom: 11.v,
),
child: Text(
"${consumedValues[2].toInt()} из ${recommendedValues[2].toInt()}",
style: theme.textTheme.bodySmall,
),
),
Padding(
padding: EdgeInsets.only(
left: 14.h,
bottom: 11.v,
),
child: Text(
"${consumedValues[3].toInt()} из ${recommendedValues[3].toInt()}",
style: theme.textTheme.bodySmall,
),
),
],
),
),
SizedBox(height: 19.v),
if (checkConsumedValues(recommendedValues, consumedValues))
Text(
"*Превышенная суточная норма",
style: theme.textTheme.labelLarge,
),
],
),
);
}*/
/// Section Widget
_buildComment(BuildContext context, DiaryStateLoaded state) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.h),
@@ -1155,7 +933,7 @@ class DiaryScreen extends StatelessWidget {
child: AbsorbPointer(
child: CustomTextFormField(
hintText:
state.wakeupController?.format(context).toString(),
state.wakeupController.format(context).toString(),
prefix: Icon(Icons.sunny),
autofocus: false,
),
@@ -1167,7 +945,7 @@ class DiaryScreen extends StatelessWidget {
child: AbsorbPointer(
child: CustomTextFormField(
hintText:
state.retireController?.format(context).toString(),
state.retireController.format(context).toString(),
prefix: Icon(Icons.bed),
autofocus: false,
),
@@ -1324,7 +1102,7 @@ class DiaryScreen extends StatelessWidget {
BuildContext context, DiaryStateLoaded state) async {
final TimeOfDay? pickedTime = await showTimePicker(
context: context,
initialTime: state.wakeupController ?? TimeOfDay.now(),
initialTime: state.wakeupController,
);
if (pickedTime != null && pickedTime != state.wakeupController) {
context.read<DiaryBloc>().add(WakeupEvent(pickedTime));
@@ -1335,7 +1113,7 @@ class DiaryScreen extends StatelessWidget {
BuildContext context, DiaryStateLoaded state) async {
final TimeOfDay? pickedTime = await showTimePicker(
context: context,
initialTime: state.retireController ?? TimeOfDay.now(),
initialTime: state.retireController,
);
if (pickedTime != null && pickedTime != state.retireController) {
context.read<DiaryBloc>().add(RetireEvent(pickedTime));