chore(project): 初始化项目基础配置文件
- 添加 CodeGraph、Android 和通用 gitignore 配置 - 创建项目元数据文件跟踪 Flutter 项目属性 - 添加 Codex AI 指导文档 AGENTS.md 说明项目架构 - 配置代码分析选项 analysis_options.yaml - 设置 Android 应用清单权限和 Kiosk 模式配置 - 实现中英文国际化支持 AppLocalizations - 配置 GoRouter 应用路由导航 - 创建明亮工业控制风格的主题配置 AppTheme
This commit is contained in:
179
lib/core/theme/app_theme.dart
Normal file
179
lib/core/theme/app_theme.dart
Normal file
@@ -0,0 +1,179 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// 应用主题配置 - 明亮工业控制风格
|
||||
/// 主色 #2196F3,圆角 4px,明亮背景,适配 1920x1080 横屏
|
||||
class AppTheme {
|
||||
// ========== 主色 ==========
|
||||
static const Color primaryColor = Color(0xFF2196F3);
|
||||
static const Color primaryDark = Color(0xFF1976D2);
|
||||
static const Color primaryLight = Color(0xFFBBDEFB);
|
||||
|
||||
// ========== 功能色 ==========
|
||||
static const Color successColor = Color(0xFF4CAF50);
|
||||
static const Color warningColor = Color(0xFFFF9800);
|
||||
static const Color errorColor = Color(0xFFF44336);
|
||||
static const Color infoColor = Color(0xFF00BCD4);
|
||||
|
||||
// ========== 背景色(明亮) ==========
|
||||
static const Color bgPage = Color(0xFFF5F7FA);
|
||||
static const Color bgDeep = Color(0xFFE8ECF0);
|
||||
static const Color bgSurface = Color(0xFFFFFFFF);
|
||||
static const Color bgCard = Color(0xFFFFFFFF);
|
||||
static const Color bgCardHover = Color(0xFFF0F7FF);
|
||||
static const Color bgSidebar = Color(0xFFF0F2F5);
|
||||
|
||||
// ========== 文本色 ==========
|
||||
static const Color textHeading = Color(0xFF1A1A2E);
|
||||
static const Color textPrimary = Color(0xFF333344);
|
||||
static const Color textSecondary = Color(0xFF6B7280);
|
||||
static const Color textTertiary = Color(0xFF9CA3AF);
|
||||
static const Color textOnPrimary = Colors.white;
|
||||
|
||||
// ========== 状态色 ==========
|
||||
static const Color statusRunning = Color(0xFF4CAF50);
|
||||
static const Color statusStopped = Color(0xFF9CA3AF);
|
||||
static const Color statusPaused = Color(0xFFFF9800);
|
||||
static const Color statusError = Color(0xFFF44336);
|
||||
|
||||
// ========== 卡片背景 ==========
|
||||
static const Color cardBg = Color(0xFFFFFFFF);
|
||||
static const Color cardSelectedBg = Color(0xFFE3F2FD);
|
||||
|
||||
// ========== 功能色(accent) ==========
|
||||
static const Color accentPrimary = primaryColor;
|
||||
static const Color accentInfo = infoColor;
|
||||
static const Color accentWarning = warningColor;
|
||||
static const Color accentCritical = errorColor;
|
||||
|
||||
// ========== 边框色 ==========
|
||||
static const Color borderLight = Color(0xFFE5E7EB);
|
||||
static const Color borderMedium = Color(0xFFD1D5DB);
|
||||
static const Color borderSubtle = borderLight;
|
||||
static const Color borderFocus = primaryColor;
|
||||
|
||||
// ========== 圆角 ==========
|
||||
static const double radiusSm = 4.0;
|
||||
static const double radiusMd = 8.0;
|
||||
static const double radiusLg = 12.0;
|
||||
|
||||
// ========== 阴影 ==========
|
||||
static const List<BoxShadow> shadowCard = [
|
||||
BoxShadow(
|
||||
color: Color(0x0A000000),
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
];
|
||||
|
||||
static const List<BoxShadow> shadowCardHover = [
|
||||
BoxShadow(
|
||||
color: Color(0x14000000),
|
||||
blurRadius: 12,
|
||||
offset: Offset(0, 4),
|
||||
),
|
||||
];
|
||||
|
||||
// ========== 兼容旧代码的颜色别名 ==========
|
||||
static const Color runningColor = statusRunning;
|
||||
static const Color idleColor = statusStopped;
|
||||
static const Color backgroundColor = bgPage;
|
||||
static const Color cardColor = bgCard;
|
||||
|
||||
/// 亮色主题 - 明亮工业风格
|
||||
static ThemeData lightTheme() {
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: primaryColor,
|
||||
brightness: Brightness.light,
|
||||
),
|
||||
scaffoldBackgroundColor: bgPage,
|
||||
fontFamily: 'Inter',
|
||||
cardTheme: CardThemeData(
|
||||
color: bgCard,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(radiusMd),
|
||||
side: const BorderSide(color: borderLight, width: 1),
|
||||
),
|
||||
margin: EdgeInsets.zero,
|
||||
),
|
||||
appBarTheme: const AppBarTheme(
|
||||
backgroundColor: bgSurface,
|
||||
foregroundColor: textHeading,
|
||||
elevation: 0,
|
||||
centerTitle: false,
|
||||
scrolledUnderElevation: 1,
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primaryColor,
|
||||
foregroundColor: textOnPrimary,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
),
|
||||
),
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
borderSide: const BorderSide(color: borderMedium),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
borderSide: const BorderSide(color: borderMedium),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
borderSide: const BorderSide(color: primaryColor, width: 2),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: bgSurface,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
),
|
||||
dialogTheme: DialogThemeData(
|
||||
backgroundColor: bgSurface,
|
||||
elevation: 4,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(radiusMd),
|
||||
),
|
||||
),
|
||||
snackBarTheme: SnackBarThemeData(
|
||||
backgroundColor: textHeading,
|
||||
contentTextStyle: const TextStyle(color: Colors.white, fontSize: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(radiusSm),
|
||||
),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
listTileTheme: const ListTileThemeData(
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(radiusSm)),
|
||||
),
|
||||
),
|
||||
dataTableTheme: DataTableThemeData(
|
||||
headingRowColor: WidgetStateProperty.all(bgSidebar),
|
||||
dividerThickness: 1,
|
||||
),
|
||||
dividerTheme: const DividerThemeData(
|
||||
color: borderLight,
|
||||
thickness: 1,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 暗色主题(与亮色主题风格一致的暗色模式)
|
||||
static ThemeData darkTheme() {
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: primaryColor,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
scaffoldBackgroundColor: const Color(0xFF121212),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user