Skip to content

feat: Add light/dark theme toggle to Flutter client - #16

Merged
EstebanPeluffo merged 1 commit into
mainfrom
feat/modo-oscuro
Nov 23, 2026
Merged

EstebanPeluffo merged 1 commit into
mainfrom
feat/modo-oscuro

Conversation

@EstebanPeluffo

Copy link
Copy Markdown
Collaborator

Theme-aware palette via ThemeExtension, toggle button in the app bar and login screen, and fixed contrast of the 'Abrir inventario' button.

Theme-aware palette via ThemeExtension, toggle button in the app bar
and login screen, and fixed contrast of the 'Abrir inventario' button.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@EstebanPeluffo
EstebanPeluffo merged commit 1e3e632 into main Nov 23, 2026
8 checks passed
@EstebanPeluffo
EstebanPeluffo deleted the feat/modo-oscuro branch November 23, 2026 02:51
appBar: AppBar(
titleSpacing: 20,
title: const Row(
title: Row(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Al pasar a context.ink se pierde el const en este Row y en casi todos los Text/Icon del archivo. Funciona, pero el patrón TextStyle(fontWeight: …, color: context.ink) se repite decenas de veces. Convendría un par de estilos reutilizables en InvenTrackContext (por ejemplo context.titulo) para no duplicarlo ni perder la optimización.

mainAxisSize: MainAxisSize.min,
children: [
Icon(
const Icon(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este color de marca sigue fijo (InvenTrackStyle.emerald), igual que orange y deepGreen en otras partes. En modo oscuro hay que revisar el contraste, porque solo se migraron ink, muted, outline, canvas, surface y mint.

/// Atajos para leer los colores del tema activo.
extension InvenTrackContext on BuildContext {
InvenTrackColors get _paleta =>
Theme.of(this).extension<InvenTrackColors>() ?? InvenTrackColors.light;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si algún ThemeData no registra la extensión, este fallback pinta en claro sin avisar y el fallo solo se vería en modo oscuro. Conviene una prueba de widget que verifique que el MaterialApp registra InvenTrackColors.light y .dark.

Color get canvas => _paleta.canvas;
Color get surface => _paleta.surface;
Color get mint => _paleta.mint;
Color get watchShadow => _paleta.shadow;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El getter se llama watchShadow pero el campo es shadow y el resto (ink, muted, surface) usa el mismo nombre. Mejor shadow, para que sea predecible

}

/// Modo de tema elegido por la persona. Por defecto sigue al sistema.
final ValueNotifier<ThemeMode> modoTema = ValueNotifier(ThemeMode.system);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El modo elegido vive en una variable global y se pierde al cerrar la app. Para el MVP está bien, pero habría que declararlo como límite o guardarlo (por ejemplo con shared_preferences). Además, una global mutable obliga a reiniciarla entre pruebas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants