themeData static method

ThemeData themeData(
  1. Color themeColor
)

Build a dark theme according to the theme color. 通过主题色构建一个默认的暗黑主题

Implementation

static ThemeData themeData(Color themeColor) {
  return ThemeData.dark().copyWith(
    primaryColor: Colors.grey[900],
    primaryColorLight: Colors.grey[900],
    primaryColorDark: Colors.grey[900],
    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(
      systemOverlayStyle: SystemUiOverlayStyle(
        statusBarBrightness: Brightness.dark,
        statusBarIconBrightness: Brightness.light,
      ),
      elevation: 0,
    ),
    buttonTheme: ButtonThemeData(buttonColor: themeColor),
    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,
    ),
  );
}