line percent indicator fix
This commit is contained in:
parent
3d5cacfd08
commit
a1c3399afa
2 changed files with 50 additions and 31 deletions
|
@ -41,6 +41,7 @@ class FilterTable<T extends Comparable> extends StatelessWidget {
|
|||
|
||||
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
|
||||
final lineHeight = 16 * textScaleFactor;
|
||||
final barRadius = Radius.circular(lineHeight / 2);
|
||||
final isRtl = context.isRtl;
|
||||
|
||||
return Padding(
|
||||
|
@ -69,20 +70,27 @@ class FilterTable<T extends Comparable> extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
if (showPercentIndicator)
|
||||
LinearPercentIndicator(
|
||||
percent: percent,
|
||||
lineHeight: lineHeight,
|
||||
backgroundColor: Colors.white24,
|
||||
progressColor: stringToColor(label),
|
||||
animation: true,
|
||||
isRTL: isRtl,
|
||||
// TODO TLAD handle low percents being rendered with wrong radius clip
|
||||
barRadius: Radius.circular(lineHeight / 2),
|
||||
center: Text(
|
||||
intl.NumberFormat.percentPattern().format(percent),
|
||||
style: const TextStyle(shadows: Constants.embossShadows),
|
||||
),
|
||||
// as of percent_indicator v4.0.0, bar radius is not correctly applied to progress bar
|
||||
// when width is lower than height, so we clip it and handle padding outside
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: lineHeight),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(barRadius),
|
||||
child: LinearPercentIndicator(
|
||||
percent: percent,
|
||||
lineHeight: lineHeight,
|
||||
backgroundColor: Colors.white24,
|
||||
progressColor: stringToColor(label),
|
||||
animation: true,
|
||||
isRTL: isRtl,
|
||||
barRadius: barRadius,
|
||||
center: Text(
|
||||
intl.NumberFormat.percentPattern().format(percent),
|
||||
style: const TextStyle(shadows: Constants.embossShadows),
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'$count',
|
||||
|
|
|
@ -96,29 +96,40 @@ class StatsPage extends StatelessWidget {
|
|||
final withGpsPercent = withGpsCount / entries.length;
|
||||
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
|
||||
final lineHeight = 16 * textScaleFactor;
|
||||
final barRadius = Radius.circular(lineHeight / 2);
|
||||
final locationIndicator = Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
// end padding to match leading, so that inside label is aligned with outside label below
|
||||
padding: const EdgeInsetsDirectional.only(end: 24),
|
||||
child: LinearPercentIndicator(
|
||||
percent: withGpsPercent,
|
||||
lineHeight: lineHeight,
|
||||
backgroundColor: Colors.white24,
|
||||
progressColor: Theme.of(context).colorScheme.secondary,
|
||||
animation: animate,
|
||||
isRTL: context.isRtl,
|
||||
leading: const Icon(AIcons.location),
|
||||
// TODO TLAD handle low percents being rendered with wrong radius clip
|
||||
barRadius: Radius.circular(lineHeight / 2),
|
||||
center: Text(
|
||||
intl.NumberFormat.percentPattern().format(withGpsPercent),
|
||||
style: const TextStyle(shadows: Constants.embossShadows),
|
||||
// as of percent_indicator v4.0.0, bar radius is not correctly applied to progress bar
|
||||
// when width is lower than height, so we clip it and handle padding outside
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(AIcons.location),
|
||||
SizedBox(width: lineHeight),
|
||||
Expanded(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(barRadius),
|
||||
child: LinearPercentIndicator(
|
||||
percent: withGpsPercent,
|
||||
lineHeight: lineHeight,
|
||||
backgroundColor: Colors.white24,
|
||||
progressColor: Theme.of(context).colorScheme.secondary,
|
||||
animation: animate,
|
||||
isRTL: context.isRtl,
|
||||
barRadius: barRadius,
|
||||
center: Text(
|
||||
intl.NumberFormat.percentPattern().format(withGpsPercent),
|
||||
style: const TextStyle(shadows: Constants.embossShadows),
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: lineHeight),
|
||||
),
|
||||
// end padding to match leading, so that inside label is aligned with outside label below
|
||||
SizedBox(width: lineHeight + 24),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
|
|
Loading…
Reference in a new issue