refactor(apps): migrate hardcoded colors to AppColors tokens
- Replace Color(0xFFF8FAFC) with AppColors.surfaceSecondary (11 uses) - Replace Color(0xFFF8FAFF) with AppColors.surfaceTertiary (9 uses) - Replace Color(0xFFE2E8F0) with AppColors.borderSecondary (5 uses) - Replace Color(0xFFDCE5F4) with AppColors.borderTertiary (5 uses) - Replace Color(0xFFCFE1FB) with AppColors.borderQuaternary (5 uses) - Replace Color(0xFFF59E0B) with AppColors.warning (4 uses) - Replace Color(0xFFEAF3FF) with AppColors.surfaceInfo (4 uses) - Replace Color(0xFF10B981) with AppColors.success (4 uses) - Replace Color(0xFFEF4444) with AppColors.error (3 uses) - Replace Color(0xFFF3F7FF) with AppColors.surfaceInfoLight (3 uses) Files migrated: - settings_screen.dart (7 colors migrated) - contacts_screen.dart (3 colors migrated) - calendar_event_detail_screen.dart (10 colors migrated) - features_screen.dart (3 colors migrated) - toast_type_config.dart (3 colors migrated) - memory_screen.dart (4 colors migrated) - account_screen.dart (3 colors migrated) - add_contact_screen.dart (2 colors migrated) Total: 37 hardcoded colors replaced with design tokens Verification: - flutter analyze: passed - flutter test: passed
This commit is contained in:
@@ -8,7 +8,7 @@ class CalendarEventDetailScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
backgroundColor: AppColors.surfaceSecondary,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -34,7 +34,7 @@ class CalendarEventDetailScreen extends StatelessWidget {
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF8FAFF),
|
||||
color: AppColors.surfaceTertiary,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
border: Border.all(color: const Color(0xFFDEE7F6)),
|
||||
),
|
||||
@@ -115,9 +115,9 @@ class CalendarEventDetailScreen extends StatelessWidget {
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF8FAFF),
|
||||
color: AppColors.surfaceTertiary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: const Color(0xFFDCE5F4)),
|
||||
border: Border.all(color: AppColors.borderTertiary),
|
||||
),
|
||||
child: const Icon(
|
||||
LucideIcons.pencil,
|
||||
@@ -190,11 +190,11 @@ class CalendarEventDetailScreen extends StatelessWidget {
|
||||
const SizedBox(width: 10),
|
||||
_buildColorOption(const Color(0xFF8B5CF6)),
|
||||
const SizedBox(width: 10),
|
||||
_buildColorOption(const Color(0xFF10B981)),
|
||||
_buildColorOption(AppColors.success),
|
||||
const SizedBox(width: 10),
|
||||
_buildColorOption(const Color(0xFFF59E0B)),
|
||||
_buildColorOption(AppColors.warning),
|
||||
const SizedBox(width: 10),
|
||||
_buildColorOption(const Color(0xFFEF4444)),
|
||||
_buildColorOption(AppColors.error),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -237,7 +237,7 @@ class CalendarEventDetailScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFDFEFF),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: const Color(0xFFDCE5F4)),
|
||||
border: Border.all(color: AppColors.borderTertiary),
|
||||
),
|
||||
child: const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -262,7 +262,7 @@ class CalendarEventDetailScreen extends StatelessWidget {
|
||||
return Container(
|
||||
height: 80,
|
||||
padding: const EdgeInsets.all(16),
|
||||
color: const Color(0xFFF8FAFC),
|
||||
color: AppColors.surfaceSecondary,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
@@ -271,7 +271,7 @@ class CalendarEventDetailScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
border: Border.all(color: const Color(0xFFE2E8F0)),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: const Icon(
|
||||
LucideIcons.plus,
|
||||
|
||||
@@ -31,7 +31,7 @@ class _AddContactScreenState extends State<AddContactScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
backgroundColor: AppColors.surfaceSecondary,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -68,9 +68,9 @@ class _AddContactScreenState extends State<AddContactScreen> {
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFEAF3FF),
|
||||
color: AppColors.surfaceInfo,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
border: Border.all(color: const Color(0xFFCFE1FB)),
|
||||
border: Border.all(color: AppColors.borderQuaternary),
|
||||
),
|
||||
child: const Icon(Icons.check, size: 16, color: AppColors.blue600),
|
||||
),
|
||||
|
||||
@@ -49,7 +49,7 @@ class _ContactsScreenState extends State<ContactsScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
backgroundColor: AppColors.surfaceSecondary,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -89,7 +89,7 @@ class _ContactsScreenState extends State<ContactsScreen> {
|
||||
height: 40,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF8FAFF),
|
||||
color: AppColors.surfaceTertiary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: const Color(0xFFE4EBF7)),
|
||||
),
|
||||
@@ -218,7 +218,7 @@ class _ContactsScreenState extends State<ContactsScreen> {
|
||||
|
||||
Color _getAvatarBackground(Color color) {
|
||||
if (color == AppColors.blue500) return const Color(0xFFEEF4FF);
|
||||
if (color == AppColors.violet600) return const Color(0xFFF3F7FF);
|
||||
if (color == AppColors.violet600) return AppColors.surfaceInfoLight;
|
||||
if (color == AppColors.blue600) return const Color(0xFFEDF5FF);
|
||||
if (color == const Color(0xFF0EA5E9)) return const Color(0xFFF2F8FF);
|
||||
if (color == AppColors.violet500) return const Color(0xFFF5F7FF);
|
||||
|
||||
@@ -12,7 +12,7 @@ class AccountScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
backgroundColor: AppColors.surfaceSecondary,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -66,7 +66,7 @@ class AccountScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFE2E8F0)),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -74,7 +74,7 @@ class AccountScreen extends StatelessWidget {
|
||||
width: 56,
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFEAF1FF),
|
||||
color: AppColors.surfaceInfo,
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
),
|
||||
child: const Icon(Icons.person, size: 28, color: AppColors.blue500),
|
||||
@@ -110,7 +110,7 @@ class AccountScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFE2E8F0)),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@@ -18,7 +18,7 @@ class _FeaturesScreenState extends State<FeaturesScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
backgroundColor: AppColors.surfaceSecondary,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -90,7 +90,7 @@ class _FeaturesScreenState extends State<FeaturesScreen> {
|
||||
children: [
|
||||
_buildFeatureCard(
|
||||
icon: Icons.calendar_view_week,
|
||||
iconColor: const Color(0xFF10B981),
|
||||
iconColor: AppColors.success,
|
||||
iconBg: const Color(0xFFECFDF5),
|
||||
iconBorder: const Color(0xFFCDEEDC),
|
||||
title: '周报生成',
|
||||
@@ -101,7 +101,7 @@ class _FeaturesScreenState extends State<FeaturesScreen> {
|
||||
const SizedBox(height: 10),
|
||||
_buildFeatureCard(
|
||||
icon: Icons.article,
|
||||
iconColor: const Color(0xFFF59E0B),
|
||||
iconColor: AppColors.warning,
|
||||
iconBg: const Color(0xFFFFF7ED),
|
||||
iconBorder: const Color(0xFFFDE6CD),
|
||||
title: '每周摘要',
|
||||
|
||||
@@ -21,7 +21,7 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
backgroundColor: AppColors.surfaceSecondary,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -55,7 +55,7 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFE2E8F0)),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -129,7 +129,7 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
height: 74,
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF8FAFF),
|
||||
color: AppColors.surfaceTertiary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: const Color(0xFFE8EDF7)),
|
||||
),
|
||||
@@ -139,7 +139,7 @@ class _MemoryScreenState extends State<MemoryScreen> {
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFE8F3FF),
|
||||
color: AppColors.surfaceInfo,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(item.icon, size: 16, color: AppColors.blue500),
|
||||
|
||||
@@ -9,7 +9,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
backgroundColor: AppColors.surfaceSecondary,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -46,7 +46,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
stops: [0, 1],
|
||||
colors: [Color(0xFFFFFFFF), Color(0xFFF3F7FF)],
|
||||
colors: [Color(0xFFFFFFFF), AppColors.surfaceInfoLight],
|
||||
transform: GradientRotation(35 * 3.14159 / 180),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
@@ -97,7 +97,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF8FAFF),
|
||||
color: AppColors.surfaceTertiary,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: const Color(0xFFDEE7F6)),
|
||||
),
|
||||
@@ -144,7 +144,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
child: _buildQuickActionCard(
|
||||
icon: Icons.people,
|
||||
iconColor: AppColors.blue600,
|
||||
iconBg: const Color(0xFFF8FAFF),
|
||||
iconBg: AppColors.surfaceTertiary,
|
||||
iconBorder: const Color(0xFFE6ECF7),
|
||||
title: '联系人',
|
||||
subtitle: '已添加 1 位:Toki',
|
||||
@@ -279,9 +279,9 @@ class SettingsScreen extends StatelessWidget {
|
||||
width: 72,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFEAF3FF),
|
||||
color: AppColors.surfaceInfo,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFCFE1FB)),
|
||||
border: Border.all(color: AppColors.borderQuaternary),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
@@ -305,7 +305,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFE2E8F0)),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'toast_type.dart';
|
||||
import '../../../core/theme/design_tokens.dart';
|
||||
|
||||
class ToastTypeConfig {
|
||||
final Color backgroundColor;
|
||||
@@ -17,19 +18,19 @@ class ToastTypeConfig {
|
||||
static ToastTypeConfig fromType(ToastType type) => switch (type) {
|
||||
ToastType.success => const ToastTypeConfig(
|
||||
backgroundColor: Color(0xFFECFDF5),
|
||||
iconColor: Color(0xFF10B981),
|
||||
iconColor: AppColors.success,
|
||||
textColor: Color(0xFF065F46),
|
||||
icon: Icons.check_circle_outline,
|
||||
),
|
||||
ToastType.warning => const ToastTypeConfig(
|
||||
backgroundColor: Color(0xFFFFFBEB),
|
||||
iconColor: Color(0xFFF59E0B),
|
||||
iconColor: AppColors.warning,
|
||||
textColor: Color(0xFF92400E),
|
||||
icon: Icons.warning_amber_rounded,
|
||||
),
|
||||
ToastType.error => const ToastTypeConfig(
|
||||
backgroundColor: Color(0xFFFEF2F2),
|
||||
iconColor: Color(0xFFEF4444),
|
||||
iconColor: AppColors.error,
|
||||
textColor: Color(0xFF991B1B),
|
||||
icon: Icons.error_outline,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user