From f224c1f91bd17aeed507804be37c519d043a7d76 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Wed, 10 Jul 2024 20:49:58 +0200 Subject: [PATCH 1/4] Support for displaying sign-in or sign-up initially --- lib/src/components/supa_email_auth.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/src/components/supa_email_auth.dart b/lib/src/components/supa_email_auth.dart index 358acc9..e09ce6c 100644 --- a/lib/src/components/supa_email_auth.dart +++ b/lib/src/components/supa_email_auth.dart @@ -95,6 +95,9 @@ class SupaEmailAuth extends StatefulWidget { /// Localization for the form final SupaEmailAuthLocalization localization; + /// Whether the form should display sign-in or sign-up initially + final bool isSigningIn; + /// {@macro supa_email_auth} const SupaEmailAuth({ super.key, @@ -109,6 +112,7 @@ class SupaEmailAuth extends StatefulWidget { this.metadataFields, this.extraMetadata, this.localization = const SupaEmailAuthLocalization(), + this.isSigningIn = true, }); @override @@ -120,21 +124,20 @@ class _SupaEmailAuthState extends State { final _emailController = TextEditingController(); final _passwordController = TextEditingController(); late final Map _metadataControllers; + late bool _isSigningIn; bool _isLoading = false; /// The user has pressed forgot password button bool _isRecoveringPassword = false; - /// Whether the user is signing in or signing up - bool _isSigningIn = true; - /// Focus node for email field final FocusNode _emailFocusNode = FocusNode(); @override void initState() { super.initState(); + _isSigningIn = widget.isSigningIn; _metadataControllers = Map.fromEntries((widget.metadataFields ?? []).map( (metadataField) => MapEntry(metadataField, TextEditingController()))); } From 61332542aed85032c3966348864046159badbe09 Mon Sep 17 00:00:00 2001 From: kowalgregy Date: Thu, 11 Jul 2024 10:28:13 +0200 Subject: [PATCH 2/4] Better indication of isSigningIn parameter Co-authored-by: Tyler --- lib/src/components/supa_email_auth.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/components/supa_email_auth.dart b/lib/src/components/supa_email_auth.dart index e09ce6c..72432cc 100644 --- a/lib/src/components/supa_email_auth.dart +++ b/lib/src/components/supa_email_auth.dart @@ -96,7 +96,7 @@ class SupaEmailAuth extends StatefulWidget { final SupaEmailAuthLocalization localization; /// Whether the form should display sign-in or sign-up initially - final bool isSigningIn; + final bool isInitiallySigningIn; /// {@macro supa_email_auth} const SupaEmailAuth({ From 7abd3895a94d18228f5e5034190fbf800ac75c89 Mon Sep 17 00:00:00 2001 From: dshukertjr Date: Fri, 4 Oct 2024 11:52:08 +0900 Subject: [PATCH 3/4] fix: update variable name --- lib/src/components/supa_email_auth.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/components/supa_email_auth.dart b/lib/src/components/supa_email_auth.dart index 72432cc..17b35c1 100644 --- a/lib/src/components/supa_email_auth.dart +++ b/lib/src/components/supa_email_auth.dart @@ -112,7 +112,7 @@ class SupaEmailAuth extends StatefulWidget { this.metadataFields, this.extraMetadata, this.localization = const SupaEmailAuthLocalization(), - this.isSigningIn = true, + this.isInitiallySigningIn = true, }); @override @@ -137,7 +137,7 @@ class _SupaEmailAuthState extends State { @override void initState() { super.initState(); - _isSigningIn = widget.isSigningIn; + _isSigningIn = widget.isInitiallySigningIn; _metadataControllers = Map.fromEntries((widget.metadataFields ?? []).map( (metadataField) => MapEntry(metadataField, TextEditingController()))); } From 791a5c164137539d5c8762bb00de86b75ea98d51 Mon Sep 17 00:00:00 2001 From: dshukertjr Date: Fri, 4 Oct 2024 12:04:15 +0900 Subject: [PATCH 4/4] remove the extra metadata controllers --- lib/src/components/supa_email_auth.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/src/components/supa_email_auth.dart b/lib/src/components/supa_email_auth.dart index 45ab2f6..c91a3f2 100644 --- a/lib/src/components/supa_email_auth.dart +++ b/lib/src/components/supa_email_auth.dart @@ -197,7 +197,6 @@ class SupaEmailAuth extends StatefulWidget { /// Localization for the form final SupaEmailAuthLocalization localization; - /// Whether the form should display sign-in or sign-up initially final bool isInitiallySigningIn; @@ -205,7 +204,6 @@ class SupaEmailAuth extends StatefulWidget { final Widget? prefixIconEmail; final Widget? prefixIconPassword; - /// {@macro supa_email_auth} const SupaEmailAuth({ super.key, @@ -233,7 +231,6 @@ class _SupaEmailAuthState extends State { final _formKey = GlobalKey(); final _emailController = TextEditingController(); final _passwordController = TextEditingController(); - late final Map _metadataControllers; late bool _isSigningIn; late final Map _metadataControllers;