72 lines
2.1 KiB
Dart
72 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import '../../state/app/modules/account/bloc/account_bloc.dart';
|
|
import '../../state/app/modules/account/bloc/account_state.dart';
|
|
import '../../theming/light_app_theme.dart';
|
|
import 'login_controller.dart';
|
|
import 'widgets/login_branding.dart';
|
|
import 'widgets/login_card.dart';
|
|
|
|
class Login extends StatefulWidget {
|
|
const Login({super.key});
|
|
|
|
@override
|
|
State<Login> createState() => _LoginState();
|
|
}
|
|
|
|
class _LoginState extends State<Login> {
|
|
static const _marianumRed = LightAppTheme.marianumRed;
|
|
|
|
final LoginController _controller = LoginController();
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
super.didChangeDependencies();
|
|
precacheImage(const AssetImage('assets/logo/icon.png'), context);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
void _onLoginSuccess() {
|
|
context.read<AccountBloc>().setStatus(AccountStatus.loggedIn);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Scaffold(
|
|
backgroundColor: _marianumRed,
|
|
body: SafeArea(
|
|
child: LayoutBuilder(
|
|
builder: (context, constraints) => SingleChildScrollView(
|
|
padding: const EdgeInsets.symmetric(horizontal: 24),
|
|
child: Center(
|
|
child: ConstrainedBox(
|
|
constraints: BoxConstraints(
|
|
minHeight: constraints.maxHeight,
|
|
maxWidth: 420,
|
|
),
|
|
child: IntrinsicHeight(
|
|
child: Column(
|
|
children: [
|
|
const LoginHeader(),
|
|
const SizedBox(height: 28),
|
|
LoginCard(controller: _controller, onSuccess: _onLoginSuccess),
|
|
const SizedBox(height: 18),
|
|
const LoginDisclaimer(),
|
|
const Spacer(),
|
|
const LoginFooter(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|