번호 자동 부여 대응 및 API 공통 처리 보강
This commit is contained in:
@@ -257,7 +257,7 @@ class _KpiCard extends StatelessWidget {
|
||||
const SizedBox(height: 6),
|
||||
Text(kpi?.displayValue ?? '--', style: theme.textTheme.h3),
|
||||
const SizedBox(height: 8),
|
||||
Text(kpi?.trendLabel ?? '데이터 동기화 중', style: theme.textTheme.muted),
|
||||
_DeltaTrendRow(kpi: kpi),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -265,6 +265,68 @@ class _KpiCard extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _DeltaTrendRow extends StatelessWidget {
|
||||
const _DeltaTrendRow({this.kpi});
|
||||
|
||||
final DashboardKpi? kpi;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ShadTheme.of(context);
|
||||
final delta = kpi?.delta;
|
||||
|
||||
if (delta == null) {
|
||||
return Text(kpi?.trendLabel ?? '데이터 동기화 중', style: theme.textTheme.muted);
|
||||
}
|
||||
|
||||
final absDelta = delta.abs();
|
||||
final percent = (absDelta * 100).toStringAsFixed(1);
|
||||
final trimmedPercent = percent.endsWith('.0')
|
||||
? percent.substring(0, percent.length - 2)
|
||||
: percent;
|
||||
final percentText = delta > 0
|
||||
? '+$trimmedPercent%'
|
||||
: delta < 0
|
||||
? '-$trimmedPercent%'
|
||||
: '0%';
|
||||
|
||||
final icon = delta > 0
|
||||
? lucide.LucideIcons.arrowUpRight
|
||||
: delta < 0
|
||||
? lucide.LucideIcons.arrowDownRight
|
||||
: lucide.LucideIcons.minus;
|
||||
|
||||
final Color color;
|
||||
if (delta > 0) {
|
||||
color = theme.colorScheme.primary;
|
||||
} else if (delta < 0) {
|
||||
color = theme.colorScheme.destructive;
|
||||
} else {
|
||||
color = theme.textTheme.muted.color ?? theme.colorScheme.mutedForeground;
|
||||
}
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, size: 16, color: color),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
percentText,
|
||||
style: theme.textTheme.small.copyWith(color: color),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
kpi?.trendLabel ?? '전일 대비',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.muted,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _RecentTransactionsCard extends StatelessWidget {
|
||||
const _RecentTransactionsCard({required this.transactions});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user