UI fixes and league
This commit is contained in:
@@ -39,6 +39,16 @@ class BarList extends StatelessWidget {
|
||||
String tick(double v) => v == v.roundToDouble() ? '${v.round()}' : v.toStringAsFixed(1);
|
||||
return LayoutBuilder(builder: (context, box) {
|
||||
final barWidth = box.maxWidth - labelWidth - valueWidth;
|
||||
// 26 high, thinner when many rows share little height (e.g. 10 … 0)
|
||||
final ticksHeight = ticks.isEmpty ? 0.0 : 20 * scale;
|
||||
final rowHeight = entries.isEmpty || !box.hasBoundedHeight
|
||||
? double.infinity
|
||||
: (box.maxHeight - ticksHeight) / entries.length;
|
||||
final barHeight = (rowHeight * 0.75).clamp(4.0, 26 * scale);
|
||||
// Text shrinks with thin rows too, so many bars (a session of 20
|
||||
// targets) don't run their labels and values into each other
|
||||
final labelSize = (rowHeight * 0.78).clamp(6.0, 12 * scale);
|
||||
final valueSize = (rowHeight * 0.85).clamp(6.0, 15 * scale);
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -51,8 +61,10 @@ class BarList extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: labelWidth,
|
||||
child: Text(e.label,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: 12 * scale,
|
||||
fontSize: labelSize,
|
||||
height: 1,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: e.goldLabel ? c.gold : c.muted)),
|
||||
),
|
||||
@@ -62,16 +74,16 @@ class BarList extends StatelessWidget {
|
||||
alignment: Alignment.centerLeft,
|
||||
children: [
|
||||
Container(
|
||||
height: 26 * scale,
|
||||
decoration: BoxDecoration(color: c.tile, borderRadius: BorderRadius.circular(7 * scale)),
|
||||
height: barHeight,
|
||||
decoration: BoxDecoration(color: c.tile, borderRadius: BorderRadius.circular(barHeight * 0.27)),
|
||||
),
|
||||
FractionallySizedBox(
|
||||
widthFactor: max <= 0 ? 0 : (e.value / max).clamp(0.0, 1.0),
|
||||
child: Container(
|
||||
height: 26 * scale,
|
||||
height: barHeight,
|
||||
decoration: BoxDecoration(
|
||||
color: e.highlight ? c.gold : c.accent,
|
||||
borderRadius: BorderRadius.circular(7 * scale),
|
||||
borderRadius: BorderRadius.circular(barHeight * 0.27),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -85,7 +97,8 @@ class BarList extends StatelessWidget {
|
||||
child: Text(e.valueText,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: 15 * scale,
|
||||
fontSize: valueSize,
|
||||
height: 1,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: e.highlight ? c.gold : (e.value == 0 ? c.faint : c.ink),
|
||||
fontFeatures: AppTheme.tnum)),
|
||||
|
||||
Reference in New Issue
Block a user