ThemeData constructor
ThemeData({
- Brightness? brightness,
- Typography? typography,
- AccentColor? accentColor,
- Color? activeColor,
- Color? inactiveColor,
- Color? inactiveBackgroundColor,
- Color? disabledColor,
- Color? scaffoldBackgroundColor,
- Color? shadowColor,
- ButtonState<
MouseCursor> ? inputMouseCursor, - Duration? fasterAnimationDuration,
- Duration? fastAnimationDuration,
- Duration? mediumAnimationDuration,
- Duration? slowAnimationDuration,
- Curve? animationCurve,
- ButtonThemeData? buttonTheme,
- CheckboxThemeData? checkboxTheme,
- ToggleSwitchThemeData? toggleSwitchTheme,
- IconThemeData? iconTheme,
- SplitButtonThemeData? splitButtonTheme,
- ContentDialogThemeData? dialogTheme,
- TooltipThemeData? tooltipTheme,
- DividerThemeData? dividerTheme,
- RadioButtonThemeData? radioButtonTheme,
- ToggleButtonThemeData? toggleButtonTheme,
- SliderThemeData? sliderTheme,
- InfoBarThemeData? infoBarTheme,
- FocusThemeData? focusTheme,
- ScrollbarThemeData? scrollbarTheme,
Implementation
factory ThemeData({
Brightness? brightness,
Typography? typography,
AccentColor? accentColor,
Color? activeColor,
Color? inactiveColor,
Color? inactiveBackgroundColor,
Color? disabledColor,
Color? scaffoldBackgroundColor,
Color? navigationPanelBackgroundColor,
Color? shadowColor,
ButtonState<MouseCursor>? inputMouseCursor,
Duration? fasterAnimationDuration,
Duration? fastAnimationDuration,
Duration? mediumAnimationDuration,
Duration? slowAnimationDuration,
Curve? animationCurve,
ButtonThemeData? buttonTheme,
CheckboxThemeData? checkboxTheme,
ToggleSwitchThemeData? toggleSwitchTheme,
IconThemeData? iconTheme,
SplitButtonThemeData? splitButtonTheme,
ContentDialogThemeData? dialogTheme,
TooltipThemeData? tooltipTheme,
DividerThemeData? dividerTheme,
NavigationPanelThemeData? navigationPanelTheme,
RadioButtonThemeData? radioButtonTheme,
ToggleButtonThemeData? toggleButtonTheme,
SliderThemeData? sliderTheme,
InfoBarThemeData? infoBarTheme,
FocusThemeData? focusTheme,
ScrollbarThemeData? scrollbarTheme,
}) {
brightness ??= Brightness.light;
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 ??= Colors.grey[100]!.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);
navigationPanelBackgroundColor ??= navigationPanelBackgroundColor ??
AccentColor('normal', {
'normal': Color.fromARGB(255, 230, 230, 230),
'dark': Color.fromARGB(255, 25, 25, 25)
}).resolveFromBrightness(brightness);
typography =
Typography.standart(brightness: brightness).copyWith(typography);
inputMouseCursor ??= (state) {
if (state.isHovering || state.isPressing)
return SystemMouseCursors.click;
else
return MouseCursor.defer;
};
focusTheme = FocusThemeData.standard(
glowColor: accentColor.withOpacity(0.15),
primaryBorderColor: inactiveColor,
secondaryBorderColor: scaffoldBackgroundColor,
animationCurve: animationCurve,
animationDuration: fasterAnimationDuration,
).copyWith(focusTheme);
buttonTheme ??= const ButtonThemeData();
checkboxTheme ??= const CheckboxThemeData();
toggleButtonTheme ??= const ToggleButtonThemeData();
toggleSwitchTheme ??= const ToggleSwitchThemeData();
iconTheme ??= const IconThemeData();
splitButtonTheme ??= const SplitButtonThemeData();
dialogTheme ??= const ContentDialogThemeData();
tooltipTheme ??= const TooltipThemeData();
dividerTheme ??= const DividerThemeData();
navigationPanelTheme ??= const NavigationPanelThemeData();
radioButtonTheme ??= const RadioButtonThemeData();
sliderTheme ??= const SliderThemeData();
infoBarTheme ??= const InfoBarThemeData();
scrollbarTheme ??= const ScrollbarThemeData();
return ThemeData.raw(
brightness: brightness,
fasterAnimationDuration: fasterAnimationDuration,
fastAnimationDuration: fastAnimationDuration,
mediumAnimationDuration: mediumAnimationDuration,
slowAnimationDuration: slowAnimationDuration,
animationCurve: animationCurve,
accentColor: accentColor,
activeColor: activeColor,
inactiveColor: inactiveColor,
inactiveBackgroundColor: inactiveBackgroundColor,
disabledColor: disabledColor,
scaffoldBackgroundColor: scaffoldBackgroundColor,
navigationPanelBackgroundColor: navigationPanelBackgroundColor,
shadowColor: shadowColor,
buttonTheme: buttonTheme,
checkboxTheme: checkboxTheme,
dialogTheme: dialogTheme,
dividerTheme: dividerTheme,
focusTheme: focusTheme,
iconTheme: iconTheme,
infoBarTheme: infoBarTheme,
navigationPanelTheme: navigationPanelTheme,
radioButtonTheme: radioButtonTheme,
scrollbarTheme: scrollbarTheme,
sliderTheme: sliderTheme,
splitButtonTheme: splitButtonTheme,
toggleButtonTheme: toggleButtonTheme,
toggleSwitchTheme: toggleSwitchTheme,
tooltipTheme: tooltipTheme,
typography: typography,
inputMouseCursor: inputMouseCursor,
);
}