import 'growth_conditions.dart'; import 'package:flutter/material.dart'; import '../../../core/theme/tokens.dart'; import '../home_data.dart'; import '../home_screen.dart' show formatPop; import '../../../core/i18n/app_locale.dart'; /// 내 팬덤 행성의 성장 — Figma 홈의 「67% 행성 성장률 / 6,270 / 10,000」. /// /// 정책 근거는 정책 설계서 §P-08. Level-up 은 POP 과 sFPI 를 **동시에** 충족해야 /// 하므로 서버가 제공한 두 조건을 각각 표시한다(UX·FX v1.5 §2.1). class PlanetGrowthCard extends StatelessWidget { const PlanetGrowthCard({super.key, required this.growth}); final PlanetGrowth growth; @override Widget build(BuildContext context) { final t = Theme.of(context).textTheme; final ratio = growth.popRatio; return Container( padding: const EdgeInsets.all(AppSpace.s5), decoration: BoxDecoration( color: AppColors.cosmicSurfaceContainer, borderRadius: BorderRadius.circular(AppRadius.lg), border: Border.all(color: AppColors.cosmicOutline), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // 「BTS_Hong 님의 1,230 POP 기여로 꾸준하게 성장하고 있어요.」 if (!growth.hasRecentContribution) Text(context.l10n.heroGrowingTogether, style: t.bodyMedium) else Text.rich( TextSpan( children: [ TextSpan( text: growth.contributorName, style: t.bodyMedium?.copyWith( color: AppColors.cosmicAccent, fontWeight: FontWeight.w600, ), ), TextSpan(text: context.l10n.growthOwnerOf, style: t.bodyMedium), TextSpan( text: '${formatPop(growth.contributedPop)} POP', style: t.bodyMedium?.copyWith(fontWeight: FontWeight.w600), ), TextSpan(text: context.l10n.growthSteadySuffix, style: t.bodyMedium), ], ), ), const SizedBox(height: AppSpace.s5), Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( growth.growthPercent == null ? '—' : '${growth.growthPercent}%', style: t.displayMedium?.copyWith(color: AppColors.cosmicAccent), ), const SizedBox(width: AppSpace.s2), Padding( padding: const EdgeInsets.only(bottom: AppSpace.s1), child: Text(context.l10n.heroPopProgress, style: t.bodySmall), ), ], ), const SizedBox(height: AppSpace.s3), ClipRRect( borderRadius: BorderRadius.circular(AppRadius.full), child: LinearProgressIndicator( value: ratio ?? 0, minHeight: 8, backgroundColor: AppColors.cosmicSurfaceRaised, valueColor: const AlwaysStoppedAnimation(AppColors.cosmicAccent), ), ), const SizedBox(height: AppSpace.s2), GrowthConditions(growth: growth), ], ), ); } }