class LoginPage extends StatelessWidget {
LoginPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Instagram Clone',
style: TextStyle(fontSize: 40,fontWeight: FontWeight.bold),),
Padding(padding: EdgeInsets.all(50),
),
SignInButton(Buttons.Google, onPressed: (){
signWithGoogle().then((user){
print('object');
});
})
]),
),
);
}
Future <UserCredential> signWithGoogle() async {
final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn();
final GoogleSignInAuthentication googleAuth = (await googleUser?.authentication)!;
final credential = GoogleAuthProvider.credential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken
);
return await FirebaseAuth.instance.signInWithCredential(credential);
}
}