Resuelto conflicto de fusión
This commit is contained in:
@@ -122,7 +122,7 @@ class _WelcomeCard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppTheme.leafGreen.withOpacity(0.3),
|
||||
color: AppTheme.leafGreen.withValues(alpha: 0.3),
|
||||
blurRadius: 16,
|
||||
offset: const Offset(0, 6),
|
||||
),
|
||||
@@ -134,7 +134,7 @@ class _WelcomeCard extends StatelessWidget {
|
||||
width: 52,
|
||||
height: 52,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
),
|
||||
child: const Icon(
|
||||
@@ -169,7 +169,7 @@ class _WelcomeCard extends StatelessWidget {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(
|
||||
@@ -307,10 +307,10 @@ class _PreventiveMessageCard extends StatelessWidget {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.alertAmber.withOpacity(0.08),
|
||||
color: AppTheme.alertAmber.withValues(alpha: 0.08),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(
|
||||
color: AppTheme.alertAmber.withOpacity(0.3),
|
||||
color: AppTheme.alertAmber.withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
|
||||
@@ -1,5 +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';
|
||||
@@ -20,6 +22,7 @@ class _LoginScreenState extends State<LoginScreen> with SingleTickerProviderStat
|
||||
final _passwordController = TextEditingController();
|
||||
|
||||
bool _obscurePassword = true;
|
||||
|
||||
late final AnimationController _animController;
|
||||
late final Animation<double> _fadeAnim;
|
||||
late final Animation<Offset> _slideAnim;
|
||||
@@ -31,17 +34,10 @@ class _LoginScreenState extends State<LoginScreen> with SingleTickerProviderStat
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 700),
|
||||
);
|
||||
_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,
|
||||
));
|
||||
_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));
|
||||
_animController.forward();
|
||||
}
|
||||
|
||||
@@ -57,7 +53,7 @@ class _LoginScreenState extends State<LoginScreen> with SingleTickerProviderStat
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
context.read<AuthBloc>().add(
|
||||
AuthLoginRequested(
|
||||
identifier: _identifierController.text,
|
||||
identifier: _identifierController.text.trim(),
|
||||
password: _passwordController.text,
|
||||
),
|
||||
);
|
||||
@@ -73,7 +69,8 @@ class _LoginScreenState extends State<LoginScreen> with SingleTickerProviderStat
|
||||
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)),
|
||||
],
|
||||
@@ -86,127 +83,176 @@ class _LoginScreenState extends State<LoginScreen> with SingleTickerProviderStat
|
||||
child: Scaffold(
|
||||
backgroundColor: AppTheme.warmWhite,
|
||||
body: SafeArea(
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: FadeTransition(
|
||||
opacity: _fadeAnim,
|
||||
child: SlideTransition(
|
||||
position: _slideAnim,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 28),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const SizedBox(height: 48),
|
||||
_buildHeader(),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: FadeTransition(
|
||||
opacity: _fadeAnim,
|
||||
child: SlideTransition(
|
||||
position: _slideAnim,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 28),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 48),
|
||||
_buildHeader(),
|
||||
const SizedBox(height: 32),
|
||||
_buildForm(context),
|
||||
const SizedBox(height: 24),
|
||||
const PrivacyNoticeCard(),
|
||||
const SizedBox(height: 32),
|
||||
_buildDemoHint(),
|
||||
const Spacer(),
|
||||
const SizedBox(height: 8),
|
||||
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),
|
||||
fontSize: 12,
|
||||
color: Colors.grey.shade600,
|
||||
height: 1.3),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
// Asegúrate de que este widget esté definido en tu proyecto o cámbialo por un placeholder
|
||||
// const ScheduleWarningBanner(),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// --- CAMPO: EMAIL / IDENTIFICADOR ---
|
||||
TextFormField(
|
||||
controller: _identifierController,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Correo Electrónico o Teléfono',
|
||||
prefixIcon: Icon(Icons.email_outlined),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
),
|
||||
validator: (value) =>
|
||||
(value == null || value.trim().isEmpty)
|
||||
? 'Por favor, ingresa tus datos de acceso'
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// --- CAMPO: CONTRASEÑA ---
|
||||
TextFormField(
|
||||
controller: _passwordController,
|
||||
obscureText: _obscurePassword,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Contraseña de Acceso',
|
||||
prefixIcon: const Icon(Icons.lock_outline_rounded),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(_obscurePassword ? Icons.visibility_off : Icons.visibility),
|
||||
onPressed: () => setState(() => _obscurePassword = !_obscurePassword),
|
||||
),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
),
|
||||
validator: (value) => (value == null || value.isEmpty)
|
||||
? 'Por favor, introduce tu contraseña'
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// --- CONTENEDOR REACTIVO DE BOTONES ---
|
||||
BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, state) {
|
||||
final isLoading = state is AuthLoading;
|
||||
|
||||
return AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: isLoading
|
||||
? []
|
||||
: [
|
||||
BoxShadow(
|
||||
color: AppTheme.leafGreen.withOpacity(0.3),
|
||||
blurRadius: 16,
|
||||
offset: const Offset(0, 6),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ElevatedButton(
|
||||
onPressed: isLoading ? null : () => _submit(context),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: isLoading
|
||||
? AppTheme.mintGreen.withOpacity(0.7)
|
||||
: AppTheme.leafGreen,
|
||||
disabledBackgroundColor: AppTheme.mintGreen.withOpacity(0.6),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
),
|
||||
child: isLoading
|
||||
? const CircularProgressIndicator(color: Colors.white)
|
||||
: const Text('Iniciar Sesión', style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const PrivacyNoticeCard(),
|
||||
const SizedBox(height: 32),
|
||||
_buildDemoHint(),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 48),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Métodos auxiliares creados como placeholders para evitar errores de compilación
|
||||
Widget _buildHeader() => const Center(child: Text("WasteNotify", style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)));
|
||||
Widget _buildDemoHint() => const Center(child: Text("Demo: ciudadano@ejemplo.com / password123", style: TextStyle(fontSize: 12)));
|
||||
Widget _buildHeader() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
Text(
|
||||
'Bienvenido a WasteNotify',
|
||||
style: TextStyle(fontSize: 26, fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
'Inicia sesión para continuar',
|
||||
style: TextStyle(fontSize: 14, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildForm(BuildContext context) {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: _identifierController,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Correo Electrónico o Teléfono',
|
||||
prefixIcon: Icon(Icons.email_outlined),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
),
|
||||
validator: (value) => (value == null || value.trim().isEmpty)
|
||||
? 'Por favor, ingresa tus datos de acceso'
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
TextFormField(
|
||||
controller: _passwordController,
|
||||
obscureText: _obscurePassword,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Contraseña de Acceso',
|
||||
prefixIcon: const Icon(Icons.lock_outline_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
_obscurePassword ? Icons.visibility : Icons.visibility_off),
|
||||
onPressed: () =>
|
||||
setState(() => _obscurePassword = !_obscurePassword),
|
||||
),
|
||||
),
|
||||
validator: (value) => (value == null || value.isEmpty)
|
||||
? 'Por favor, introduce tu contraseña'
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, state) {
|
||||
final isLoading = state is AuthLoading;
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: isLoading
|
||||
? []
|
||||
: [
|
||||
BoxShadow(
|
||||
color:
|
||||
AppTheme.leafGreen.withValues(alpha: 0.3),
|
||||
blurRadius: 16,
|
||||
offset: const Offset(0, 6),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ElevatedButton(
|
||||
onPressed: isLoading ? null : () => _submit(context),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: isLoading
|
||||
? AppTheme.mintGreen.withValues(alpha: 0.7)
|
||||
: AppTheme.leafGreen,
|
||||
disabledBackgroundColor:
|
||||
AppTheme.mintGreen.withValues(alpha: 0.6),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
child: isLoading
|
||||
? const SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.white, strokeWidth: 2),
|
||||
)
|
||||
: const Text('Iniciar Sesión',
|
||||
style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 📍 BOTÓN DE REGISTRO CORREGIDO (child al final)
|
||||
TextButton(
|
||||
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í'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Placeholders para evitar errores si no están definidos
|
||||
Widget _buildDemoHint() => const SizedBox.shrink();
|
||||
}
|
||||
|
||||
@@ -11,11 +11,31 @@ class RegisterScreen extends StatefulWidget {
|
||||
|
||||
class _RegisterScreenState extends State<RegisterScreen> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
String _selectedColonia = 'Centro';
|
||||
late String _selectedColonia; // 📍 Se mantiene late pero se inicializa abajo
|
||||
final _nameController = TextEditingController();
|
||||
final _emailController = TextEditingController();
|
||||
final _passwordController = TextEditingController();
|
||||
|
||||
// 📍 CORRECCIÓN CRÍTICA: Asignar el valor inicial antes del método build
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (MockWasteData.schedules.isNotEmpty) {
|
||||
// Evita problemas de aserción tomando el primer valor real de tus mocks
|
||||
_selectedColonia = MockWasteData.schedules.first.colonia;
|
||||
} else {
|
||||
_selectedColonia = ''; // Respaldo por si la lista estuviera vacía
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameController.dispose();
|
||||
_emailController.dispose();
|
||||
_passwordController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -38,24 +58,24 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
||||
TextFormField(
|
||||
controller: _nameController,
|
||||
decoration: const InputDecoration(labelText: 'Nombre Completo', border: OutlineInputBorder()),
|
||||
validator: (v) => v!.isEmpty ? 'Ingresa tu nombre' : null,
|
||||
validator: (v) => v == null || v.isEmpty ? 'Ingresa tu nombre' : null,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _emailController,
|
||||
decoration: const InputDecoration(labelText: 'Correo o Teléfono', border: OutlineInputBorder()),
|
||||
validator: (v) => v!.isEmpty ? 'Ingresa tus datos' : null,
|
||||
validator: (v) => v == null || v.isEmpty ? 'Ingresa tus datos' : null,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _passwordController,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(labelText: 'Contraseña', border: OutlineInputBorder()),
|
||||
validator: (v) => v!.length < 6 ? 'Mínimo 6 caracteres' : null,
|
||||
validator: (v) => v == null || v.length < 6 ? 'Mínimo 6 caracteres' : null,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Dropdown para seleccionar la Colonia (Requisito MVP)
|
||||
// Dropdown para seleccionar la Colonia
|
||||
DropdownButtonFormField<String>(
|
||||
value: _selectedColonia,
|
||||
decoration: const InputDecoration(labelText: 'Selecciona tu Colonia / Domicilio', border: OutlineInputBorder()),
|
||||
@@ -82,7 +102,6 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
||||
style: ElevatedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 16), backgroundColor: Colors.green),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// Simulación de Registro Exitoso: Navega al Home enviando la colonia elegida
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Cuenta creada con éxito (Modo Simulación)')),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user