feat(account): 增加账号中心页面与入口

This commit is contained in:
Zhou Weidong committed 2026-10-19 09:50:23 +08:00
1 parent c68f02449f
commit da095115d4
23 files changed
+2343 -60

No files matched your search

+71 -6
View File
@@ -24,6 +24,10 @@ import '../watch_records/watch_records_page.dart';
import '../favorites/favorites_page.dart';
import '../notices/notices_page.dart';
import '../downloads/downloads_page.dart';
import '../account/account_profile_page.dart';
import '../account/account_devices_page.dart';
import '../account/account_export_page.dart';
import '../account/account_deactivate_page.dart';
class MyPage extends StatefulWidget {
const MyPage({
@@ -198,7 +202,12 @@ class _MyPageState extends State<MyPage> {
List<Widget> _accountPage(AppLocalizations l10n) => [
if (widget.signedIn) _signedInRow(l10n) else _guestRow(l10n),
if (widget.signedIn) ...[const SizedBox(height: 18), _wallet(l10n)],
if (widget.signedIn) ...[
const SizedBox(height: 18),
_wallet(l10n),
const SizedBox(height: 14),
_accountCard(l10n),
],
const SizedBox(height: 14),
_menuCard(l10n),
const SizedBox(height: 18),
@@ -487,6 +496,66 @@ class _MyPageState extends State<MyPage> {
);
}
Widget _accountCard(AppLocalizations l10n) {
return Material(
key: const Key('mine-account-card'),
color: AppColors.card,
borderRadius: BorderRadius.circular(16),
clipBehavior: Clip.antiAlias,
child: Column(
children: [
ListTile(
key: const Key('mine-account-profile'),
leading: const Icon(
Icons.person_outline_rounded,
color: AppColors.blueSoft,
),
title: Text(l10n.accountProfile),
trailing: const Icon(Icons.chevron_right_rounded),
onTap: () => _openAccount(const AccountProfilePage()),
),
const Divider(height: 1, color: AppColors.outlineVariantDark),
ListTile(
key: const Key('mine-account-devices'),
leading: const Icon(
Icons.devices_other_rounded,
color: AppColors.blueSoft,
),
title: Text(l10n.accountDevices),
trailing: const Icon(Icons.chevron_right_rounded),
onTap: () => _openAccount(const AccountDevicesPage()),
),
const Divider(height: 1, color: AppColors.outlineVariantDark),
ListTile(
key: const Key('mine-account-export'),
leading: const Icon(
Icons.file_download_outlined,
color: AppColors.blueSoft,
),
title: Text(l10n.accountDataExport),
trailing: const Icon(Icons.chevron_right_rounded),
onTap: () => _openAccount(const AccountExportPage()),
),
const Divider(height: 1, color: AppColors.outlineVariantDark),
ListTile(
key: const Key('mine-account-deactivate'),
leading: const Icon(
Icons.person_remove_outlined,
color: AppColors.blueSoft,
),
title: Text(l10n.accountDeactivate),
trailing: const Icon(Icons.chevron_right_rounded),
onTap: () => _openAccount(const AccountDeactivatePage()),
),
],
),
);
}
void _openAccount(Widget page) {
Navigator.of(context).push<void>(MaterialPageRoute(builder: (_) => page));
}
Widget _library(
AppLocalizations l10n,
Duration position,
@@ -886,11 +955,7 @@ class _NavItem extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
icon,
size: 21,
color: selected ? _accent : AppColors.muted,
),
Icon(icon, size: 21, color: selected ? _accent : AppColors.muted),
Text(
label,
style: TextStyle(