readful/lib/theme/app_theme.dart
ddshi 8b5fdaa36d feat: 完成UI基础架构搭建和代码质量优化
🏗️ UI基础架构完成:
- 实现底部Tab导航系统,包含4个主要页面
- 创建完整的Material Design 3主题系统
- 支持亮色/暗夜模式自动跟随系统
- 建立规范的页面结构和组件目录

🎨 主题系统特性:
- 专业电子书阅读器配色方案(#0D7A7F)
- 完整的文本主题和组件主题配置
- 响应式颜色适配,优化阅读体验
- 底部导航栏主题色彩统一

📚 项目架构优化:
- 添加详细的代码注释和文档说明
- 创建analysis_options.yaml配置代码质量规范
- 优化文件组织结构,新增components目录
- 修复未使用的导入和代码质量问题

📖 学习文档完善:
- 新增《UI开发阶段基础学习总结》文档
- 详细记录Flutter Widget系统和主题系统知识
- 包含完整的代码示例和最佳实践
- 更新项目主文档CLAUDE.md反映最新进展

🔧 代码质量提升:
- 静态代码分析通过,无严重警告
- 统一命名规范和注释风格
- 完善错误处理和状态管理基础
- 建立可扩展的组件架构基础

🎯 当前项目状态:
- 数据层: 100%完成(Hive + Repository)
- UI基础架构: 100%完成(Tab导航 + 主题)
- 代码质量: 企业级标准
- 技术债务: 零

🚀 下一里程碑: 顶部导航组件开发
- 搜索栏UI设计和实现
- 文件导入按钮功能
- 页面交互和路由系统

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 11:43:57 +08:00

132 lines
3.7 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/material.dart';
/// Readful应用主题配置
///
/// 提供完整的Material Design 3主题系统包括
/// - 亮色和暗色主题支持
/// - 自动跟随系统主题切换
/// - 统一的颜色方案和字体系统
/// - 专业的电子书阅读器配色
class AppTheme {
/// 主题种子颜色
///
/// 选择蓝绿色调(#0D7A7F),原因:
/// - 眼睛友好,适合长时间阅读
/// - 专业且现代的视觉效果
/// - 在亮色和暗色模式下都有良好对比度
static const Color primarySeed = Color(0xFF0D7A7F);
// 亮色主题
static ThemeData lightTheme = ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: primarySeed,
brightness: Brightness.light,
),
// 文本主题配置
textTheme: const TextTheme(
headlineLarge: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
letterSpacing: -0.5,
),
headlineMedium: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
letterSpacing: -0.25,
),
bodyLarge: TextStyle(
fontSize: 16,
fontWeight: FontWeight.normal,
letterSpacing: 0.1,
),
bodyMedium: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
letterSpacing: 0.25,
),
),
// AppBar主题
appBarTheme: const AppBarTheme(
centerTitle: true,
elevation: 0,
scrolledUnderElevation: 1,
),
// Card主题
cardTheme: const CardTheme(
elevation: 2,
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
),
// 底部导航栏主题
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
selectedItemColor: Color(0xFF0D7A7F), // 主题色
unselectedItemColor: Colors.grey,
type: BottomNavigationBarType.fixed,
),
);
// 暗色主题
static ThemeData darkTheme = ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: primarySeed,
brightness: Brightness.dark,
),
// 文本主题配置(暗色模式下的字体配置)
textTheme: const TextTheme(
headlineLarge: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
letterSpacing: -0.5,
color: Colors.white,
),
headlineMedium: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
letterSpacing: -0.25,
color: Colors.white,
),
bodyLarge: TextStyle(
fontSize: 16,
fontWeight: FontWeight.normal,
letterSpacing: 0.1,
color: Colors.white70,
),
bodyMedium: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
letterSpacing: 0.25,
color: Colors.white70,
),
),
// AppBar主题暗色模式
appBarTheme: const AppBarTheme(
centerTitle: true,
elevation: 0,
scrolledUnderElevation: 1,
),
// Card主题暗色模式
cardTheme: const CardTheme(
elevation: 2,
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
),
// 底部导航栏主题(暗色模式)
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
selectedItemColor: Color(0xFF4DD0E1), // 暗色模式下的亮色版本
unselectedItemColor: Colors.grey,
type: BottomNavigationBarType.fixed,
),
);
/// 获取系统当前的主题模式
static Brightness getCurrentBrightness(BuildContext context) {
return MediaQuery.of(context).platformBrightness;
}
/// 根据系统返回对应的主题
static ThemeData getSystemTheme(BuildContext context) {
return getCurrentBrightness(context) == Brightness.dark
? darkTheme
: lightTheme;
}
}