Skip to content

Instantly share code, notes, and snippets.

@Leocardoso94
Created May 8, 2020 18:12
Show Gist options
  • Select an option

  • Save Leocardoso94/1cba7cd4e3563026d21b2f574a6ccfe2 to your computer and use it in GitHub Desktop.

Select an option

Save Leocardoso94/1cba7cd4e3563026d21b2f574a6ccfe2 to your computer and use it in GitHub Desktop.
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