Repository navigation
feat: Add light/dark theme toggle to Flutter client - #16
Conversation
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>
|
| appBar: AppBar( | ||
| titleSpacing: 20, | ||
| title: const Row( | ||
| title: Row( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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



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