feat(profile): add profile charts models, requests. Max length of description in posts, recipes, diets = 200

This commit is contained in:
mso7nueh
2024-09-13 14:22:57 +03:00
parent a826cba866
commit c800d35663
111 changed files with 5760 additions and 3215 deletions

View File

@@ -1,8 +1,13 @@
import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/presentation/widgets/blog_post_widget.dart';
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
import 'package:eatvio_app/features/profile/models/weight_model.dart';
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_state.dart';
import 'package:eatvio_app/features/profile/presentation/widgets/circumference_chart_widget.dart';
import 'package:eatvio_app/features/profile/presentation/widgets/imt_chart_widget.dart';
import 'package:eatvio_app/features/profile/presentation/widgets/weight_chart_widget.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
@@ -21,8 +26,8 @@ class ProfileScreen extends StatefulWidget {
}
class _ProfileScreenState extends State<ProfileScreen> {
// List<Circumference> chartData = [];
// List<ChartPointModel> chartPoints = [];
List<CircumferenceModel> circumferencePoints = [];
List<WeightModel> weightPoints = [];
final List<String> chipsLabelList = ['Вес', 'Замеры', 'ИМТ'];
final List<String> chipsIntervalLabelList = ['1М', '3М', '6М', '1Г', 'ВСЁ ВРЕМЯ'];
int _selectedChipIndex = 0;
@@ -40,8 +45,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
child: BlocBuilder<ProfileCubit, ProfileState>(
builder: (BuildContext context, ProfileState state) {
if (state is ProfileStateLoaded) {
// chartData = state.profile.circumferences;
// chartPoints = state.profile.chartPoints;
circumferencePoints = state.circumferencePoints;
weightPoints = state.weightPoints;
return Scaffold(
backgroundColor: Colors.grey.shade200,
appBar: widget.author == null ? AppBar(toolbarHeight: 0) : AppBar(),
@@ -209,25 +214,27 @@ class _ProfileScreenState extends State<ProfileScreen> {
],
),
),
// Builder(
// builder: (context) {
// switch (_selectedChipIndex) {
// case 0:
// return WeightChartWidget(
// chartPoints: chartPoints,
// profileCubit: context.read<ProfileCubit>(),
// );
// case 1:
// return CircumferenceChartWidget(
// chartData: chartData,
// profileCubit: context.read<ProfileCubit>(),
// );
// case 2:
// return ImtChartWidget(chartPoints: chartPoints);
// }
// return SizedBox.shrink();
// },
// ),
Builder(
builder: (context) {
switch (_selectedChipIndex) {
case 0:
return WeightChartWidget(
weightPoints: weightPoints,
profileCubit: context.read<ProfileCubit>(),
);
case 1:
return CircumferenceChartWidget(
circumferencePoints: circumferencePoints,
profileCubit: context.read<ProfileCubit>(),
);
case 2:
return ImtChartWidget(
weightPoints: weightPoints,
);
}
return SizedBox.shrink();
},
),
SizedBox(height: 8),
Row(
children: [