Added class clearance fixes and improvements
Some checks failed
Release / meta (push) Successful in 18s
Release / android-build (push) Successful in 11m48s
Release / linux-build (push) Successful in 1m24s
Release / web-build (push) Successful in 6m15s
Release / release-dev (push) Has been cancelled
Release / release-master (push) Has been cancelled
Some checks failed
Release / meta (push) Successful in 18s
Release / android-build (push) Successful in 11m48s
Release / linux-build (push) Successful in 1m24s
Release / web-build (push) Successful in 6m15s
Release / release-dev (push) Has been cancelled
Release / release-master (push) Has been cancelled
This commit is contained in:
@@ -449,6 +449,23 @@ class _BadgesPageState extends State<BadgesPage> {
|
||||
ClassClearanceProgress progress,
|
||||
) {
|
||||
final pct = progress.percentComplete.clamp(0, 100);
|
||||
final activePct = progress.activePercent.clamp(0, 100);
|
||||
final showActive =
|
||||
progress.activeTotal > 0 || progress.activeCompleted > 0;
|
||||
final showActiveCrest =
|
||||
progress.activeTotal > 0 && progress.activeCompleted == progress.activeTotal;
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final total = progress.total;
|
||||
final activeTotal = progress.activeTotal.clamp(0, total);
|
||||
final had = progress.completed.clamp(0, total);
|
||||
final activeHad = progress.activeCompleted.clamp(0, activeTotal).clamp(0, had);
|
||||
final activeRemaining =
|
||||
(activeTotal - activeHad).clamp(0, total - had);
|
||||
final remaining =
|
||||
(total - activeTotal - (had - activeHad)).clamp(0, total);
|
||||
final hadColor = scheme.primary;
|
||||
final activeColor = scheme.primary.withValues(alpha: 0.4);
|
||||
final remainingColor = scheme.primary.withValues(alpha: 0.18);
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: Padding(
|
||||
@@ -471,9 +488,55 @@ class _BadgesPageState extends State<BadgesPage> {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
LinearProgressIndicator(
|
||||
value: progress.total == 0 ? 0 : pct / 100,
|
||||
minHeight: 6,
|
||||
if (showActive)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Active: ${progress.activeCompleted}/${progress.activeTotal} (${activePct.toStringAsFixed(0)}%)',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall
|
||||
?.copyWith(color: Theme.of(context).hintColor),
|
||||
),
|
||||
if (showActiveCrest) ...[
|
||||
const SizedBox(width: 6),
|
||||
Icon(
|
||||
Icons.verified,
|
||||
size: 14,
|
||||
color: scheme.primary,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: SizedBox(
|
||||
height: 6,
|
||||
child: total <= 0
|
||||
? Container(color: remainingColor)
|
||||
: Row(
|
||||
children: [
|
||||
if (had > 0)
|
||||
Expanded(
|
||||
flex: had,
|
||||
child: Container(color: hadColor),
|
||||
),
|
||||
if (showActive && activeRemaining > 0)
|
||||
Expanded(
|
||||
flex: activeRemaining,
|
||||
child: Container(color: activeColor),
|
||||
),
|
||||
if (remaining > 0)
|
||||
Expanded(
|
||||
flex: remaining,
|
||||
child: Container(color: remainingColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (progress.total > 0)
|
||||
Padding(
|
||||
|
||||
Reference in New Issue
Block a user