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
@@ -2,21 +2,21 @@ import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:lucide_icons/lucide_icons.dart';
import '../../../../app/router/app_routes.dart';
import '../../../home/presentation/navigation/home_return_policy.dart';
import '../../../../app/router/home_return_policy.dart';
import '../../../../app/di/injection.dart';
import '../../../../core/l10n/l10n.dart';
import '../../../../core/theme/design_tokens.dart';
import '../../../../data/repositories/calendar_repository.dart';
import '../../../../shared/widgets/app_pressable.dart';
import '../../data/models/schedule_item_model.dart';
import '../../data/services/calendar_repository.dart';
import '../calendar_state_manager.dart';
import '../../../../shared/widgets/bottom_dock.dart';
import '../../../../shared/state/calendar_state_manager.dart';
import '../../../../data/repositories/models/schedule_item_model.dart';
import '../calendar_time_utils.dart';
import '../utils/event_color_resolver.dart';
import '../dayweek/day_event_layout_engine.dart';
import '../dayweek/day_timeline_metrics.dart';
import '../dayweek/day_view_scale.dart';
import '../widgets/bottom_dock.dart';
class CalendarDayWeekScreen extends StatefulWidget {
final DateTime? initialDate;
@@ -52,6 +52,8 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
late List<DateTime> _monthDates;
List<ScheduleItemModel> _events = const [];
ColorScheme get _colorScheme => Theme.of(context).colorScheme;
@override
void initState() {
super.initState();
@@ -107,7 +109,7 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.todoBg,
backgroundColor: _colorScheme.surface,
body: PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) {
@@ -244,18 +246,18 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
height: 36,
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: AppColors.messageBtnWrap,
color: _colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(AppRadius.xl),
border: Border.all(color: AppColors.messageBtnBorder),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(
Icon(
LucideIcons.chevronLeft,
size: 16,
color: AppColors.slate700,
color: _colorScheme.onSurface,
),
const SizedBox(width: 6),
AnimatedSwitcher(
@@ -277,10 +279,10 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
child: Text(
monthLabel,
key: ValueKey(monthLabel),
style: const TextStyle(
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: AppColors.slate700,
color: _colorScheme.onSurface,
),
),
),
@@ -297,17 +299,17 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
height: 36,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
color: AppColors.messageBtnWrap,
color: _colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(AppRadius.xl),
border: Border.all(color: AppColors.messageBtnBorder),
border: Border.all(color: _colorScheme.outlineVariant),
),
child: Center(
child: Text(
context.l10n.calendarToday,
style: const TextStyle(
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: AppColors.slate700,
color: _colorScheme.onSurface,
),
),
),
@@ -328,13 +330,13 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
width: 36,
height: 36,
decoration: BoxDecoration(
color: AppColors.blue600,
color: _colorScheme.primary,
borderRadius: BorderRadius.circular(AppRadius.full),
),
child: const Icon(
child: Icon(
LucideIcons.plus,
size: 20,
color: AppColors.white,
color: _colorScheme.onPrimary,
),
),
),
@@ -454,7 +456,9 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
_weekdayLabel(date),
style: TextStyle(
fontSize: 11,
color: isWeekend ? AppColors.slate400 : AppColors.slate600,
color: isWeekend
? _colorScheme.onSurfaceVariant
: _colorScheme.onSurface,
),
),
const SizedBox(height: 2),
@@ -464,7 +468,9 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
width: 32,
height: 32,
decoration: BoxDecoration(
color: isSelected ? AppColors.blue100 : Colors.transparent,
color: isSelected
? _colorScheme.primaryContainer
: _colorScheme.surface.withValues(alpha: 0),
borderRadius: BorderRadius.circular(AppRadius.full),
),
child: Center(
@@ -474,8 +480,10 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
fontSize: 17,
fontWeight: isSelected ? FontWeight.w700 : FontWeight.w600,
color: isSelected
? AppColors.blue600
: (isWeekend ? AppColors.slate400 : AppColors.slate900),
? _colorScheme.primary
: (isWeekend
? _colorScheme.onSurfaceVariant
: _colorScheme.onSurface),
),
),
),
@@ -572,7 +580,7 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
top: adjustedY,
left: eventAreaLeft,
right: 0,
child: Container(height: 1, color: AppColors.border),
child: Container(height: 1, color: _colorScheme.outlineVariant),
),
Positioned(
top: labelTop,
@@ -584,7 +592,7 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.w600,
color: AppColors.slate400,
color: _colorScheme.onSurfaceVariant,
),
),
),
@@ -613,16 +621,16 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
width: DayTimelineMetrics.timeLabelWidth,
height: 18,
decoration: BoxDecoration(
color: AppColors.red500,
color: _colorScheme.error,
borderRadius: BorderRadius.circular(9),
),
child: Center(
child: Text(
formatHm(now),
style: const TextStyle(
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.w700,
color: Colors.white,
color: _colorScheme.onError,
),
),
),
@@ -632,7 +640,7 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
child: Container(
height: 2,
decoration: BoxDecoration(
color: AppColors.red500,
color: _colorScheme.error,
borderRadius: BorderRadius.circular(99),
),
),
@@ -651,7 +659,7 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
final isArchived = layout.event.status == ScheduleStatus.archived;
Color eventColor;
if (isArchived) {
eventColor = AppColors.slate400;
eventColor = _colorScheme.onSurfaceVariant;
} else {
eventColor = resolveEventColor(
status: layout.event.status,