As a developer, I want an easy way to display all kinds of stats in a card
Requirements
Implement a generic StatCard which offers two layout (small and large), it should displays:
an icon
a stats (accepts a string)
an optional subtitle
On the StatCard, add named constructor for:
small layout
large layout
streak (icon: red Icons.whatshot_rounded
timer (icon: Icons.timer_rounded)
words (icon: Icons.translate_rounded)
What needs to be done
Under src/core/widgets, implement a stateless widget StatCard:
constructor takes:
Icon icon: icon to display on the left side
String title: the main element to display, likely a statistique like a percentage or a number
String? subtitle: the text to display under the title, it should be smaller and grey (see Figma file)
bool isSmall: indicate which to use
Color? backgroundColor: override the default background color
TextStyle? titleTextStyle: override the default text style for the title
TextStyle? subtitleTextStyle: override the default text style for the subtitle
named constructors:
.small should take everything from the main constructor except isSmall that will be set to true
.large should take everything from the main constructor except isSmall that will be set to false
.streak should take everything from the main constructor except icon, title, subtitle, it should add an int days. Those should be:
icon: Icons.whatshot_rounded
title: '$days days' for the large, and $days for small ⚠️ don't forget to localize the string
subtitle: 'of continued learning' ⚠️ don't forget to localize the string
.timer should take everything from the main constructor except icon, title, subtitle and isSmall, it should add an Duration elapsedTime. Those should be:
icon: Icons.timer_rounded
title: '$duration' ⚠️ don't forget to localize the string
isSmall: true
.words should take everything from the main constructor except icon, title, subtitle, it should add an int words and bool? newWords = false. Those should be:
icon: Icons.translate_rounded
title: '$words words' for large, and $words or +$words if newWords is provided for small ⚠️ don't forget to localize the string
subtitle: 'learned' ⚠️ don't forget to localize the string
displays:
the icon on the left
the title using titleTextStyle or Body Medium
underneath the title, the subtitle using subtitleTextStyle or Body Small in grey
wrap everything in a Card
Design
Wireframe of StatCard small layout
![image](https://github.com/RoadTripMoustache/kana_to_kanji/assets/22211097/7d2249e8-4eb5-4c15-b486-ccedebd6170d)
Wireframes of StatCard large layout
![image](https://github.com/RoadTripMoustache/kana_to_kanji/assets/22211097/97181201-5b1a-495d-9e62-69e24c1dd260)
As a developer, I want an easy way to display all kinds of stats in a card
Requirements
Implement a generic
StatCard
which offers two layout (small and large), it should displays:On the
StatCard
, add named constructor for:Icons.whatshot_rounded
Icons.timer_rounded
)Icons.translate_rounded
)What needs to be done
Under
src/core/widgets
, implement a stateless widgetStatCard
:Icon icon
: icon to display on the left sideString title
: the main element to display, likely a statistique like a percentage or a numberString? subtitle
: the text to display under thetitle
, it should be smaller and grey (see Figma file)bool isSmall
: indicate which to useColor? backgroundColor
: override the default background colorTextStyle? titleTextStyle
: override the default text style for the titleTextStyle? subtitleTextStyle
: override the default text style for the subtitle.small
should take everything from the main constructor exceptisSmall
that will be set to true.large
should take everything from the main constructor exceptisSmall
that will be set to false.streak
should take everything from the main constructor excepticon
,title
,subtitle
, it should add anint days
. Those should be:icon: Icons.whatshot_rounded
title: '$days days'
for the large, and$days
for small ⚠️ don't forget to localize the stringsubtitle: 'of continued learning'
⚠️ don't forget to localize the string.timer
should take everything from the main constructor excepticon
,title
,subtitle
andisSmall
, it should add anDuration elapsedTime
. Those should be:icon: Icons.timer_rounded
title: '$duration'
⚠️ don't forget to localize the stringisSmall: true
.words
should take everything from the main constructor excepticon
,title
,subtitle
, it should add anint words
andbool? newWords = false
. Those should be:icon: Icons.translate_rounded
title: '$words words'
for large, and$words
or+$words
ifnewWords
is provided for small ⚠️ don't forget to localize the stringsubtitle: 'learned'
⚠️ don't forget to localize the stringtitle
usingtitleTextStyle
or Body Mediumtitle
, thesubtitle
usingsubtitleTextStyle
or Body Small in greyCard
Design
Wireframe of
![image](https://github.com/RoadTripMoustache/kana_to_kanji/assets/22211097/7d2249e8-4eb5-4c15-b486-ccedebd6170d)StatCard
small layoutWireframes of
![image](https://github.com/RoadTripMoustache/kana_to_kanji/assets/22211097/97181201-5b1a-495d-9e62-69e24c1dd260)StatCard
large layoutDependencies
Child of #210
Dev notes