FluentThemeData constructor
FluentThemeData({
- Iterable<
ThemeExtension> ? extensions, - Brightness? brightness,
- VisualDensity? visualDensity,
- Typography? typography,
- String? fontFamily,
- AccentColor? accentColor,
- Color? activeColor,
- Color? inactiveColor,
- Color? inactiveBackgroundColor,
- Color? scaffoldBackgroundColor,
- Color? acrylicBackgroundColor,
- Color? micaBackgroundColor,
- Color? shadowColor,
- Color? cardColor,
- Color? selectionColor,
- Duration? fasterAnimationDuration,
- Duration? fastAnimationDuration,
- Duration? mediumAnimationDuration,
- Duration? slowAnimationDuration,
- Curve? animationCurve,
- ButtonThemeData? buttonTheme,
- CheckboxThemeData? checkboxTheme,
- ToggleSwitchThemeData? toggleSwitchTheme,
- IconThemeData? iconTheme,
- ContentDialogThemeData? dialogTheme,
- TooltipThemeData? tooltipTheme,
- DividerThemeData? dividerTheme,
- RadioButtonThemeData? radioButtonTheme,
- ToggleButtonThemeData? toggleButtonTheme,
- SliderThemeData? sliderTheme,
- InfoBarThemeData? infoBarTheme,
- FocusThemeData? focusTheme,
- ScrollbarThemeData? scrollbarTheme,
- ResourceDictionary? resources,
Implementation
factory FluentThemeData({
Iterable<ThemeExtension<dynamic>>? extensions,
Brightness? brightness,
VisualDensity? visualDensity,
Typography? typography,
String? fontFamily,
AccentColor? accentColor,
Color? activeColor,
Color? inactiveColor,
Color? inactiveBackgroundColor,
Color? scaffoldBackgroundColor,
Color? acrylicBackgroundColor,
Color? micaBackgroundColor,
Color? shadowColor,
Color? menuColor,
Color? cardColor,
Color? selectionColor,
Duration? fasterAnimationDuration,
Duration? fastAnimationDuration,
Duration? mediumAnimationDuration,
Duration? slowAnimationDuration,
Curve? animationCurve,
BottomNavigationThemeData? bottomNavigationTheme,
ButtonThemeData? buttonTheme,
CheckboxThemeData? checkboxTheme,
ToggleSwitchThemeData? toggleSwitchTheme,
IconThemeData? iconTheme,
ContentDialogThemeData? dialogTheme,
TooltipThemeData? tooltipTheme,
DividerThemeData? dividerTheme,
NavigationPaneThemeData? navigationPaneTheme,
RadioButtonThemeData? radioButtonTheme,
ToggleButtonThemeData? toggleButtonTheme,
SliderThemeData? sliderTheme,
InfoBarThemeData? infoBarTheme,
FocusThemeData? focusTheme,
ScrollbarThemeData? scrollbarTheme,
ResourceDictionary? resources,
}) {
brightness ??= Brightness.light;
extensions ??= [];
final isLight = brightness == Brightness.light;
visualDensity ??= VisualDensity.adaptivePlatformDensity;
fasterAnimationDuration ??= const Duration(milliseconds: 83);
fastAnimationDuration ??= const Duration(milliseconds: 167);
mediumAnimationDuration ??= const Duration(milliseconds: 250);
slowAnimationDuration ??= const Duration(milliseconds: 358);
resources ??= isLight
? const ResourceDictionary.light()
: const ResourceDictionary.dark();
animationCurve ??= standardCurve;
accentColor ??= Colors.blue;
activeColor ??= Colors.white;
inactiveColor ??= isLight ? Colors.black : Colors.white;
inactiveBackgroundColor ??=
isLight ? const Color(0xFFd6d6d6) : const Color(0xFF292929);
shadowColor ??= isLight ? Colors.black : Colors.grey[130];
scaffoldBackgroundColor ??= resources.layerOnAcrylicFillColorDefault;
acrylicBackgroundColor ??= isLight
? resources.layerOnAcrylicFillColorDefault
: const Color(0xFF2c2c2c);
micaBackgroundColor ??= resources.solidBackgroundFillColorBase;
menuColor ??= isLight ? const Color(0xFFf9f9f9) : const Color(0xFF2c2c2c);
cardColor ??= resources.cardBackgroundFillColorDefault;
selectionColor ??= accentColor.normal;
typography = Typography.fromBrightness(
brightness: brightness,
color: resources.textFillColorPrimary,
).merge(typography).apply(fontFamily: fontFamily);
focusTheme ??= const FocusThemeData();
buttonTheme ??= const ButtonThemeData();
checkboxTheme ??= const CheckboxThemeData();
toggleButtonTheme ??= const ToggleButtonThemeData();
toggleSwitchTheme ??= const ToggleSwitchThemeData();
iconTheme ??= isLight
? const IconThemeData(color: Colors.black, size: 18.0)
: const IconThemeData(color: Colors.white, size: 18.0);
dialogTheme ??= const ContentDialogThemeData();
tooltipTheme ??= const TooltipThemeData();
dividerTheme ??= const DividerThemeData();
navigationPaneTheme = NavigationPaneThemeData.fromResources(
resources: resources,
animationCurve: animationCurve,
animationDuration: fastAnimationDuration,
highlightColor: accentColor.defaultBrushFor(brightness),
typography: typography,
).merge(navigationPaneTheme);
radioButtonTheme ??= const RadioButtonThemeData();
sliderTheme ??= const SliderThemeData();
infoBarTheme ??= const InfoBarThemeData();
scrollbarTheme ??= const ScrollbarThemeData();
bottomNavigationTheme ??= const BottomNavigationThemeData();
return FluentThemeData.raw(
brightness: brightness,
extensions: _themeExtensionIterableToMap(extensions),
visualDensity: visualDensity,
fasterAnimationDuration: fasterAnimationDuration,
fastAnimationDuration: fastAnimationDuration,
mediumAnimationDuration: mediumAnimationDuration,
slowAnimationDuration: slowAnimationDuration,
animationCurve: animationCurve,
accentColor: accentColor,
activeColor: activeColor,
inactiveColor: inactiveColor,
inactiveBackgroundColor: inactiveBackgroundColor,
scaffoldBackgroundColor: scaffoldBackgroundColor,
acrylicBackgroundColor: acrylicBackgroundColor,
micaBackgroundColor: micaBackgroundColor,
shadowColor: shadowColor,
bottomNavigationTheme: bottomNavigationTheme,
buttonTheme: buttonTheme,
checkboxTheme: checkboxTheme,
dialogTheme: dialogTheme,
dividerTheme: dividerTheme,
focusTheme: focusTheme,
iconTheme: iconTheme,
infoBarTheme: infoBarTheme,
navigationPaneTheme: navigationPaneTheme,
radioButtonTheme: radioButtonTheme,
scrollbarTheme: scrollbarTheme,
sliderTheme: sliderTheme,
toggleButtonTheme: toggleButtonTheme,
toggleSwitchTheme: toggleSwitchTheme,
tooltipTheme: tooltipTheme,
typography: typography,
menuColor: menuColor,
cardColor: cardColor,
resources: resources,
selectionColor: selectionColor,
);
}