성운 상세 실시간 기여 랭킹에 실제 기여자 표시

This commit is contained in:
Sn-Kinos
2026-10-05 18:07:44 +09:00
parent 96a95a12d1
commit be623d2e46
9 changed files with 514 additions and 229 deletions
@@ -35,7 +35,10 @@ class _PlanetHistoryScreenState extends State<PlanetHistoryScreen> {
_failed = false;
});
try {
final page = await widget.repository.history(cursor: _cursor, personal: _personal);
final page = await widget.repository.history(
cursor: _cursor,
personal: _personal,
);
if (!mounted) return;
setState(() {
final ids = _items.map((item) => item.id).toSet();
@@ -60,18 +63,25 @@ class _PlanetHistoryScreenState extends State<PlanetHistoryScreen> {
const SizedBox(height: 16),
SegmentedButton<bool>(
segments: [
ButtonSegment(value: false, label: Text(context.l10n.homeFandomHistory)),
ButtonSegment(
value: false,
label: Text(context.l10n.homeFandomHistory),
),
ButtonSegment(value: true, label: Text(context.l10n.historyMine)),
],
selected: {_personal},
onSelectionChanged: _loading ? null : (selection) {
if (selection.single == _personal) return;
setState(() {
_personal = selection.single;
_items.clear(); _cursor = null; _loaded = false;
});
_load();
},
onSelectionChanged: _loading
? null
: (selection) {
if (selection.single == _personal) return;
setState(() {
_personal = selection.single;
_items.clear();
_cursor = null;
_loaded = false;
});
_load();
},
),
const SizedBox(height: 16),
for (final item in _items)
@@ -87,11 +97,10 @@ class _PlanetHistoryScreenState extends State<PlanetHistoryScreen> {
PlanetHistoryKind.funding => Icons.favorite_border,
}),
title: Text(switch (item.kind) {
PlanetHistoryKind.evolution =>
context.l10n.historyEvolution(
'${item.fromStage}',
'${item.toStage}',
),
PlanetHistoryKind.evolution => context.l10n.historyEvolution(
'${item.fromStage}',
'${item.toStage}',
),
PlanetHistoryKind.hibernation => context.l10n.historyHibernation,
PlanetHistoryKind.wakeUp => context.l10n.historyWakeUp,
PlanetHistoryKind.zap => context.l10n.historyZap,
@@ -104,7 +113,8 @@ class _PlanetHistoryScreenState extends State<PlanetHistoryScreen> {
MaterialLocalizations.of(
context,
).formatMediumDate(item.occurredAt.toLocal()),
if (item.amount != null) context.l10n.historyGrowthPop('${item.amount}'),
if (item.amount != null)
context.l10n.historyGrowthPop('${item.amount}'),
if (item.participationConfirmed) context.l10n.historyJoined,
].join('\n'),
),
@@ -114,9 +124,11 @@ class _PlanetHistoryScreenState extends State<PlanetHistoryScreen> {
Text(context.l10n.historyLoadFailed),
TextButton(onPressed: _load, child: Text(context.l10n.commonRetry)),
] else if (_loaded && _items.isEmpty && _cursor == null)
Text(_personal
Text(
_personal
? context.l10n.historyMineEmpty
: context.l10n.historyFandomEmpty),
: context.l10n.historyFandomEmpty,
),
if (!_loading && !_failed && _cursor != null)
TextButton(onPressed: _load, child: Text(context.l10n.historyMore)),
],