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 createState() => _AuthorizationPage(); } class _AuthorizationPage extends ConsumerState { @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')), ); } }