import 'package:flutter/material.dart'; ///优先使用Theme中的颜色,如果Theme中颜色不满足需求再使用colorScheme中的颜色 ///primaryColor是主颜色,确定色系 ///primaryColorLight为主颜色的浅色变种 ///primaryColorDark为主颜色的深色变种 ///errorColor为错误色和警告色 /// ///colorScheme: ///primary为主颜色(和primaryColor保持一致或相近颜色) ///secondary为次级颜色(和primaryColor保持一致或同一色系) ///error为错误色(和errorColor保持一致) ///onPrimary为以primaryColor为背景的字体颜色(多为按钮的默认颜色) ///onSurface为Text组件的默认颜色 ///brightness为模式 /// (会影响状态栏以及webview的背景)[ActivityViewPage],[PhonePage],[NewsPage] /// /// 以上为必须需要的颜色,其余未列举出的颜色可自由发挥 /// class Themes { static Map get values => {'默认主题': defaultTheme, '蓝色主题': lightTheme, '夜间主题': darkTheme}; static final ThemeData defaultTheme = ThemeData( primaryColor: const Color(0xFF038873), primaryColorLight: Colors.green, primaryColorDark: const Color(0xFF026F5C), indicatorColor: Colors.green, errorColor: const Color(0xffb00020), toggleableActiveColor: const Color(0xFF038873), colorScheme: ColorScheme( primary: const Color(0xFF038873), secondary: const Color(0xFF038873), surface: Colors.white, background: Colors.white, error: const Color(0xffb00020), onPrimary: Colors.white, onSecondary: Colors.white, onSurface: Colors.black, onBackground: Colors.black, onError: Colors.white, brightness: Brightness.light, primaryVariant: const Color(0xFF038873), secondaryVariant: const Color(0xFF038873), ), ); static final ThemeData lightTheme = ThemeData.light(); static final ThemeData darkTheme = ThemeData.dark().copyWith(brightness: Brightness.dark); }