Created
May 8, 2020 18:12
-
-
Save Leocardoso94/1cba7cd4e3563026d21b2f574a6ccfe2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:apple_sign_in/apple_sign_in.dart'; | |
| import 'package:firebase_auth/firebase_auth.dart'; | |
| import 'package:flutter/material.dart'; | |
| class LoginScreen extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return FutureBuilder( | |
| future: AppleSignIn.isAvailable(), | |
| builder: (context, snapshot) { | |
| if (snapshot.data == true) { | |
| return AppleSignInButton( | |
| onPressed: () async { | |
| FirebaseUser user = await AuthService().signInWithApple(); | |
| if (user != null) { | |
| Navigator.pushReplacementNamed(context, '/home'); | |
| } | |
| }, | |
| ); | |
| } else { | |
| return Container(); | |
| } | |
| }, | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment