refactor(account): 收敛账号页组件结构
This commit is contained in:
1 parent
da095115d4
commit
6fce24d9ec
5 files changed
+308
-247
No files matched your search
@@ -0,0 +1,93 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../core/theme/app_colors.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import 'account_deactivate_page.dart';
|
||||
import 'account_devices_page.dart';
|
||||
import 'account_export_page.dart';
|
||||
import 'account_profile_page.dart';
|
||||
|
||||
/// 我的页账号入口卡;只在登录态由父页面展示。
|
||||
class AccountEntryCard extends StatelessWidget {
|
||||
const AccountEntryCard({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return Material(
|
||||
key: const Key('mine-account-card'),
|
||||
color: AppColors.card,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 14, 16, 8),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
l10n.accountCenter,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1, color: AppColors.outlineVariantDark),
|
||||
_entry(
|
||||
context,
|
||||
key: const Key('mine-account-profile'),
|
||||
icon: Icons.person_outline_rounded,
|
||||
title: l10n.accountProfile,
|
||||
page: const AccountProfilePage(),
|
||||
),
|
||||
const Divider(height: 1, color: AppColors.outlineVariantDark),
|
||||
_entry(
|
||||
context,
|
||||
key: const Key('mine-account-devices'),
|
||||
icon: Icons.devices_other_rounded,
|
||||
title: l10n.accountDevices,
|
||||
page: const AccountDevicesPage(),
|
||||
),
|
||||
const Divider(height: 1, color: AppColors.outlineVariantDark),
|
||||
_entry(
|
||||
context,
|
||||
key: const Key('mine-account-export'),
|
||||
icon: Icons.file_download_outlined,
|
||||
title: l10n.accountDataExport,
|
||||
page: const AccountExportPage(),
|
||||
),
|
||||
const Divider(height: 1, color: AppColors.outlineVariantDark),
|
||||
_entry(
|
||||
context,
|
||||
key: const Key('mine-account-deactivate'),
|
||||
icon: Icons.person_remove_outlined,
|
||||
title: l10n.accountDeactivate,
|
||||
page: const AccountDeactivatePage(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _entry(
|
||||
BuildContext context, {
|
||||
required Key key,
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required Widget page,
|
||||
}) {
|
||||
return ListTile(
|
||||
key: key,
|
||||
leading: Icon(icon, color: AppColors.blueSoft),
|
||||
title: Text(title),
|
||||
trailing: const Icon(Icons.chevron_right_rounded),
|
||||
onTap: () => Navigator.of(
|
||||
context,
|
||||
).push<void>(MaterialPageRoute(builder: (_) => page)),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user