Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for displaying sign-in or sign-up initially #107

Conversation

kowalgregy
Copy link
Contributor

What kind of change does this PR introduce?

feature

What is the current behavior?

We always display the login form by default

What is the new behavior?

We added a parameter to control whether sign up for or sign-in form is being displayed initially.

Additional context

From the business perspective, depending on the UX flow, you should be able to present either login or sign-up. For example, a page with CTA "try for free, no credit card required" should redirect to a sign-up form, not a login form that requires one additional unnecessary step from the user.

Copy link
Member

@dshukertjr dshukertjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I love it! Just had one little thing.

lib/src/components/supa_email_auth.dart Outdated Show resolved Hide resolved
@kowalgregy
Copy link
Contributor Author

Thanks for the PR. I love it! Just had one little thing.

Sure, definitely!

@dshukertjr
Copy link
Member

Would you be able to update the variable name on other places that it's used as well?

@@ -109,6 +112,7 @@ class SupaEmailAuth extends StatefulWidget {
this.metadataFields,
this.extraMetadata,
this.localization = const SupaEmailAuthLocalization(),
this.isSigningIn = true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.isSigningIn = true,
this.isInitiallySigningIn = true,

/// Focus node for email field
final FocusNode _emailFocusNode = FocusNode();

@override
void initState() {
super.initState();
_isSigningIn = widget.isSigningIn;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_isSigningIn = widget.isSigningIn;
_isInitiallySigningIn = widget.isInitiallySigningIn;

@@ -120,21 +124,20 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
final _emailController = TextEditingController();
final _passwordController = TextEditingController();
late final Map<MetaDataField, TextEditingController> _metadataControllers;
late bool _isSigningIn;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
late bool _isSigningIn;
late bool _isInitiallySigningIn;

@dshukertjr
Copy link
Member

Closing in favor of #116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants