Skip to content

Commit 5abeab0

Browse files
authored
Change CircularProgressIndicator color and fix loading state
1 parent e32e968 commit 5abeab0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/src/components/supa_email_auth.dart

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
494494
height: 16,
495495
width: 16,
496496
child: CircularProgressIndicator(
497-
color: Theme.of(context).colorScheme.surface,
497+
color: Theme.of(context).colorScheme.primary,
498498
strokeWidth: 1.5,
499499
),
500500
)
@@ -559,6 +559,9 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
559559
setState(() {
560560
_isLoading = true;
561561
});
562+
563+
await Future.delayed(Duration(milliseconds: 50));
564+
562565
try {
563566
if (_isSigningIn) {
564567
final response = await supabase.auth.signInWithPassword(
@@ -605,11 +608,12 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
605608
widget.onError?.call(error);
606609
}
607610
_emailFocusNode.requestFocus();
608-
}
609-
if (mounted) {
610-
setState(() {
611-
_isLoading = false;
612-
});
611+
} finally {
612+
if (mounted) {
613+
setState(() {
614+
_isLoading = false;
615+
});
616+
}
613617
}
614618
}
615619

0 commit comments

Comments
 (0)