animated login
animated login
for flutter is a ready-made login/signup screen with soft and pleasant animations.
it is fully responsible to be able to use on both web and mobile apps. you can welcome your users with this beautiful animated screen that gives functionality for both login and sign up.
web view example video
mobile view example video
installation
you can follow the instructions for installation here
reference
property |
type |
description |
onsignup |
signupcallback |
signup callback that will be called after signup button pressed. |
onlogin |
logincallback |
login callback that will be called after login button pressed. |
sociallogins |
list<sociallogin> |
list of social login options that will be provided. |
logintexts |
logintexts |
determines all of the texts on the screen. |
logintheme |
logintheme |
determines all of the theme related variables on the screen. |
onforgotpassword |
forgotpasswordcallback |
callback that will be called after on tap of forgot password text. commonly it navigates user to a screen to reset the password. |
animationcurve |
curve |
custom animation curve that will be used for animations. |
formwidthratio |
double |
ratio of width of the form to the width of the screen. |
animationduration |
duration |
the duration of the animations. |
formkey |
globalkey<formstate> |
the optional custom form key, if not provided will be created locally. |
formelementsspacing |
double |
the spacing between the elements of form. |
socialloginsspacing |
double |
the spacing between the social login options. |
checkerror |
bool |
indicates whether the login screen should handle errors, show the error messages returned from the callbacks in a dialog. |
showforgotpassword |
bool |
indicates whether the forgot password option will be enabled. |
showchangeactiontitle |
bool |
indicates whether the change action title should be displayed. |
showpasswordvisibility |
bool |
indicates whether the user can show the password text without obscuring. |
namecontroller |
texteditingcontroller |
optional texteditingcontroller for name input field. |
emailcontroller |
texteditingcontroller |
optional texteditingcontroller for email input field. |
passwordcontroller |
texteditingcontroller |
optional texteditingcontroller for password input field. |
confirmpasswordcontroller |
texteditingcontroller |
optional texteditingcontroller for confirm password input field. |
actionbuttonstyle |
buttonstyle |
custom button style for action button (login/signup). |
changeactionbuttonstyle |
buttonstyle |
custom button style for change action button that will switch auth mode. |
welcomepadding |
edgeinsets |
padding of the welcome part widget. |
formpadding |
edgeinsets |
padding of the form part widget. |
backgroundimage |
string |
full asset image path for background of the welcome part. |
logo |
string |
full asset image path for the logo. |
logosize |
size |
size of the logo in the welcome part. |
signupmode |
signupmodes |
enum to determine which text form fields should be displayed in addition to the email and password fields: name / confirm password / both. |
logintexts
property |
type |
description |
welcome |
string |
welcome title in signup mode for the informing part. |
welcomedescription |
string |
welcome description in signup mode for the informing part. |
signup |
string |
action button text for sign up mode. |
signupformtitle |
string |
form title for sign up mode. |
signupuseemail |
string |
use email cta for sign up mode. |
welcomeback |
string |
welcome title in login mode for the informing part. |
welcomebackdescription |
string |
welcome description in login mode for the informing part. |
login |
string |
action button text for login mode. |
loginformtitle |
string |
form title for login mode. |
loginuseemail |
string |
use email cta for login mode. |
forgotpassword |
string |
forgot password text for login mode. |
nothaveanaccount |
string |
text above the sign up button to direct users who don’t have an account. |
alreadyhaveanaccount |
string |
text above the login button to direct users who already have an account. |
namehint |
string |
hint text for name [textformfield] |
emailhint |
string |
hint text for email [textformfield] |
passwordhint |
string |
hint text for password [textformfield] |
confirmpasswordhint |
string |
hint text for confirm password [textformfield] |
passwordmatchingerror |
string |
the error text for not matching password and confirm password inputs. |
dialogbuttontext |
string |
the button text of error dialog. |
logintheme
property |
type |
description |
formtitlestyle |
textstyle |
text style for the title of form part. |
welcometitlestyle |
textstyle |
text style for the title of welcome part. |
welcomedescriptionstyle |
textstyle |
text style for the description of welcome part. |
changeactionstyle |
textstyle |
text style for the change action cta of welcome part. |
useemailstyle |
textstyle |
text style for the use email text of form part. |
forgotpasswordstyle |
textstyle |
text style for the forgot password cta of form part. |
hinttextstyle |
textstyle |
text style for hint texts in the text form fields. |
errortextstyle |
textstyle |
text style for error texts in the text form fields. |
textformstyle |
textstyle |
text style for input texts in the text form fields. |
actiontextstyle |
textstyle |
text style for action button text in the form part. |
changeactiontextstyle |
textstyle |
text style for change action button text in the welcome part. |
textformfielddeco |
inputdecoration |
input decoration for the text form fields. |
nameicon |
widget |
prefix widget for name text form field. |
emailicon |
widget |
prefix widget for email text form field. |
passwordicon |
widget |
prefix widget for password text form field. |
formfieldelevation |
double |
elevation for text form fields. |
formfieldbackgroundcolor |
color |
background color for text form fields. |
formfieldshadowcolor |
color |
shadow color for text form fields. |
formfieldborderradius |
borderradius |
border radius for text form fields. |
formfieldsize |
size |
size of text form fields. |
formfieldhovercolor |
color |
hover color for text form fields. |
backgroundcolor |
color |
background color of the login screen. |
errorbordercolor |
color |
error border color for text form fields. |
focusederrorbordercolor |
color |
focused error border color for text form fields. |
focusedbordercolor |
color |
focused border color for text form fields. |
enabledbordercolor |
color |
enabled border color for text form fields. |
enabledborder |
inputborder |
enabled border for text form fields. |
errorborder |
inputborder |
error border for text form fields. |
focusederrorborder |
inputborder |
focused error border for text form fields. |
focusedborder |
inputborder |
focused border for text form fields. |
showformfielderrors |
bool |
indicates whether the error messages should be displayed below the text form fields. |
showlabeltexts |
bool |
indicates whether the labels should be displayed above the text form fields. |
socialloginhovercolor |
color |
hover color for social login widgets. |
socialloginborder |
borderside |
border for social login widgets. |
sociallogin
property |
type |
description |
iconpath |
string |
full asset path of the social platform logo. |
callback |
sociallogincallback |
the callback will be called on click to logo of the social platform. |
logindata
property |
type |
description |
email |
string |
email text the user entered to the email [textformfield] |
password |
string |
password text the user entered to the password [textformfield] |
signupdata
property |
type |
description |
name |
string |
name text the user entered to the name [textformfield] |
email |
string |
email text the user entered to the email [textformfield] |
password |
string |
password text the user entered to the password [textformfield] |
confirmpassword |
string |
confirm password text the user entered to the confirm password [textformfield] |
signupmodes
enum |
description |
name |
only displays name text form field, not displays confirm password. |
confirmpassword |
only displays confirm password form field, not name. |
both |
displays both name and confirm password text form fields. |
sign up modes to determine which text form fields should be displayed.
complete example
you can see the complete example in the example folder with the example project. the video recordings for the example project are shown above via gifs.
basic example
import 'package:flutter/material.dart';
import 'package:animated_login/animated_login.dart';
class loginscreen extends statelesswidget {
const loginscreen({key? key}) : super(key: key);
/// simulates the multilanguage, you will implement your own logic.
/// according to the current language, you can display a text message
/// with the help of [logintexts] class.
final string langcode = 'en';
@override
widget build(buildcontext context) {
return animatedlogin(
onlogin: onlogin,
onsignup: onsignup,
onforgotpassword: onforgotpassword,
formwidthratio: 60,
logo: 'images/logo.gif',
// backgroundimage: 'images/background_image.jpg',
signupmode: signupmodes.both,
logintheme: _logintheme,
logintexts: _logintexts,
);
}
/// you can adjust the colors, text styles, button styles, borders
/// according to your design preferences.
/// you can also set some additional display options such as [showlabeltexts].
logintheme get _logintheme => logintheme(
// showlabeltexts: false,
backgroundcolor: colors.blue, // const color(0xff6666ff),
formfieldbackgroundcolor: colors.white,
changeactiontextstyle: const textstyle(color: colors.white),
);
logintexts get _logintexts => logintexts(
namehint: _username,
login: _login,
signup: _signup,
);
/// you can adjust the texts in the screen according to the current language
/// with the help of [logintexts], you can create a multilanguage scren.
string get _username => langcode == 'tr' ? 'kullanıcı adı' : 'username';
string get _login => langcode == 'tr' ? 'giriş yap' : 'login';
string get _signup => langcode == 'tr' ? 'kayıt ol' : 'sign up';
/// login action that will be performed on click to action button in login mode.
future<string?> onlogin(logindata logindata) async {
await future.delayed(const duration(seconds: 2));
print('successfully logged in.');
return null;
}
/// sign up action that will be performed on click to action button in sign up mode.
future<string?> onsignup(signupdata logindata) async {
await future.delayed(const duration(seconds: 2));
print('successfully signed up.');
return null;
}
/// action that will be performed on click to "forgot password?" text/cta.
/// probably you will navigate user to a page to create a new password after the verification.
future<string?> onforgotpassword(string email) async {
await future.delayed(const duration(seconds: 2));
print('successfully navigated.');
return null;
}
}
basic example with social login options and data checks
import 'package:flutter/material.dart';
import 'package:animated_login/animated_login.dart';
class loginscreen extends statelesswidget {
const loginscreen({key? key}) : super(key: key);
/// simulates the multilanguage, you will implement your own logic.
/// according to the current language, you can display a text message
/// with the help of [logintexts] class.
final string langcode = 'en';
@override
widget build(buildcontext context) {
return animatedlogin(
onlogin: onlogin,
onsignup: onsignup,
onforgotpassword: onforgotpassword,
formwidthratio: 60,
logo: 'images/logo.gif',
// backgroundimage: 'images/background_image.jpg',
signupmode: signupmodes.both,
sociallogins: _sociallogins,
logintheme: _logintheme,
logintexts: _logintexts,
);
}
/// you can adjust the colors, text styles, button styles, borders
/// according to your design preferences.
/// you can also set some additional display options such as [showlabeltexts].
logintheme get _logintheme => logintheme(
// showlabeltexts: false,
backgroundcolor: colors.blue, // const color(0xff6666ff),
formfieldbackgroundcolor: colors.white,
changeactiontextstyle: const textstyle(color: colors.white),
);
logintexts get _logintexts => logintexts(
namehint: _username,
login: _login,
signup: _signup,
);
/// you can adjust the texts in the screen according to the current language
/// with the help of [logintexts], you can create a multilanguage scren.
string get _username => langcode == 'tr' ? 'kullanıcı adı' : 'username';
string get _login => langcode == 'tr' ? 'giriş yap' : 'login';
string get _signup => langcode == 'tr' ? 'kayıt ol' : 'sign up';
/// social login options, you should provide callback function and icon path.
/// icon paths should be the full path in the assets
/// don't forget to also add the icon folder to the "pubspec.yaml" file.
list<sociallogin> get _sociallogins => <sociallogin>[
sociallogin(
callback: () async => sociallogin('google'),
iconpath: 'images/google.png'),
sociallogin(
callback: () async => sociallogin('facebook'),
iconpath: 'images/facebook.png'),
sociallogin(
callback: () async => sociallogin('linkedin'),
iconpath: 'images/linkedin.png'),
];
/// login action that will be performed on click to action button in login mode.
future<string?> onlogin(logindata logindata) async {
await future.delayed(const duration(seconds: 2));
print("""
successfully logged in.n
email: ${logindata.email}n
password: ${logindata.password}""");
return null;
}
/// sign up action that will be performed on click to action button in sign up mode.
future<string?> onsignup(signupdata signupdata) async {
await future.delayed(const duration(seconds: 2));
print("""
successfully signed up.n
username: ${signupdata.name}n
email: ${signupdata.email}n
password: ${signupdata.password}n
confirm password: ${signupdata.confirmpassword}""");
return null;
}
/// action that will be performed on click to "forgot password?" text/cta.
/// probably you will navigate user to a page to create a new password after the verification.
future<string?> onforgotpassword(string email) async {
await future.delayed(const duration(seconds: 2));
print('successfully navigated. email is $email');
return null;
}
/// social login callback example.
future<string?> sociallogin(string type) async {
await future.delayed(const duration(seconds: 2));
print('successfully logged in with $type.');
return null;
}
}
more screenshots
web login |
mobile login |
|
|
web sign up |
mobile sign up |
|
|
color change |
without social logins |
|
|
error example |
|
contributing
contributions are so important for both me and those who want to use this package. i will be very appreciative if you allocate time to push forward the package.
all help is welcomed but if you have questions, bug reports, issues, feature requests, pull requests, etc, please first refer to the contributing guide.
if you like and benefit from this package, please give us a star on github and like on pub.dev to help!
license
Comments are closed.