themeData static method
Build a dark theme according to the theme color. 通过主题色构建一个默认的暗黑主题
Implementation
static ThemeData themeData(Color themeColor) {
return ThemeData.dark().copyWith(
buttonColor: themeColor,
brightness: Brightness.dark,
primaryColor: Colors.grey[900],
primaryColorBrightness: Brightness.dark,
primaryColorLight: Colors.grey[900],
primaryColorDark: Colors.grey[900],
accentColor: themeColor,
accentColorBrightness: Brightness.dark,
canvasColor: Colors.grey[850],
scaffoldBackgroundColor: Colors.grey[900],
bottomAppBarColor: Colors.grey[900],
cardColor: Colors.grey[900],
highlightColor: Colors.transparent,
toggleableActiveColor: themeColor,
textSelectionTheme: TextSelectionThemeData(
cursorColor: themeColor,
selectionColor: themeColor.withAlpha(100),
selectionHandleColor: themeColor,
),
indicatorColor: themeColor,
appBarTheme: const AppBarTheme(
brightness: Brightness.dark,
elevation: 0,
),
colorScheme: ColorScheme(
primary: Colors.grey[900]!,
primaryVariant: Colors.grey[900]!,
secondary: themeColor,
secondaryVariant: themeColor,
background: Colors.grey[900]!,
surface: Colors.grey[900]!,
brightness: Brightness.dark,
error: const Color(0xffcf6679),
onPrimary: Colors.black,
onSecondary: Colors.black,
onSurface: Colors.white,
onBackground: Colors.white,
onError: Colors.black,
),
);
}