login implementado

This commit is contained in:
Abraham
2025-07-15 23:02:46 -07:00
parent 07395137a5
commit 14775dc90d
2 changed files with 802 additions and 303 deletions

View File

@@ -15,8 +15,51 @@ class LoginPage extends StatefulWidget {
State<LoginPage> createState() => _LoginPageState(); State<LoginPage> createState() => _LoginPageState();
} }
class _LoginPageState extends State<LoginPage> { class _LoginPageState extends State<LoginPage> with TickerProviderStateMixin {
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
late AnimationController _fadeController;
late AnimationController _slideController;
late Animation<double> _fadeAnimation;
late Animation<Offset> _slideAnimation;
@override
void initState() {
super.initState();
_fadeController = AnimationController(
duration: const Duration(milliseconds: 1500),
vsync: this,
);
_slideController = AnimationController(
duration: const Duration(milliseconds: 1200),
vsync: this,
);
_fadeAnimation = Tween<double>(
begin: 0.0,
end: 1.0,
).animate(CurvedAnimation(
parent: _fadeController,
curve: Curves.easeInOut,
));
_slideAnimation = Tween<Offset>(
begin: const Offset(-0.3, 0),
end: Offset.zero,
).animate(CurvedAnimation(
parent: _slideController,
curve: Curves.elasticOut,
));
_fadeController.forward();
_slideController.forward();
}
@override
void dispose() {
_fadeController.dispose();
_slideController.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -27,156 +70,328 @@ class _LoginPageState extends State<LoginPage> {
child: LayoutBuilder( child: LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
if (constraints.maxWidth < 768) { if (constraints.maxWidth < 768) {
// Vista móvil - fondo degradado completo // Vista móvil - fondo degradado completo con mejoras
return Container( return Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
decoration: const BoxDecoration( decoration: const BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.centerLeft, begin: Alignment.topLeft,
end: Alignment.centerRight, end: Alignment.bottomRight,
colors: [ colors: [
Color(0xFF22C55E), // Verde izquierda Color(
Color(0xFF3B82F6), // Azul centro 0xFF0F172A), // Azul muy oscuro (más oscuro para móvil)
Color(0xFF8B5CF6), // Morado derecha Color(0xFF1E293B), // Azul oscuro
Color(0xFF075985), // Azul medio oscuro
Color(0xFF059669), // Verde más oscuro
], ],
stops: [0.0, 0.3, 0.7, 1.0],
), ),
), ),
child: Stack(
children: [
// Efectos de partículas/círculos flotantes (más sutiles en móvil)
...List.generate(
4, (index) => _buildFloatingCircle(index, constraints)),
// Overlay oscuro con blur para mejor legibilidad
Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.3),
),
),
SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Container( child: Container(
width: double.infinity,
constraints: BoxConstraints( constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height, minHeight: MediaQuery.of(context).size.height -
MediaQuery.of(context).padding.top -
MediaQuery.of(context).padding.bottom,
),
padding: const EdgeInsets.symmetric(
horizontal: 24, // Padding simétrico
vertical: 20,
), ),
padding: const EdgeInsets.all(20),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment
.center, // Centrado horizontal
children: [ children: [
// Logo NetHive para móvil // Logo NetHive para móvil
Container( FadeTransition(
margin: const EdgeInsets.only(bottom: 30), opacity: _fadeAnimation,
child: Container(
margin: const EdgeInsets.only(bottom: 40),
child: Column( child: Column(
children: [ children: [
Container( Container(
width: 80, width: 100,
height: 80, height: 100,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(16), borderRadius:
BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color:
Colors.black.withOpacity(0.3),
blurRadius: 30,
offset: const Offset(0, 15),
),
BoxShadow(
color:
Colors.white.withOpacity(0.1),
blurRadius: 20,
offset: const Offset(0, -5),
),
],
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(20),
child: Image.asset( child: Image.asset(
'assets/images/favicon.png', 'assets/images/favicon.png',
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 24),
const Text( const Text(
'NetHive', 'NetHive',
style: TextStyle( style: TextStyle(
fontSize: 32, fontSize: 38,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white, color: Colors.white,
shadows: [
Shadow(
offset: Offset(0, 3),
blurRadius: 15,
color: Colors.black38,
), ),
],
), ),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
const Text( const Text(
'Infrastructure Management', 'Infrastructure Management',
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: Colors.white70, color: Colors.white70,
fontWeight: FontWeight.w300,
letterSpacing: 0.8,
), ),
textAlign: TextAlign.center,
), ),
], ],
), ),
), ),
const LoginForm(), ),
// Formulario con contenedor para mejor contraste
SlideTransition(
position: _slideAnimation,
child: Container(
width: double.infinity,
constraints:
const BoxConstraints(maxWidth: 400),
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.2),
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Colors.white.withOpacity(0.1),
width: 1,
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 30,
offset: const Offset(0, 15),
),
],
),
child: const LoginForm(),
),
),
const SizedBox(height: 20),
], ],
), ),
), ),
), ),
),
],
),
); );
} else { } else {
// Vista desktop - columna izquierda sólida, derecha degradado // Vista desktop - columna izquierda sólida, derecha degradado
return Row( return Row(
children: [ children: [
// Lado izquierdo - Formulario (fondo sólido) // Lado izquierdo - Formulario (fondo sólido con efectos)
Expanded( Expanded(
flex: 1, flex: 1,
child: Container( child: Container(
color: decoration: BoxDecoration(
const Color(0xFF1E293B), // Fondo sólido azul oscuro color: const Color(0xFF0F172A),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 30,
offset: const Offset(10, 0),
),
],
),
child: Stack(
children: [
// Patrón de puntos sutil
Positioned.fill(
child: CustomPaint(
painter: DotPatternPainter(),
),
),
Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 60, vertical: 40), horizontal: 60, vertical: 40),
child: Center( child: Center(
child: SingleChildScrollView( child: SingleChildScrollView(
child: ConstrainedBox( child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 400), constraints:
const BoxConstraints(maxWidth: 420),
child: SlideTransition(
position: _slideAnimation,
child: const LoginForm(), child: const LoginForm(),
), ),
), ),
), ),
), ),
), ),
// Lado derecho - Logo (con degradado) ],
),
),
),
// Lado derecho - Logo (con degradado mejorado)
Expanded( Expanded(
flex: 1, flex: 1,
child: Container( child: Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.centerLeft, begin: Alignment.topLeft,
end: Alignment.centerRight, end: Alignment.bottomRight,
colors: [ colors: [
Color(0xFF22C55E), // Verde izquierda Color(0xFF1E40AF), // Azul profundo
Color(0xFF3B82F6), // Azul centro Color(0xFF3B82F6), // Azul brillante
Color(0xFF8B5CF6), // Morado derecha Color(0xFF10B981), // Verde esmeralda
Color(0xFF059669), // Verde intenso
Color(0xFF7C3AED), // Púrpura
], ],
stops: [0.0, 0.25, 0.5, 0.75, 1.0],
), ),
), ),
child: Stack(
children: [
// Efectos de círculos flotantes
...List.generate(
8,
(index) => _buildFloatingCircle(
index, constraints, true)),
// Contenido centrado horizontal y verticalmente
Center(
child: Container(
padding: const EdgeInsets.all(60), padding: const EdgeInsets.all(60),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [ children: [
// Logo NetHive // Logo NetHive con animación
Container( FadeTransition(
width: 120, opacity: _fadeAnimation,
height: 120, child: Container(
width: 150,
height: 150,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(30),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withOpacity(0.1), color:
Colors.black.withOpacity(0.2),
blurRadius: 40,
offset: const Offset(0, 20),
),
BoxShadow(
color:
Colors.white.withOpacity(0.1),
blurRadius: 20, blurRadius: 20,
offset: const Offset(0, 10), offset: const Offset(0, -10),
), ),
], ],
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(30),
child: Image.asset( child: Image.asset(
'assets/images/favicon.png', 'assets/images/favicon.png',
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
), ),
), ),
const SizedBox(height: 32), ),
const Text( const SizedBox(height: 40),
FadeTransition(
opacity: _fadeAnimation,
child: const Text(
'NetHive', 'NetHive',
style: TextStyle( style: TextStyle(
fontSize: 48, fontSize: 52,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white, color: Colors.white,
shadows: [
Shadow(
offset: Offset(0, 4),
blurRadius: 20,
color: Colors.black26,
),
],
),
textAlign: TextAlign.center,
), ),
), ),
const SizedBox(height: 8), const SizedBox(height: 12),
const Text( FadeTransition(
opacity: _fadeAnimation,
child: Text(
'Infrastructure Management', 'Infrastructure Management',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 20,
color: Colors.white70, color: Colors.white.withOpacity(0.8),
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
letterSpacing: 1.2,
),
textAlign: TextAlign.center,
),
),
const SizedBox(height: 30),
// Línea decorativa
FadeTransition(
opacity: _fadeAnimation,
child: Container(
width: 100,
height: 2,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [
Colors.transparent,
Colors.white,
Colors.transparent,
],
),
borderRadius: BorderRadius.circular(2),
),
),
),
],
),
), ),
), ),
], ],
@@ -191,4 +406,76 @@ class _LoginPageState extends State<LoginPage> {
), ),
); );
} }
Widget _buildFloatingCircle(int index, BoxConstraints constraints,
[bool isRightSide = false]) {
final random = [
{'size': 80.0, 'top': 50.0, 'left': 30.0, 'opacity': 0.1},
{'size': 120.0, 'top': 200.0, 'right': 50.0, 'opacity': 0.08},
{'size': 60.0, 'bottom': 150.0, 'left': 80.0, 'opacity': 0.12},
{'size': 100.0, 'top': 300.0, 'left': 200.0, 'opacity': 0.06},
{'size': 140.0, 'bottom': 100.0, 'right': 100.0, 'opacity': 0.09},
{'size': 70.0, 'top': 450.0, 'right': 150.0, 'opacity': 0.11},
{'size': 90.0, 'top': 100.0, 'left': 150.0, 'opacity': 0.07},
{'size': 110.0, 'bottom': 200.0, 'left': 50.0, 'opacity': 0.08},
];
if (index >= random.length) return const SizedBox();
final circle = random[index];
return AnimatedBuilder(
animation: _fadeController,
builder: (context, child) {
return Positioned(
top: circle['top'] as double?,
bottom: circle['bottom'] as double?,
left: circle['left'] as double?,
right: circle['right'] as double?,
child: Transform.scale(
scale: 0.5 + (_fadeAnimation.value * 0.5),
child: Container(
width: circle['size'] as double,
height: circle['size'] as double,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white.withOpacity(
(circle['opacity'] as double) * _fadeAnimation.value),
border: Border.all(
color: Colors.white.withOpacity(0.1 * _fadeAnimation.value),
width: 1,
),
),
),
),
);
},
);
}
}
// Custom painter para patrón de puntos
class DotPatternPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()
..color = Colors.white.withOpacity(0.02)
..style = PaintingStyle.fill;
const double spacing = 30;
const double dotSize = 1.5;
for (double x = 0; x < size.width; x += spacing) {
for (double y = 0; y < size.height; y += spacing) {
canvas.drawCircle(
Offset(x, y),
dotSize,
paint,
);
}
}
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
} }

