120 lines
3.3 KiB
Dart
120 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
class AppTheme {
|
|
// 颜色系统
|
|
static const Color primaryColor = Color(0xFF6366F1); // Indigo
|
|
static const Color secondaryColor = Color(0xFF8B5CF6); // Purple
|
|
static const Color accentColor = Color(0xFF10B981); // Green
|
|
|
|
// 分类颜色
|
|
static const Color workColor = Color(0xFF6366F1); // Indigo
|
|
static const Color studyColor = Color(0xFF8B5CF6); // Purple
|
|
static const Color entertainmentColor = Color(0xFFF59E0B); // Orange
|
|
static const Color socialColor = Color(0xFFEC4899); // Pink
|
|
static const Color toolColor = Color(0xFF6B7280); // Gray
|
|
|
|
// 状态颜色
|
|
static const Color successColor = Color(0xFF10B981);
|
|
static const Color warningColor = Color(0xFFF59E0B);
|
|
static const Color errorColor = Color(0xFFEF4444);
|
|
static const Color infoColor = Color(0xFF3B82F6);
|
|
|
|
// 浅色主题
|
|
static ThemeData get lightTheme {
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: primaryColor,
|
|
brightness: Brightness.light,
|
|
),
|
|
textTheme: GoogleFonts.interTextTheme(),
|
|
scaffoldBackgroundColor: Colors.white,
|
|
cardTheme: CardThemeData(
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
color: Colors.grey[50],
|
|
),
|
|
appBarTheme: AppBarTheme(
|
|
elevation: 0,
|
|
backgroundColor: Colors.white,
|
|
foregroundColor: Colors.black87,
|
|
titleTextStyle: GoogleFonts.inter(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.black87,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
// 深色主题
|
|
static ThemeData get darkTheme {
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: primaryColor,
|
|
brightness: Brightness.dark,
|
|
),
|
|
textTheme: GoogleFonts.interTextTheme(ThemeData.dark().textTheme),
|
|
scaffoldBackgroundColor: const Color(0xFF1F2937),
|
|
cardTheme: CardThemeData(
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
color: const Color(0xFF374151),
|
|
),
|
|
appBarTheme: AppBarTheme(
|
|
elevation: 0,
|
|
backgroundColor: const Color(0xFF1F2937),
|
|
foregroundColor: Colors.white,
|
|
titleTextStyle: GoogleFonts.inter(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
// 获取分类颜色
|
|
static Color getCategoryColor(String category) {
|
|
switch (category.toLowerCase()) {
|
|
case 'work':
|
|
return workColor;
|
|
case 'study':
|
|
return studyColor;
|
|
case 'entertainment':
|
|
return entertainmentColor;
|
|
case 'social':
|
|
return socialColor;
|
|
case 'tool':
|
|
return toolColor;
|
|
default:
|
|
return Colors.grey;
|
|
}
|
|
}
|
|
|
|
// 获取分类中文名称
|
|
static String getCategoryName(String category) {
|
|
switch (category.toLowerCase()) {
|
|
case 'work':
|
|
return '工作';
|
|
case 'study':
|
|
return '学习';
|
|
case 'entertainment':
|
|
return '娱乐';
|
|
case 'social':
|
|
return '社交';
|
|
case 'tool':
|
|
return '工具';
|
|
default:
|
|
return '其他';
|
|
}
|
|
}
|
|
}
|
|
|