Skip to content

Commit

Permalink
134 points animation (#142)
Browse files Browse the repository at this point in the history
* our grading animation

* polishcapital animation

* chore: format

---------

Co-authored-by: Marcin Stepnowski <[email protected]>
  • Loading branch information
karolgeneral and WezSieTato authored Nov 28, 2024
1 parent 610d21c commit ff24f9b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 52 deletions.
22 changes: 13 additions & 9 deletions lib/pages/detail/company_score_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Color>(AppColors.defaultRed),
minHeight: 12.0,
),
),
borderRadius: BorderRadius.circular(10.0),
child: TweenAnimationBuilder(
duration: Duration(milliseconds: data.plScore * 10),
tween: Tween<double>(begin: 0, end: data.plScore.toDouble()),
builder: (_, double score, __) {
return LinearProgressIndicator(
value: score / 100.0,
backgroundColor: AppColors.buttonBackground,
valueColor: const AlwaysStoppedAnimation<Color>(
AppColors.defaultRed),
minHeight: 12.0,
);
})),
),
const SizedBox(height: 17.0),
Divider(
Expand Down
89 changes: 46 additions & 43 deletions lib/pages/detail/polish_capital_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,60 @@ class PolishCapitalGraph extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: size,
width: size,
child: SfRadialGauge(
axes: <RadialAxis>[
RadialAxis(
minimum: 0,
maximum: 100,
showLabels: false,
showTicks: false,
axisLineStyle: AxisLineStyle(
thickness: thickness,
cornerStyle: CornerStyle.bothCurve,
color: AppColors.buttonBackground,
thicknessUnit: GaugeSizeUnit.factor,
),
pointers: <GaugePointer>[
RangePointer(
value: percentage,
cornerStyle: CornerStyle.bothCurve,
width: thickness,
sizeUnit: GaugeSizeUnit.factor,
color: AppColors.defaultRed,
),
],
annotations: <GaugeAnnotation>[
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<double>(begin: 0, end: percentage),
builder: (_, double score, __) {
return SfRadialGauge(
axes: <RadialAxis>[
RadialAxis(
minimum: 0,
maximum: 100,
showLabels: false,
showTicks: false,
axisLineStyle: AxisLineStyle(
thickness: thickness,
cornerStyle: CornerStyle.bothCurve,
color: AppColors.buttonBackground,
thicknessUnit: GaugeSizeUnit.factor,
),
pointers: <GaugePointer>[
RangePointer(
value: score,
cornerStyle: CornerStyle.bothCurve,
width: thickness,
sizeUnit: GaugeSizeUnit.factor,
color: AppColors.defaultRed,
),
],
annotations: <GaugeAnnotation>[
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(
t.companyScreen.polishCapital,
style: TextStyle(
fontSize: 11.0,
fontWeight: FontWeight.w400,
color: AppColors.text,
color: AppColors.text,
fontFamily: FontFamily.lato,
),
),
Expand Down

0 comments on commit ff24f9b

Please sign in to comment.