ThemeData constructor

ThemeData({
  1. Brightness? brightness,
  2. VisualDensity? visualDensity,
  3. Typography? typography,
  4. String? fontFamily,
  5. AccentColor? accentColor,
  6. Color? activeColor,
  7. Color? inactiveColor,
  8. Color? inactiveBackgroundColor,
  9. Color? disabledColor,
  10. Color? scaffoldBackgroundColor,
  11. Color? acrylicBackgroundColor,
  12. Color? shadowColor,
  13. ButtonState<MouseCursor>? inputMouseCursor,
  14. Duration? fasterAnimationDuration,
  15. Duration? fastAnimationDuration,
  16. Duration? mediumAnimationDuration,
  17. Duration? slowAnimationDuration,
  18. Curve? animationCurve,
  19. BottomNavigationThemeData? bottomNavigationTheme,
  20. BottomSheetThemeData? bottomSheetTheme,
  21. ButtonThemeData? buttonTheme,
  22. CheckboxThemeData? checkboxTheme,
  23. ChipThemeData? chipTheme,
  24. ToggleSwitchThemeData? toggleSwitchTheme,
  25. IconThemeData? iconTheme,
  26. SplitButtonThemeData? splitButtonTheme,
  27. ContentDialogThemeData? dialogTheme,
  28. TooltipThemeData? tooltipTheme,
  29. DividerThemeData? dividerTheme,
  30. NavigationPaneThemeData? navigationPaneTheme,
  31. RadioButtonThemeData? radioButtonTheme,
  32. ToggleButtonThemeData? toggleButtonTheme,
  33. SliderThemeData? sliderTheme,
  34. InfoBarThemeData? infoBarTheme,
  35. PillButtonBarThemeData? pillButtonBarTheme,
  36. FocusThemeData? focusTheme,
  37. ScrollbarThemeData? scrollbarTheme,
  38. SnackbarThemeData? snackbarTheme,
})

Implementation

