refactor(apps): 主题系统迁移至 ColorScheme + 扩展架构并支持 Dark Mode

This commit is contained in:
qzl
2026-03-27 19:07:39 +08:00
parent ecc1ec6ce4
commit ae29a8209b
146 changed files with 4301 additions and 3200 deletions
@@ -34,8 +34,9 @@ class _AddContactScreenState extends State<AddContactScreen> {
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return Scaffold(
backgroundColor: AppColors.surfaceSecondary,
backgroundColor: colorScheme.surfaceContainerLow,
resizeToAvoidBottomInset: false,
body: SafeArea(
maintainBottomViewPadding: true,
@@ -73,6 +74,7 @@ class _AddContactScreenState extends State<AddContactScreen> {
}
Widget _buildConfirmButton() {
final colorScheme = Theme.of(context).colorScheme;
return SizedBox(
width: AppSpacing.xxl * 2,
height: AppSpacing.xxl * 2,
@@ -80,47 +82,45 @@ class _AddContactScreenState extends State<AddContactScreen> {
onPressed: _handleConfirm,
style: TextButton.styleFrom(
padding: const EdgeInsets.all(AppSpacing.none),
backgroundColor: AppColors.surfaceInfo,
backgroundColor: colorScheme.primaryContainer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppRadius.full),
side: const BorderSide(color: AppColors.borderQuaternary),
side: BorderSide(color: colorScheme.outlineVariant),
),
),
child: const Icon(
child: Icon(
Icons.check,
size: AppSpacing.lg,
color: AppColors.blue600,
color: colorScheme.primary,
),
),
);
}
Widget _buildAvatarSection() {
final colorScheme = Theme.of(context).colorScheme;
return Center(
child: Container(
width: 72,
height: 72,
decoration: BoxDecoration(
color: AppColors.surfaceInfoLight,
color: colorScheme.primaryContainer.withValues(alpha: 0.45),
borderRadius: BorderRadius.circular(36),
border: Border.all(color: Colors.transparent),
),
child: const Icon(
Icons.person_outline,
size: 24,
color: AppColors.slate400,
border: Border.all(color: colorScheme.surface.withValues(alpha: 0)),
),
child: Icon(Icons.person_outline, size: 24, color: colorScheme.outline),
),
);
}
Widget _buildFormCard() {
final colorScheme = Theme.of(context).colorScheme;
return Container(
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
color: AppColors.white,
color: colorScheme.surface,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: AppColors.messageCardBorder),
border: Border.all(color: colorScheme.outlineVariant),
),
child: Column(
children: [
@@ -149,12 +149,13 @@ class _AddContactScreenState extends State<AddContactScreen> {
}
Widget _buildDeleteRow() {
final colorScheme = Theme.of(context).colorScheme;
return Padding(
padding: const EdgeInsets.only(bottom: AppSpacing.sm),
child: LinkButton(
text: context.l10n.contactDelete,
onTap: _handleDelete,
foregroundColor: AppColors.red600,
foregroundColor: colorScheme.error,
),
);
}
@@ -177,6 +178,7 @@ class _AddContactScreenState extends State<AddContactScreen> {
}
void _handleDelete() {
final colorScheme = Theme.of(context).colorScheme;
showDialog(
context: context,
builder: (context) => AlertDialog(
@@ -195,7 +197,7 @@ class _AddContactScreenState extends State<AddContactScreen> {
},
child: Text(
context.l10n.commonDelete,
style: const TextStyle(color: AppColors.red600),
style: TextStyle(color: colorScheme.error),
),
),
],