Start writing the web app
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
Signed-off-by: Nikolai Rodionov <allanger@posteo.com>
This commit was merged in pull request #5.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
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);
|
||||
|
||||
return state.when(
|
||||
data: (value) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final showDecoration = constraints.maxWidth > 1000;
|
||||
|
||||
return Scaffold(
|
||||
body: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: showDecoration ? 7 : 1,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (value.mode == AuthMode.login)
|
||||
LoginForm()
|
||||
else
|
||||
RegisterForm(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// ✅ only show decoration if width > 400
|
||||
if (showDecoration)
|
||||
Expanded(flex: 3, child: AuthDecoration()),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (e, _) => Center(child: Text('$e')),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user