facebook change
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"CodeGPT.apiKey": "CodeGPT Plus Beta"
|
||||
"CodeGPT.apiKey": "CodeGPT Plus Beta",
|
||||
"dart.flutterSdkPath": "D:\\pooja\\fluttersdk\\flutter_3.16.9\\flutter"
|
||||
}
|
||||
@@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) {
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
@@ -68,4 +68,6 @@ flutter {
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'com.facebook.android:facebook-login:latest.release'
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.regroup">
|
||||
package="com.example.regroup"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission
|
||||
@@ -47,5 +52,23 @@
|
||||
android:value="2" />
|
||||
<meta-data android:name="com.google.android.geo.API_KEY"
|
||||
android:value="AIzaSyDdTfKwZav5Qyg3ht88N76lDTFntOe30dQ"/>
|
||||
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
|
||||
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
|
||||
|
||||
<activity android:name="com.facebook.FacebookActivity"
|
||||
android:configChanges=
|
||||
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
|
||||
android:label="@string/app_name" />
|
||||
<activity
|
||||
android:name="com.facebook.CustomTabActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="@string/fb_login_protocol_scheme" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
7
android/app/src/main/res/values/strings.xml
Normal file
7
android/app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">ReGroup123</string>
|
||||
<string name="facebook_app_id">8076081959097016</string>
|
||||
<string name="fb_login_protocol_scheme">fb8076081959097016</string>
|
||||
<string name="facebook_client_token">ca5a1805872edbec0d3a0a0b02229ba5</string>
|
||||
</resources>
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -14,6 +13,7 @@ import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
|
||||
import 'package:show_fps/show_fps.dart';
|
||||
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
|
||||
|
||||
class LoginScreen extends StatefulWidget {
|
||||
const LoginScreen({super.key});
|
||||
@@ -23,11 +23,69 @@ class LoginScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LoginScreenState extends State<LoginScreen> {
|
||||
Map<String, dynamic>? _userData;
|
||||
AccessToken? _accessToken;
|
||||
bool _checking = true;
|
||||
final TextEditingController _email = TextEditingController();
|
||||
RxBool isObscured = true.obs;
|
||||
final TextEditingController _password = TextEditingController();
|
||||
// final GlobalKey<FormState> _form = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
// _checkIfisLoggedIn();
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
_checkIfisLoggedIn() async {
|
||||
final accessToken = await FacebookAuth.instance.accessToken;
|
||||
|
||||
setState(() {
|
||||
_checking = false;
|
||||
});
|
||||
|
||||
if (accessToken != null) {
|
||||
print("/////////////////////////////////////////check");
|
||||
print("worked");
|
||||
print(accessToken.toJson());
|
||||
final userData = await FacebookAuth.instance.getUserData();
|
||||
_accessToken = accessToken;
|
||||
setState(() {
|
||||
_userData = userData;
|
||||
});
|
||||
} else {
|
||||
print("/////////////////////////////////////////check");
|
||||
|
||||
print("not worked");
|
||||
_login();
|
||||
}
|
||||
}
|
||||
_login() async {
|
||||
final LoginResult result = await FacebookAuth.instance.login();
|
||||
|
||||
if (result.status == LoginStatus.success) {
|
||||
_accessToken = result.accessToken;
|
||||
|
||||
final userData = await FacebookAuth.instance.getUserData();
|
||||
_userData = userData;
|
||||
} else {
|
||||
print(result.status);
|
||||
print(result.message);
|
||||
}
|
||||
setState(() {
|
||||
_checking = false;
|
||||
});
|
||||
}
|
||||
|
||||
_logout() async {
|
||||
await FacebookAuth.instance.logOut();
|
||||
_accessToken = null;
|
||||
_userData = null;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -242,28 +300,44 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
'assets/images/png/login3.png'))),
|
||||
),
|
||||
const Spacer(),
|
||||
Container(
|
||||
width: 55,
|
||||
height: 55,
|
||||
decoration: ShapeDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: const Alignment(0.71, -0.70),
|
||||
end: const Alignment(-0.71, 0.7),
|
||||
colors: [
|
||||
Colors.white
|
||||
.withOpacity(0.07999999821186066),
|
||||
Colors.white
|
||||
.withOpacity(0.12999999523162842)
|
||||
],
|
||||
),
|
||||
shape: const OvalBorder(
|
||||
side: BorderSide(
|
||||
width: 0.50,
|
||||
color: Color(0xFF434A53)),
|
||||
),
|
||||
image: const DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/images/png/login4.png'))),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
_checkIfisLoggedIn();
|
||||
|
||||
/* FacebookAuth.instance.login(
|
||||
permissions: ['public_profile', 'email'],
|
||||
).then((value) {
|
||||
FacebookAuth.instance.getUserData().then((userData) {
|
||||
setState(() {
|
||||
/* _isLoggedIn = true;
|
||||
_userObj = userData; */
|
||||
});
|
||||
});
|
||||
}); */
|
||||
},
|
||||
child: Container(
|
||||
width: 55,
|
||||
height: 55,
|
||||
decoration: ShapeDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: const Alignment(0.71, -0.70),
|
||||
end: const Alignment(-0.71, 0.7),
|
||||
colors: [
|
||||
Colors.white
|
||||
.withOpacity(0.07999999821186066),
|
||||
Colors.white
|
||||
.withOpacity(0.12999999523162842)
|
||||
],
|
||||
),
|
||||
shape: const OvalBorder(
|
||||
side: BorderSide(
|
||||
width: 0.50,
|
||||
color: Color(0xFF434A53)),
|
||||
),
|
||||
image: const DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/images/png/login4.png'))),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -18,8 +18,13 @@ Future<void> main() async {
|
||||
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
]).then((value) => runApp(StatsFl(
|
||||
align: Alignment.center, width: 200, height: 100, child: const MyApp())));
|
||||
]).then(
|
||||
(value) =>runApp(MyApp()) /* runApp(StatsFl(
|
||||
align: Alignment.center,
|
||||
width: 200,
|
||||
height: 100,
|
||||
child: const MyApp())), */
|
||||
);
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
|
||||
24
pubspec.lock
24
pubspec.lock
@@ -230,6 +230,30 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_facebook_auth:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_facebook_auth
|
||||
sha256: fd1a6749dafbd5923585038671b63abdcedd4fe5923eb42fc154247dc5622519
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.4"
|
||||
flutter_facebook_auth_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_facebook_auth_platform_interface
|
||||
sha256: "86630c4dbba1c20fba26ea9e59ad0d48f5ff59e7373cacd36f916160186f9ce9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
flutter_facebook_auth_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_facebook_auth_web
|
||||
sha256: "0e2960e9e23f2538e29b406495e18b047fbf233abfaed8d2b99acda17a2f7479"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.1"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
||||
@@ -67,6 +67,7 @@ dependencies:
|
||||
glassmorphism_ui: ^0.3.0
|
||||
show_fps: ^1.0.6
|
||||
statsfl: ^2.3.0
|
||||
flutter_facebook_auth: ^6.0.4
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user