All checks were successful
ci/woodpecker/push/build Pipeline was successful
Signed-off-by: Nikolai Rodionov <allanger@posteo.de>
68 lines
2.2 KiB
Dart
68 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();
|
|
}
|
|
|
|
enum AuthMode { login, signup }
|
|
|
|
class _AuthorizationPage extends ConsumerState<AuthorizationPage> {
|
|
bool showSignUp = false;
|
|
|
|
void toggleAuth() {
|
|
setState(() {
|
|
showSignUp = !showSignUp;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
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: [
|
|
Offstage(
|
|
offstage: showSignUp == true,
|
|
child: LoginForm(toggleAuth: toggleAuth),
|
|
),
|
|
Offstage(
|
|
offstage: showSignUp != true,
|
|
child: RegisterForm(toggleAuth: toggleAuth),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
// ✅ only show decoration if width > 400
|
|
if (showDecoration) Expanded(flex: 3, child: AuthDecoration()),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|