View File

@@ -20,15 +20,44 @@ class LoginForm extends StatefulWidget {
State<LoginForm> createState() => _LoginFormState(); State<LoginForm> createState() => _LoginFormState();
} }
class _LoginFormState extends State<LoginForm> { class _LoginFormState extends State<LoginForm> with TickerProviderStateMixin {
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
bool passwordVisibility = false; bool passwordVisibility = false;
late AnimationController _buttonController;
late Animation<double> _buttonScale;
bool _isLoading = false;
@override
void initState() {
super.initState();
_buttonController = AnimationController(
duration: const Duration(milliseconds: 150),
vsync: this,
);
_buttonScale = Tween<double>(
begin: 1.0,
end: 0.95,
).animate(CurvedAnimation(
parent: _buttonController,
curve: Curves.easeInOut,
));
}
@override
void dispose() {
_buttonController.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final UserState userState = Provider.of<UserState>(context); final UserState userState = Provider.of<UserState>(context);
final isMobile = MediaQuery.of(context).size.width < 768;
Future<void> login() async { Future<void> login() async {
setState(() => _isLoading = true);
_buttonController.forward().then((_) => _buttonController.reverse());
//Login //Login
try { try {
// Check if user exists // Check if user exists
@@ -37,6 +66,7 @@ class _LoginFormState extends State<LoginForm> {
if (userId == null) { if (userId == null) {
await ApiErrorHandler.callToast('Este Correo no está registrado'); await ApiErrorHandler.callToast('Este Correo no está registrado');
setState(() => _isLoading = false);
return; return;
} }
@@ -57,6 +87,7 @@ class _LoginFormState extends State<LoginForm> {
if (supabase.auth.currentUser == null) { if (supabase.auth.currentUser == null) {
await ApiErrorHandler.callToast(); await ApiErrorHandler.callToast();
setState(() => _isLoading = false);
return; return;
} }
@@ -64,6 +95,7 @@ class _LoginFormState extends State<LoginForm> {
if (currentUser == null) { if (currentUser == null) {
await ApiErrorHandler.callToast(); await ApiErrorHandler.callToast();
setState(() => _isLoading = false);
return; return;
} }
/* /*
@@ -91,16 +123,17 @@ class _LoginFormState extends State<LoginForm> {
userState.emailController.text, userState.emailController.text,
); );
await ApiErrorHandler.callToast('Credenciales Invalidas'); await ApiErrorHandler.callToast('Credenciales Invalidas');
setState(() => _isLoading = false);
return; return;
} }
log('Error al iniciar sesion - $e'); log('Error al iniciar sesion - $e');
setState(() => _isLoading = false);
} }
} }
return Container( return Container(
width: double.infinity, width: double.infinity,
constraints: const BoxConstraints(maxWidth: 400), constraints: const BoxConstraints(maxWidth: 420),
child: Form( child: Form(
key: formKey, key: formKey,
child: Column( child: Column(
@@ -109,32 +142,48 @@ class _LoginFormState extends State<LoginForm> {
// Logo NetHive para formulario (solo en desktop) // Logo NetHive para formulario (solo en desktop)
MediaQuery.of(context).size.width >= 768 MediaQuery.of(context).size.width >= 768
? Container( ? Container(
margin: const EdgeInsets.only(bottom: 40), margin: const EdgeInsets.only(bottom: 50),
child: Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [ children: [
Container( Container(
width: 40, width: 50,
height: 40, height: 50,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFF3B82F6), gradient: const LinearGradient(
borderRadius: BorderRadius.circular(8), colors: [
Color(0xFF3B82F6),
Color(0xFF10B981)
],
),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: const Color(0xFF3B82F6)
.withOpacity(0.3),
blurRadius: 20,
offset: const Offset(0, 8),
),
],
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(10),
child: Image.asset( child: Image.asset(
'assets/images/favicon.png', 'assets/images/favicon.png',
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
), ),
), ),
const SizedBox(width: 12), const SizedBox(width: 16),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'Bienvenido a NetHive', 'Bienvenido a NetHive',
style: GoogleFonts.inter( style: GoogleFonts.inter(
fontSize: 24, fontSize: 28,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white, color: Colors.white,
), ),
@@ -143,13 +192,27 @@ class _LoginFormState extends State<LoginForm> {
'Plataforma de Gestión de Infraestructura', 'Plataforma de Gestión de Infraestructura',
style: GoogleFonts.inter( style: GoogleFonts.inter(
fontSize: 14, fontSize: 14,
color: Colors.white70, color: Colors.white60,
fontWeight: FontWeight.w300,
), ),
), ),
], ],
), ),
], ],
), ),
const SizedBox(height: 20),
Container(
width: 60,
height: 3,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFF10B981), Color(0xFF3B82F6)],
),
borderRadius: BorderRadius.circular(2),
),
),
],
),
) )
: const SizedBox(), : const SizedBox(),
@@ -157,16 +220,27 @@ class _LoginFormState extends State<LoginForm> {
Text( Text(
'CORREO ELECTRÓNICO', 'CORREO ELECTRÓNICO',
style: GoogleFonts.inter( style: GoogleFonts.inter(
fontSize: 12, fontSize: 13,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.white, color: Colors.white,
letterSpacing: 1.2, letterSpacing: 1.5,
), ),
), ),
const SizedBox(height: 8), const SizedBox(height: 12),
// Campo de email // Campo de email con efectos mejorados
TextFormField( Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 20,
offset: const Offset(0, 8),
),
],
),
child: TextFormField(
controller: userState.emailController, controller: userState.emailController,
onFieldSubmitted: (value) async { onFieldSubmitted: (value) async {
if (!formKey.currentState!.validate()) { if (!formKey.currentState!.validate()) {
@@ -185,42 +259,76 @@ class _LoginFormState extends State<LoginForm> {
style: GoogleFonts.inter( style: GoogleFonts.inter(
color: Colors.white, color: Colors.white,
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w400,
), ),
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'admin@nethive.com', hintText: 'admin@nethive.com',
hintStyle: GoogleFonts.inter( hintStyle: GoogleFonts.inter(
color: Colors.white54, color: isMobile
? Colors.white.withOpacity(0.6)
: Colors.white.withOpacity(0.4),
fontSize: 16, fontSize: 16,
), ),
filled: true, filled: true,
fillColor: Colors.white.withOpacity(0.1), fillColor: isMobile
? Colors.white.withOpacity(0.15) // Más opaco en móvil
: Colors.white.withOpacity(0.08),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(12),
borderSide: BorderSide.none, borderSide: BorderSide.none,
), ),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: const BorderSide(
color: Color(0xFF10B981),
width: 2,
),
),
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.symmetric(
horizontal: 16, horizontal: 20,
vertical: 16, vertical: 18,
),
prefixIcon: Container(
padding: const EdgeInsets.all(12),
child: Icon(
Icons.email_outlined,
color: isMobile
? Colors.white.withOpacity(0.8)
: Colors.white60,
size: 20,
),
),
), ),
), ),
), ),
const SizedBox(height: 20), const SizedBox(height: 24),
// Título contraseña // Título contraseña
Text( Text(
'CONTRASEÑA', 'CONTRASEÑA',
style: GoogleFonts.inter( style: GoogleFonts.inter(
fontSize: 12, fontSize: 13,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.white, color: Colors.white,
letterSpacing: 1.2, letterSpacing: 1.5,
), ),
), ),
const SizedBox(height: 8), const SizedBox(height: 12),
// Campo de contraseña // Campo de contraseña con efectos mejorados
TextFormField( Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 20,
offset: const Offset(0, 8),
),
],
),
child: TextFormField(
controller: userState.passwordController, controller: userState.passwordController,
obscureText: !passwordVisibility, obscureText: !passwordVisibility,
onFieldSubmitted: (value) async { onFieldSubmitted: (value) async {
@@ -238,29 +346,54 @@ class _LoginFormState extends State<LoginForm> {
style: GoogleFonts.inter( style: GoogleFonts.inter(
color: Colors.white, color: Colors.white,
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w400,
), ),
decoration: InputDecoration( decoration: InputDecoration(
hintText: '••••••', hintText: '••••••••',
hintStyle: GoogleFonts.inter( hintStyle: GoogleFonts.inter(
color: Colors.white54, color: isMobile
? Colors.white.withOpacity(0.6)
: Colors.white.withOpacity(0.4),
fontSize: 16, fontSize: 16,
), ),
filled: true, filled: true,
fillColor: Colors.white.withOpacity(0.1), fillColor: isMobile
? Colors.white.withOpacity(0.15) // Más opaco en móvil
: Colors.white.withOpacity(0.08),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(12),
borderSide: BorderSide.none, borderSide: BorderSide.none,
), ),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: const BorderSide(
color: Color(0xFF10B981),
width: 2,
),
),
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.symmetric(
horizontal: 16, horizontal: 20,
vertical: 16, vertical: 18,
),
prefixIcon: Container(
padding: const EdgeInsets.all(12),
child: Icon(
Icons.lock_outline,
color: isMobile
? Colors.white.withOpacity(0.8)
: Colors.white60,
size: 20,
),
), ),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
passwordVisibility passwordVisibility
? Icons.visibility_outlined ? Icons.visibility_outlined
: Icons.visibility_off_outlined, : Icons.visibility_off_outlined,
color: Colors.white54, color: isMobile
? Colors.white.withOpacity(0.8)
: Colors.white60,
size: 20,
), ),
onPressed: () => setState( onPressed: () => setState(
() => passwordVisibility = !passwordVisibility, () => passwordVisibility = !passwordVisibility,
@@ -268,31 +401,62 @@ class _LoginFormState extends State<LoginForm> {
), ),
), ),
), ),
),
const SizedBox(height: 32), const SizedBox(height: 40),
// Botón de iniciar sesión // Botón de iniciar sesión mejorado
SizedBox( ScaleTransition(
scale: _buttonScale,
child: Container(
width: double.infinity, width: double.infinity,
height: 50, height: 56,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: isMobile
? const Color(0xFF0369A1)
.withOpacity(0.6) // Azul en móvil
: const Color(0xFF10B981)
.withOpacity(0.4), // Verde en desktop
blurRadius: 20,
offset: const Offset(0, 8),
),
],
),
child: ElevatedButton( child: ElevatedButton(
onPressed: () async { onPressed: _isLoading
? null
: () async {
if (!formKey.currentState!.validate()) { if (!formKey.currentState!.validate()) {
return; return;
} }
await login(); await login();
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF22C55E), backgroundColor: isMobile
? const Color(
0xFF0369A1) // Azul más contrastante en móvil
: const Color(0xFF10B981), // Verde en desktop
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(12),
), ),
elevation: 0, elevation: 0,
), ),
child: Text( child: _isLoading
? const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: Text(
'INICIAR SESIÓN', 'INICIAR SESIÓN',
style: GoogleFonts.inter( style: GoogleFonts.inter(
fontSize: 14, fontSize: 15,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.white, color: Colors.white,
letterSpacing: 1.2, letterSpacing: 1.2,
@@ -300,70 +464,117 @@ class _LoginFormState extends State<LoginForm> {
), ),
), ),
), ),
),
const SizedBox(height: 12), const SizedBox(height: 16),
// Enlace "Conexión insegura" // Enlace "Conexión segura" mejorado
Center( Center(
child: TextButton( child: TextButton(
onPressed: () {}, onPressed: () {},
child: Text( child: Row(
'Conexión insegura', mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.lock_outline,
color: Color(0xFF10B981),
size: 16,
),
const SizedBox(width: 8),
Text(
'Conexión segura',
style: GoogleFonts.inter( style: GoogleFonts.inter(
color: const Color(0xFFEF4444), color: const Color(0xFF10B981),
fontSize: 13, fontSize: 13,
decoration: TextDecoration.underline, fontWeight: FontWeight.w500,
decorationColor: const Color(0xFFEF4444),
), ),
), ),
],
),
), ),
), ),
const SizedBox(height: 40), const SizedBox(height: 50),
// Características principales // Características principales con diseño mejorado
Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.03),
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: Colors.white.withOpacity(0.1),
width: 1,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 6,
height: 6,
decoration: const BoxDecoration(
color: Color(0xFF10B981),
shape: BoxShape.circle,
),
),
const SizedBox(width: 12),
Text( Text(
'CARACTERÍSTICAS PRINCIPALES', 'CARACTERÍSTICAS PRINCIPALES',
style: GoogleFonts.inter( style: GoogleFonts.inter(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.white, color: Colors.white,
letterSpacing: 1.2, letterSpacing: 1.5,
), ),
), ),
const SizedBox(height: 16), ],
),
// Lista de características const SizedBox(height: 20),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
_buildFeatureItem('Gestión completa de infraestructura'), _buildFeatureItem('Gestión completa de infraestructura',
_buildFeatureItem('Monitoreo en tiempo real'), Icons.dashboard_outlined),
_buildFeatureItem('Reportes avanzados'), _buildFeatureItem(
_buildFeatureItem('Dashboard intuitivo'), 'Monitoreo en tiempo real', Icons.analytics_outlined),
_buildFeatureItem(
'Reportes avanzados', Icons.assessment_outlined),
_buildFeatureItem(
'Dashboard intuitivo', Icons.widgets_outlined),
], ],
), ),
], ],
), ),
), ),
],
),
),
); );
} }
Widget _buildFeatureItem(String text) { Widget _buildFeatureItem(String text, IconData icon) {
return Padding( return Padding(
padding: const EdgeInsets.only(bottom: 8), padding: const EdgeInsets.only(bottom: 16),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: const EdgeInsets.only(top: 6, right: 12), width: 32,
width: 6, height: 32,
height: 6, decoration: BoxDecoration(
decoration: const BoxDecoration( color: const Color(0xFF10B981).withOpacity(0.1),
color: Color(0xFF22C55E), borderRadius: BorderRadius.circular(8),
shape: BoxShape.circle, ),
child: Icon(
icon,
color: const Color(0xFF10B981),
size: 16,
), ),
), ),
const SizedBox(width: 12),
Expanded( Expanded(
child: Text( child: Text(
text, text,
@@ -371,6 +582,7 @@ class _LoginFormState extends State<LoginForm> {
color: Colors.white70, color: Colors.white70,
fontSize: 14, fontSize: 14,
height: 1.5, height: 1.5,
fontWeight: FontWeight.w400,
), ),
), ),
), ),