refactor(apps): 主题系统迁移至 ColorScheme + 扩展架构并支持 Dark Mode
This commit is contained in:
@@ -5,7 +5,6 @@ import 'package:lucide_icons/lucide_icons.dart';
|
||||
import '../../../../app/di/injection.dart';
|
||||
import '../../../../app/router/app_routes.dart';
|
||||
import '../../../../core/l10n/l10n.dart';
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
import '../../../../shared/widgets/back_title_page_header.dart';
|
||||
import '../../../../shared/widgets/detail_header_action_menu.dart';
|
||||
import '../../../../shared/widgets/destructive_action_sheet.dart';
|
||||
@@ -84,30 +83,31 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Color _getPriorityColor(int priority) {
|
||||
Color _getPriorityColor(int priority, ColorScheme colorScheme) {
|
||||
switch (priority) {
|
||||
case 1:
|
||||
return AppColors.g1Text;
|
||||
return colorScheme.error;
|
||||
case 2:
|
||||
return AppColors.g3Text;
|
||||
return colorScheme.tertiary;
|
||||
case 3:
|
||||
return AppColors.g2Text;
|
||||
return colorScheme.primary;
|
||||
default:
|
||||
return AppColors.slate500;
|
||||
return colorScheme.onSurfaceVariant;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.todoBg,
|
||||
backgroundColor: colorScheme.surface,
|
||||
body: SafeArea(
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [AppColors.homeBackgroundTop, AppColors.todoBg],
|
||||
colors: [colorScheme.surfaceContainerHigh, colorScheme.surface],
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
@@ -164,6 +164,7 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
}
|
||||
|
||||
Widget _buildContent() {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
if (_isLoading) {
|
||||
return const FullScreenLoading();
|
||||
}
|
||||
@@ -192,7 +193,7 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.slate500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
@@ -201,7 +202,7 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
time: _formatEventTime(item.startAt, item.endAt),
|
||||
borderColor: AppColors.todoEventBorder1,
|
||||
borderColor: colorScheme.outlineVariant,
|
||||
onTap: () =>
|
||||
context.push(AppRoutes.calendarEventDetail(item.id)),
|
||||
),
|
||||
@@ -225,60 +226,61 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
}
|
||||
|
||||
Widget _buildMainCard() {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.todoCardBg,
|
||||
color: colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: AppColors.todoDetailCardBorder, width: 1),
|
||||
border: Border.all(color: colorScheme.outlineVariant, width: 1),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_todo!.title,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.slate900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_buildSubtitle(),
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.slate500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
if (_todo!.description != null && _todo!.description!.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
_todo!.description!,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 13,
|
||||
color: AppColors.slate600,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
Container(height: 1, color: AppColors.border),
|
||||
Container(height: 1, color: colorScheme.outlineVariant),
|
||||
const SizedBox(height: 8),
|
||||
_buildInfoRow(
|
||||
label: context.l10n.todoPriorityQuadrant,
|
||||
value: _getPriorityLabel(_todo!.priority),
|
||||
valueColor: _getPriorityColor(_todo!.priority),
|
||||
valueColor: _getPriorityColor(_todo!.priority, colorScheme),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildInfoRow(
|
||||
label: context.l10n.todoLinkedCalendarEvents,
|
||||
value: context.l10n.todoItemCount(_todo!.scheduleItems.length),
|
||||
valueColor: AppColors.g3Text,
|
||||
valueColor: colorScheme.tertiary,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildInfoRow(
|
||||
@@ -287,8 +289,8 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
? context.l10n.todoStatusDone
|
||||
: context.l10n.todoStatusInProgress,
|
||||
valueColor: _todo!.status == 'done'
|
||||
? AppColors.success
|
||||
: AppColors.blue600,
|
||||
? colorScheme.tertiary
|
||||
: colorScheme.primary,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -311,16 +313,17 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
required String value,
|
||||
required Color valueColor,
|
||||
}) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.slate400,
|
||||
color: colorScheme.outline,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
@@ -343,6 +346,7 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
required Color borderColor,
|
||||
VoidCallback? onTap,
|
||||
}) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
@@ -350,7 +354,7 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
padding: const EdgeInsets.all(10),
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.todoCardBg,
|
||||
color: colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: borderColor, width: 1),
|
||||
),
|
||||
@@ -359,21 +363,21 @@ class _TodoDetailScreenState extends State<TodoDetailScreen> {
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.slate700,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
time,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.slate500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user