refactor(account): 收敛账号页组件结构
This commit is contained in:
1 parent
da095115d4
commit
6fce24d9ec
5 files changed
+308
-247
No files matched your search
@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../core/data/models/account_export.dart';
|
||||
import '../../core/data/repositories/account_repository.dart';
|
||||
import '../../core/data/services/auth_controller.dart';
|
||||
import '../../core/formatting/error_text.dart';
|
||||
@@ -87,57 +88,61 @@ class _AccountExportPageState extends State<AccountExportPage> {
|
||||
key: const Key('account-export-content'),
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 28),
|
||||
children: [
|
||||
_card(
|
||||
children: [
|
||||
Text(
|
||||
data.profile.nickname,
|
||||
style: const TextStyle(fontSize: 19, fontWeight: FontWeight.w700),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${l10n.accountUid}: ${data.profile.uid}',
|
||||
style: const TextStyle(color: AppColors.muted, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
_profileCard(data, l10n),
|
||||
const SizedBox(height: 12),
|
||||
_card(
|
||||
children: [
|
||||
Text(
|
||||
l10n.accountCredentials,
|
||||
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w700),
|
||||
),
|
||||
for (final credential in data.credentials)
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: const Icon(
|
||||
Icons.verified_user_outlined,
|
||||
color: AppColors.blueSoft,
|
||||
),
|
||||
title: Text(credential.masked),
|
||||
subtitle: Text(credential.type),
|
||||
trailing: Text(
|
||||
credential.verified
|
||||
? l10n.accountVerified
|
||||
: l10n.accountUnverified,
|
||||
style: const TextStyle(color: AppColors.muted, fontSize: 11),
|
||||
),
|
||||
),
|
||||
_summary(l10n.accountConsentRecords, '${data.consentCount}'),
|
||||
_summary(l10n.accountDeviceCount, '${data.deviceCount}'),
|
||||
],
|
||||
),
|
||||
_credentialsCard(data, l10n),
|
||||
const SizedBox(height: 16),
|
||||
FilledButton.icon(
|
||||
key: const Key('account-export-copy'),
|
||||
onPressed: _copy,
|
||||
icon: const Icon(Icons.copy_rounded),
|
||||
label: Text(l10n.accountCopyJson),
|
||||
),
|
||||
_copyButton(l10n),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _profileCard(AccountExport data, AppLocalizations l10n) => _card(
|
||||
children: [
|
||||
Text(
|
||||
data.profile.nickname,
|
||||
style: const TextStyle(fontSize: 19, fontWeight: FontWeight.w700),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${l10n.accountUid}: ${data.profile.uid}',
|
||||
style: const TextStyle(color: AppColors.muted, fontSize: 12),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Widget _credentialsCard(AccountExport data, AppLocalizations l10n) => _card(
|
||||
children: [
|
||||
Text(
|
||||
l10n.accountCredentials,
|
||||
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w700),
|
||||
),
|
||||
for (final credential in data.credentials)
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: const Icon(
|
||||
Icons.verified_user_outlined,
|
||||
color: AppColors.blueSoft,
|
||||
),
|
||||
title: Text(credential.masked),
|
||||
subtitle: Text(credential.type),
|
||||
trailing: Text(
|
||||
credential.verified ? l10n.accountVerified : l10n.accountUnverified,
|
||||
style: const TextStyle(color: AppColors.muted, fontSize: 11),
|
||||
),
|
||||
),
|
||||
_summary(l10n.accountConsentRecords, '${data.consentCount}'),
|
||||
_summary(l10n.accountDeviceCount, '${data.deviceCount}'),
|
||||
],
|
||||
);
|
||||
|
||||
Widget _copyButton(AppLocalizations l10n) => FilledButton.icon(
|
||||
key: const Key('account-export-copy'),
|
||||
onPressed: _copy,
|
||||
icon: const Icon(Icons.copy_rounded),
|
||||
label: Text(l10n.accountCopyJson),
|
||||
);
|
||||
|
||||
Widget _card({required List<Widget> children}) => Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
|
||||
Reference in new issue
Block a user