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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/src/components/supa_email_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 isInitiallySigningIn;

/// {@macro supa_email_auth}
const SupaEmailAuth({
super.key,
Expand All @@ -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,

});

@override
Expand All @@ -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;


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;
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;

_metadataControllers = Map.fromEntries((widget.metadataFields ?? []).map(
(metadataField) => MapEntry(metadataField, TextEditingController())));
}
Expand Down
Loading