adjust loggin in indicator
All checks were successful
All checks were successful
This commit is contained in:
@@ -17,7 +17,9 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _checkExistingSession());
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => _checkExistingSession(),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _checkExistingSession() async {
|
||||
@@ -71,15 +73,6 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_checkingSession)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: SizedBox(
|
||||
height: 24,
|
||||
width: 24,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 50),
|
||||
const LoginPanel(),
|
||||
const SizedBox(height: 16),
|
||||
@@ -95,6 +88,24 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
);
|
||||
},
|
||||
),
|
||||
if (_checkingSession) ...[
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
width: 24,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Trying to log in',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -193,9 +204,9 @@ class _LoginPanelContentState extends State<LoginPanelContent> {
|
||||
setState(() {
|
||||
_loggingIn = false;
|
||||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Login failed: $e')),
|
||||
);
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('Login failed: $e')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,14 +317,16 @@ class _RegisterPanelContentState extends State<RegisterPanelContent> {
|
||||
);
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Registration successful. Please log in.')),
|
||||
const SnackBar(
|
||||
content: Text('Registration successful. Please log in.'),
|
||||
),
|
||||
);
|
||||
widget.onBack();
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Registration failed: $e')),
|
||||
);
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('Registration failed: $e')));
|
||||
} finally {
|
||||
if (mounted) setState(() => _registering = false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user