factory ThemeData({
  Brightness? brightness,
  VisualDensity? visualDensity,
  Typography? typography,
  String? fontFamily,
  AccentColor? accentColor,
  Color? activeColor,
  Color? inactiveColor,
  Color? inactiveBackgroundColor,
  Color? disabledColor,
  Color? scaffoldBackgroundColor,
  Color? acrylicBackgroundColor,
  Color? shadowColor,
  ButtonState<MouseCursor>? inputMouseCursor,
  Duration? fasterAnimationDuration,
  Duration? fastAnimationDuration,
  Duration? mediumAnimationDuration,
  Duration? slowAnimationDuration,
  Curve? animationCurve,
  BottomNavigationThemeData? bottomNavigationTheme,
  BottomSheetThemeData? bottomSheetTheme,
  ButtonThemeData? buttonTheme,
  CheckboxThemeData? checkboxTheme,
  ChipThemeData? chipTheme,
  ToggleSwitchThemeData? toggleSwitchTheme,
  IconThemeData? iconTheme,
  SplitButtonThemeData? splitButtonTheme,
  ContentDialogThemeData? dialogTheme,
  TooltipThemeData? tooltipTheme,
  DividerThemeData? dividerTheme,
  NavigationPaneThemeData? navigationPaneTheme,
  RadioButtonThemeData? radioButtonTheme,
  ToggleButtonThemeData? toggleButtonTheme,
  SliderThemeData? sliderTheme,
  InfoBarThemeData? infoBarTheme,
  PillButtonBarThemeData? pillButtonBarTheme,
  FocusThemeData? focusTheme,
  ScrollbarThemeData? scrollbarTheme,
  SnackbarThemeData? snackbarTheme,
}) {
  brightness ??= Brightness.light;
  visualDensity ??= VisualDensity.adaptivePlatformDensity;
  fasterAnimationDuration ??= Duration(milliseconds: 90);
  fastAnimationDuration ??= Duration(milliseconds: 150);
  mediumAnimationDuration ??= Duration(milliseconds: 300);
  slowAnimationDuration ??= Duration(milliseconds: 500);
  animationCurve ??= standartCurve;
  accentColor ??= Colors.blue;
  activeColor ??= Colors.white;
  inactiveColor ??= AccentColor('normal', {
    'normal': Colors.black,
    'dark': Colors.white,
  }).resolveFromBrightness(brightness);
  inactiveBackgroundColor ??= AccentColor('normal', {
    'normal': Color(0xFFd6d6d6),
    'dark': Color(0xFF292929),
  }).resolveFromBrightness(brightness);
  disabledColor ??= AccentColor('normal', {
    'normal': const Color(0xFF838383),
    'dark': Colors.grey[80].withOpacity(0.6)
  });
  shadowColor ??= AccentColor('normal', {
    'normal': Colors.black,
    'dark': Colors.grey[130],
  }).resolveFromBrightness(brightness);
  scaffoldBackgroundColor ??= AccentColor('normal', {
    'normal': Colors.white,
    'dark': Colors.black,
  }).resolveFromBrightness(brightness);
  acrylicBackgroundColor ??= AccentColor('normal', {
    'normal': Color.fromARGB(204, 255, 255, 255),
    'dark': Color(0x7F1e1e1e),
  }).resolveFromBrightness(brightness);
  typography = Typography.standard(brightness: brightness)
      .merge(typography)
      .apply(fontFamily: fontFamily);
  inputMouseCursor ??= ButtonState.resolveWith((states) {
    if (states.isHovering || states.isPressing)
      return SystemMouseCursors.click;
    else
      return MouseCursor.defer;
  });
  focusTheme = FocusThemeData.standard(
    glowColor: accentColor.withOpacity(0.15),
    primaryBorderColor: inactiveColor,
    secondaryBorderColor: scaffoldBackgroundColor,
  ).merge(focusTheme);
  buttonTheme ??= const ButtonThemeData();
  checkboxTheme ??= const CheckboxThemeData();
  chipTheme ??= const ChipThemeData();
  toggleButtonTheme ??= const ToggleButtonThemeData();
  toggleSwitchTheme ??= const ToggleSwitchThemeData();
  iconTheme ??= brightness.isDark
      ? const IconThemeData(color: Colors.white, size: 18.0)
      : const IconThemeData(color: Colors.black, size: 18.0);
  splitButtonTheme ??= const SplitButtonThemeData();
  dialogTheme ??= const ContentDialogThemeData();
  tooltipTheme ??= const TooltipThemeData();
  dividerTheme ??= const DividerThemeData();
  navigationPaneTheme ??= NavigationPaneThemeData.standard(
    animationCurve: animationCurve,
    animationDuration: fastAnimationDuration,
    backgroundColor: acrylicBackgroundColor,
    disabledColor: disabledColor,
    highlightColor: accentColor,
    inputMouseCursor: inputMouseCursor,
    typography: typography,
    inactiveColor: inactiveColor,
  );
  radioButtonTheme ??= const RadioButtonThemeData();
  sliderTheme ??= const SliderThemeData();
  infoBarTheme ??= const InfoBarThemeData();
  pillButtonBarTheme ??= const PillButtonBarThemeData();
  scrollbarTheme ??= const ScrollbarThemeData();
  bottomNavigationTheme ??= const BottomNavigationThemeData();
  snackbarTheme ??= const SnackbarThemeData();
  bottomSheetTheme ??= const BottomSheetThemeData();
  return ThemeData.raw(
    brightness: brightness,
    visualDensity: visualDensity,
    fasterAnimationDuration: fasterAnimationDuration,
    fastAnimationDuration: fastAnimationDuration,
    mediumAnimationDuration: mediumAnimationDuration,
    slowAnimationDuration: slowAnimationDuration,
    animationCurve: animationCurve,
    accentColor: accentColor,
    activeColor: activeColor,
    inactiveColor: inactiveColor,
    inactiveBackgroundColor: inactiveBackgroundColor,
    disabledColor: disabledColor,
    scaffoldBackgroundColor: scaffoldBackgroundColor,
    acrylicBackgroundColor: acrylicBackgroundColor,
    shadowColor: shadowColor,
    bottomNavigationTheme: bottomNavigationTheme,
    buttonTheme: buttonTheme,
    checkboxTheme: checkboxTheme,
    chipTheme: chipTheme,
    dialogTheme: dialogTheme,
    dividerTheme: dividerTheme,
    focusTheme: focusTheme,
    iconTheme: iconTheme,
    infoBarTheme: infoBarTheme,
    navigationPaneTheme: navigationPaneTheme,
    radioButtonTheme: radioButtonTheme,
    scrollbarTheme: scrollbarTheme,
    sliderTheme: sliderTheme,
    splitButtonTheme: splitButtonTheme,
    toggleButtonTheme: toggleButtonTheme,
    toggleSwitchTheme: toggleSwitchTheme,
    tooltipTheme: tooltipTheme,
    typography: typography,
    inputMouseCursor: inputMouseCursor,
    snackbarTheme: snackbarTheme,
    pillButtonBarTheme: pillButtonBarTheme,
    bottomSheetTheme: bottomSheetTheme,
  );
}