From be1318a74d744045eb84c4fda0588ec86c4b86a8 Mon Sep 17 00:00:00 2001 From: Dhruv80576 Date: Sat, 19 Oct 2024 13:41:59 +0530 Subject: [PATCH] feat:google oAuth added --- assets/images/google.png | Bin 0 -> 20865 bytes lib/cubit/auth/auth_cubit.dart | 56 +++++++++++++++++++++++++++ lib/views/pages/login/login.dart | 63 ++++++++++++++++++++----------- pubspec.lock | 48 +++++++++++++++++++++++ pubspec.yaml | 1 + 5 files changed, 145 insertions(+), 23 deletions(-) create mode 100644 assets/images/google.png diff --git a/assets/images/google.png b/assets/images/google.png new file mode 100644 index 0000000000000000000000000000000000000000..494acede0c520f847f75982ca1f671fc6eaa889e GIT binary patch literal 20865 zcmYJb2Rv2(|2Y1-F0OeILfH}$Qpx6$?QO4ym7S4&&A6EtWmGD%$t*KlTqKH&ka2Cw zy!M{IqtEyM`1g49h;v@!x%VkbS6h{u;t~Y_fLdKmNgn_r=tm+zMhgA2?K^M?{X^`j zsBTCG{Rt$q!9u^2yQ$sx1OWN<{4Xp~5P2DT$l|4Z&&$Bo&dcYKhb{2&@ezLf#L3h8 zk(;fstB3vjRhdfwZ~}ED1w-GIm2saG!<{c@8+-H8x9|&iA3fT|tgH~(OT;Rxcom0J02ot+m&}bf3E7wj&%wu-inv zlqfn(An*eourT_KL#L&zD2eNwD7C2w!%Hs|T-0 z@s*fXPg4TW^1h2*d>>cJLd*ltya{?wX}3eNm@usGUC1wk2Ljh;!iWRza@Rjs@FUyT zRhm$;`xX+C#9?&r1rLP;5-7Q6y+Z6hTVesE3Zk?)P5=knr4N70;NiH9FcR&1rJY!3 zFAx2qRqKb8QjF|gY| zJ7Td3f4CBco=2p2KdgzCCQ)i{hG7yHu~ zk`??qIszVr&TrLy3V2|b@g2>SVB!WcUgy4wsla^f!HMx?GLttasr54MnKR76rqoD# zu?b7q=9jcBIv1~-Zl!=&f-v_(381UdCqR}N)XRd2oj8-~X_jb~p6^sgBpUGjl&nD_Cbs=GLzDuyEa$ISE9a?VU<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I)+>^6*pXohCy;$UJNV^<%Z5Xyvi;$rD@1Q zeRi(B806|2w@Qx9qQPr}R@@rB1>b(b^P5wtCNLZ83^V4%FYx2< z)%#~B77qQT^asas*1?JCzRgR z>N#W5<61be%BsXQOjlXwowerWR%N9C9FTPR?~rmKSB5ZUNneK*p~;fL0hZk(yR@mS zX7**!7y$bXES(6c!$rWJ6J^}jiiw*JfNF%bFMjW7e(W0h^^Da% zYX!^egjDe&a3Ce(UMz)_s43jGc(g7))Xm%In1~!2@MOFHc-T6m(;1E9H|DjTiqK)- zb%u<+BBBn1+m^>ynU;{~Y=CvDDNBBMoX4n?=_SLzDPGp~U!sKZZ7 zOg)Tob*neqzQFv~20Cn{ho(62(4hnuWV(FY$4>%DDh7=EAi$gXPUKB!8r33! zzixyZ+sS+$`c)c2|CBGqwXvJoSyQiujz#LglthU=f%KbA1#rL7)0JvsVv%YmzfcD9 zKaE^aCBv{=nO{#dFSkxSP3LW}=bDTgV*`3omcm820}%6XNJ;fuNQ-Ij8K3a}GV|qB z2^rGSv{N6#Y3ql(`3JV)vJDq=W5 zdY~|;lzK;K(V zH;#aV3?~1Ip8pkuOl9)XphR`~ztsF2-?9Z>?GPk#QZ~cK;*Y_@Z0OtodQ1!~NOV1? G$o~QRsPyvy literal 0 HcmV?d00001 diff --git a/lib/cubit/auth/auth_cubit.dart b/lib/cubit/auth/auth_cubit.dart index 6de63a3..6979d08 100644 --- a/lib/cubit/auth/auth_cubit.dart +++ b/lib/cubit/auth/auth_cubit.dart @@ -1,10 +1,12 @@ import 'package:donorconnect/views/pages/welcome/welcome_screen.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:donorconnect/cubit/auth/auth_state.dart'; import 'package:donorconnect/models/user_model.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:google_sign_in/google_sign_in.dart'; import 'package:shared_preferences/shared_preferences.dart'; class AuthCubit extends Cubit { @@ -58,6 +60,60 @@ class AuthCubit extends Cubit { } } + Future signInWithGoogle() async { + GoogleSignInAccount? googleUser = await GoogleSignIn().signIn(); + GoogleSignInAuthentication? googleAuth = await googleUser?.authentication; + try { + AuthCredential credential = GoogleAuthProvider.credential( + accessToken: googleAuth?.accessToken, + idToken: googleAuth?.idToken, + ); + + await FirebaseAuth.instance + .signInWithCredential(credential) + .whenComplete(() {}); + UserModel userModel = UserModel( + uid: FirebaseAuth.instance.currentUser!.uid, + name: FirebaseAuth.instance.currentUser!.displayName!, + email: FirebaseAuth.instance.currentUser!.email!, + phone: FirebaseAuth.instance.currentUser!.phoneNumber ?? '', + isOrganDonor: false, + isBloodDonor: false, + ); + _firestore + .collection('users') + .doc(FirebaseAuth.instance.currentUser!.uid) + .snapshots() + .listen( + (DocumentSnapshot snapshot) { + if (snapshot.exists) { + UserModel user = + UserModel.fromMap(snapshot.data() as Map); + emit(Authenticated(user)); + print(user.name); + print(user.email); + // Save user name to SharedPreferences + _saveUserToPrefs(FirebaseAuth.instance.currentUser!.uid, user); + } else { + _firestore + .collection('users') + .doc(FirebaseAuth.instance.currentUser!.uid) + .set(userModel.toMap()); + // Save user data to SharedPreferences + _saveUserToPrefs(FirebaseAuth.instance.currentUser!.uid, userModel); + emit(Authenticated(userModel)); + } + }, + onError: (error) { + emit(AuthError(error.toString())); + }, + ); + emit(Authenticated(userModel)); + } catch (e) { + print(e); + } + } + Future registerUser({ required String email, required String password, diff --git a/lib/views/pages/login/login.dart b/lib/views/pages/login/login.dart index 7089c11..c00425f 100644 --- a/lib/views/pages/login/login.dart +++ b/lib/views/pages/login/login.dart @@ -28,7 +28,7 @@ class _LoginPageState extends State { TextEditingController passwordController = TextEditingController(); //variable to control password visibility - bool _isPasswordVisible =false; + bool _isPasswordVisible = false; // VALIDATION bool _isValidate = false; late SharedPreferences prefs; @@ -158,16 +158,18 @@ class _LoginPageState extends State { name: _text.password, errormsg: _isValidate ? _text.password_error_text : null, - suffixIcon: IconButton( - icon: Icon( - _isPasswordVisible ? Icons.visibility : Icons.visibility_off, - ), - onPressed: () { - setState(() { - _isPasswordVisible = !_isPasswordVisible; - }); - }, - ), + suffixIcon: IconButton( + icon: Icon( + _isPasswordVisible + ? Icons.visibility + : Icons.visibility_off, + ), + onPressed: () { + setState(() { + _isPasswordVisible = !_isPasswordVisible; + }); + }, + ), ), ], ), @@ -177,16 +179,16 @@ class _LoginPageState extends State { padding: EdgeInsets.only(left: screenWidth * 0.45), child: TextButton( onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => BlocProvider( - create: (context) => ForgotPasswordCubit(FirebaseAuth.instance), - child: ForgotPasswordScreen(), - ), - ), -); - + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => BlocProvider( + create: (context) => ForgotPasswordCubit( + FirebaseAuth.instance), + child: ForgotPasswordScreen(), + ), + ), + ); }, child: Text( _text.forget_password, @@ -200,7 +202,7 @@ class _LoginPageState extends State { // LOGIN BUTTON SizedBox( - height: screenHeight * 0.18, + height: screenHeight * 0.12, ), GestureDetector( onTap: loginUser, @@ -225,7 +227,22 @@ class _LoginPageState extends State { ), ), ), - + + //Google Login + SizedBox( + height: screenHeight * 0.02, + ), + Container( + height: 50, + alignment: Alignment.center, + child: IconButton( + icon: Image.asset('assets/images/google.png'), + iconSize: 50, + onPressed: () { + context.read().signInWithGoogle(); + }, + ), + ), // FINAL TEXT Row( mainAxisAlignment: MainAxisAlignment.center, diff --git a/pubspec.lock b/pubspec.lock index 089054a..8193d1d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -570,6 +570,54 @@ packages: url: "https://pub.dev" source: hosted version: "6.2.1" + google_identity_services_web: + dependency: transitive + description: + name: google_identity_services_web + sha256: "5be191523702ba8d7a01ca97c17fca096822ccf246b0a9f11923a6ded06199b6" + url: "https://pub.dev" + source: hosted + version: "0.3.1+4" + google_sign_in: + dependency: "direct main" + description: + name: google_sign_in + sha256: "0b8787cb9c1a68ad398e8010e8c8766bfa33556d2ab97c439fb4137756d7308f" + url: "https://pub.dev" + source: hosted + version: "6.2.1" + google_sign_in_android: + dependency: transitive + description: + name: google_sign_in_android + sha256: "0928059d2f0840f63c7b07a30cf73b593ae872cdd0dbd46d1b9ba878d2599c01" + url: "https://pub.dev" + source: hosted + version: "6.1.33" + google_sign_in_ios: + dependency: transitive + description: + name: google_sign_in_ios + sha256: "83f015169102df1ab2905cf8abd8934e28f87db9ace7a5fa676998842fed228a" + url: "https://pub.dev" + source: hosted + version: "5.7.8" + google_sign_in_platform_interface: + dependency: transitive + description: + name: google_sign_in_platform_interface + sha256: "1f6e5787d7a120cc0359ddf315c92309069171306242e181c09472d1b00a2971" + url: "https://pub.dev" + source: hosted + version: "2.4.5" + google_sign_in_web: + dependency: transitive + description: + name: google_sign_in_web + sha256: "042805a21127a85b0dc46bba98a37926f17d2439720e8a459d27045d8ef68055" + url: "https://pub.dev" + source: hosted + version: "0.12.4+2" graphs: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index da1ea78..3ed8bca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,6 +50,7 @@ dependencies: mongo_dart: ^0.10.3 url_launcher: ^6.3.1 table_calendar: ^3.1.2 + google_sign_in: ^6.2.1 dev_dependencies: