feat(points): 实现积分流水列表功能

- 后端新增 GET /api/v1/points/ledger 接口
- 前端新增积分流水列表页面
- 积分中心添加「查看流水」入口
- 重命名 AccountDeleteScreen 为 AccountDataScreen
- 流水列表支持分页加载和空状态展示
This commit is contained in:
ZL-Q
2026-04-28 17:19:08 +08:00
parent a83001de0d
commit 940c67e642
12 changed files with 794 additions and 70 deletions
@@ -9,7 +9,7 @@ import '../../data/models/profile_settings.dart';
import '../../data/repositories/invite_repository.dart';
import '../models/legal_document_type.dart';
import '../utils/legal_document_assets.dart';
import 'account_delete_screen.dart';
import 'account_data_screen.dart';
import '../widgets/settings_section_widgets.dart';
import 'coin_center_screen.dart';
import 'feedback_screen.dart';
@@ -18,6 +18,9 @@ import 'invite_screen.dart';
import 'legal_document_screen.dart';
import 'profile_edit_screen.dart';
// 临时标志位:我的邀请逻辑施工完毕后删除此标志位,并恢复入口与子页面访问。
final bool _showInviteEntry = false;
class SettingsScreen extends StatefulWidget {
const SettingsScreen({
super.key,
@@ -48,7 +51,7 @@ class SettingsScreen extends StatefulWidget {
final Future<void> Function() onLogout;
final Future<void> Function() onDeleteAccount;
final Future<ProfileSettingsV1> Function(ProfileSettingsV1 updated)
onSaveProfile;
onSaveProfile;
final void Function(int newBalance) onBalanceChanged;
@override
@@ -118,13 +121,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
background: colors.surfaceContainerHighest,
onTap: _openGeneralSettings,
),
SettingsMenuTile(
icon: Icons.card_giftcard_rounded,
title: l10n.settingsInviteTitle,
tint: colors.primary,
background: colors.surfaceContainerHighest,
onTap: _openInvite,
),
if (_showInviteEntry)
SettingsMenuTile(
icon: Icons.card_giftcard_rounded,
title: l10n.settingsInviteTitle,
tint: colors.primary,
background: colors.surfaceContainerHighest,
onTap: _openInvite,
),
SettingsMenuTile(
icon: Icons.feedback_outlined,
title: l10n.settingsFeedbackTitle,
@@ -142,7 +146,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
tint: colors.primary,
background: colors.surfaceContainerHighest,
showDivider: false,
onTap: _openAccountDelete,
onTap: _openAccountData,
),
],
),
@@ -161,7 +165,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: l10n.privacyPolicy,
tint: colors.secondary,
background: colors.surfaceContainerHighest,
onTap: () => _openLegalDocument(LegalDocumentType.privacyPolicy),
onTap: () =>
_openLegalDocument(LegalDocumentType.privacyPolicy),
),
SettingsMenuTile(
icon: Icons.description_outlined,
@@ -169,7 +174,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
tint: colors.secondary,
background: colors.surfaceContainerHighest,
showDivider: false,
onTap: () => _openLegalDocument(LegalDocumentType.termsOfService),
onTap: () =>
_openLegalDocument(LegalDocumentType.termsOfService),
),
],
),
@@ -222,6 +228,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
}
Future<void> _openInvite() async {
if (!_showInviteEntry) {
return;
}
await Navigator.of(context).push<void>(
MaterialPageRoute<void>(
builder: (_) => InviteScreen(inviteRepository: widget.inviteRepository),
@@ -261,11 +270,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
Future<void> _openAccountDelete() async {
Future<void> _openAccountData() async {
final deleted = await Navigator.of(context).push<bool>(
MaterialPageRoute<bool>(
builder: (_) =>
AccountDeleteScreen(onDeleteAccount: widget.onDeleteAccount),
AccountDataScreen(onDeleteAccount: widget.onDeleteAccount),
),
);
if (deleted != true) {