FIX: VIEW REGISTER

This commit is contained in:
25030248hasel
2026-05-23 04:17:45 -06:00
parent 6ae45fd371
commit c560fb09fb
3 changed files with 74 additions and 86 deletions

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import '../../../../core/router/app_router.dart'; // 📍 Importación de rutas verificada
import '../../../../core/theme/app_theme.dart';
import '../bloc/auth_bloc.dart';
@@ -36,7 +37,8 @@ class _LoginScreenState extends State<LoginScreen>
);
_fadeAnim = CurvedAnimation(parent: _animController, curve: Curves.easeOut);
_slideAnim = Tween<Offset>(begin: const Offset(0, 0.06), end: Offset.zero)
.animate(CurvedAnimation(parent: _animController, curve: Curves.easeOutCubic));
.animate(CurvedAnimation(
parent: _animController, curve: Curves.easeOutCubic));
_animController.forward();
}
@@ -68,7 +70,8 @@ class _LoginScreenState extends State<LoginScreen>
SnackBar(
content: Row(
children: [
const Icon(Icons.error_outline, color: Colors.white, size: 18),
const Icon(Icons.error_outline,
color: Colors.white, size: 18),
const SizedBox(width: 10),
Expanded(child: Text(state.message)),
],
@@ -104,13 +107,15 @@ class _LoginScreenState extends State<LoginScreen>
_buildDemoHint(),
const Spacer(),
const SizedBox(height: 8),
Text(
'Sistema Municipal de Recolección Residencial\nCelaya, Guanajuato',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
height: 1.3),
Center(
child: Text(
'Sistema Municipal de Recolección Residencial\nCelaya, Guanajuato',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
height: 1.3),
),
),
const SizedBox(height: 48),
],
@@ -163,7 +168,6 @@ class _LoginScreenState extends State<LoginScreen>
: null,
),
const SizedBox(height: 20),
TextFormField(
controller: _passwordController,
obscureText: _obscurePassword,
@@ -175,7 +179,8 @@ class _LoginScreenState extends State<LoginScreen>
suffixIcon: IconButton(
icon: Icon(
_obscurePassword ? Icons.visibility : Icons.visibility_off),
onPressed: () => setState(() => _obscurePassword = !_obscurePassword),
onPressed: () =>
setState(() => _obscurePassword = !_obscurePassword),
),
),
validator: (value) => (value == null || value.isEmpty)
@@ -183,7 +188,6 @@ class _LoginScreenState extends State<LoginScreen>
: null,
),
const SizedBox(height: 32),
BlocBuilder<AuthBloc, AuthState>(
builder: (context, state) {
final isLoading = state is AuthLoading;
@@ -200,7 +204,8 @@ class _LoginScreenState extends State<LoginScreen>
? []
: [
BoxShadow(
color: AppTheme.leafGreen.withValues(alpha: 0.3),
color:
AppTheme.leafGreen.withValues(alpha: 0.3),
blurRadius: 16,
offset: const Offset(0, 6),
),
@@ -220,43 +225,26 @@ class _LoginScreenState extends State<LoginScreen>
),
child: isLoading
? const SizedBox(
height: 22,
width: 22,
height: 20,
width: 20,
child: CircularProgressIndicator(
strokeWidth: 2.5,
valueColor: AlwaysStoppedAnimation(Colors.white),
),
color: Colors.white, strokeWidth: 2),
)
: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.login_rounded,
size: 20, color: Colors.white),
SizedBox(width: 10),
Text(
'Ingresar de forma segura',
style: TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.bold),
),
],
),
: const Text('Iniciar Sesión',
style: TextStyle(color: Colors.white)),
),
),
const SizedBox(height: 20),
const SizedBox(height: 16),
// 📍 BOTÓN DE REGISTRO CORREGIDO (child al final)
TextButton(
onPressed: () => context.push('/register'),
child: const Text(
'¿No tienes una cuenta ciudadana? Regístrate aquí',
style: TextStyle(
color: AppTheme.leafGreen,
fontWeight: FontWeight.w700,
fontSize: 13,
),
onPressed: () => context.push(AppRoutes.register),
style: TextButton.styleFrom(
foregroundColor: AppTheme.leafGreen,
textStyle: const TextStyle(
fontSize: 14, fontWeight: FontWeight.w500),
),
)
child: const Text('¿No tienes cuenta? Regístrate aquí'),
),
],
);
},
@@ -266,10 +254,6 @@ class _LoginScreenState extends State<LoginScreen>
);
}
Widget _buildDemoHint() {
return const Text(
'Credenciales de demo: ciudadano@ejemplo.com / password123',
style: TextStyle(fontSize: 12, color: Colors.black54),
);
}
// Placeholders para evitar errores si no están definidos
Widget _buildDemoHint() => const SizedBox.shrink();
}