getPendingOverrides method
Get all pending color overrides by comparing current state colors against theme. Phase 3.2: Now uses local _componentStates directly (no GlobalKey needed).
Implementation
Map<String, Color> getPendingOverrides() {
if (widget.palette == null) return {};
final overrides = <String, Color>{};
final palette = widget.palette!;
// Helper to check and add override if different
void checkOverride(
String componentName,
String state,
String property,
String mode,
Color currentColor,
) {
final themeColors = ThemeColorMapper.forComponent(palette, componentName);
Color? themeColor;
final colorKey = '$state${_capitalize(property)}Color${_capitalize(mode)}';
switch (colorKey) {
case 'restBaseColorLight':
themeColor = themeColors.restBaseColorLight;
case 'restBaseColorDark':
themeColor = themeColors.restBaseColorDark;
case 'restTextColorLight':
themeColor = themeColors.restTextColorLight;
case 'restTextColorDark':
themeColor = themeColors.restTextColorDark;
case 'restIconColorLight':
themeColor = themeColors.restIconColorLight;
case 'restIconColorDark':
themeColor = themeColors.restIconColorDark;
case 'hoverBaseColorLight':
themeColor = themeColors.hoverBaseColorLight;
case 'hoverBaseColorDark':
themeColor = themeColors.hoverBaseColorDark;
case 'hoverTextColorLight':
themeColor = themeColors.hoverTextColorLight;
case 'hoverTextColorDark':
themeColor = themeColors.hoverTextColorDark;
case 'hoverIconColorLight':
themeColor = themeColors.hoverIconColorLight;
case 'hoverIconColorDark':
themeColor = themeColors.hoverIconColorDark;
case 'pressedBaseColorLight':
themeColor = themeColors.pressedBaseColorLight;
case 'pressedBaseColorDark':
themeColor = themeColors.pressedBaseColorDark;
case 'pressedTextColorLight':
themeColor = themeColors.pressedTextColorLight;
case 'pressedTextColorDark':
themeColor = themeColors.pressedTextColorDark;
case 'pressedIconColorLight':
themeColor = themeColors.pressedIconColorLight;
case 'pressedIconColorDark':
themeColor = themeColors.pressedIconColorDark;
case 'disabledBaseColorLight':
themeColor = themeColors.disabledBaseColorLight;
case 'disabledBaseColorDark':
themeColor = themeColors.disabledBaseColorDark;
case 'disabledTextColorLight':
themeColor = themeColors.disabledTextColorLight;
case 'disabledTextColorDark':
themeColor = themeColors.disabledTextColorDark;
case 'disabledIconColorLight':
themeColor = themeColors.disabledIconColorLight;
case 'disabledIconColorDark':
themeColor = themeColors.disabledIconColorDark;
}
if (themeColor != null && currentColor.toARGB32() != themeColor.toARGB32()) {
final overrideKey = ColorKeys.componentKey(
componentName,
state,
property,
mode,
);
overrides[overrideKey] = currentColor;
}
}
// Check button overrides
_checkButtonOverrides(checkOverride);
return overrides;
}