feat(widgets): Z-Design usar theme dinámico en todos los widgets

Cambio de Style.Theme.dark (hardcoded) a Style.currentTheme().*
en 5 archivos / 7 ocurrencias:

- text_input.zig (línea 282)
- button.zig (líneas 75, 163)
- list.zig (líneas 124, 131)
- checkbox.zig (línea 61)
- select.zig (línea 102)

Ahora todos los widgets usan el ThemeManager global, permitiendo
cambio de tema en runtime.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
R.Eugenio 2025-12-29 21:30:11 +01:00
parent 9559b14a33
commit 8f4336f1f6
5 changed files with 13 additions and 11 deletions

View file

@ -71,8 +71,8 @@ pub fn buttonRect(ctx: *Context, bounds: Layout.Rect, text: []const u8, config:
const pressed = hovered and ctx.input.mouseDown(.left);
const clicked = hovered and ctx.input.mouseReleased(.left);
// Determine colors based on state
const theme = Style.Theme.dark;
// Determine colors based on state (Z-Design: usar theme dinámico)
const theme = Style.currentTheme().*;
const base_bg = config.bg orelse switch (config.importance) {
.normal => theme.button_bg,
@ -159,8 +159,8 @@ pub fn buttonStatefulRect(
// Update transition animation
state.transition.updateWithPress(hovered, pressed, dt_ms);
// Determine colors based on animated state
const theme = Style.Theme.dark;
// Determine colors based on animated state (Z-Design: usar theme dinámico)
const theme = Style.currentTheme().*;
const base_bg = config.bg orelse switch (config.importance) {
.normal => theme.button_bg,

View file

@ -57,8 +57,8 @@ pub fn checkboxRect(
changed = true;
}
// Theme colors
const theme = Style.Theme.dark;
// Theme colors (Z-Design: usar theme dinámico)
const theme = Style.currentTheme().*;
// Calculate box position (vertically centered)
const box_y = bounds.y + @as(i32, @intCast((bounds.h -| config.box_size) / 2));

View file

@ -121,14 +121,15 @@ pub fn listRect(
if (items.len == 0) {
// Draw empty list
if (config.show_border) {
const theme = Style.Theme.dark;
const theme = Style.currentTheme().*;
ctx.pushCommand(Command.rect(bounds.x, bounds.y, bounds.w, bounds.h, theme.background));
ctx.pushCommand(Command.rectOutline(bounds.x, bounds.y, bounds.w, bounds.h, theme.border));
}
return result;
}
const theme = Style.Theme.dark;
// Z-Design: usar theme dinámico
const theme = Style.currentTheme().*;
const mouse = ctx.input.mousePos();
const list_hovered = bounds.contains(mouse.x, mouse.y);

View file

@ -99,7 +99,8 @@ pub fn selectRect(
// Register as focusable in the active focus group
ctx.registerFocusable(widget_id);
const theme = Style.Theme.dark;
// Z-Design: usar theme dinámico
const theme = Style.currentTheme().*;
// Check mouse interaction on main button
const mouse = ctx.input.mousePos();

View file

@ -278,8 +278,8 @@ pub fn textInputRect(
// Sync state.focused for backwards compatibility
state.focused = has_focus;
// Theme colors
const theme = Style.Theme.dark;
// Theme colors (Z-Design: usar theme dinámico)
const theme = Style.currentTheme().*;
const bg_color = if (has_focus) theme.input_bg.lighten(5) else theme.input_bg;
// Use override colors if provided, otherwise use theme defaults
const border_color = config.border_color orelse (if (has_focus) theme.primary else theme.input_border);