@@ -142,8 +142,8 @@
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
0B649054ED34D466116A76B4 /* [CP] Embed Pods Frameworks */,
|
||||
AEB6A3F5C2646ACD5FD07AD4 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */,
|
||||
3991F7BB322D4A93148EBA5F /* [CP] Copy Pods Resources */,
|
||||
2A6497560A75576FDBB7BFE8 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -220,6 +220,24 @@
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
2A6497560A75576FDBB7BFE8 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\"";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\n#!/bin/bash\nPATH=${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin\nflutterfire upload-crashlytics-symbols --upload-symbols-script-path=$PODS_ROOT/FirebaseCrashlytics/upload-symbols --platform=ios --apple-project-path=${SRCROOT} --env-platform-name=${PLATFORM_NAME} --env-configuration=${CONFIGURATION} --env-project-dir=${PROJECT_DIR} --env-built-products-dir=${BUILT_PRODUCTS_DIR} --env-dwarf-dsym-folder-path=${DWARF_DSYM_FOLDER_PATH} --env-dwarf-dsym-file-name=${DWARF_DSYM_FILE_NAME} --env-infoplist-path=${INFOPLIST_PATH} --default-config=default\n";
|
||||
};
|
||||
3991F7BB322D4A93148EBA5F /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -268,24 +286,6 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
AEB6A3F5C2646ACD5FD07AD4 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\"";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\n#!/bin/bash\nPATH=${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin\nflutterfire upload-crashlytics-symbols --upload-symbols-script-path=$PODS_ROOT/FirebaseCrashlytics/upload-symbols --platform=ios --apple-project-path=${SRCROOT} --env-platform-name=${PLATFORM_NAME} --env-configuration=${CONFIGURATION} --env-project-dir=${PROJECT_DIR} --env-built-products-dir=${BUILT_PRODUCTS_DIR} --env-dwarf-dsym-folder-path=${DWARF_DSYM_FOLDER_PATH} --env-dwarf-dsym-file-name=${DWARF_DSYM_FILE_NAME} --env-infoplist-path=${INFOPLIST_PATH} --default-config=default\n";
|
||||
};
|
||||
F8F084BCF7BD9B22A56A9676 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CLIENT_ID</key>
|
||||
<string>307701736370-il62k6tumpu03hnaiqkefj44494bvae6.apps.googleusercontent.com</string>
|
||||
<key>REVERSED_CLIENT_ID</key>
|
||||
<string>com.googleusercontent.apps.307701736370-il62k6tumpu03hnaiqkefj44494bvae6</string>
|
||||
<key>API_KEY</key>
|
||||
<string>AIzaSyAX1quOawuuZYT8WuHjLNnfk_e6e6hdt-U</string>
|
||||
<key>GCM_SENDER_ID</key>
|
||||
|
||||
@@ -63,6 +63,8 @@ class DefaultFirebaseOptions {
|
||||
messagingSenderId: '307701736370',
|
||||
projectId: 'traders-circuit',
|
||||
storageBucket: 'traders-circuit.appspot.com',
|
||||
iosClientId: '307701736370-il62k6tumpu03hnaiqkefj44494bvae6.apps.googleusercontent.com',
|
||||
iosBundleId: 'com.example.traderscircuit',
|
||||
);
|
||||
|
||||
}
|
||||
@@ -2,16 +2,21 @@ import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:glassmorphism/glassmorphism.dart';
|
||||
import 'package:google_sign_in/google_sign_in.dart';
|
||||
import 'package:onesignal_flutter/onesignal_flutter.dart';
|
||||
import 'package:traderscircuit/Utils/Common/CustomTextFormField.dart';
|
||||
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
|
||||
import 'package:traderscircuit/Utils/base_manager.dart';
|
||||
import 'package:traderscircuit/Utils/text.dart';
|
||||
import 'package:traderscircuit/Utils/utils.dart';
|
||||
import 'package:traderscircuit/resources/routes/route_name.dart';
|
||||
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
|
||||
import 'package:traderscircuit/view_model/GoogleApi/google_api.dart';
|
||||
import '../../view_model/SendOtp/sendOtpObserver.dart';
|
||||
import '../../view_model/SendOtp/sendOtpbloc.dart';
|
||||
|
||||
@@ -31,6 +36,89 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
return !phoneNumberExpression.hasMatch(phoneNumber);
|
||||
}
|
||||
|
||||
_signInWithGooglecheck() async {
|
||||
// try {
|
||||
final GoogleSignIn googleSignIn = GoogleSignIn();
|
||||
await googleSignIn.signOut();
|
||||
final GoogleSignInAccount? googleUser = await googleSignIn.signIn();
|
||||
if (googleUser == null) {
|
||||
return;
|
||||
}
|
||||
final GoogleSignInAuthentication googleAuth =
|
||||
await googleUser.authentication;
|
||||
|
||||
print('googleAuth AccessToken ${googleAuth.accessToken}');
|
||||
|
||||
// Show loading dialog
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
// final status = await OneSignal.shared.getDeviceState();
|
||||
// final String? playerIdV = status?.userId;
|
||||
// Map<String, String> updata = {
|
||||
// "principal_source_xid": '3',
|
||||
// "access_token": '${googleAuth.accessToken}',
|
||||
// "player_id": playerIdV!,
|
||||
// };
|
||||
// // Call Google API
|
||||
// final data = await GoogleAPI(updata).googleApi();
|
||||
|
||||
// // Dismiss loading dialog
|
||||
// Navigator.of(context).pop();
|
||||
|
||||
// if (data.status == ResponseStatus.SUCCESS) {
|
||||
// // await global.setname();
|
||||
// // await global.getVar();
|
||||
|
||||
// Get.snackbar(
|
||||
// "Success!",
|
||||
// 'Google Sign In successful!',
|
||||
// duration: Duration(seconds: 2),
|
||||
// colorText: Colors.white,
|
||||
// backgroundColor: Colors.green,
|
||||
// margin: EdgeInsets.all(8),
|
||||
// snackStyle: SnackStyle.FLOATING,
|
||||
// snackPosition: SnackPosition.BOTTOM,
|
||||
// );
|
||||
|
||||
// Get.toNamed(RouteName.adddetails);
|
||||
// } else {
|
||||
// // Show an error message
|
||||
// Get.snackbar(
|
||||
// "Error!",
|
||||
// data.message,
|
||||
// duration: Duration(seconds: 2),
|
||||
// colorText: Colors.white,
|
||||
// backgroundColor: Colors.red,
|
||||
// margin: EdgeInsets.all(8),
|
||||
// snackStyle: SnackStyle.FLOATING,
|
||||
// snackPosition: SnackPosition.BOTTOM,
|
||||
// );
|
||||
// }
|
||||
// } catch (e) {
|
||||
// print("Error during Google sign-in and API call: $e");
|
||||
// Get.snackbar(
|
||||
// "Error!",
|
||||
// 'Something went wrong, please try again!',
|
||||
// duration: Duration(seconds: 2),
|
||||
// colorText: Colors.white,
|
||||
// backgroundColor: Colors.red,
|
||||
// margin: EdgeInsets.all(8),
|
||||
// snackStyle: SnackStyle.FLOATING,
|
||||
// snackPosition: SnackPosition.BOTTOM,
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final CounterBloc counterbloc = BlocProvider.of<CounterBloc>(context);
|
||||
@@ -353,52 +441,57 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
GlassmorphicContainer(
|
||||
width: double.infinity,
|
||||
height: 55.h,
|
||||
borderRadius: 8,
|
||||
linearGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFffffff).withOpacity(0.1),
|
||||
const Color(0xFFFFFFFF).withOpacity(0.05),
|
||||
],
|
||||
stops: const [
|
||||
0.1,
|
||||
1,
|
||||
]),
|
||||
border: 0.5,
|
||||
blur: 10,
|
||||
borderGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xff4A73FB).withOpacity(0.2),
|
||||
const Color(0xff4A73FB).withOpacity(0.2),
|
||||
const Color(0xff4A73FB).withOpacity(0.2),
|
||||
],
|
||||
stops: const [
|
||||
0.3,
|
||||
0.6,
|
||||
1,
|
||||
]),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/png/google.png",
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 7.h,
|
||||
),
|
||||
text16W400(
|
||||
"Continue with google",
|
||||
),
|
||||
],
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
_signInWithGooglecheck();
|
||||
},
|
||||
child: GlassmorphicContainer(
|
||||
width: double.infinity,
|
||||
height: 55.h,
|
||||
borderRadius: 8,
|
||||
linearGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFffffff).withOpacity(0.1),
|
||||
const Color(0xFFFFFFFF).withOpacity(0.05),
|
||||
],
|
||||
stops: const [
|
||||
0.1,
|
||||
1,
|
||||
]),
|
||||
border: 0.5,
|
||||
blur: 10,
|
||||
borderGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xff4A73FB).withOpacity(0.2),
|
||||
const Color(0xff4A73FB).withOpacity(0.2),
|
||||
const Color(0xff4A73FB).withOpacity(0.2),
|
||||
],
|
||||
stops: const [
|
||||
0.3,
|
||||
0.6,
|
||||
1,
|
||||
]),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/png/google.png",
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 7.h,
|
||||
),
|
||||
text16W400(
|
||||
"Continue with google",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
30
lib/view_model/GoogleApi/google_api.dart
Normal file
30
lib/view_model/GoogleApi/google_api.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:traderscircuit/Utils/base_manager.dart';
|
||||
import 'package:traderscircuit/data/network/network_api_services.dart';
|
||||
|
||||
class GoogleAPI {
|
||||
GoogleAPI(this.data);
|
||||
var data;
|
||||
Future<ResponseData<dynamic>> googleApi() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response = await NetworkApiServices().postApi(
|
||||
data,
|
||||
"auth/google-signin/",
|
||||
);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
//Map<String, dynamic> responseData = jsonDecode(response.data);
|
||||
if (response.data['success'] == true) {
|
||||
// await prefs.setString('token', response.data["data"]["access"]);
|
||||
// await prefs.setString('refreshToken', response.data["data"]["refresh"]);
|
||||
// await prefs.setBool('hasSignedInBefore', response.data["data"]["complete"]);
|
||||
print('signup: ${prefs.getString('token')}');
|
||||
} else {
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -337,8 +337,10 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
|
||||
|
||||
version: "0.5.7+7"
|
||||
|
||||
|
||||
firebase_core:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -592,10 +594,12 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_android
|
||||
|
||||
sha256: "8f2606fffd912ff8c23e8d94da106764c116112ce65fb18c78123331ae628eb3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.24"
|
||||
|
||||
google_sign_in_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -616,10 +620,12 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_web
|
||||
|
||||
sha256: f2b3af0ba52ff59439f18962fca71db860f09507a81da929fc0e719270b35db2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.3+3"
|
||||
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1613,5 +1619,7 @@ packages:
|
||||
source: hosted
|
||||
version: "6.5.0"
|
||||
sdks:
|
||||
|
||||
dart: ">=3.4.0 <4.0.0"
|
||||
flutter: ">=3.22.0"
|
||||
|
||||
|
||||
@@ -62,7 +62,9 @@ dependencies:
|
||||
flutter_inappwebview: ^6.0.0
|
||||
flutter_branch_sdk: ^7.1.0
|
||||
socket_io_client: ^2.0.3+1
|
||||
|
||||
web_socket_channel:
|
||||
|
||||
google_sign_in: ^6.2.1
|
||||
firebase_auth: ^4.20.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user