195 lines
7.6 KiB
Dart
195 lines
7.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:nethive_neo/models/users/token.dart';
|
|
import 'package:nethive_neo/pages/login_page/widgets/login_form.dart';
|
|
|
|
class LoginPage extends StatefulWidget {
|
|
const LoginPage({
|
|
Key? key,
|
|
this.token,
|
|
}) : super(key: key);
|
|
|
|
final Token? token;
|
|
|
|
@override
|
|
State<LoginPage> createState() => _LoginPageState();
|
|
}
|
|
|
|
class _LoginPageState extends State<LoginPage> {
|
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
key: scaffoldKey,
|
|
body: GestureDetector(
|
|
onTap: () => FocusScope.of(context).unfocus(),
|
|
child: LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
if (constraints.maxWidth < 768) {
|
|
// Vista móvil - fondo degradado completo
|
|
return Container(
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
decoration: const BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
colors: [
|
|
Color(0xFF22C55E), // Verde izquierda
|
|
Color(0xFF3B82F6), // Azul centro
|
|
Color(0xFF8B5CF6), // Morado derecha
|
|
],
|
|
),
|
|
),
|
|
child: SingleChildScrollView(
|
|
child: Container(
|
|
constraints: BoxConstraints(
|
|
minHeight: MediaQuery.of(context).size.height,
|
|
),
|
|
padding: const EdgeInsets.all(20),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
// Logo NetHive para móvil
|
|
Container(
|
|
margin: const EdgeInsets.only(bottom: 30),
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
width: 80,
|
|
height: 80,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Image.asset(
|
|
'assets/images/favicon.png',
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
const Text(
|
|
'NetHive',
|
|
style: TextStyle(
|
|
fontSize: 32,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
const Text(
|
|
'Infrastructure Management',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: Colors.white70,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const LoginForm(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
} else {
|
|
// Vista desktop - columna izquierda sólida, derecha degradado
|
|
return Row(
|
|
children: [
|
|
// Lado izquierdo - Formulario (fondo sólido)
|
|
Expanded(
|
|
flex: 1,
|
|
child: Container(
|
|
color:
|
|
const Color(0xFF1E293B), // Fondo sólido azul oscuro
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 60, vertical: 40),
|
|
child: Center(
|
|
child: SingleChildScrollView(
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 400),
|
|
child: const LoginForm(),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
// Lado derecho - Logo (con degradado)
|
|
Expanded(
|
|
flex: 1,
|
|
child: Container(
|
|
decoration: const BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
colors: [
|
|
Color(0xFF22C55E), // Verde izquierda
|
|
Color(0xFF3B82F6), // Azul centro
|
|
Color(0xFF8B5CF6), // Morado derecha
|
|
],
|
|
),
|
|
),
|
|
padding: const EdgeInsets.all(60),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
// Logo NetHive
|
|
Container(
|
|
width: 120,
|
|
height: 120,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(24),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.1),
|
|
blurRadius: 20,
|
|
offset: const Offset(0, 10),
|
|
),
|
|
],
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Image.asset(
|
|
'assets/images/favicon.png',
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 32),
|
|
const Text(
|
|
'NetHive',
|
|
style: TextStyle(
|
|
fontSize: 48,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
const Text(
|
|
'Infrastructure Management',
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
color: Colors.white70,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|