Skip to content

Commit

Permalink
feat: Support for displaying sign-in or sign-up initially (#116)
Browse files Browse the repository at this point in the history
* Support for displaying sign-in or sign-up initially

* Better indication of isSigningIn parameter

Co-authored-by: Tyler <[email protected]>

* fix: update variable name

* remove the extra metadata controllers

---------

Co-authored-by: Grzegorz Kowal <[email protected]>
Co-authored-by: kowalgregy <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2024
1 parent 785387f commit 9f284d8
Showing 1 changed file with 6 additions and 3 deletions.
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 @@ -197,6 +197,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;

/// Icons or custom prefix widgets for email UI
final Widget? prefixIconEmail;
final Widget? prefixIconPassword;
Expand All @@ -215,6 +218,7 @@ class SupaEmailAuth extends StatefulWidget {
this.metadataFields,
this.extraMetadata,
this.localization = const SupaEmailAuthLocalization(),
this.isInitiallySigningIn = true,
this.prefixIconEmail = const Icon(Icons.email),
this.prefixIconPassword = const Icon(Icons.lock),
});
Expand All @@ -227,22 +231,21 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
final _formKey = GlobalKey<FormState>();
final _emailController = TextEditingController();
final _passwordController = TextEditingController();
late bool _isSigningIn;
late final Map<String, MetadataController> _metadataControllers;

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.isInitiallySigningIn;
_metadataControllers = Map.fromEntries((widget.metadataFields ?? []).map(
(metadataField) => MapEntry(
metadataField.key,
Expand Down

0 comments on commit 9f284d8

Please sign in to comment.