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
@@ -47,6 +47,8 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
int _contextWindowCount = 2;
final Set<String> _selectedTools = <String>{'memory.write', 'memory.forget'};
ColorScheme get _colorScheme => Theme.of(context).colorScheme;
@override
void initState() {
super.initState();
@@ -117,8 +119,8 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
const SizedBox(height: AppSpacing.sm),
Text(
error,
style: const TextStyle(
color: AppColors.error,
style: TextStyle(
color: _colorScheme.error,
fontSize: 13,
fontWeight: FontWeight.w500,
),
@@ -245,23 +247,23 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
width: double.infinity,
padding: const EdgeInsets.all(AppSpacing.lg),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [AppColors.white, AppColors.surfaceInfoLight],
gradient: LinearGradient(
colors: [_colorScheme.surface, _colorScheme.surfaceContainerLow],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(AppRadius.xl),
border: Border.all(color: AppColors.borderTertiary),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
job.title,
style: const TextStyle(
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
color: AppColors.slate900,
color: _colorScheme.onSurface,
),
),
const SizedBox(height: AppSpacing.sm),
@@ -294,14 +296,14 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
vertical: AppSpacing.xs,
),
decoration: BoxDecoration(
color: AppColors.white,
color: _colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.full),
border: Border.all(color: AppColors.borderSecondary),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Text(
text,
style: const TextStyle(
color: AppColors.slate600,
style: TextStyle(
color: _colorScheme.onSurfaceVariant,
fontSize: 12,
fontWeight: FontWeight.w600,
),
@@ -453,9 +455,9 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
vertical: AppSpacing.md,
),
decoration: BoxDecoration(
color: AppColors.white,
color: _colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.lg),
border: Border.all(color: AppColors.borderSecondary),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Row(
children: [
@@ -465,8 +467,8 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
children: [
Text(
label,
style: const TextStyle(
color: AppColors.slate500,
style: TextStyle(
color: _colorScheme.onSurfaceVariant,
fontSize: 12,
fontWeight: FontWeight.w500,
),
@@ -474,8 +476,8 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
const SizedBox(height: AppSpacing.xs),
Text(
value,
style: const TextStyle(
color: AppColors.slate800,
style: TextStyle(
color: _colorScheme.onSurface,
fontSize: 14,
fontWeight: FontWeight.w600,
),
@@ -483,7 +485,10 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
],
),
),
const Icon(Icons.keyboard_arrow_down, color: AppColors.slate400),
Icon(
Icons.keyboard_arrow_down,
color: _colorScheme.onSurfaceVariant,
),
],
),
),
@@ -502,17 +507,17 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
vertical: AppSpacing.md,
),
decoration: BoxDecoration(
color: AppColors.white,
color: _colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.lg),
border: Border.all(color: AppColors.borderSecondary),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Row(
children: [
Expanded(
child: Text(
context.l10n.settingsJobCounterValue(label, value),
style: const TextStyle(
color: AppColors.slate800,
style: TextStyle(
color: _colorScheme.onSurface,
fontSize: 14,
fontWeight: FontWeight.w600,
),
@@ -537,14 +542,18 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
width: AppSpacing.xxl + AppSpacing.md,
height: AppSpacing.xxl + AppSpacing.md,
decoration: BoxDecoration(
color: onTap == null ? AppColors.slate100 : AppColors.surfaceTertiary,
color: onTap == null
? _colorScheme.surfaceContainerHighest
: _colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(AppRadius.full),
border: Border.all(color: AppColors.borderSecondary),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Icon(
icon,
size: AppSpacing.lg,
color: onTap == null ? AppColors.slate300 : AppColors.blue500,
color: onTap == null
? _colorScheme.onSurfaceVariant
: _colorScheme.primary,
),
),
);
@@ -573,16 +582,22 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
vertical: AppSpacing.sm,
),
decoration: BoxDecoration(
color: selected ? AppColors.blue50 : AppColors.white,
color: selected
? _colorScheme.primaryContainer
: _colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.full),
border: Border.all(
color: selected ? AppColors.blue300 : AppColors.borderSecondary,
color: selected
? _colorScheme.primary
: _colorScheme.outlineVariant,
),
),
child: Text(
localizeToolName(toolName),
style: TextStyle(
color: selected ? AppColors.blue600 : AppColors.slate600,
color: selected
? _colorScheme.primary
: _colorScheme.onSurfaceVariant,
fontSize: 12,
fontWeight: FontWeight.w600,
),
@@ -608,9 +623,9 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
return Container(
padding: const EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: AppColors.white,
color: _colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.lg),
border: Border.all(color: AppColors.borderSecondary),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -618,7 +633,7 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
Text(
l10n.settingsJobRunDays,
style: TextStyle(
color: AppColors.slate500,
color: _colorScheme.onSurfaceVariant,
fontSize: 12,
fontWeight: FontWeight.w500,
),
@@ -648,18 +663,22 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
vertical: AppSpacing.sm,
),
decoration: BoxDecoration(
color: selected ? AppColors.blue50 : AppColors.white,
color: selected
? _colorScheme.primaryContainer
: _colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.full),
border: Border.all(
color: selected
? AppColors.blue300
: AppColors.borderSecondary,
? _colorScheme.primary
: _colorScheme.outlineVariant,
),
),
child: Text(
entry.value,
style: TextStyle(
color: selected ? AppColors.blue600 : AppColors.slate600,
color: selected
? _colorScheme.primary
: _colorScheme.onSurfaceVariant,
fontSize: 12,
fontWeight: FontWeight.w600,
),
@@ -691,14 +710,14 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
width: double.infinity,
padding: const EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: AppColors.white,
color: _colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.lg),
border: Border.all(color: AppColors.borderSecondary),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Text(
text,
style: const TextStyle(
color: AppColors.slate700,
style: TextStyle(
color: _colorScheme.onSurface,
fontSize: 13,
fontWeight: FontWeight.w500,
height: 1.5,
@@ -710,10 +729,10 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
Widget _buildSectionTitle(String title) {
return Text(
title,
style: const TextStyle(
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
color: AppColors.slate500,
color: _colorScheme.onSurfaceVariant,
),
);
}
@@ -722,9 +741,9 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
return Container(
padding: const EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: AppColors.white,
color: _colorScheme.surface,
borderRadius: BorderRadius.circular(AppRadius.lg),
border: Border.all(color: AppColors.borderSecondary),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -742,8 +761,8 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
children: [
Text(
label,
style: const TextStyle(
color: AppColors.slate500,
style: TextStyle(
color: _colorScheme.onSurfaceVariant,
fontSize: 13,
fontWeight: FontWeight.w500,
),
@@ -753,8 +772,8 @@ class _JobDetailScreenState extends State<JobDetailScreen> {
child: Text(
value,
textAlign: TextAlign.right,
style: const TextStyle(
color: AppColors.slate800,
style: TextStyle(
color: _colorScheme.onSurface,
fontSize: 13,
fontWeight: FontWeight.w600,
),