FluentThemeData constructor

FluentThemeData({
  1. Iterable<ThemeExtension>? extensions,
  2. Brightness? brightness,
  3. VisualDensity? visualDensity,
  4. Typography? typography,
  5. String? fontFamily,
  6. AccentColor? accentColor,
  7. Color? activeColor,
  8. Color? inactiveColor,
  9. Color? inactiveBackgroundColor,
  10. Color? scaffoldBackgroundColor,
  11. Color? acrylicBackgroundColor,
  12. Color? micaBackgroundColor,
  13. Color? shadowColor,
  14. Color? menuColor,
  15. Color? cardColor,
  16. Color? selectionColor,
  17. Duration? fasterAnimationDuration,
  18. Duration? fastAnimationDuration,
  19. Duration? mediumAnimationDuration,
  20. Duration? slowAnimationDuration,
  21. Curve? animationCurve,
  22. BottomNavigationThemeData? bottomNavigationTheme,
  23. ButtonThemeData? buttonTheme,
  24. CheckboxThemeData? checkboxTheme,
  25. ToggleSwitchThemeData? toggleSwitchTheme,
  26. IconThemeData? iconTheme,
  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. FocusThemeData? focusTheme,
  36. ScrollbarThemeData? scrollbarTheme,
  37. 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,
  );
}