forked from eatvio/eatvio_app
merge
This commit is contained in:
@@ -11,7 +11,6 @@ import 'package:image_picker/image_picker.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'dart:convert';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
part 'diary_event.dart';
|
||||
|
||||
@@ -144,7 +143,7 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
||||
) async {
|
||||
final responseChart = await http.get(
|
||||
Uri.parse(
|
||||
dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/dailyNutritionData/',
|
||||
baseUrl + '/api/' + '/diary/$diaryID/dailyNutritionData/',
|
||||
),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -613,6 +613,7 @@ abstract class _$$DiaryStateLoadedImplCopyWith<$Res> {
|
||||
|
||||
$DiaryModelCopyWith<$Res> get diary;
|
||||
$MealCopyWith<$Res> get currentMeal;
|
||||
$SelectionPopupModelCopyWith<$Res> get portionController;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -786,6 +787,15 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
|
||||
return _then(_value.copyWith(currentMeal: value));
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$SelectionPopupModelCopyWith<$Res> get portionController {
|
||||
return $SelectionPopupModelCopyWith<$Res>(_value.portionController,
|
||||
(value) {
|
||||
return _then(_value.copyWith(portionController: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
@@ -17,7 +17,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
@@ -111,35 +110,80 @@ 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SfCircularChart(
|
||||
title: ChartTitle(text: 'График КБЖУ'),
|
||||
legend: Legend(isVisible: true),
|
||||
series: <CircularSeries>[
|
||||
RadialBarSeries<NutritionData, String>(
|
||||
dataSource: state.chartData,
|
||||
xValueMapper: (NutritionData data, _) => data.category,
|
||||
yValueMapper: (NutritionData data, _) => data.nutrition,
|
||||
pointColorMapper: (NutritionData data, _) => data.color,
|
||||
)
|
||||
],
|
||||
));
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
"График КБЖУ",
|
||||
style: theme.textTheme.titleMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Transform.rotate(
|
||||
angle: -1.5708,
|
||||
child: ClipRect(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
widthFactor: 0.5,
|
||||
child: SfCircularChart(
|
||||
legend: Legend(isVisible: false),
|
||||
series: <CircularSeries>[
|
||||
RadialBarSeries<NutritionData, String>(
|
||||
dataSource: state.chartData,
|
||||
xValueMapper: (NutritionData data, _) => data.category,
|
||||
yValueMapper: (NutritionData data, _) => data.nutrition,
|
||||
pointColorMapper: (NutritionData data, _) => data.color,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
SizedBox(height: 16.0),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Калории'),
|
||||
Text('Белки'),
|
||||
Text('Жиры'),
|
||||
Text('Углеводы'),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'${state.chartData![0].nutrition.toStringAsFixed(1)}'), // Калории
|
||||
Text(
|
||||
'${state.chartData![1].nutrition.toStringAsFixed(1)}'), // Белки
|
||||
Text(
|
||||
'${state.chartData![2].nutrition.toStringAsFixed(1)}'), // Жиры
|
||||
Text(
|
||||
'${state.chartData![3].nutrition.toStringAsFixed(1)}'), // Углеводы
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildEndDay(BuildContext context) {
|
||||
@@ -759,7 +803,7 @@ class DiaryScreen extends StatelessWidget {
|
||||
borderRadius: BorderRadiusStyle.roundedBorder5,
|
||||
),
|
||||
child: Image.network(
|
||||
dotenv.env['STORAGE_URL']! + photo.path,
|
||||
baseUrl + '/storage/' + photo.path,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
|
||||
Reference in New Issue
Block a user