Files
fanuzu/app/lib/features/home/growth_complete_screen.dart

87 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
import '../../core/ui/sheet_route.dart';
import 'home_data.dart';
import 'home_screen.dart' show HomeHeader;
import 'planet_create_screen.dart';
import 'widgets/home_hero.dart';
/// 성장 완료 — Figma 사본 「홈_성장 완료」(`344:213778`).
///
/// 사본에서는 따로 된 페이지가 아니라 **HOME 탭의 성운 상태**다. HOME 은 서버 Stage 가
/// 0(성운)이면 같은 [HomeHero] 성운 모드를 그리고, 이 화면은 그 상태를 값으로 직접 받아
/// 띄운다(검수 대조용 입구).
///
/// 정책 근거는 정책 원장 B-10 — **10명 이상 + 1,000 POP 이상 두 조건을 모두** 채워야
/// 정식 행성(Stage1)이 된다. 한쪽만 채우면 성운을 눌러도 행성 생성으로 가지 않는다.
class GrowthCompleteScreen extends StatelessWidget {
const GrowthCompleteScreen({
super.key,
this.nebulaName = 'BTS_RM',
this.nickname = 'BTS_Hong',
this.pop = 0,
this.members = 12,
this.requiredMembers = 10,
this.contributedPop = 1240,
this.requiredPop = 1000,
this.isFounder = true,
});
final String nebulaName;
/// 헤더 아래 「{닉네임} 님의」.
final String nickname;
/// 헤더의 내 활동 POP.
final int pop;
final int members;
final int requiredMembers;
final int contributedPop;
final int requiredPop;
/// 이 성운을 만든 창립자인가 — 탄생 안내는 창립자에게만 뜬다(Q-PN-01 A안).
final bool isFounder;
@override
Widget build(BuildContext context) {
final growth = PlanetGrowth(
stage: 0,
fandomName: nebulaName,
contributorName: nickname,
contributedPop: contributedPop,
growthPercent: requiredPop <= 0
? null
: (contributedPop * 100 / requiredPop).clamp(0, 100).round(),
currentPop: contributedPop,
requiredPop: requiredPop,
members: members,
requiredMembers: requiredMembers,
isFounder: isFounder,
);
return Scaffold(
body: SingleChildScrollView(
child: Stack(
children: [
HomeHero(
growth: growth,
fandomId: nebulaName,
onBirth: () => Navigator.of(context).push(
SheetRoute<void>(
builder: (_) => PlanetCreateScreen(nebulaName: nebulaName),
),
),
),
Positioned(
top: MediaQuery.paddingOf(context).top,
left: 0,
right: 0,
child: HomeHeader(pop: pop),
),
],
),
),
);
}
}