How to add support for additional Providers like Facebook?
The Good thing about the library is it is written as a framework so you could easily add support for your provider of choice.
For example, Google Auth (provided inbuilt) was implemented as follows.
Comments explain all of how it happens.
/** * Extend AuthMethod to create a new method */classGoogleextendsAuthMethod {/** * Provide the look and feel of the Provider Button */@overrideWidgetgetLayout(bool isInSignIn, BuildContext context) {returnPadding( padding:constEdgeInsets.all(0), child:NiceButton( elevation:8.0, onPressed: () {/** * Kick off the signing Process */startSigning(context); }, text:"Google", width:double.infinity, radius:40, fontSize:16, background:Color(0xffc4302b), )); }/** * Perform the siging process */@overrideFuture<void> sign(bool isInSignIn, FirebaseAuth auth) async {finalGoogleSignInAccount googleUser =awaitGoogleSignIn().signIn();finalGoogleSignInAuthentication googleAuth =await googleUser.authentication;finalGoogleAuthCredential credential =GoogleAuthProvider.credential( accessToken: googleAuth.accessToken, idToken: googleAuth.idToken, );returnawaitFirebaseAuth.instance.signInWithCredential(credential); }}
Now pass it as a list item to SignIn Widget auth param.
final widget =SignIn( themeColor:Colors.deepPurple,// Sign in and Sign Up fields are customizable in EmailConfig methods: [Google()], auth:FirebaseAuth.instance, onSuccess: (user, context, fields) {showSnackBar('You made the signUp flow in record time. Cheers.', context);print('user: $user \n fields: $fields'); }, );
One request in case you added support for some provider eg. Facebook please make a pull request to the repo with the code which will serve as an example. Fellow Developers will thank you!!!