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 - Text colors
  restCallerNameColorLight = colors.restTextColorLight;
  restCallerNameColorDark = colors.restTextColorDark;
  restVoiceHintColorLight = ThemeColorMapper.getSecondaryTextColor(palette, Brightness.light);
  restVoiceHintColorDark = ThemeColorMapper.getSecondaryTextColor(palette, Brightness.dark);

  // Rest state - Button colors use accent
  restMuteButtonColorLight = colors.accentColorLight;
  restMuteButtonColorDark = colors.accentColorDark;
  restVideoButtonColorLight = colors.accentColorLight;
  restVideoButtonColorDark = colors.accentColorDark;

  // End call button uses error color
  restEndCallButtonColorLight = ThemeColorMapper.getErrorColor(palette, Brightness.light);
  restEndCallButtonColorDark = ThemeColorMapper.getErrorColor(palette, Brightness.dark);

  // Disabled state - All text/icons use disabled color
  disabledCallerNameColorLight = colors.disabledTextColorLight;
  disabledCallerNameColorDark = colors.disabledTextColorDark;
  disabledVideoIconColorLight = colors.disabledIconColorLight;
  disabledVideoIconColorDark = colors.disabledIconColorDark;
  disabledMuteButtonColorLight = colors.disabledIconColorLight;
  disabledMuteButtonColorDark = colors.disabledIconColorDark;
  disabledVideoButtonColorLight = colors.disabledIconColorLight;
  disabledVideoButtonColorDark = colors.disabledIconColorDark;
  disabledEndCallButtonColorLight = colors.disabledIconColorLight;
  disabledEndCallButtonColorDark = colors.disabledIconColorDark;
  disabledMutedIndicatorColorLight = colors.disabledIconColorLight;
  disabledMutedIndicatorColorDark = colors.disabledIconColorDark;
  disabledActiveIndicatorColorLight = colors.disabledIconColorLight;
  disabledActiveIndicatorColorDark = colors.disabledIconColorDark;
  disabledVoiceHintColorLight = colors.disabledTextColorLight;
  disabledVoiceHintColorDark = colors.disabledTextColorDark;
  disabledSelfPreviewBorderColorLight = colors.disabledIconColorLight;
  disabledSelfPreviewBorderColorDark = colors.disabledIconColorDark;

  // Update border color - green for active call
  borderColor = const Color(0xFF10b981);
}