feat(profile): some fixes, add buttons

This commit is contained in:
mso7nueh
2024-09-04 17:27:46 +03:00
parent d76f535663
commit f9c10047b2
154 changed files with 1249 additions and 296 deletions

View File

@@ -9,6 +9,7 @@ import 'package:eatvio_app/features/profile/presentation/widgets/imt_chart_widge
import 'package:eatvio_app/features/profile/presentation/widgets/weight_chart_widget.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class ProfileScreen extends StatefulWidget {
final Author? author;
@@ -62,35 +63,125 @@ class _ProfileScreenState extends State<ProfileScreen> {
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Row(
children: [
CircleAvatar(
radius: 32,
backgroundImage: NetworkImage(state.profile.user.profilePhotoUrl),
),
state.profile.user.profilePhotoUrl != null
? CircleAvatar(
radius: 32,
backgroundImage: NetworkImage(state.profile.user.profilePhotoUrl!),
)
: CircleAvatar(
radius: 32,
),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
Text(
state.profile.user.name,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.w500,
height: 1,
),
),
const Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
state.profile.user.name,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.w500,
height: 1,
Container(
child: SvgPicture.asset(
height: 28,
width: 28,
'assets/icons/subscribers.svg',
colorFilter: ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn),
),
),
if (state.profile.userDetails.additionalInfo.isNotEmpty)
Text(
state.profile.userDetails.additionalInfo,
style: TextStyle(
color: Colors.black.withOpacity(0.4),
height: 1,
SizedBox(width: 8),
Column(
children: [
Text(
'123',
style: TextStyle(
height: 1,
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.black87,
),
),
),
Text(
'Подписчика',
style: TextStyle(
height: 1,
fontSize: 12,
fontWeight: FontWeight.w400,
color: Colors.black38,
),
),
],
),
],
),
Container(
padding: EdgeInsets.only(left: 16),
child: SvgPicture.asset(
height: 24,
width: 24,
'assets/icons/share.svg',
colorFilter: ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn),
),
),
],
),
),
if (state.profile.userDetails.additionalInfo.isNotEmpty)
Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.all(16),
child: Text(
state.profile.userDetails.additionalInfo,
style: TextStyle(
color: Colors.black.withOpacity(0.4),
height: 1,
),
),
),
if (widget.author != null) const SizedBox(height: 8),
if (widget.author != null)
Row(
children: [
SizedBox(width: 16),
Container(
alignment: Alignment.center,
padding: EdgeInsets.all(8),
width: (MediaQuery.of(context).size.width - 40) / 2,
decoration: BoxDecoration(
color: appTheme.blueA400.withOpacity(0.1),
borderRadius: BorderRadius.circular(16),
),
child: Text(
'Сообщение',
style: TextStyle(
color: appTheme.blueA400,
),
),
),
SizedBox(width: 8),
Container(
alignment: Alignment.center,
padding: EdgeInsets.all(8),
width: (MediaQuery.of(context).size.width - 40) / 2,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(16),
),
child: Text(
'Подписаться',
style: TextStyle(
color: Colors.white,
),
),
),
SizedBox(width: 16),
],
),
if (widget.author != null) SizedBox(height: 16),
if (widget.author == null) _divider(context),
if (widget.author == null)
Column(

View File

@@ -32,70 +32,104 @@ class _CircumferenceChartWidgetState extends State<CircumferenceChartWidget> {
Widget build(BuildContext context) {
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'${widget.chartData.last.chestCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
if (widget.chartData.isNotEmpty)
Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'${widget.chartData.last.chestCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
),
),
widget.chartData.last.chestCircumference > widget.chartData[widget.chartData.length - 2].chestCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
if (widget.chartData.length == 1)
Container(
margin: EdgeInsets.symmetric(horizontal: 12),
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black12,
),
Text(
'${widget.chartData.last.waistCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
if (widget.chartData.length > 1)
widget.chartData.last.chestCircumference > widget.chartData[widget.chartData.length - 2].chestCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
),
Text(
'${widget.chartData.last.waistCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
),
),
widget.chartData.last.waistCircumference > widget.chartData[widget.chartData.length - 2].waistCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
if (widget.chartData.length == 1)
Container(
margin: EdgeInsets.symmetric(horizontal: 12),
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black12,
),
Text(
'${widget.chartData.last.hipCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
if (widget.chartData.length > 1)
widget.chartData.last.waistCircumference > widget.chartData[widget.chartData.length - 2].waistCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
),
Text(
'${widget.chartData.last.hipCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
),
),
widget.chartData.last.hipCircumference > widget.chartData[widget.chartData.length - 2].hipCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
if (widget.chartData.length == 1)
Container(
margin: EdgeInsets.symmetric(horizontal: 12),
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black12,
),
],
),
if (widget.chartData.length > 1)
widget.chartData.last.hipCircumference > widget.chartData[widget.chartData.length - 2].hipCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
),
],
),
),
),
Stack(
alignment: Alignment.bottomRight,
children: [
@@ -140,12 +174,18 @@ class _CircumferenceChartWidgetState extends State<CircumferenceChartWidget> {
FloatingActionButton.small(
heroTag: 'addCircumference',
onPressed: () {
chest = widget.chartData.last.chestCircumference;
waist = widget.chartData.last.waistCircumference;
hip = widget.chartData.last.hipCircumference;
chestController = FixedExtentScrollController(initialItem: chest - 20);
waistController = FixedExtentScrollController(initialItem: waist - 20);
hipController = FixedExtentScrollController(initialItem: hip - 20);
if (widget.chartData.isNotEmpty) {
chest = widget.chartData.last.chestCircumference;
waist = widget.chartData.last.waistCircumference;
hip = widget.chartData.last.hipCircumference;
chestController = FixedExtentScrollController(initialItem: chest - 20);
waistController = FixedExtentScrollController(initialItem: waist - 20);
hipController = FixedExtentScrollController(initialItem: hip - 20);
} else {
chestController = FixedExtentScrollController();
waistController = FixedExtentScrollController();
hipController = FixedExtentScrollController();
}
showModalBottomSheet(
useRootNavigator: true,
context: context,

View File

@@ -31,83 +31,97 @@ class _WeightChartWidgetState extends State<WeightChartWidget> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'${widget.chartPoints.last.weight.toStringAsFixed(1)} кг',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
if (widget.chartPoints.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'${widget.chartPoints.last.weight.toStringAsFixed(1)} кг',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
),
),
widget.chartPoints.last.weight > widget.chartPoints[widget.chartPoints.length - 2].weight
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey.withOpacity(0.4),
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey.withOpacity(0.4),
if (widget.chartPoints.length == 1)
Container(
margin: EdgeInsets.symmetric(horizontal: 12),
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black12,
),
],
),
if (widget.chartPoints.length > 1) widget.chartPoints.last.weight > widget.chartPoints[widget.chartPoints.length - 2].weight
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey.withOpacity(0.4),
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey.withOpacity(0.4),
),
],
),
),
),
Stack(
alignment: Alignment.bottomRight,
children: [
SfCartesianChart(
margin: EdgeInsets.symmetric(horizontal: 8),
enableAxisAnimation: true,
plotAreaBorderWidth: 0,
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
tooltipSettings: InteractiveTooltip(),
lineType: TrackballLineType.vertical,
SfCartesianChart(
margin: EdgeInsets.symmetric(horizontal: 8),
enableAxisAnimation: true,
plotAreaBorderWidth: 0,
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
tooltipSettings: InteractiveTooltip(),
lineType: TrackballLineType.vertical,
),
primaryXAxis: DateTimeCategoryAxis(
tickPosition: TickPosition.inside,
majorTickLines: MajorTickLines(
size: 0,
),
edgeLabelPlacement: EdgeLabelPlacement.shift,
dateFormat: DateFormat.MMMd('ru'),
labelStyle: TextStyle(
color: Colors.grey,
),
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
axisLine: AxisLine(
color: Colors.grey.withOpacity(0.3),
width: 0.4,
),
),
primaryYAxis: NumericAxis(
isVisible: false,
labelFormat: '{value} кг',
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey),
axisLine: AxisLine(
width: 1,
),
majorTickLines: MajorTickLines(size: 0),
),
series: _getSplineSeries(),
tooltipBehavior: TooltipBehavior(enable: true),
),
primaryXAxis: DateTimeCategoryAxis(
initialVisibleMinimum: widget.chartPoints.first.createdAt,
initialVisibleMaximum: widget.chartPoints.last.createdAt,
tickPosition: TickPosition.inside,
majorTickLines: MajorTickLines(
size: 0,
),
edgeLabelPlacement: EdgeLabelPlacement.shift,
dateFormat: DateFormat.MMMd('ru'),
labelStyle: TextStyle(
color: Colors.grey,
),
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
axisLine: AxisLine(
color: Colors.grey.withOpacity(0.3),
width: 0.4,
),
),
primaryYAxis: NumericAxis(
isVisible: false,
labelFormat: '{value} кг',
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey),
axisLine: AxisLine(
width: 1,
),
majorTickLines: MajorTickLines(size: 0),
),
series: _getSplineSeries(),
tooltipBehavior: TooltipBehavior(enable: true),
),
FloatingActionButton.small(
heroTag: 'addWeight',
onPressed: () {
weightKilo = int.parse(widget.chartPoints.last.weight.toString().split('.')[0]);
weightGrams = int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]);
weightKiloController = FixedExtentScrollController(initialItem: weightKilo - 20);
weightGramsController = FixedExtentScrollController(initialItem: weightGrams);
if (widget.chartPoints.isNotEmpty) {
weightKilo = int.parse(widget.chartPoints.last.weight.toString().split('.')[0]);
weightGrams = int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]);
weightKiloController = FixedExtentScrollController(initialItem: weightKilo - 20);
weightGramsController = FixedExtentScrollController(initialItem: weightGrams);
} else {
weightKiloController = FixedExtentScrollController();
weightGramsController = FixedExtentScrollController();
}
showModalBottomSheet(
useRootNavigator: true,
context: context,