feat(programmer): dashboard stat tiles + badges
Add StatTiles and BadgesStrip widgets wired into ProgrammerDashboard. StatTiles shows 2 tiles (focus + completed) when showSheetStats is false, and 5 tiles (+ streak, first-pass approval, help given) when the viewing user's role is programmer. BadgesStrip renders earned/locked chips in a horizontal Wrap with tap-to-dialog detail. Dashboard feeds todayFocus via buildDayRows/totalSeconds, leaveDays via approvedLeaveDays, and sheets: const [] until Task 20 wires real data. Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../theme/app_status_colors.dart';
|
||||
import '../../../utils/programmer_stats.dart';
|
||||
|
||||
/// A horizontal wrap of badge chips for the programmer dashboard.
|
||||
///
|
||||
/// Earned badges use the success container colour; locked badges show neutral
|
||||
/// styling and display `current/target` as their label. Tapping any chip opens
|
||||
/// an [AlertDialog] with the badge title and description.
|
||||
class BadgesStrip extends StatelessWidget {
|
||||
const BadgesStrip({
|
||||
super.key,
|
||||
required this.badges,
|
||||
});
|
||||
|
||||
final List<BadgeProgress> badges;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (badges.isEmpty) return const SizedBox.shrink();
|
||||
return Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
for (final badge in badges) _BadgeChip(badge: badge),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _BadgeChip extends StatelessWidget {
|
||||
const _BadgeChip({required this.badge});
|
||||
|
||||
final BadgeProgress badge;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final statusColors = AppStatusColors.of(context);
|
||||
final earned = badge.earned;
|
||||
|
||||
return ActionChip(
|
||||
avatar: Icon(badge.icon, size: 16),
|
||||
label: Text(earned ? badge.title : '${badge.current}/${badge.target}'),
|
||||
backgroundColor: earned ? statusColors.success.container : null,
|
||||
onPressed: () {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text(badge.title),
|
||||
content: Text(badge.description),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user