Refactor theme colors and styles across the application
- Introduced AppColors class to centralize color definitions for better maintainability and consistency. - Updated various screens (Settings, Vault Access, Note Card, etc.) to use AppColors for styling instead of hardcoded colors. - Enhanced UI elements with improved color contrast and accessibility. - Replaced gradient backgrounds with defined color schemes for a cohesive look. - Refactored button styles and text colors to align with the new theme structure.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notas/theme/app_colors.dart';
|
||||
|
||||
class BiometricChoiceScreen extends StatelessWidget {
|
||||
const BiometricChoiceScreen({
|
||||
@@ -16,17 +17,7 @@ class BiometricChoiceScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF191A1D),
|
||||
Color(0xFF222326),
|
||||
Color(0xFF101114),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
decoration: const BoxDecoration(gradient: AppColors.backdropGradient),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -39,12 +30,12 @@ class BiometricChoiceScreen extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF1D1E20),
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
|
||||
border: Border.all(color: AppColors.borderMuted),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.35),
|
||||
color: AppColors.shadow,
|
||||
blurRadius: 30,
|
||||
offset: const Offset(0, 18),
|
||||
),
|
||||
@@ -64,7 +55,7 @@ class BiometricChoiceScreen extends StatelessWidget {
|
||||
'Proteger con huella',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
@@ -74,7 +65,7 @@ class BiometricChoiceScreen extends StatelessWidget {
|
||||
'¿Quieres que la app te pida huella o cara antes de entrar a tus notas?',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.72),
|
||||
color: AppColors.textSecondary,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
@@ -82,13 +73,17 @@ class BiometricChoiceScreen extends StatelessWidget {
|
||||
FilledButton(
|
||||
onPressed: isBusy ? null : onEnableBiometrics,
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 14,
|
||||
),
|
||||
),
|
||||
child: isBusy
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: const Text('Sí, activar huella'),
|
||||
),
|
||||
@@ -96,9 +91,13 @@ class BiometricChoiceScreen extends StatelessWidget {
|
||||
OutlinedButton(
|
||||
onPressed: isBusy ? null : onSkipBiometrics,
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
side: const BorderSide(color: Colors.white24),
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 14,
|
||||
),
|
||||
side: const BorderSide(
|
||||
color: AppColors.textDisabled,
|
||||
),
|
||||
foregroundColor: AppColors.textPrimary,
|
||||
),
|
||||
child: const Text('No, entrar sin huella'),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notas/theme/app_colors.dart';
|
||||
|
||||
class BiometricGateScreen extends StatefulWidget {
|
||||
const BiometricGateScreen({
|
||||
@@ -40,17 +41,7 @@ class _BiometricGateScreenState extends State<BiometricGateScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF191A1D),
|
||||
Color(0xFF222326),
|
||||
Color(0xFF101114),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
decoration: const BoxDecoration(gradient: AppColors.backdropGradient),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -63,12 +54,12 @@ class _BiometricGateScreenState extends State<BiometricGateScreen> {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF1D1E20),
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
|
||||
border: Border.all(color: AppColors.borderMuted),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.35),
|
||||
color: AppColors.shadow,
|
||||
blurRadius: 30,
|
||||
offset: const Offset(0, 18),
|
||||
),
|
||||
@@ -88,7 +79,7 @@ class _BiometricGateScreenState extends State<BiometricGateScreen> {
|
||||
'Desbloqueo biométrico',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
@@ -98,21 +89,27 @@ class _BiometricGateScreenState extends State<BiometricGateScreen> {
|
||||
'Pon tu huella o cara para entrar a tus notas.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.72),
|
||||
color: AppColors.textSecondary,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 22),
|
||||
FilledButton(
|
||||
onPressed: widget.isBusy ? null : widget.onUnlockRequested,
|
||||
onPressed: widget.isBusy
|
||||
? null
|
||||
: widget.onUnlockRequested,
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 14,
|
||||
),
|
||||
),
|
||||
child: widget.isBusy
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: const Text('Desbloquear'),
|
||||
),
|
||||
|
||||
@@ -15,6 +15,7 @@ import 'package:notas/widgets/note_card.dart';
|
||||
import 'package:notas/widgets/search_app_bar.dart';
|
||||
import 'package:notas/widgets/sync_status.dart';
|
||||
import 'package:notas/widgets/sync_status_indicator.dart';
|
||||
import 'package:notas/theme/app_colors.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
const HomeScreen({
|
||||
@@ -490,13 +491,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFF191A1D), Color(0xFF222326), Color(0xFF101114)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
decoration: const BoxDecoration(gradient: AppColors.backdropGradient),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -570,7 +565,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: _closeMenu,
|
||||
child: Container(color: Colors.black),
|
||||
child: Container(color: AppColors.overlay),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -583,7 +578,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
bottom: 0,
|
||||
width: 280,
|
||||
child: Material(
|
||||
color: const Color.fromRGBO(24, 25, 26, 1),
|
||||
color: AppColors.cardBackground,
|
||||
elevation: 8,
|
||||
child: MenuDrawer(
|
||||
onMenuItemTapped: _handleMenuItemTapped,
|
||||
@@ -651,7 +646,7 @@ class _DraggableNote extends StatelessWidget {
|
||||
return MouseRegion(
|
||||
cursor: SystemMouseCursors.grabbing,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
color: AppColors.transparent,
|
||||
elevation: 8,
|
||||
child: SizedBox(
|
||||
width: cellWidth,
|
||||
@@ -689,9 +684,12 @@ class _DraggableNote extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromRGBO(24, 25, 26, 1),
|
||||
color: AppColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: borderColor ?? Colors.white24, width: 1),
|
||||
border: Border.all(
|
||||
color: borderColor ?? AppColors.textDisabled,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -700,7 +698,7 @@ class _DraggableNote extends StatelessWidget {
|
||||
Text(
|
||||
note.title,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -710,7 +708,10 @@ class _DraggableNote extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
note.body,
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 14),
|
||||
style: const TextStyle(
|
||||
color: AppColors.textSecondary,
|
||||
fontSize: 14,
|
||||
),
|
||||
maxLines: 20,
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
@@ -726,7 +727,7 @@ class _DraggableNote extends StatelessWidget {
|
||||
final Widget content = Container(
|
||||
decoration: BoxDecoration(
|
||||
border: isDragTargetActive
|
||||
? Border.all(color: Colors.blue.shade400, width: 2)
|
||||
? Border.all(color: AppColors.dragTargetBorder, width: 2)
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
@@ -781,7 +782,11 @@ class _EmptyState extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.note_add_outlined, color: Colors.white54, size: 48),
|
||||
const Icon(
|
||||
Icons.note_add_outlined,
|
||||
color: AppColors.textMuted,
|
||||
size: 48,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
searchQuery != null && searchQuery!.isNotEmpty
|
||||
@@ -792,7 +797,7 @@ class _EmptyState extends StatelessWidget {
|
||||
? 'No hay notas en esta categoría'
|
||||
: 'Aún no hay notas',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -807,7 +812,7 @@ class _EmptyState extends StatelessWidget {
|
||||
? 'Pulsa el botón + para crear una nota en “$categoryName”.'
|
||||
: 'Pulsa el botón + para crear la primera.',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(color: Colors.white70),
|
||||
style: const TextStyle(color: AppColors.textSecondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -1000,9 +1005,9 @@ class _CategoryDialogState extends State<_CategoryDialog> {
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.04),
|
||||
color: AppColors.fill,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: Colors.white12),
|
||||
border: Border.all(color: AppColors.border),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -1031,7 +1036,7 @@ class _CategoryDialogState extends State<_CategoryDialog> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(height: 1, color: Colors.white12),
|
||||
const Divider(height: 1, color: AppColors.border),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: AnimatedSwitcher(
|
||||
@@ -1057,11 +1062,11 @@ class _CategoryDialogState extends State<_CategoryDialog> {
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: isSelected
|
||||
? Border.all(
|
||||
color: Colors.white,
|
||||
color: AppColors.textPrimary,
|
||||
width: 2,
|
||||
)
|
||||
: Border.all(
|
||||
color: Colors.white12,
|
||||
color: AppColors.border,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
@@ -1087,21 +1092,21 @@ class _CategoryDialogState extends State<_CategoryDialog> {
|
||||
height: 42,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? Colors.white10
|
||||
: Colors.transparent,
|
||||
? AppColors.hover
|
||||
: AppColors.transparent,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: Colors.white12,
|
||||
? AppColors.textPrimary
|
||||
: AppColors.border,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: Colors.white70,
|
||||
? AppColors.textPrimary
|
||||
: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1119,7 +1124,10 @@ class _CategoryDialogState extends State<_CategoryDialog> {
|
||||
if (widget.category != null)
|
||||
TextButton(
|
||||
onPressed: _deleteCategory,
|
||||
child: const Text('Borrar', style: TextStyle(color: Colors.red)),
|
||||
child: const Text(
|
||||
'Borrar',
|
||||
style: TextStyle(color: AppColors.destructive),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
@@ -1158,7 +1166,7 @@ class _PickerTabButton extends StatelessWidget {
|
||||
return Material(
|
||||
borderRadius: borderRadius,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
color: selected ? Colors.white10 : Colors.transparent,
|
||||
color: selected ? AppColors.hover : AppColors.transparent,
|
||||
child: InkWell(
|
||||
borderRadius: borderRadius,
|
||||
onTap: onTap,
|
||||
@@ -1168,7 +1176,7 @@ class _PickerTabButton extends StatelessWidget {
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
color: selected ? Colors.white : Colors.white54,
|
||||
color: selected ? AppColors.textPrimary : AppColors.textMuted,
|
||||
fontWeight: selected ? FontWeight.w600 : FontWeight.w400,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:intl/intl.dart';
|
||||
import 'package:notas/models/category.dart';
|
||||
import 'package:notas/models/note.dart';
|
||||
import 'package:notas/platform/app_platform.dart';
|
||||
import 'package:notas/theme/app_colors.dart';
|
||||
import 'package:notas/widgets/category_style.dart';
|
||||
|
||||
// NoteEditorScreen: unified UI for creating and editing notes.
|
||||
@@ -41,7 +42,7 @@ class NoteEditorScreen extends StatefulWidget {
|
||||
return showGeneralDialog<dynamic>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
barrierColor: Colors.transparent,
|
||||
barrierColor: AppColors.transparent,
|
||||
transitionDuration: const Duration(milliseconds: 200),
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
return NoteEditorScreen(
|
||||
@@ -201,30 +202,30 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
final bool isDeletedNote = _currentNote.isDeleted;
|
||||
|
||||
return AlertDialog(
|
||||
backgroundColor: const Color(0xFF303134),
|
||||
backgroundColor: AppColors.surfaceElevated,
|
||||
title: Text(
|
||||
isDeletedNote ? 'Eliminar permanentemente' : 'Eliminar nota',
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: const TextStyle(color: AppColors.textPrimary),
|
||||
),
|
||||
content: Text(
|
||||
isDeletedNote
|
||||
? 'Esta nota ya está borrada. Si la eliminas ahora, se borrará permanentemente.'
|
||||
: '¿Estás seguro de que deseas eliminar esta nota?',
|
||||
style: const TextStyle(color: Colors.white70),
|
||||
style: const TextStyle(color: AppColors.textSecondary),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => onConfirmed(false),
|
||||
child: const Text(
|
||||
'Cancelar',
|
||||
style: TextStyle(color: Colors.white70),
|
||||
style: TextStyle(color: AppColors.textSecondary),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => onConfirmed(true),
|
||||
child: Text(
|
||||
isDeletedNote ? 'Eliminar permanentemente' : 'Eliminar',
|
||||
style: const TextStyle(color: Colors.red),
|
||||
style: const TextStyle(color: AppColors.destructive),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -236,7 +237,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
final bool? confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
barrierColor: Colors.transparent,
|
||||
barrierColor: AppColors.transparent,
|
||||
builder: (BuildContext dialogContext) {
|
||||
return _buildDeleteConfirmationDialog(
|
||||
onConfirmed: (bool confirmed) =>
|
||||
@@ -253,7 +254,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
final bool? confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
barrierColor: Colors.transparent,
|
||||
barrierColor: AppColors.transparent,
|
||||
builder: (BuildContext dialogContext) {
|
||||
return _buildDeleteConfirmationDialog(
|
||||
onConfirmed: (bool confirmed) =>
|
||||
@@ -282,13 +283,13 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
};
|
||||
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
color: AppColors.transparent,
|
||||
child: Stack(
|
||||
children: [
|
||||
const Positioned.fill(
|
||||
child: ModalBarrier(
|
||||
dismissible: false,
|
||||
color: Color.fromARGB(140, 0, 0, 0),
|
||||
color: AppColors.overlay,
|
||||
),
|
||||
),
|
||||
Center(
|
||||
@@ -319,7 +320,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
|
||||
Color _categoryBackgroundColor(Category? category) {
|
||||
if (category?.colorValue == null) {
|
||||
return Colors.white.withValues(alpha: 0.08);
|
||||
return AppColors.borderMuted;
|
||||
}
|
||||
|
||||
return Color(category!.colorValue!);
|
||||
@@ -327,11 +328,13 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
|
||||
Color _categoryForegroundColor(Category? category) {
|
||||
if (category == null || category.colorValue == null) {
|
||||
return Colors.white;
|
||||
return AppColors.textPrimary;
|
||||
}
|
||||
|
||||
final Color background = Color(category.colorValue!);
|
||||
return background.computeLuminance() > 0.55 ? Colors.black87 : Colors.white;
|
||||
return background.computeLuminance() > 0.55
|
||||
? AppColors.textOnSurfaceDark
|
||||
: AppColors.textPrimary;
|
||||
}
|
||||
|
||||
Widget _buildCategorySelectorBox({Category? category}) {
|
||||
@@ -351,7 +354,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
border: Border.all(
|
||||
color: category?.colorValue != null
|
||||
? backgroundColor.withValues(alpha: 0.85)
|
||||
: Colors.white24,
|
||||
: AppColors.textDisabled,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
@@ -407,7 +410,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
final double menuHeight = math.min(screenSize.height - 32, 360);
|
||||
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
color: AppColors.transparent,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
@@ -425,7 +428,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
),
|
||||
child: Material(
|
||||
elevation: 10,
|
||||
color: const Color(0xFF303134),
|
||||
color: AppColors.surfaceElevated,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ListView(
|
||||
@@ -485,7 +488,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||
color: isSelected ? Colors.white.withValues(alpha: 0.08) : null,
|
||||
color: isSelected ? AppColors.hover : null,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
@@ -497,7 +500,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
border: Border.all(
|
||||
color: category?.colorValue != null
|
||||
? backgroundColor.withValues(alpha: 0.85)
|
||||
: Colors.white24,
|
||||
: AppColors.textDisabled,
|
||||
),
|
||||
),
|
||||
child: Icon(icon, size: 16, color: foregroundColor),
|
||||
@@ -553,13 +556,15 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: Colors.white12, width: 1)),
|
||||
border: Border(
|
||||
bottom: BorderSide(color: AppColors.border, width: 1),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: _closeWithoutSaving,
|
||||
icon: const Icon(Icons.close, color: Colors.white70),
|
||||
icon: const Icon(Icons.close, color: AppColors.textSecondary),
|
||||
tooltip: 'Cerrar sin guardar',
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -571,14 +576,14 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
Text(
|
||||
'Posicion: ${_currentNote.position}',
|
||||
style: const TextStyle(
|
||||
color: Colors.white54,
|
||||
color: AppColors.textMuted,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Creado: ${_formatDate(_currentNote.createdAt)}',
|
||||
style: const TextStyle(
|
||||
color: Colors.white54,
|
||||
color: AppColors.textMuted,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
@@ -586,7 +591,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
Text(
|
||||
'Modificado: ${_formatDate(_currentNote.updatedAt)}',
|
||||
style: const TextStyle(
|
||||
color: Colors.white54,
|
||||
color: AppColors.textMuted,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
@@ -621,13 +626,13 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
TextField(
|
||||
controller: _titleController,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Título',
|
||||
hintStyle: TextStyle(color: Colors.white30),
|
||||
hintStyle: TextStyle(color: AppColors.textHint),
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
),
|
||||
@@ -640,13 +645,13 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
maxLines: null,
|
||||
expands: true,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 16,
|
||||
height: 1.6,
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Escribe tu nota...',
|
||||
hintStyle: TextStyle(color: Colors.white30),
|
||||
hintStyle: TextStyle(color: AppColors.textHint),
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
),
|
||||
@@ -659,7 +664,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(top: BorderSide(color: Colors.white12, width: 1)),
|
||||
border: Border(top: BorderSide(color: AppColors.border, width: 1)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -667,7 +672,10 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
if (!_isNewNote)
|
||||
IconButton(
|
||||
onPressed: _deleteNote,
|
||||
icon: const Icon(Icons.delete_outline, color: Colors.red),
|
||||
icon: const Icon(
|
||||
Icons.delete_outline,
|
||||
color: AppColors.destructive,
|
||||
),
|
||||
tooltip: 'Eliminar nota',
|
||||
)
|
||||
else
|
||||
@@ -684,10 +692,10 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
if (_isMobileLayout) {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
color: AppColors.transparent,
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
color: const Color.fromARGB(255, 24, 25, 26),
|
||||
color: AppColors.cardBackground,
|
||||
child: _buildEditorContent(isMobile: true),
|
||||
),
|
||||
),
|
||||
@@ -704,7 +712,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
Positioned.fill(
|
||||
child: ModalBarrier(
|
||||
dismissible: false,
|
||||
color: const Color.fromARGB(54, 0, 0, 0).withValues(alpha: 0.5),
|
||||
color: AppColors.shadowDim,
|
||||
),
|
||||
),
|
||||
Positioned.fill(
|
||||
@@ -713,10 +721,10 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
child: Material(
|
||||
color: const Color.fromRGBO(24, 25, 26, 1),
|
||||
color: AppColors.cardBackground,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
side: BorderSide(color: Colors.white24, width: 1),
|
||||
side: BorderSide(color: AppColors.textDisabled, width: 1),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: _buildEditorContent(isMobile: false),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notas/data/local_vault_service.dart';
|
||||
import 'package:notas/theme/app_colors.dart';
|
||||
import 'package:notas/widgets/search_app_bar.dart';
|
||||
import 'package:notas/data/api_client.dart';
|
||||
|
||||
@@ -29,30 +30,35 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
bool _isServerDeleting = false;
|
||||
bool _isThemeSaving = false;
|
||||
final TextEditingController _endpointController = TextEditingController();
|
||||
final TextEditingController _encryptionKeyController = TextEditingController();
|
||||
final TextEditingController _encryptionKeyController =
|
||||
TextEditingController();
|
||||
bool _endpointLoading = true;
|
||||
bool _encryptionKeyLoading = false;
|
||||
bool _encryptionKeyVisible = false;
|
||||
late Color _selectedSeedColor;
|
||||
|
||||
static const List<Color> _themeColorOptions = <Color>[
|
||||
Colors.amber,
|
||||
Colors.blue,
|
||||
Colors.teal,
|
||||
Colors.green,
|
||||
Colors.pink,
|
||||
Colors.purple,
|
||||
];
|
||||
static const List<Color> _themeColorOptions = AppColors.themeSeedColors;
|
||||
|
||||
Future<void> _confirmAndDeleteAll() async {
|
||||
final bool? confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Borrar todos los datos'),
|
||||
content: const Text('¿Estás seguro? Esta acción eliminará la base de datos local y la clave de cifrado. Asegúrate de tener una copia de seguridad si es necesario o cuenta sincronizada.'),
|
||||
content: const Text(
|
||||
'¿Estás seguro? Esta acción eliminará la base de datos local y la clave de cifrado. Asegúrate de tener una copia de seguridad si es necesario o cuenta sincronizada.',
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.of(context).pop(false), child: const Text('Cancelar')),
|
||||
TextButton(onPressed: () => Navigator.of(context).pop(true), child: const Text('Borrar', style: TextStyle(color: Colors.red))),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
child: const Text('Cancelar'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: const Text(
|
||||
'Borrar',
|
||||
style: TextStyle(color: AppColors.destructive),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -69,7 +75,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
if (!mounted) return;
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Todos los datos locales han sido eliminados.')),
|
||||
const SnackBar(
|
||||
content: Text('Todos los datos locales han sido eliminados.'),
|
||||
),
|
||||
);
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
@@ -101,7 +109,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: const Text(
|
||||
'Borrar',
|
||||
style: TextStyle(color: Colors.red),
|
||||
style: TextStyle(color: AppColors.destructive),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -115,11 +123,13 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
});
|
||||
|
||||
try {
|
||||
final Map<String, dynamic> response =
|
||||
await AuthApi.instance.deleteAllServerData();
|
||||
final Map<String, dynamic> response = await AuthApi.instance
|
||||
.deleteAllServerData();
|
||||
|
||||
if (response['error'] == true) {
|
||||
throw Exception(response['body'] ?? response['message'] ?? 'Error desconocido');
|
||||
throw Exception(
|
||||
response['body'] ?? response['message'] ?? 'Error desconocido',
|
||||
);
|
||||
}
|
||||
|
||||
await AuthApi.instance.clearTokens();
|
||||
@@ -127,7 +137,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
if (!mounted) return;
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Toda la información del servidor ha sido eliminada.')),
|
||||
const SnackBar(
|
||||
content: Text('Toda la información del servidor ha sido eliminada.'),
|
||||
),
|
||||
);
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
@@ -239,7 +251,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
});
|
||||
|
||||
try {
|
||||
final String? encryptionKey = await LocalVaultService.instance.readEncryptionKey();
|
||||
final String? encryptionKey = await LocalVaultService.instance
|
||||
.readEncryptionKey();
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
@@ -286,8 +299,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
}) {
|
||||
return ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.redAccent,
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: AppColors.destructiveAccent,
|
||||
foregroundColor: AppColors.textPrimary,
|
||||
textStyle: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
@@ -306,8 +319,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
final bool isSelected = _selectedSeedColor.value == color.value;
|
||||
final Color foregroundColor =
|
||||
ThemeData.estimateBrightnessForColor(color) == Brightness.dark
|
||||
? Colors.white
|
||||
: Colors.black;
|
||||
? AppColors.textPrimary
|
||||
: AppColors.textOnAccent;
|
||||
|
||||
return Semantics(
|
||||
button: true,
|
||||
@@ -326,12 +339,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
color: color,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: isSelected ? Colors.white : Colors.white24,
|
||||
color: isSelected
|
||||
? AppColors.textPrimary
|
||||
: AppColors.textDisabled,
|
||||
width: isSelected ? 2.5 : 1.2,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.25),
|
||||
color: AppColors.shadowSoft,
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
@@ -341,11 +356,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
if (isSelected)
|
||||
Icon(
|
||||
Icons.check,
|
||||
size: 22,
|
||||
color: foregroundColor,
|
||||
),
|
||||
Icon(Icons.check, size: 22, color: foregroundColor),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -366,10 +377,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
try {
|
||||
await ApiConfig.setEndpoint(value);
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Endpoint guardado')));
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('Endpoint guardado')));
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Error guardando endpoint: $e')));
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('Error guardando endpoint: $e')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,7 +393,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
final String endpoint = await ApiConfig.getEndpoint();
|
||||
if (!mounted) return;
|
||||
_endpointController.text = endpoint;
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Endpoint restaurado al valor por defecto')));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Endpoint restaurado al valor por defecto')),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildResponsiveInputActionsRow({
|
||||
@@ -433,17 +450,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF191A1D),
|
||||
Color(0xFF222326),
|
||||
Color(0xFF101114),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
decoration: const BoxDecoration(gradient: AppColors.backdropGradient),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -462,9 +469,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Expanded(
|
||||
child: Text('Borrar datos locales:'),
|
||||
),
|
||||
const Expanded(child: Text('Borrar datos locales:')),
|
||||
_buildDestructiveButton(
|
||||
label: 'Borrar',
|
||||
onPressed: (_isBusy || _isServerDeleting)
|
||||
@@ -483,7 +488,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
),
|
||||
_buildDestructiveButton(
|
||||
label: 'Borrar',
|
||||
onPressed: (_isBusy || _isSyncing || _isServerDeleting)
|
||||
onPressed:
|
||||
(_isBusy || _isSyncing || _isServerDeleting)
|
||||
? null
|
||||
: _confirmAndDeleteServerData,
|
||||
isLoading: _isServerDeleting,
|
||||
@@ -498,14 +504,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
child: Text('Forzar sincronizacion total:'),
|
||||
),
|
||||
ElevatedButton.icon(
|
||||
onPressed: (_isBusy || _isSyncing || _isServerDeleting)
|
||||
onPressed:
|
||||
(_isBusy || _isSyncing || _isServerDeleting)
|
||||
? null
|
||||
: _forceSync,
|
||||
icon: _isSyncing
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: const Icon(Icons.sync),
|
||||
label: const Text('Sincronizar'),
|
||||
@@ -524,31 +533,49 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const Text('API endpoint (ej: https://notas-api.lpncnd.es/api)'),
|
||||
const Text(
|
||||
'API endpoint (ej: https://notas-api.lpncnd.es/api)',
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildResponsiveInputActionsRow(
|
||||
input: _endpointLoading
|
||||
? const SizedBox(height: 48, child: Center(child: CircularProgressIndicator()))
|
||||
? const SizedBox(
|
||||
height: 48,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
)
|
||||
: TextField(
|
||||
controller: _endpointController,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
keyboardType: TextInputType.url,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'API endpoint',
|
||||
labelStyle: TextStyle(color: Colors.white.withValues(alpha: 0.7)),
|
||||
labelStyle: const TextStyle(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white.withValues(alpha: 0.05),
|
||||
fillColor: AppColors.fill,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: const BorderSide(color: Colors.amber, width: 1.2),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.accent,
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -573,39 +600,56 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
obscureText: !_encryptionKeyVisible,
|
||||
enableSuggestions: false,
|
||||
autocorrect: false,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: const TextStyle(color: AppColors.textPrimary),
|
||||
decoration: InputDecoration(
|
||||
labelText: _encryptionKeyVisible ? 'Clave de cifrado' : 'Oculta hasta pulsar mostrar',
|
||||
labelStyle: TextStyle(color: Colors.white.withValues(alpha: 0.7)),
|
||||
labelText: _encryptionKeyVisible
|
||||
? 'Clave de cifrado'
|
||||
: 'Oculta hasta pulsar mostrar',
|
||||
labelStyle: const TextStyle(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white.withValues(alpha: 0.05),
|
||||
fillColor: AppColors.fill,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: const BorderSide(color: Colors.amber, width: 1.2),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.accent,
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
onPressed: _encryptionKeyLoading ? null : _loadEncryptionKey,
|
||||
onPressed: _encryptionKeyLoading
|
||||
? null
|
||||
: _loadEncryptionKey,
|
||||
child: _encryptionKeyLoading
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: const Text('Mostrar'),
|
||||
),
|
||||
OutlinedButton(
|
||||
onPressed: _encryptionKeyVisible ? _hideEncryptionKey : null,
|
||||
onPressed: _encryptionKeyVisible
|
||||
? _hideEncryptionKey
|
||||
: null,
|
||||
child: const Text('Ocultar'),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notas/data/api_client.dart';
|
||||
import 'package:notas/theme/app_colors.dart';
|
||||
|
||||
class VaultAccessScreen extends StatefulWidget {
|
||||
const VaultAccessScreen({
|
||||
@@ -11,7 +12,8 @@ class VaultAccessScreen extends StatefulWidget {
|
||||
});
|
||||
|
||||
final bool isBusy;
|
||||
final Future<void> Function(String email, String password) onCreateAccountPressed;
|
||||
final Future<void> Function(String email, String password)
|
||||
onCreateAccountPressed;
|
||||
final Future<void> Function(String email, String password) onSignInPressed;
|
||||
final Future<void> Function() onContinueWithoutAccount;
|
||||
|
||||
@@ -75,17 +77,7 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF191A1D),
|
||||
Color(0xFF222326),
|
||||
Color(0xFF101114),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
decoration: const BoxDecoration(gradient: AppColors.backdropGradient),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -98,12 +90,12 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF1D1E20),
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
|
||||
border: Border.all(color: AppColors.borderMuted),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.35),
|
||||
color: AppColors.shadow,
|
||||
blurRadius: 30,
|
||||
offset: const Offset(0, 18),
|
||||
),
|
||||
@@ -115,7 +107,7 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.lock_outline,
|
||||
color: Colors.amber,
|
||||
color: AppColors.accent,
|
||||
size: 44,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
@@ -123,7 +115,7 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
'Mis Notas',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
@@ -133,7 +125,7 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
'Tus notas se guardan cifradas en este dispositivo. La cuenta y la sincronización vendrán después.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.72),
|
||||
color: AppColors.textSecondary,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
@@ -141,29 +133,42 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
_endpointLoading
|
||||
? const SizedBox(
|
||||
height: 48,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
)
|
||||
: TextField(
|
||||
controller: _endpointController,
|
||||
enabled: !widget.isBusy,
|
||||
keyboardType: TextInputType.url,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'API endpoint',
|
||||
labelStyle: TextStyle(color: Colors.white.withValues(alpha: 0.7)),
|
||||
labelStyle: const TextStyle(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white.withValues(alpha: 0.05),
|
||||
fillColor: AppColors.fill,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: const BorderSide(color: Colors.amber, width: 1.2),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.accent,
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -172,23 +177,34 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
controller: _emailController,
|
||||
enabled: !widget.isBusy,
|
||||
keyboardType: TextInputType.text,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Usuario',
|
||||
labelStyle: TextStyle(color: Colors.white.withValues(alpha: 0.7)),
|
||||
labelStyle: const TextStyle(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white.withValues(alpha: 0.05),
|
||||
fillColor: AppColors.fill,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: const BorderSide(color: Colors.amber, width: 1.2),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.accent,
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -197,37 +213,54 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
controller: _passwordController,
|
||||
enabled: !widget.isBusy,
|
||||
obscureText: true,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Contraseña',
|
||||
labelStyle: TextStyle(color: Colors.white.withValues(alpha: 0.7)),
|
||||
labelStyle: const TextStyle(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white.withValues(alpha: 0.05),
|
||||
fillColor: AppColors.fill,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: const BorderSide(color: Colors.amber, width: 1.2),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.accent,
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 22),
|
||||
FilledButton(
|
||||
onPressed: widget.isBusy ? null : _handleCreateAccount,
|
||||
onPressed: widget.isBusy
|
||||
? null
|
||||
: _handleCreateAccount,
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 14,
|
||||
),
|
||||
),
|
||||
child: widget.isBusy
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: const Text('Crear cuenta'),
|
||||
),
|
||||
@@ -235,15 +268,21 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
OutlinedButton(
|
||||
onPressed: widget.isBusy ? null : _handleSignIn,
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
side: const BorderSide(color: Colors.white24),
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 14,
|
||||
),
|
||||
side: const BorderSide(
|
||||
color: AppColors.textDisabled,
|
||||
),
|
||||
foregroundColor: AppColors.textPrimary,
|
||||
),
|
||||
child: const Text('Iniciar sesión'),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
TextButton(
|
||||
onPressed: widget.isBusy ? null : widget.onContinueWithoutAccount,
|
||||
onPressed: widget.isBusy
|
||||
? null
|
||||
: widget.onContinueWithoutAccount,
|
||||
child: const Text('Entrar sin cuenta'),
|
||||
),
|
||||
],
|
||||
@@ -259,4 +298,4 @@ class _VaultAccessScreenState extends State<VaultAccessScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user