Testing app
This commit is contained in:
parent
5bf61cabfc
commit
f2cf8db136
2 changed files with 29 additions and 16 deletions
|
|
@ -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 {
|
|||
),
|
||||
);
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
|
|
|||
28
lib/src/resources/google_sign_in_provider.dart
Normal file
28
lib/src/resources/google_sign_in_provider.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue