fix login
This commit is contained in:
@@ -11,7 +11,11 @@ import '../widgets/app_text_field.dart';
|
||||
import '../widgets/responsive_body.dart';
|
||||
|
||||
class LoginScreen extends StatefulWidget {
|
||||
const LoginScreen({super.key});
|
||||
const LoginScreen({super.key, this.asRoot = false});
|
||||
|
||||
/// When true (cold start / auth gate), stay put on success so [AuthGate]
|
||||
/// rebuilds into the shell. When false, pop with `true` for modal sign-in.
|
||||
final bool asRoot;
|
||||
|
||||
@override
|
||||
State<LoginScreen> createState() => _LoginScreenState();
|
||||
@@ -43,7 +47,9 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
password: _passwordController.text,
|
||||
);
|
||||
if (!mounted) return;
|
||||
Navigator.of(context).pop(true);
|
||||
if (!widget.asRoot) {
|
||||
Navigator.of(context).pop(true);
|
||||
}
|
||||
} on ClientException catch (error) {
|
||||
if (!mounted) return;
|
||||
final message = error.response['message'] as String? ??
|
||||
@@ -66,19 +72,25 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Sign in')),
|
||||
appBar: AppBar(
|
||||
title: const Text('Sign in'),
|
||||
automaticallyImplyLeading: !widget.asRoot,
|
||||
),
|
||||
body: ResponsiveBody(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 24, 16, 32),
|
||||
children: [
|
||||
Text(
|
||||
'Sync account',
|
||||
widget.asRoot ? 'Welcome to $kAppName' : 'Sync account',
|
||||
style: theme.textTheme.headlineSmall,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Sign in to link this device with PocketBase. Labels, notes, '
|
||||
'and bank transactions sync across your devices.',
|
||||
widget.asRoot
|
||||
? 'Sign in to sync labels, notes, and transactions across '
|
||||
'your devices. You can connect your bank afterward.'
|
||||
: 'Sign in to link this device with PocketBase. Labels, notes, '
|
||||
'and bank transactions sync across your devices.',
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user