diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index 290560a6..8753bb64 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -86,12 +86,6 @@ class _BlogPostWidgetState extends State { child: Html( data: widget.feedBlogPostModel.description, ), - // child: Text( - // widget.feedBlogPostModel.description, - // style: TextStyle( - // color: Colors.black87, - // ), - // ), ), if (widget.feedBlogPostModel.title.isNotEmpty || widget.feedBlogPostModel.description.isNotEmpty) SizedBox(height: 8), GestureDetector( diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index 05f53ce8..de0336fc 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -112,20 +112,21 @@ class _ProfileScreenState extends State { ), Builder( builder: (context) { - if (_selectedChipIndex == 0) - return WeightChartWidget( - chartPoints: chartPoints, - profileCubit: context.read(), - ); - if (_selectedChipIndex == 1) - return CircumferenceChartWidget( - chartData: chartData, - profileCubit: context.read(), - ); - if (_selectedChipIndex == 2) - return ImtChartWidget(chartPoints: chartPoints); - else - return Container(); + switch (_selectedChipIndex) { + case 0: + return WeightChartWidget( + chartPoints: chartPoints, + profileCubit: context.read(), + ); + case 1: + return CircumferenceChartWidget( + chartData: chartData, + profileCubit: context.read(), + ); + case 2: + return ImtChartWidget(chartPoints: chartPoints); + } + return SizedBox.shrink(); }, ), SizedBox(height: 8), diff --git a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart index 23f9c55d..650c0990 100644 --- a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart @@ -21,89 +21,76 @@ class CircumferenceChartWidget extends StatefulWidget { } class _CircumferenceChartWidgetState extends State { - late final chestController; - late final hipController; - late final waistController; + late FixedExtentScrollController chestController; + late FixedExtentScrollController waistController; + late FixedExtentScrollController hipController; late int chest; - late int hip; late int waist; - - @override - void initState() { - super.initState(); - chestController = FixedExtentScrollController(initialItem: int.parse(widget.chartData.last.chestCircumference.toString())); - hipController = FixedExtentScrollController(initialItem: int.parse(widget.chartData.last.hipCircumference.toString())); - waistController = FixedExtentScrollController(initialItem: int.parse(widget.chartData.last.waistCircumference.toString())); - chest = widget.chartData.last.chestCircumference; - hip = widget.chartData.last.hipCircumference; - waist = widget.chartData.last.waistCircumference; - } + late int hip; @override Widget build(BuildContext context) { return Column( children: [ - SingleChildScrollView( + Padding( padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - scrollDirection: Axis.horizontal, - physics: const BouncingScrollPhysics(), child: Row( children: [ Text( - '${widget.chartData.last.chestCircumference} см', + '${widget.chartData.last.chestCircumference}', style: TextStyle( color: Colors.black, - fontSize: 48, + fontSize: 40, fontWeight: FontWeight.w500, ), ), widget.chartData.last.chestCircumference > widget.chartData[widget.chartData.length - 2].chestCircumference ? Icon( Icons.arrow_drop_up, - size: 48, + size: 40, color: Colors.grey, ) : Icon( Icons.arrow_drop_down, - size: 48, + size: 40, color: Colors.grey, ), Text( - '${widget.chartData.last.waistCircumference} см', + '${widget.chartData.last.waistCircumference}', style: TextStyle( color: Colors.black, - fontSize: 48, + fontSize: 40, fontWeight: FontWeight.w500, ), ), widget.chartData.last.waistCircumference > widget.chartData[widget.chartData.length - 2].waistCircumference ? Icon( Icons.arrow_drop_up, - size: 48, + size: 40, color: Colors.grey, ) : Icon( Icons.arrow_drop_down, - size: 48, + size: 40, color: Colors.grey, ), Text( - '${widget.chartData.last.hipCircumference} см', + '${widget.chartData.last.hipCircumference}', style: TextStyle( color: Colors.black, - fontSize: 48, + fontSize: 40, fontWeight: FontWeight.w500, ), ), widget.chartData.last.hipCircumference > widget.chartData[widget.chartData.length - 2].hipCircumference ? Icon( Icons.arrow_drop_up, - size: 48, + size: 40, color: Colors.grey, ) : Icon( Icons.arrow_drop_down, - size: 48, + size: 40, color: Colors.grey, ), ], @@ -151,8 +138,14 @@ class _CircumferenceChartWidgetState extends State { tooltipBehavior: TooltipBehavior(enable: true), ), FloatingActionButton.small( - heroTag: 'addWeight', + 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); showModalBottomSheet( useRootNavigator: true, context: context, @@ -173,22 +166,7 @@ class _CircumferenceChartWidgetState extends State { chest = value; }, children: [ - for (int i = 0; i < 301; i++) Text('$i'), - ], - ), - ), - Expanded( - child: CupertinoPicker( - magnification: 1.22, - squeeze: 1.2, - useMagnifier: true, - scrollController: hipController, - itemExtent: 24, - onSelectedItemChanged: (int value) { - hip = value; - }, - children: [ - for (int i = 0; i < 301; i++) Text('$i'), + for (int i = 20; i < 200; i++) Text('$i'), ], ), ), @@ -203,7 +181,22 @@ class _CircumferenceChartWidgetState extends State { waist = value; }, children: [ - for (int i = 0; i < 301; i++) Text('$i'), + for (int i = 20; i < 200; i++) Text('$i'), + ], + ), + ), + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: hipController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + hip = value; + }, + children: [ + for (int i = 20; i < 200; i++) Text('$i'), ], ), ), diff --git a/lib/features/profile/presentation/widgets/imt_chart_widget.dart b/lib/features/profile/presentation/widgets/imt_chart_widget.dart index eaf5808a..6646367e 100644 --- a/lib/features/profile/presentation/widgets/imt_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/imt_chart_widget.dart @@ -22,22 +22,22 @@ class ImtChartWidget extends StatelessWidget { child: Row( children: [ Text( - '${chartPoints.last.bmi.toStringAsFixed(2)} кг/м²', + '${chartPoints.last.bmi.toStringAsFixed(2)}', style: TextStyle( color: Colors.black, - fontSize: 48, + fontSize: 40, fontWeight: FontWeight.w500, ), ), chartPoints.last.bmi > chartPoints[chartPoints.length - 2].bmi ? Icon( Icons.arrow_drop_up, - size: 48, + size: 40, color: Colors.grey, ) : Icon( Icons.arrow_drop_down, - size: 48, + size: 40, color: Colors.grey, ), ], diff --git a/lib/features/profile/presentation/widgets/weight_chart_widget.dart b/lib/features/profile/presentation/widgets/weight_chart_widget.dart index 684a052c..ce3222c8 100644 --- a/lib/features/profile/presentation/widgets/weight_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/weight_chart_widget.dart @@ -21,20 +21,11 @@ class WeightChartWidget extends StatefulWidget { } class _WeightChartWidgetState extends State { - late final weightKiloController; - late final weightGramsController; + late FixedExtentScrollController weightKiloController; + late FixedExtentScrollController weightGramsController; late int weightKilo; late int weightGrams; - @override - void initState() { - super.initState(); - weightKiloController = FixedExtentScrollController(initialItem: int.parse(widget.chartPoints.last.weight.toString().split('.')[0]) - 20); - weightGramsController = FixedExtentScrollController(initialItem: int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0])); - weightKilo = int.parse(widget.chartPoints.last.weight.toString().split('.')[0]); - weightGrams = int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]); - } - @override Widget build(BuildContext context) { return Column( @@ -48,19 +39,19 @@ class _WeightChartWidgetState extends State { '${widget.chartPoints.last.weight.toStringAsFixed(1)} кг', style: TextStyle( color: Colors.black, - fontSize: 48, + fontSize: 40, fontWeight: FontWeight.w500, ), ), widget.chartPoints.last.weight > widget.chartPoints[widget.chartPoints.length - 2].weight ? Icon( Icons.arrow_drop_up, - size: 48, + size: 40, color: Colors.grey.withOpacity(0.4), ) : Icon( Icons.arrow_drop_down, - size: 48, + size: 40, color: Colors.grey.withOpacity(0.4), ), ], @@ -113,6 +104,10 @@ class _WeightChartWidgetState extends State { 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); showModalBottomSheet( useRootNavigator: true, context: context, @@ -133,7 +128,7 @@ class _WeightChartWidgetState extends State { weightKilo = value + 20; }, children: [ - for (int i = 20; i < 301; i++) Text('$i'), + for (int i = 20; i < 300; i++) Text('$i'), ], ), ),