Testing app

This commit is contained in:
Mariano Uvalle 2019-02-26 20:48:21 -06:00
parent 5bf61cabfc
commit f2cf8db136
2 changed files with 29 additions and 16 deletions

View file

@ -6,21 +6,6 @@ import './models/user_model.dart';
import './resources/firestore_provider.dart';
class App extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Do more',
//home: Text('Start'),
home: Scaffold(
appBar: AppBar(
title: Text('DO>'),
),
body: Text('Tasks'),
),
);
}
}
/* class App extends StatelessWidget {
Widget build(BuildContext context) {
final fire = FirestoreProvider();
return MaterialApp(
@ -86,4 +71,4 @@ class App extends StatelessWidget {
),
);
}
} */
}

View file

@ -0,0 +1,28 @@
import 'dart:async';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
class GoogleSignInProvider {
final GoogleSignIn _googleSignIn;
final FirebaseAuth _auth;
GoogleSignInProvider([GoogleSignIn googleSignIn, FirebaseAuth firebaseAuth])
: _googleSignIn = googleSignIn ?? GoogleSignIn(),
_auth = firebaseAuth ?? FirebaseAuth.instance;
Future<FirebaseUser> signIn() async {
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth =
await googleUser.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
final FirebaseUser user = await _auth.signInWithCredential(credential);
print("signed in " + user.displayName);
return user;
}
}