82 lines
2.4 KiB
Dart
82 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import '../../../../core/theme/app_colors.dart';
|
|
import '../store/auth_store.dart';
|
|
import '../widgets/login_form_widget.dart';
|
|
import '../widgets/login_header_widget.dart';
|
|
|
|
class LoginView extends StatefulWidget {
|
|
final AuthStore? store;
|
|
|
|
const LoginView({super.key, this.store});
|
|
|
|
@override
|
|
State<LoginView> createState() => _LoginViewState();
|
|
}
|
|
|
|
class _LoginViewState extends State<LoginView> {
|
|
late final AuthStore _authStore;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_authStore = widget.store ?? AuthStore();
|
|
}
|
|
|
|
void _onSuccess() {
|
|
context.go('/');
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.background,
|
|
body: SafeArea(
|
|
child: Center(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 32),
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 440),
|
|
child: Container(
|
|
padding: const EdgeInsets.all(32),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(20),
|
|
border: Border.all(color: AppColors.border),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: AppColors.primary.withValues(alpha: 0.04),
|
|
blurRadius: 24,
|
|
offset: const Offset(0, 8),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const LoginHeaderWidget(),
|
|
const SizedBox(height: 28),
|
|
LoginFormWidget(
|
|
store: _authStore,
|
|
onLoginSuccess: _onSuccess,
|
|
),
|
|
const SizedBox(height: 24),
|
|
const Text(
|
|
'Sistema protegido · Exclusivo Consultorio Dr. Luis Castro',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
color: AppColors.textMuted,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|