WIP: Trying to throw real errors
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 <iam@allanger.xyz>
This commit is contained in:
@@ -16,42 +16,44 @@ class _AuthorizationPage extends ConsumerState<AuthorizationPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final state = ref.watch(authorizationControllerProvider);
|
||||
final isLoading = state.isLoading;
|
||||
final authState = state.value;
|
||||
|
||||
return state.when(
|
||||
data: (value) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final showDecoration = constraints.maxWidth > 1000;
|
||||
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(),
|
||||
],
|
||||
),
|
||||
),
|
||||
return Scaffold(
|
||||
body: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: showDecoration ? 7 : 1,
|
||||
child: Center(
|
||||
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()),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
// ✅ 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()),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (e, _) => Center(child: Text('$e')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class _LoginForm extends ConsumerState<LoginForm> {
|
||||
Widget build(BuildContext context) {
|
||||
final state = ref.watch(authorizationControllerProvider);
|
||||
final controller = ref.read(authorizationControllerProvider.notifier);
|
||||
final isLoading = state.isLoading;
|
||||
return SizedBox(
|
||||
width: 400,
|
||||
child: Form(
|
||||
@@ -119,23 +120,14 @@ class _LoginForm extends ConsumerState<LoginForm> {
|
||||
width: double.infinity,
|
||||
child: Text("Forgot password?", textAlign: TextAlign.left),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: _submitForm,
|
||||
child: const Text('Log in'),
|
||||
// ) {
|
||||
// if (_formKey.currentState!.validate()) {
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// const SnackBar(content: Text('Processing Data')),
|
||||
// );
|
||||
// }
|
||||
// _
|
||||
// },
|
||||
),
|
||||
state.when(
|
||||
loading: () => const CircularProgressIndicator(),
|
||||
data: (_) => const SizedBox.shrink(),
|
||||
error: (_, _) => const SizedBox.shrink(),
|
||||
),
|
||||
ElevatedButton(onPressed: _submitForm, child: const Text('Log in')),
|
||||
if (isLoading)
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
color: Colors.black.withValues(alpha: 0.2),
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user