66 lines
2.2 KiB
Dart
66 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:softplayer_web/features/authorization/application/authorization_application.dart';
|
|
import 'package:softplayer_web/features/authorization/presentation/decoration.dart';
|
|
import 'package:softplayer_web/features/authorization/presentation/login_form.dart';
|
|
import 'package:softplayer_web/features/authorization/presentation/register_form.dart';
|
|
|
|
class AuthorizationPage extends ConsumerStatefulWidget {
|
|
const AuthorizationPage({super.key});
|
|
|
|
@override
|
|
ConsumerState<AuthorizationPage> createState() => _AuthorizationPage();
|
|
}
|
|
|
|
class _AuthorizationPage extends ConsumerState<AuthorizationPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final state = ref.watch(authorizationControllerProvider);
|
|
final isLoading = state.isLoading;
|
|
final authState = state.value;
|
|
|
|
return LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
final showDecoration = constraints.maxWidth > 1000;
|
|
|
|
return Scaffold(
|
|
body: Row(
|
|
children: [
|
|
Expanded(
|
|
flex: showDecoration ? 7 : 1,
|
|
child: Center(
|
|
child: Padding(
|
|
padding: EdgeInsetsGeometry.symmetric(
|
|
horizontal: constraints.maxWidth * 0.05,
|
|
vertical: 0,
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (authState!.mode == AuthMode.login)
|
|
LoginForm()
|
|
else
|
|
RegisterForm(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
// ✅ only show decoration if width > 400
|
|
if (showDecoration) Expanded(flex: 3, child: AuthDecoration()),
|
|
if (isLoading)
|
|
Positioned.fill(
|
|
child: Container(
|
|
color: Colors.black.withValues(alpha: 0.2),
|
|
child: const Center(child: CircularProgressIndicator()),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|