7849f6e7e5
- 修复 CardTheme → CardThemeData(Flutter 3.41 API 变更) - 修复 finance_screen 缺少 FormDialog import - 修复工具栏 Row overflow(添加横向滚动) - flutter create --platforms=macos,web 生成平台配置 - 添加 docs/dev-setup.md:完整开发环境配置指南 含 Go/Flutter/Docker 安装、已知 macOS 26 兼容问题及解决方案 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
100 lines
3.6 KiB
Dart
100 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class AppTheme {
|
|
static const Color primary = Color(0xFF1565C0);
|
|
static const Color primaryDark = Color(0xFF0D47A1);
|
|
static const Color primaryLight = Color(0xFF1976D2);
|
|
static const Color accent = Color(0xFFFF6F00);
|
|
static const Color success = Color(0xFF2E7D32);
|
|
static const Color danger = Color(0xFFC62828);
|
|
static const Color background = Color(0xFFF5F5F5);
|
|
static const Color surface = Color(0xFFFFFFFF);
|
|
static const Color border = Color(0xFFE0E0E0);
|
|
static const Color textPrimary = Color(0xFF212121);
|
|
static const Color textSecondary = Color(0xFF757575);
|
|
|
|
static ThemeData light() {
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: primary,
|
|
brightness: Brightness.light,
|
|
).copyWith(
|
|
primary: primary,
|
|
surface: surface,
|
|
onPrimary: Colors.white,
|
|
),
|
|
scaffoldBackgroundColor: background,
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: primary,
|
|
foregroundColor: Colors.white,
|
|
elevation: 0,
|
|
centerTitle: false,
|
|
toolbarHeight: 56,
|
|
),
|
|
cardTheme: CardThemeData(
|
|
color: surface,
|
|
elevation: 1,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(4),
|
|
side: const BorderSide(color: border, width: 0.5),
|
|
),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: primary,
|
|
foregroundColor: Colors.white,
|
|
minimumSize: const Size(0, 36),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
|
|
),
|
|
),
|
|
outlinedButtonTheme: OutlinedButtonThemeData(
|
|
style: OutlinedButton.styleFrom(
|
|
foregroundColor: primary,
|
|
minimumSize: const Size(0, 36),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
|
|
side: const BorderSide(color: primary),
|
|
),
|
|
),
|
|
textButtonTheme: TextButtonThemeData(
|
|
style: TextButton.styleFrom(
|
|
foregroundColor: primary,
|
|
minimumSize: const Size(0, 36),
|
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
),
|
|
),
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(4),
|
|
borderSide: const BorderSide(color: border),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(4),
|
|
borderSide: const BorderSide(color: border),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(4),
|
|
borderSide: const BorderSide(color: primary, width: 1.5),
|
|
),
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
|
isDense: true,
|
|
filled: true,
|
|
fillColor: surface,
|
|
),
|
|
dividerTheme: const DividerThemeData(color: border, thickness: 0.5),
|
|
textTheme: const TextTheme(
|
|
bodyLarge: TextStyle(fontSize: 14, color: textPrimary),
|
|
bodyMedium: TextStyle(fontSize: 14, color: textPrimary),
|
|
bodySmall: TextStyle(fontSize: 12, color: textSecondary),
|
|
titleMedium: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: textPrimary),
|
|
labelMedium: TextStyle(fontSize: 12, color: textSecondary),
|
|
),
|
|
);
|
|
}
|
|
}
|