feat: 二级页面色彩刷新 + 用药/通知/设备重构 + 后端健康档案/通知管线增强 + 大量测试
## 后端 - 健康档案: 新增手术状态字段 + EF 迁移; HealthArchiveService 新增查询方法 - 健康记录: HealthRecordService 新增批量/统计方法; 契约扩展 - 用药: 新增 MedicationScheduleStatus 枚举; MedicationService 排班逻辑调整 - 通知: EfUserNotificationPipeline 重构; 新增 EfReminderCatchUpService; 通知管线支持更多场景 - 用户: UserService 账号删除逻辑; 新增 local_account_file_cleanup; EfUserRepository 扩展 - AI: medication_agent_handler 微调; prompt_manager 优化; AiConversationService 上下文处理 - Endpoint: doctor/medication/exercise/health/notification/user 等多接口调整 - BackgroundService: health_record_reminder_service 重构, 提醒补漏逻辑 - 测试: 新增 account_deletion/doctor_endpoint/medication_schedule/medication_update/prompt_manager 测试 ## 前端 - UI 系统: app_theme 大幅重构; app_colors/app_design_tokens/app_module_visuals 调整; 二级页面色彩刷新 - 主页: home_page 背景渐变 + 消息列表提取 _HomeMessages + 通知检查逻辑; chat_messages_view 全面重构 - 用药: medication_list/edit/checkin 三页重构, 新增 medication_ui_logic 抽取 - 通知: notification_prefs_page 重构, 新增 notification_prefs_logic; notification_center 优化 - 设备: device_management 重构, 新增 device_sync_ui_logic; device_scan 优化 - 趋势图: trend_page 大幅重构 - 登录: login_page 重构 - 个人资料: 新增 profile_edit_page; profile_page 优化 - 运动: 新增 exercise/ 目录 + care_plan_ui_logic - 其他: remaining_pages/report_pages/health_drawer/admin/doctor 等多页面调整 - 组件: common_widgets/app_empty_state/app_error_state/app_future_view/app_toast/ai_content 优化 - Provider: chat_provider/consultation_provider/data_providers/auth_provider 调整 - AndroidManifest: 移除多余权限 - 测试: 新增 ai_content/care_plan/home_message/login_flow/medication_checkin/medication_ui/notification_prefs/profile_device/secondary_page/swipe_delete 等大量测试 ## 文档 - 新增 ui-design-system.md 设计系统文档 - 新增 secondary-page-color-refresh 计划 + specs 目录
This commit is contained in:
278
health_app/lib/pages/profile/profile_edit_page.dart
Normal file
278
health_app/lib/pages/profile/profile_edit_page.dart
Normal file
@@ -0,0 +1,278 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/app_colors.dart';
|
||||
import '../../core/app_design_tokens.dart';
|
||||
import '../../core/app_theme.dart';
|
||||
import '../../core/navigation_provider.dart';
|
||||
import '../../providers/auth_provider.dart';
|
||||
import '../../providers/data_providers.dart';
|
||||
import '../../widgets/app_error_state.dart';
|
||||
import '../../widgets/app_toast.dart';
|
||||
import '../../widgets/common_widgets.dart';
|
||||
|
||||
class ProfileEditPage extends ConsumerStatefulWidget {
|
||||
const ProfileEditPage({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<ProfileEditPage> createState() => _ProfileEditPageState();
|
||||
}
|
||||
|
||||
class _ProfileEditPageState extends ConsumerState<ProfileEditPage> {
|
||||
final _nameController = TextEditingController();
|
||||
bool _loading = true;
|
||||
bool _saving = false;
|
||||
String? _error;
|
||||
String _gender = '';
|
||||
DateTime? _birthDate;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_load();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _load() async {
|
||||
try {
|
||||
final profile = await ref.read(userServiceProvider).getProfile();
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_nameController.text = profile?['name']?.toString() ?? '';
|
||||
_gender = profile?['gender']?.toString() ?? '';
|
||||
_birthDate = DateTime.tryParse(profile?['birthDate']?.toString() ?? '');
|
||||
_loading = false;
|
||||
_error = null;
|
||||
});
|
||||
} catch (_) {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_loading = false;
|
||||
_error = '个人资料加载失败';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _save() async {
|
||||
final name = _nameController.text.trim();
|
||||
if (name.isEmpty) {
|
||||
AppToast.show(context, '请填写姓名', type: AppToastType.warning);
|
||||
return;
|
||||
}
|
||||
setState(() => _saving = true);
|
||||
try {
|
||||
await ref
|
||||
.read(userServiceProvider)
|
||||
.updateProfile(
|
||||
name: name,
|
||||
gender: _gender.isEmpty ? null : _gender,
|
||||
birthDate: _birthDate == null ? null : _formatDate(_birthDate!),
|
||||
);
|
||||
await ref.read(authProvider.notifier).refreshProfile();
|
||||
if (!mounted) return;
|
||||
AppToast.show(context, '个人资料已保存', type: AppToastType.success);
|
||||
popRoute(ref);
|
||||
} catch (_) {
|
||||
if (mounted) {
|
||||
AppToast.show(context, '保存失败,请稍后重试', type: AppToastType.error);
|
||||
}
|
||||
} finally {
|
||||
if (mounted) setState(() => _saving = false);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _pickBirthDate() async {
|
||||
final now = DateTime.now();
|
||||
final selected = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: _birthDate ?? DateTime(now.year - 30),
|
||||
firstDate: DateTime(1900),
|
||||
lastDate: now,
|
||||
);
|
||||
if (selected != null && mounted) setState(() => _birthDate = selected);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GradientScaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios_new_rounded, size: 19),
|
||||
onPressed: _saving ? null : () => popRoute(ref),
|
||||
),
|
||||
title: const Text('基本资料'),
|
||||
centerTitle: true,
|
||||
),
|
||||
bottomNavigationBar: _loading || _error != null
|
||||
? null
|
||||
: SafeArea(
|
||||
minimum: const EdgeInsets.fromLTRB(18, 8, 18, 14),
|
||||
child: AppGradientOutlineButton(
|
||||
label: _saving ? '保存中...' : '保存',
|
||||
loading: _saving,
|
||||
onPressed: _saving ? null : _save,
|
||||
),
|
||||
),
|
||||
body: _loading
|
||||
? const Center(child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: _error != null
|
||||
? AppErrorState(title: _error!, subtitle: '请检查网络后重试', onRetry: _load)
|
||||
: ListView(
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
padding: const EdgeInsets.fromLTRB(18, 12, 18, 28),
|
||||
children: [
|
||||
_FormPanel(
|
||||
children: [
|
||||
const _FieldLabel('姓名'),
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
controller: _nameController,
|
||||
maxLength: 30,
|
||||
textInputAction: TextInputAction.done,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '请输入姓名',
|
||||
counterText: '',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
const _FieldLabel('性别'),
|
||||
const SizedBox(height: 8),
|
||||
SegmentedButton<String>(
|
||||
segments: const [
|
||||
ButtonSegment(value: 'Male', label: Text('男')),
|
||||
ButtonSegment(value: 'Female', label: Text('女')),
|
||||
ButtonSegment(value: 'Other', label: Text('其他')),
|
||||
],
|
||||
selected: _gender.isEmpty ? const {} : {_gender},
|
||||
emptySelectionAllowed: true,
|
||||
showSelectedIcon: false,
|
||||
onSelectionChanged: (value) {
|
||||
setState(
|
||||
() => _gender = value.isEmpty ? '' : value.first,
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
const _FieldLabel('出生日期'),
|
||||
const SizedBox(height: 8),
|
||||
InkWell(
|
||||
onTap: _pickBirthDate,
|
||||
borderRadius: AppRadius.mdBorder,
|
||||
child: Container(
|
||||
height: 52,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColors.border),
|
||||
borderRadius: AppRadius.mdBorder,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
_birthDate == null
|
||||
? '请选择出生日期'
|
||||
: _formatDate(_birthDate!),
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: _birthDate == null
|
||||
? AppColors.textHint
|
||||
: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.calendar_today_outlined,
|
||||
size: 19,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_ReadOnlyPhone(phone: ref.read(authProvider).user?.phone ?? ''),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatDate(DateTime value) =>
|
||||
'${value.year.toString().padLeft(4, '0')}-${value.month.toString().padLeft(2, '0')}-${value.day.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
class _FormPanel extends StatelessWidget {
|
||||
final List<Widget> children;
|
||||
const _FormPanel({required this.children});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container(
|
||||
padding: const EdgeInsets.all(18),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: children,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _FieldLabel extends StatelessWidget {
|
||||
final String text;
|
||||
const _FieldLabel(this.text);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _ReadOnlyPhone extends StatelessWidget {
|
||||
final String phone;
|
||||
const _ReadOnlyPhone({required this.phone});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container(
|
||||
padding: const EdgeInsets.all(18),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.phone_iphone_rounded, color: AppColors.textSecondary),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('手机号', style: AppTextStyles.listTitle),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
phone.isEmpty ? '未绑定' : phone,
|
||||
style: AppTextStyles.listSubtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
'手机号不可修改',
|
||||
style: TextStyle(fontSize: 12, color: AppColors.textHint),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -13,10 +13,11 @@ class ProfilePage extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final auth = ref.watch(authProvider);
|
||||
final user = auth.user;
|
||||
final name = user?.name?.isNotEmpty == true ? user!.name! : '未设置昵称';
|
||||
final phone = user?.phone ?? '';
|
||||
final user = ref.watch(authProvider.select((state) => state.user));
|
||||
final name = user?.name?.trim().isNotEmpty == true ? user!.name! : '未设置昵称';
|
||||
final phone = user?.phone.trim().isNotEmpty == true
|
||||
? user!.phone
|
||||
: '未绑定手机号';
|
||||
|
||||
return GradientScaffold(
|
||||
appBar: AppBar(
|
||||
@@ -29,23 +30,48 @@ class ProfilePage extends ConsumerWidget {
|
||||
),
|
||||
body: SafeArea(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.fromLTRB(18, 16, 18, 32),
|
||||
padding: const EdgeInsets.fromLTRB(18, 12, 18, 32),
|
||||
children: [
|
||||
_AccountCard(
|
||||
_AccountSummary(
|
||||
name: name,
|
||||
phone: phone.isNotEmpty ? phone : '未绑定手机号',
|
||||
phone: phone,
|
||||
avatarUrl: user?.avatarUrl,
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
_ActionTile(
|
||||
icon: AppModuleVisuals.health.icon,
|
||||
title: '健康档案',
|
||||
subtitle: '维护个人资料、病史、手术和过敏信息',
|
||||
visual: AppModuleVisuals.health,
|
||||
onTap: () => pushRoute(ref, 'healthArchive'),
|
||||
const SizedBox(height: 20),
|
||||
const _SectionTitle('资料管理'),
|
||||
const SizedBox(height: 9),
|
||||
_SettingsGroup(
|
||||
children: [
|
||||
_ActionRow(
|
||||
icon: Icons.badge_outlined,
|
||||
iconColor: AppColors.primary,
|
||||
title: '基本资料',
|
||||
subtitle: '姓名、性别和出生日期',
|
||||
onTap: () => pushRoute(ref, 'profileEdit'),
|
||||
),
|
||||
_ActionRow(
|
||||
icon: AppModuleVisuals.health.icon,
|
||||
iconColor: AppModuleVisuals.health.color,
|
||||
title: '健康档案',
|
||||
subtitle: '疾病、手术、过敏和生活习惯',
|
||||
onTap: () => pushRoute(ref, 'healthArchive'),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const _SectionTitle('账号操作'),
|
||||
const SizedBox(height: 9),
|
||||
_SettingsGroup(
|
||||
children: [
|
||||
_ActionRow(
|
||||
icon: Icons.logout_rounded,
|
||||
iconColor: AppColors.textSecondary,
|
||||
title: '退出登录',
|
||||
showChevron: false,
|
||||
onTap: () => _logout(context, ref),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
_LogoutButton(onPressed: () => _logout(context, ref)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -53,37 +79,37 @@ class ProfilePage extends ConsumerWidget {
|
||||
}
|
||||
|
||||
Future<void> _logout(BuildContext context, WidgetRef ref) async {
|
||||
final ok = await showDialog<bool>(
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: AppRadius.lgBorder),
|
||||
title: const Text('退出登录'),
|
||||
content: const Text('确定退出当前账号?'),
|
||||
content: const Text('确定退出当前账号吗?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
onPressed: () => Navigator.pop(dialogContext, false),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
child: const Text('确定', style: TextStyle(color: AppColors.error)),
|
||||
onPressed: () => Navigator.pop(dialogContext, true),
|
||||
style: TextButton.styleFrom(foregroundColor: AppColors.errorText),
|
||||
child: const Text('退出'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (ok == true) {
|
||||
await ref.read(authProvider.notifier).logout();
|
||||
goRoute(ref, 'login');
|
||||
}
|
||||
if (confirmed != true || !context.mounted) return;
|
||||
await ref.read(authProvider.notifier).logout();
|
||||
goRoute(ref, 'login');
|
||||
}
|
||||
}
|
||||
|
||||
class _AccountCard extends StatelessWidget {
|
||||
class _AccountSummary extends StatelessWidget {
|
||||
final String name;
|
||||
final String phone;
|
||||
final String? avatarUrl;
|
||||
|
||||
const _AccountCard({
|
||||
const _AccountSummary({
|
||||
required this.name,
|
||||
required this.phone,
|
||||
required this.avatarUrl,
|
||||
@@ -91,17 +117,31 @@ class _AccountCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container(
|
||||
padding: AppSpacing.panel,
|
||||
padding: const EdgeInsets.all(18),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
border: Border.all(color: AppColors.border, width: 1.1),
|
||||
boxShadow: AppShadows.soft,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
_Avatar(avatarUrl: avatarUrl),
|
||||
const SizedBox(width: 14),
|
||||
Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: AppModuleVisuals.health.lightColor,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
),
|
||||
child: avatarUrl?.isNotEmpty == true
|
||||
? Image.network(
|
||||
avatarUrl!,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
const _AvatarFallback(),
|
||||
)
|
||||
: const _AvatarFallback(),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -113,11 +153,11 @@ class _AccountCard extends StatelessWidget {
|
||||
style: AppTextStyles.summaryTitle.copyWith(fontSize: 20),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
phone,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: AppTextStyles.listSubtitle,
|
||||
Text(phone, style: AppTextStyles.listSubtitle),
|
||||
const SizedBox(height: 5),
|
||||
const Text(
|
||||
'头像由账号系统统一管理',
|
||||
style: TextStyle(fontSize: 12, color: AppColors.textHint),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -127,103 +167,124 @@ class _AccountCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
class _Avatar extends StatelessWidget {
|
||||
final String? avatarUrl;
|
||||
|
||||
const _Avatar({required this.avatarUrl});
|
||||
class _AvatarFallback extends StatelessWidget {
|
||||
const _AvatarFallback();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container(
|
||||
width: 58,
|
||||
height: 58,
|
||||
decoration: BoxDecoration(
|
||||
gradient: AppModuleVisuals.health.gradient,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: avatarUrl != null && avatarUrl!.isNotEmpty
|
||||
? Image.network(avatarUrl!, fit: BoxFit.cover)
|
||||
: const Icon(Icons.person_rounded, color: Colors.white, size: 34),
|
||||
Widget build(BuildContext context) => Icon(
|
||||
Icons.person_rounded,
|
||||
color: AppModuleVisuals.health.color,
|
||||
size: 34,
|
||||
);
|
||||
}
|
||||
|
||||
class _ActionTile extends StatelessWidget {
|
||||
class _SectionTitle extends StatelessWidget {
|
||||
final String text;
|
||||
const _SectionTitle(this.text);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 2),
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _SettingsGroup extends StatelessWidget {
|
||||
final List<Widget> children;
|
||||
const _SettingsGroup({required this.children});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
for (var i = 0; i < children.length; i++) ...[
|
||||
children[i],
|
||||
if (i != children.length - 1)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 62),
|
||||
child: Divider(height: 1, color: AppColors.borderLight),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _ActionRow extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final Color iconColor;
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final AppModuleVisual visual;
|
||||
final String? subtitle;
|
||||
final bool showChevron;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _ActionTile({
|
||||
const _ActionRow({
|
||||
required this.icon,
|
||||
required this.iconColor,
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.visual,
|
||||
this.subtitle,
|
||||
this.showChevron = true,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Material(
|
||||
color: Colors.white,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
border: Border.all(color: AppColors.border, width: 1.1),
|
||||
boxShadow: AppShadows.soft,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 14),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 46,
|
||||
height: 46,
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
gradient: visual.gradient,
|
||||
borderRadius: AppRadius.mdBorder,
|
||||
color: iconColor.withValues(alpha: 0.10),
|
||||
borderRadius: AppRadius.smBorder,
|
||||
),
|
||||
child: Icon(icon, color: Colors.white, size: 24),
|
||||
child: Icon(icon, color: iconColor, size: 20),
|
||||
),
|
||||
const SizedBox(width: 13),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title, style: AppTextStyles.listTitle),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
subtitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: AppTextStyles.listSubtitle,
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 3),
|
||||
Text(subtitle!, style: AppTextStyles.listSubtitle),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const Icon(Icons.chevron_right_rounded, color: AppColors.textHint),
|
||||
if (showChevron)
|
||||
const Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: AppColors.textHint,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _LogoutButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const _LogoutButton({required this.onPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => TextButton(
|
||||
onPressed: onPressed,
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: AppColors.error,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
textStyle: AppTextStyles.button,
|
||||
),
|
||||
child: const Text('退出登录'),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user