You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.8 KiB

import 'package:flutter/material.dart';
class AppTheme {
static final ThemeData lightTheme = ThemeData(
brightness: Brightness.light,
primaryColor: Colors.blue,
scaffoldBackgroundColor: Colors.white,
// colorScheme: const ColorScheme.light(
// primary: Colors.blue, // 主色:蓝色(修复:确保 colorScheme.primary 为蓝色)
// secondary: Color(0xFF5E5CE6), // 次色:紫色,与暗色主题保持一致
// surface: Colors.white,
// background: Colors.white,
// error: Colors.redAccent,
// ),
appBarTheme: const AppBarTheme(
backgroundColor: Colors.blue,
foregroundColor: Colors.white,
elevation: 0,
),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
selectedItemColor: Colors.blue,
unselectedItemColor: Colors.grey,
),
);
static final ThemeData darkTheme = ThemeData(
brightness: Brightness.dark,
primaryColor: const Color(0xFF0066CC), // 深蓝色主色调
primarySwatch: Colors.blue,
scaffoldBackgroundColor: Colors.black, // 纯黑色背景
cardColor: const Color(0xFF1A1A1A), // 深灰色卡片背景
dividerColor: Colors.white12,
colorScheme: const ColorScheme.dark(
primary: Color(0xFF0066CC), // 主色调
secondary: Color(0xFF5E5CE6), // 紫色次要色调
surface: Color(0xFF1A1A1A), // 表面颜色
background: Colors.black, // 背景色
error: Colors.redAccent,
),
textTheme: const TextTheme(
bodyLarge: TextStyle(color: Colors.white),
bodyMedium: TextStyle(color: Colors.white),
bodySmall: TextStyle(color: Colors.white70),
),
appBarTheme: const AppBarTheme(
backgroundColor: Colors.black,
foregroundColor: Colors.white,
elevation: 0,
iconTheme: IconThemeData(color: Colors.white),
),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
backgroundColor: Color(0xFF1A1A1A), // 深灰色导航栏背景
selectedItemColor: Colors.white, // 选中项为白色
unselectedItemColor: Colors.grey, // 未选中项为灰色
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: Colors.white.withOpacity(0.1),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: const BorderSide(color: Color(0xFF0066CC)),
),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF0066CC),
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.symmetric(vertical: 12),
),
),
);
}