diff --git a/lib/features/diary/presentation/pages/diary_screen.dart b/lib/features/diary/presentation/pages/diary_screen.dart index 452e9b8e..e82d338f 100644 --- a/lib/features/diary/presentation/pages/diary_screen.dart +++ b/lib/features/diary/presentation/pages/diary_screen.dart @@ -254,126 +254,136 @@ class _DiaryScreenState extends State { height: 1, ), ), - SfRadialGauge( - axes: [ - RadialAxis( - startAngle: 180, - endAngle: 0, - minimum: 0, - maximum: 100, - showLabels: false, - showTicks: false, - radiusFactor: 0.7, - axisLineStyle: AxisLineStyle( - thickness: 0.1, - color: Colors.grey[200], - thicknessUnit: GaugeSizeUnit.factor, - ), - pointers: [ - // Carbohydrates Arc - RangePointer( - value: (chartData[0].intake / chartData[0].recommendation) * 100, - width: 0.16, - color: chartData[0].color, - sizeUnit: GaugeSizeUnit.factor, - enableAnimation: true, - cornerStyle: CornerStyle.bothCurve, // Rounded ends - ), - // Fats Arc - RangePointer( - value: (chartData[1].intake / chartData[1].recommendation) * 100, - width: 0.16, - color: chartData[1].color, - sizeUnit: GaugeSizeUnit.factor, - enableAnimation: true, - cornerStyle: CornerStyle.bothCurve, - pointerOffset: -0.18, - ), - // Proteins Arc - RangePointer( - value: (chartData[2].intake / chartData[2].recommendation) * 100, - width: 0.16, - color: chartData[2].color, - sizeUnit: GaugeSizeUnit.factor, - enableAnimation: true, - cornerStyle: CornerStyle.bothCurve, - pointerOffset: -0.36, - ), - // Calories Arc - RangePointer( - value: (chartData[3].intake / chartData[3].recommendation) * 100, - width: 0.16, - color: chartData[3].color, - sizeUnit: GaugeSizeUnit.factor, - enableAnimation: true, - cornerStyle: CornerStyle.bothCurve, - pointerOffset: -0.54, + const SizedBox(height: 48), + Stack( + alignment: Alignment.bottomCenter, + children: [ + SfRadialGauge( + axes: [ + RadialAxis( + startAngle: 180, + endAngle: 0, + minimum: 0, + maximum: 100, + showLabels: false, + showTicks: false, + radiusFactor: 0.7, + axisLineStyle: AxisLineStyle( + thickness: 0.1, + color: Colors.grey[200], + thicknessUnit: GaugeSizeUnit.factor, + ), + pointers: [ + // Carbohydrates Arc + RangePointer( + value: (chartData[0].intake / chartData[0].recommendation) * 100, + width: 0.16, + color: chartData[0].color, + sizeUnit: GaugeSizeUnit.factor, + enableAnimation: true, + cornerStyle: CornerStyle.bothCurve, // Rounded ends + ), + // Fats Arc + RangePointer( + value: (chartData[1].intake / chartData[1].recommendation) * 100, + width: 0.16, + color: chartData[1].color, + sizeUnit: GaugeSizeUnit.factor, + enableAnimation: true, + cornerStyle: CornerStyle.bothCurve, + pointerOffset: -0.18, + ), + // Proteins Arc + RangePointer( + value: (chartData[2].intake / chartData[2].recommendation) * 100, + width: 0.16, + color: chartData[2].color, + sizeUnit: GaugeSizeUnit.factor, + enableAnimation: true, + cornerStyle: CornerStyle.bothCurve, + pointerOffset: -0.36, + ), + // Calories Arc + RangePointer( + value: (chartData[3].intake / chartData[3].recommendation) * 100, + width: 0.16, + color: chartData[3].color, + sizeUnit: GaugeSizeUnit.factor, + enableAnimation: true, + cornerStyle: CornerStyle.bothCurve, + pointerOffset: -0.54, + ), + ], + annotations: [ + // Label for Carbohydrates + GaugeAnnotation( + widget: Transform.rotate( + angle: 30.1, + child: Text( + 'Углеводы', + style: TextStyle(color: Colors.white, fontSize: 12), + ), + ), + angle: 198, + positionFactor: 0.92, + ), + // Label for Fats + GaugeAnnotation( + widget: Transform.rotate( + angle: 30, + child: Text( + 'Жиры', + style: TextStyle(color: Colors.white, fontSize: 12), + ), + ), + angle: 190, + positionFactor: 1.1, + ), + // Label for Proteins + GaugeAnnotation( + widget: Transform.rotate( + angle: 30, + child: Text( + 'Белки', + style: TextStyle(color: Colors.white, fontSize: 12), + ), + ), + angle: 190, + positionFactor: 1.27, + ), + // Label for Calories + GaugeAnnotation( + widget: Transform.rotate( + angle: 30, + child: Text( + 'Калории', + style: TextStyle(color: Colors.white, fontSize: 12), + ), + ), + angle: 192, + positionFactor: 1.46, + ), + ], ), ], - annotations: [ - // Label for Carbohydrates - GaugeAnnotation( - widget: Transform.rotate( - angle: 30.1, - child: Text( - 'Углеводы', - style: TextStyle(color: Colors.white, fontSize: 12), - ), - ), - angle: 198, - positionFactor: 0.92, - ), - // Label for Fats - GaugeAnnotation( - widget: Transform.rotate( - angle: 30, - child: Text( - 'Жиры', - style: TextStyle(color: Colors.white, fontSize: 12), - ), - ), - angle: 190, - positionFactor: 1.1, - ), - // Label for Proteins - GaugeAnnotation( - widget: Transform.rotate( - angle: 30, - child: Text( - 'Белки', - style: TextStyle(color: Colors.white, fontSize: 12), - ), - ), - angle: 190, - positionFactor: 1.27, - ), - // Label for Calories - GaugeAnnotation( - widget: Transform.rotate( - angle: 30, - child: Text( - 'Калории', - style: TextStyle(color: Colors.white, fontSize: 12), - ), - ), - angle: 192, - positionFactor: 1.46, - ), + ), + Column( + children: [ + _chartData('Калории', + '${nutrition.dailyNutritionIntake.energy.toStringAsFixed(0)} из ${nutrition.dailyNutritionRecommendation.energy.toStringAsFixed(0)} ккал'), + const SizedBox(height: 8), + _chartData('Белки', + '${nutrition.dailyNutritionIntake.proteins.toStringAsFixed(0)} из ${nutrition.dailyNutritionRecommendation.proteins.toStringAsFixed(0)} грамм'), + const SizedBox(height: 8), + _chartData('Жиры', + '${nutrition.dailyNutritionIntake.fats.toStringAsFixed(0)} из ${nutrition.dailyNutritionRecommendation.fats.toStringAsFixed(0)} грамм'), + const SizedBox(height: 8), + _chartData('Углеводы', + '${nutrition.dailyNutritionIntake.carbohydrates.toStringAsFixed(0)} из ${nutrition.dailyNutritionRecommendation.carbohydrates.toStringAsFixed(0)} грамм'), ], ), ], ), - _chartData('Калории', - '${nutrition.dailyNutritionIntake.energy.toStringAsFixed(0)} из ${nutrition.dailyNutritionRecommendation.energy.toStringAsFixed(0)} ккал'), - const SizedBox(height: 8), - _chartData('Белки', - '${nutrition.dailyNutritionIntake.proteins.toStringAsFixed(0)} из ${nutrition.dailyNutritionRecommendation.proteins.toStringAsFixed(0)} грамм'), - const SizedBox(height: 8), - _chartData( - 'Жиры', '${nutrition.dailyNutritionIntake.fats.toStringAsFixed(0)} из ${nutrition.dailyNutritionRecommendation.fats.toStringAsFixed(0)} грамм'), - const SizedBox(height: 8), - _chartData('Углеводы', - '${nutrition.dailyNutritionIntake.carbohydrates.toStringAsFixed(0)} из ${nutrition.dailyNutritionRecommendation.carbohydrates.toStringAsFixed(0)} грамм'), ], ), );