flutter_login_simple 0.0.3 copy "flutter_login_simple: ^0.0.3" to clipboard
flutter_login_simple: ^0.0.3 copied to clipboard

outdated

Simple Flutter Firebase Authentication widget for email. Create, delete and reset password of account.

flutter_login_simple #

A basic login for Firebase Authentication by email.

Handles the UI and Firebase Authentication in the background. In case the user is aready logged in, the user the suceess-login callback function will be called.

It has to be initialized with:

  • Image logo
  • Callback function on succesful login
  • Privacy HTML
  • Terms of Service HTML

The callback receives user data:

  • uid
  • email
  • ...

It also allows for calls like

  • user.logout()
  • user.delete()

[Demo]

Outlook #

Add more login options and potentially theming.

Installation #

flutter pub get flutter_login_simple

Run the example #

The example directory contains a working Flutter app. Add your Firebase config before running it: lib/firebase_options.dart.

Make sure to enable Firebase Authentication for Email in the Firebase Console. Forgetting to do so is a common pitfall.

Basic usage #

Please refer to the complete example.

// Your logo
Image logo = Image.network(
    'https://storage.flutter-io.cn/cms-storage-bucket/c823e53b3a1a7b0d36a9.png');


// Your callback will get executed on successful login.
onLoginSuccess(UserSessionData user) {
  Navigator.pushAndRemoveUntil(context,
      MaterialPageRoute(builder: (context) 
        => LoginSuccessPage(user)),
      (Route<dynamic> route) => false);
}

// Your Terms of Service
String htmlToc = '<h1>Terms of Service</h1>';

// Ypur Privacy Policy
String htmlPrivacy = '<h1>Privacy Policy</h1>';

return LoginStarter(logo, onLoginSuccess, htmlToc, htmlPrivacy);

Accessing the returned UserSessionData:

user is UserSessionData;

print(user.uid);
print(user.email ?? 'not given');
print(user.displayName ?? 'not given');
// ... and so on with all properties

// void return !
await user.logoutUser(); 

bool isSuccess = await user.deleteUser();

// The original Firebase Authentication user
// for other use cases.
var firebaseUser = user.firebaseUser();

Bugs and Requests #

If you encounter any problems feel free to open an issue. Pull request are also welcome.

https://github.com/xErik/flutter_login_simple/issues

License #

This project is licensed under the MIT License - see the LICENSE file for details