Files
softplayer-web/lib/features/authorization/presentation/authorization_page.dart
Nikolai Rodionov 84d65786bf
All checks were successful
ci/woodpecker/push/build Pipeline was successful
Better form and remove squares
Signed-off-by: Nikolai Rodionov <allanger@posteo.de>
2026-05-28 23:58:08 +02:00

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()),
],
),
);
},
);
}
}