feat(profile): add blogPosts of user, charts

This commit is contained in:
mso7nueh
2024-08-30 16:36:22 +03:00
parent f994589baa
commit 01d6fea790
20 changed files with 582 additions and 164 deletions

View File

@@ -13,35 +13,61 @@ class ImtChartWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SfCartesianChart(
margin: EdgeInsets.zero,
enableAxisAnimation: true,
enableSideBySideSeriesPlacement: true,
legend: const Legend(
isVisible: true,
opacity: 0.7,
position: LegendPosition.bottom,
),
plotAreaBorderWidth: 0,
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
),
primaryXAxis: DateTimeAxis(
dateFormat: DateFormat.MMMd('ru'),
axisLine: AxisLine(
width: 1,
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'${chartPoints.last.bmi.toStringAsFixed(2)} кг/м²',
style: TextStyle(
color: Colors.black,
fontSize: 48,
fontWeight: FontWeight.w500,
),
),
chartPoints.last.bmi > chartPoints[chartPoints.length - 2].bmi
? Icon(
Icons.arrow_drop_up,
size: 48,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 48,
color: Colors.grey,
),
],
),
),
),
primaryYAxis: NumericAxis(
labelFormat: '{value} кг',
axisLine: AxisLine(
width: 1,
SfCartesianChart(
margin: EdgeInsets.zero,
enableAxisAnimation: true,
enableSideBySideSeriesPlacement: true,
plotAreaBorderWidth: 0,
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
),
primaryXAxis: DateTimeCategoryAxis(
dateFormat: DateFormat.MMMd('ru'),
axisLine: AxisLine(
width: 1,
),
),
primaryYAxis: NumericAxis(
labelFormat: '{value} кг/м²',
axisLine: AxisLine(
width: 1,
),
majorTickLines: MajorTickLines(size: 0),
),
series: _getSplineSeries(),
tooltipBehavior: TooltipBehavior(enable: true),
),
majorTickLines: MajorTickLines(size: 0),
),
series: _getSplineSeries(),
tooltipBehavior: TooltipBehavior(enable: true),
],
);
}
@@ -62,7 +88,7 @@ class ImtChartWidget extends StatelessWidget {
color: Colors.blue,
name: 'ИМТ',
xValueMapper: (ProfileModel.ChartPoint value, int index) => value.createdAt,
yValueMapper: (ProfileModel.ChartPoint value, int index) => double.parse(value.bmi),
yValueMapper: (ProfileModel.ChartPoint value, int index) => value.bmi,
),
];
}