applyTheme method

  1. @override
void applyTheme(
  1. GeneratedPalette palette
)
override

Apply colors from a GeneratedPalette to this component's state.

This method is called when the theme changes or when a new palette is generated. It should update all color properties based on the palette's values.

Implementation should use ThemeColorMapper.forComponent() for component-specific color resolution.

Implementation

@override
void applyTheme(GeneratedPalette palette) {
  super.applyTheme(palette);

  final colors = ThemeColorMapper.forComponent(palette, componentName);

  // Rest state - label/hint use icon color
  restLabelColorLight = colors.restIconColorLight;
  restLabelColorDark = colors.restIconColorDark;
  restHintColorLight = colors.restIconColorLight;
  restHintColorDark = colors.restIconColorDark;

  // Hover state
  hoverLabelColorLight = colors.hoverIconColorLight;
  hoverLabelColorDark = colors.hoverIconColorDark;
  hoverHintColorLight = colors.hoverIconColorLight;
  hoverHintColorDark = colors.hoverIconColorDark;

  // Pressed/Focused state - accent color for label
  pressedLabelColorLight = colors.accentColorLight;
  pressedLabelColorDark = colors.accentColorDark;
  pressedHintColorLight = colors.pressedIconColorLight;
  pressedHintColorDark = colors.pressedIconColorDark;

  // Disabled state
  disabledLabelColorLight = colors.disabledIconColorLight;
  disabledLabelColorDark = colors.disabledIconColorDark;
  disabledHintColorLight = colors.disabledIconColorLight;
  disabledHintColorDark = colors.disabledIconColorDark;

  // Border color uses accent
  borderColor = colors.accentColorLight;
}