From 22ebc9c5535c6245dd638b9f19823a8acc39b97c Mon Sep 17 00:00:00 2001 From: Karol Stolarczyk Date: Tue, 5 Nov 2024 15:56:09 +0100 Subject: [PATCH 1/3] our grading animation --- lib/pages/detail/company_score_widget.dart | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/pages/detail/company_score_widget.dart b/lib/pages/detail/company_score_widget.dart index 2544d9e..5eeeb11 100644 --- a/lib/pages/detail/company_score_widget.dart +++ b/lib/pages/detail/company_score_widget.dart @@ -66,15 +66,19 @@ class CompanyScoreWidget extends StatelessWidget { Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: ClipRRect( - borderRadius: BorderRadius.circular(10.0), - child: LinearProgressIndicator( - value: data.plScore / 100.0, - backgroundColor: AppColors.buttonBackground, - valueColor: - const AlwaysStoppedAnimation(AppColors.defaultRed), - minHeight: 12.0, - ), - ), + borderRadius: BorderRadius.circular(10.0), + child: TweenAnimationBuilder( + duration: Duration(milliseconds: data.plScore * 10), + tween: Tween(begin: 0, end: data.plScore.toDouble()), + builder: (_, double score, __) { + return LinearProgressIndicator( + value: score / 100.0, + backgroundColor: AppColors.buttonBackground, + valueColor: const AlwaysStoppedAnimation( + AppColors.defaultRed), + minHeight: 12.0, + ); + })), ), const SizedBox(height: 17.0), Divider( From cb3f6534b09323bcf7f0a3397c6d61cedb431aa8 Mon Sep 17 00:00:00 2001 From: Karol Stolarczyk Date: Tue, 5 Nov 2024 17:11:03 +0100 Subject: [PATCH 2/3] polishcapital animation --- lib/pages/detail/polish_capital_graph.dart | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/pages/detail/polish_capital_graph.dart b/lib/pages/detail/polish_capital_graph.dart index 04cd554..b908eac 100644 --- a/lib/pages/detail/polish_capital_graph.dart +++ b/lib/pages/detail/polish_capital_graph.dart @@ -19,7 +19,12 @@ class PolishCapitalGraph extends StatelessWidget { SizedBox( height: size, width: size, - child: SfRadialGauge( + child: + TweenAnimationBuilder( + duration: Duration(milliseconds: percentage.toInt() * 10), + tween: Tween(begin: 0, end: percentage), + builder: (_, double score, __) { + return SfRadialGauge( axes: [ RadialAxis( minimum: 0, @@ -34,7 +39,7 @@ class PolishCapitalGraph extends StatelessWidget { ), pointers: [ RangePointer( - value: percentage, + value: score, cornerStyle: CornerStyle.bothCurve, width: thickness, sizeUnit: GaugeSizeUnit.factor, @@ -54,11 +59,14 @@ class PolishCapitalGraph extends StatelessWidget { color: AppColors.text), ), ), - + ], ), ], - ), + ); + } + ) + ), Padding( padding: const EdgeInsets.only(top: 0.0), From 9e260281f58c2b776edd3716d72399fd0d6cdd00 Mon Sep 17 00:00:00 2001 From: Marcin Stepnowski Date: Thu, 28 Nov 2024 16:02:46 +0100 Subject: [PATCH 3/3] chore: format --- lib/pages/detail/polish_capital_graph.dart | 97 ++++++++++------------ 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/lib/pages/detail/polish_capital_graph.dart b/lib/pages/detail/polish_capital_graph.dart index b908eac..78cdbc1 100644 --- a/lib/pages/detail/polish_capital_graph.dart +++ b/lib/pages/detail/polish_capital_graph.dart @@ -17,57 +17,52 @@ class PolishCapitalGraph extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( - height: size, - width: size, - child: - TweenAnimationBuilder( - duration: Duration(milliseconds: percentage.toInt() * 10), - tween: Tween(begin: 0, end: percentage), - builder: (_, double score, __) { - return SfRadialGauge( - axes: [ - RadialAxis( - minimum: 0, - maximum: 100, - showLabels: false, - showTicks: false, - axisLineStyle: AxisLineStyle( - thickness: thickness, - cornerStyle: CornerStyle.bothCurve, - color: AppColors.buttonBackground, - thicknessUnit: GaugeSizeUnit.factor, - ), - pointers: [ - RangePointer( - value: score, - cornerStyle: CornerStyle.bothCurve, - width: thickness, - sizeUnit: GaugeSizeUnit.factor, - color: AppColors.defaultRed, - ), - ], - annotations: [ - GaugeAnnotation( - positionFactor: 0.01, - angle: 90, - widget: Text( - '${percentage.toInt()}%', - style: TextStyle( - fontSize: 26.0, - fontWeight: FontWeight.w700, - fontFamily: FontFamily.lato, - color: AppColors.text), + height: size, + width: size, + child: TweenAnimationBuilder( + duration: Duration(milliseconds: percentage.toInt() * 10), + tween: Tween(begin: 0, end: percentage), + builder: (_, double score, __) { + return SfRadialGauge( + axes: [ + RadialAxis( + minimum: 0, + maximum: 100, + showLabels: false, + showTicks: false, + axisLineStyle: AxisLineStyle( + thickness: thickness, + cornerStyle: CornerStyle.bothCurve, + color: AppColors.buttonBackground, + thicknessUnit: GaugeSizeUnit.factor, + ), + pointers: [ + RangePointer( + value: score, + cornerStyle: CornerStyle.bothCurve, + width: thickness, + sizeUnit: GaugeSizeUnit.factor, + color: AppColors.defaultRed, + ), + ], + annotations: [ + GaugeAnnotation( + positionFactor: 0.01, + angle: 90, + widget: Text( + '${percentage.toInt()}%', + style: TextStyle( + fontSize: 26.0, + fontWeight: FontWeight.w700, + fontFamily: FontFamily.lato, + color: AppColors.text), + ), + ), + ], ), - ), - - ], - ), - ], - ); - } - ) - - ), + ], + ); + })), Padding( padding: const EdgeInsets.only(top: 0.0), child: Text( @@ -75,7 +70,7 @@ class PolishCapitalGraph extends StatelessWidget { style: TextStyle( fontSize: 11.0, fontWeight: FontWeight.w400, - color: AppColors.text, + color: AppColors.text, fontFamily: FontFamily.lato, ), ),