FlutterLogin class
A customizable, animated login/signup UI component for Flutter apps.
FlutterLogin
provides an all-in-one solution for authentication screens,
supporting login, signup, password recovery, third-party providers,
and terms of service agreements with beautiful transitions and theming.
Features:
- Login, signup, and password recovery flows
- Confirmation steps (e.g., OTP or email codes)
- Support for additional signup fields
- Customizable appearance via LoginTheme
- Animated transitions
- Third-party authentication buttons
- Terms of service support
Example usage:
FlutterLogin(
onLogin: (loginData) async => null,
onSignup: (signupData) async => null,
onRecoverPassword: (email) async => 'Recover link sent',
)
See Auth, LoginTheme, and LoginMessages for full customization options.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FlutterLogin
Constructors
-
FlutterLogin.new({required LoginCallback onLogin, required RecoverCallback onRecoverPassword, Key? key, SignupCallback? onSignup, String? title, dynamic logo, dynamic backgroundImage, LoginMessages? messages, LoginTheme? theme, FormFieldValidator<
String> ? userValidator, bool? validateUserImmediately, FormFieldValidator<String> ? passwordValidator, VoidCallback? onSubmitAnimationCompleted, String? logoTag, LoginUserType userType = LoginUserType.email, String? titleTag, bool showDebugButtons = false, List<LoginProvider> loginProviders = const <LoginProvider>[], bool hideForgotPasswordButton = false, bool loginAfterSignUp = true, bool hideProvidersTitle = false, List<UserFormField> ? additionalSignupFields, bool disableCustomPageTransformer = false, List<TermOfService> termsOfService = const <TermOfService>[], ConfirmRecoverCallback? onConfirmRecover, ConfirmSignupCallback? onConfirmSignup, ConfirmSignupRequiredCallback? confirmSignupRequired, SignupCallback? onResendCode, String savedEmail = '', String savedPassword = '', AuthMode initialAuthMode = AuthMode.login, List<Widget> ? children, bool scrollable = false, TextInputType? confirmSignupKeyboardType, Widget? headerWidget, BeforeAdditionalFieldsCallback? onSwitchToAdditionalFields, String? initialIsoCode, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, bool hideSignupPasswordFields = false, void onSwitchAuthMode(AuthMode mode)?, bool autofocus = false}) - Creates a FlutterLogin widget.
Properties
-
additionalSignupFields
→ List<
UserFormField> ? -
This List contains the additional signup fields.
By setting this, after signup another card with a form for additional user data is shown
final
- autofocus → bool
-
Whether or not to autofocus on the user input field when the form loads.
final
-
backgroundImage
→ ImageProvider<
Object> ? -
The image provider for the background image to be displayed
final
-
children
→ List<
Widget> ? -
Supply custom widgets to the auth stack such as a custom logo widget
final
- confirmSignupKeyboardType → TextInputType?
-
Sets TextInputType of sign up confirmation form.
final
- confirmSignupRequired → ConfirmSignupRequiredCallback?
-
Additional option to decide in runtime if confirmation is required
Optional
final
- disableCustomPageTransformer → bool
-
Disable the page transformation between switching authentication modes.
Fixes #97 if disabled. https://github.com/NearHuscarl/flutter_login/issues/97
final
-
Optional footer text for example a copyright notice
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- headerWidget → Widget?
-
A widget that can be placed on top of the loginCard.
final
- hideForgotPasswordButton → bool
-
Set to true to hide the Forgot Password button
final
- hideProvidersTitle → bool
-
Hide the title above the login providers. If no providers are set this is uneffective
final
- hideSignupPasswordFields → bool
-
Whether to hide password fields during Signup - useful for login flows that
may use OTP (e.g. Authenticator apps, 1-time email-codes) only.
Default: false
final
- initialAuthMode → AuthMode
-
The initial auth mode for the widget to show. This defaults to AuthMode.login
if not specified. This field can allow you to show the sign up state by default.
final
- initialIsoCode → String?
-
The initial Iso Code for the widget to show using LoginUserType.intlPhone.
if not specified. This field will show
'US'
by default.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardDismissBehavior → ScrollViewKeyboardDismissBehavior
-
Controls how the keyboard is dismissed when interacting with scrollable content.
final
- loginAfterSignUp → bool
-
Set to false to return back to sign in page after successful sign up
final
-
loginProviders
→ List<
LoginProvider> -
list of LoginProvider each have an icon and a callback that will be Called when
the user hit the provider icon button
if not specified nothing will be shown
final
-
logo
→ ImageProvider<
Object> ? -
The image provider for the logo image to be displayed
final
- logoTag → String?
-
Hero tag for logo image. If not specified, it will simply fade out when
changing route
final
- messages → LoginMessages?
-
Describes all of the labels, text hints, button texts and other auth
descriptions
final
-
Navigate back to the login screen after recovery of password.
final
- onConfirmRecover → ConfirmRecoverCallback?
-
Called when the user submits confirmation code in recover password mode
Optional
final
- onConfirmSignup → ConfirmSignupCallback?
-
Called when the user hits the submit button when in confirm signup mode
Optional
final
- onLogin → LoginCallback
-
Called when the user hit the submit button when in login mode
final
- onRecoverPassword → RecoverCallback
-
Called when the user hit the submit button when in recover password mode
final
- onResendCode → SignupCallback?
-
Called when the user hits the resend code button in confirm signup mode
Only when onConfirmSignup is set
final
- onSignup → SignupCallback?
-
Called when the user hit the submit button when in sign up mode
final
- onSubmitAnimationCompleted → VoidCallback?
-
Called after the submit animation's completed. Put your route transition
logic here. Recommend to use with logoTag and titleTag
final
- onSwitchAuthMode → void Function(AuthMode mode)?
-
Called when the user switches between sign-in and sign-up mode.
final
- onSwitchToAdditionalFields → BeforeAdditionalFieldsCallback?
-
Called when the user hit the submit button when in sign up mode, before
additionalSignupFields are shown
Optional
final
-
passwordValidator
→ FormFieldValidator<
String> ? -
Same as userValidator but for password
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- savedEmail → String
-
Prefilled (ie. saved from previous session) value at startup for username
(Auth class calls username email, therefore we use savedEmail here aswell)
final
- savedPassword → String
-
Prefilled (ie. saved from previous session) value at startup for password (applies both
to Auth class password and confirmation password)
final
- scrollable → bool
-
If set to true, make the login window scrollable when overflowing instead
of resizing the window.
Default: false
final
- showDebugButtons → bool
-
Display the debug buttons to quickly forward/reverse login animations. In
release mode, this will be overrided to false regardless of the value
passed in
final
-
termsOfService
→ List<
TermOfService> -
List of terms of service to be listed during registration. On onSignup callback LoginData contains a list of TermOfServiceResult
final
- theme → LoginTheme?
-
FlutterLogin's theme. If not specified, it will use the default theme as
shown in the demo gifs and use the colorsheme in the closest
Theme
widgetfinal - title → String?
-
The large text above the login Card, usually the app or company name
final
- titleTag → String?
-
Hero tag for title text. Need to specify
LoginTheme.beforeHeroFontSize
andLoginTheme.afterHeroFontSize
if you want different font size before and after hero animationfinal - userType → LoginUserType
-
LoginUserType can be email, name or phone, by default is email. It will change how
the edit text autofill and behave accordingly to your choice
final
-
userValidator
→ FormFieldValidator<
String> ? -
Email validating logic, Returns an error string to display if the input is
invalid, or null otherwise
final
- validateUserImmediately → bool?
-
Should email be validated after losing focus true or after form
submissions false. Default: false
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< FlutterLogin> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
defaultEmailValidator(
String? value) → String? - Default email validator used when none is supplied.
-
defaultPasswordValidator(
String? value) → String? - Default password validator used when none is supplied.