From a9ae9ac0284b8887c99010037fd41ca3d6fe0343 Mon Sep 17 00:00:00 2001 From: kishan06 Date: Fri, 12 Jul 2024 19:16:47 +0530 Subject: [PATCH 1/4] oauth in progress --- .vscode/settings.json | 4 -- lib/Common/api_urls.dart | 1 + lib/Login/View/loginscreen.dart | 23 +++++-- lib/Login/View/verifygoogleapple.dart | 62 +++++++++++++++---- lib/Login/ViewModel/LoginApi.dart | 38 +++++++++++- lib/Utils/Common/AppleOAuthService.dart | 3 +- lib/Utils/Common/googleOAuthService.dart | 12 +--- .../Business/ViewModel/TellUsBusinessApi.dart | 15 +---- lib/resources/routes/routes.dart | 2 +- 9 files changed, 111 insertions(+), 49 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index fe1640e..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "CodeGPT.apiKey": "CodeGPT Plus Beta", - "dart.flutterSdkPath": "D:\\pooja\\fluttersdk\\flutter_3.16.9\\flutter" -} \ No newline at end of file diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index a8c14e7..cb4057d 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -27,6 +27,7 @@ class ApiUrls { static const postcommunities = "${baseUrl}select-communities"; static const googlelogin = "${baseUrl}sign-in-with-google-login"; + static const applelogin = "${baseUrl}sign-in-with-google-login"; static const storeDetailsOfOAuth = "${baseUrl}update-user-account-type"; } diff --git a/lib/Login/View/loginscreen.dart b/lib/Login/View/loginscreen.dart index 48821a7..19ffecd 100644 --- a/lib/Login/View/loginscreen.dart +++ b/lib/Login/View/loginscreen.dart @@ -50,8 +50,22 @@ class _LoginScreenState extends State { {"google_access_token": value, "one_signal_player_id": "ABCD"}); if (resp.message == "go-to-signin-via-oauth") { // Get.to(()=> ); - Get.toNamed(RouteName.verifygoogleapplepage); + Get.toNamed(RouteName.verifygoogleapplepage, + arguments: {"email": resp.data}); logger.d("go to sign in"); + } else if (resp.message == "profile-incomplete") { + if (resp.data) { + + } + } + else if (value == null) { + Get.snackbar( + 'Error', + 'Google Sign-In canceled', + snackPosition: SnackPosition.BOTTOM, + backgroundColor: Colors.red, + colorText: Colors.white, + ); } else { Get.snackbar( "Success!", @@ -63,8 +77,7 @@ class _LoginScreenState extends State { snackStyle: SnackStyle.FLOATING, snackPosition: SnackPosition.BOTTOM, ); - - Get.toNamed(RouteName.mainscreen); + //Get.toNamed(RouteName.mainscreen); logger.d("go to login"); } } else { @@ -401,8 +414,8 @@ class _LoginScreenState extends State { GestureDetector( onTap: () { _loginWithApple(); - Get.toNamed( - RouteName.verifygoogleapplepage); + // Get.toNamed( + // RouteName.verifygoogleapplepage); }, child: Container( width: 55, diff --git a/lib/Login/View/verifygoogleapple.dart b/lib/Login/View/verifygoogleapple.dart index 2fac0b9..bc134a0 100644 --- a/lib/Login/View/verifygoogleapple.dart +++ b/lib/Login/View/verifygoogleapple.dart @@ -1,8 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:glassmorphism/glassmorphism.dart'; +import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/CommonTextFormField.dart'; +import 'package:regroup/Global.dart'; +import 'package:regroup/Login/ViewModel/LoginApi.dart'; import 'package:regroup/Utils/Common/CommonAppbar.dart'; import 'package:regroup/Utils/Common/CommonDropdown.dart'; import 'package:regroup/Utils/Common/CustomNextButton.dart'; @@ -10,10 +14,13 @@ import 'package:regroup/Utils/Common/blureffect.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/dialogs.dart'; 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'; class Verifygoogleandapple extends StatefulWidget { - const Verifygoogleandapple({super.key}); + Verifygoogleandapple({ + super.key, + }); @override State createState() => _VerifygoogleandappleState(); @@ -22,20 +29,53 @@ class Verifygoogleandapple extends StatefulWidget { class _VerifygoogleandappleState extends State { TextEditingController emailidcontroller = TextEditingController(); - final Map _accountTypeMap = { - 'Individual': 1, - 'Business': 2, - }; - String _selectedAccountType = ''; + @override + void initState() { + emailidcontroller.text = Get.arguments['email']; + super.initState(); + } + void _onItemSelected(String value) { setState(() { _selectedAccountType = value; }); } - + getIdFromAccountType() { + if (_selectedAccountType == 'Individual') { + return 1; + } else { + return 2; + } + } + + _createAccountWithOAuth() async { + var updata = { + "principal_type_xid": getIdFromAccountType(), + "email_address": emailidcontroller.text, + }; + + final resp = await LoginAPI() + .storeUserDetailsWhenComingFromGoogleAppleSignin(updata); + + if (resp.status == ResponseStatus.SUCCESS) { + if (_selectedAccountType == 'Individual') { + Get.toNamed(RouteName.tellusindividualscreen); + } else { + Get.toNamed(RouteName.tellusbusinessscreen); + } + } else { + Get.snackbar( + 'Error', + 'Google Sign-In canceled', + snackPosition: SnackPosition.BOTTOM, + backgroundColor: Colors.red, + colorText: Colors.white, + ); + } + } @override Widget build(BuildContext context) { @@ -169,13 +209,11 @@ class _VerifygoogleandappleState extends State { CustomButton( text: "Continue", onPressed: () { - if ( - // isValid! - emailidcontroller.text.isEmpty && - _selectedAccountType.isEmpty) { + if (emailidcontroller.text.isEmpty && + _selectedAccountType.isEmpty) { utils.showToast('Please fill all fields'); } else { - // Uploadata(); + _createAccountWithOAuth(); } }), const Spacer() diff --git a/lib/Login/ViewModel/LoginApi.dart b/lib/Login/ViewModel/LoginApi.dart index 280d05b..2819c3c 100644 --- a/lib/Login/ViewModel/LoginApi.dart +++ b/lib/Login/ViewModel/LoginApi.dart @@ -1,7 +1,9 @@ +import 'package:get/get.dart'; import 'package:regroup/Common/api_urls.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/data/network/network_api.dart'; import 'package:regroup/Login/Model/LoginModel.dart'; +import 'package:regroup/resources/routes/route_name.dart'; import 'package:shared_preferences/shared_preferences.dart'; class LoginAPI { @@ -32,9 +34,37 @@ class LoginAPI { if (response.status == ResponseStatus.SUCCESS) { await prefs.setString('access-token', response.data['data']['token']); if (response.data['data']['is_account_type_updated'] == 3) { + return ResponseData( + "go-to-signin-via-oauth", ResponseStatus.SUCCESS, + data: response.data['data']['email']); + } + if (response.data['data']['is_account_type_updated'] == 2 || + response.data['data']['is_account_type_updated'] == 1) { + //get user data + + return ResponseData( + "profile-incomplete", ResponseStatus.SUCCESS, + data: response.data['data']['email']); + } else { + return ResponseData("go-to-login", ResponseStatus.SUCCESS); + } + } + + return response; + } + + Future storeAppleSignin(var data) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + final response = await NetworkApiServices() + .postApi(data, ApiUrls.applelogin, optionalpar: true); + if (response.status == ResponseStatus.SUCCESS) { + await prefs.setString('access-token', response.data['data']['token']); + if (response.data['data']['is_account_type_updated'] == 3) { + Get.toNamed(RouteName.verifygoogleapplepage); return ResponseData( "go-to-signin-via-oauth", ResponseStatus.SUCCESS); } else { + Get.toNamed(RouteName.mainscreen); return ResponseData("go-to-login", ResponseStatus.SUCCESS); } } @@ -44,10 +74,12 @@ class LoginAPI { Future storeUserDetailsWhenComingFromGoogleAppleSignin( var data) async { - SharedPreferences prefs = await SharedPreferences.getInstance(); final response = await NetworkApiServices() - .postApi(data, ApiUrls.storeDetailsOfOAuth, optionalpar: true); - if (response.status == ResponseStatus.SUCCESS) {} + .postApi(data, ApiUrls.storeDetailsOfOAuth, optionalpar: false); + if (response.status == ResponseStatus.SUCCESS) { + return ResponseData( + response.data['message'], ResponseStatus.SUCCESS); + } return response; } diff --git a/lib/Utils/Common/AppleOAuthService.dart b/lib/Utils/Common/AppleOAuthService.dart index 91f2954..0179e0d 100644 --- a/lib/Utils/Common/AppleOAuthService.dart +++ b/lib/Utils/Common/AppleOAuthService.dart @@ -1,4 +1,5 @@ import 'package:get/get.dart'; +import 'package:regroup/Login/ViewModel/LoginApi.dart'; import 'package:regroup/Utils/Common/googleOAuthService.dart'; import 'package:sign_in_with_apple/sign_in_with_apple.dart'; @@ -14,7 +15,7 @@ class AppleOAuthService { logger.d("email is ${credential.email}"); logger.d("fullname is ${credential.givenName}"); logger.d("token is ${credential.userIdentifier}"); - + // LoginAPI().storeAppleSignin(); } catch (e) { print("Error occured"); } diff --git a/lib/Utils/Common/googleOAuthService.dart b/lib/Utils/Common/googleOAuthService.dart index 19c4520..660944f 100644 --- a/lib/Utils/Common/googleOAuthService.dart +++ b/lib/Utils/Common/googleOAuthService.dart @@ -32,16 +32,6 @@ class GoogleAuthService extends GetxController { } Future handleGoogleSignIn() async { - // await FirebaseAuth.instance.signOut(); - - // Map updata = { - // "username": "kishan1", - // "email": "kishan1@gmail.com", - // "phone": "123456564", - // "ID": "efsfsfsefsef" - // }; - // GoogleSigninApi().googleSigninApi(updata); - try { // Sign out the user if they are already signed in await _googleSignIn.signOut(); @@ -88,7 +78,7 @@ class GoogleAuthService extends GetxController { } catch (error) { // Handle any errors that occurred during the sign-in process. print('Error during Google Sign-In: $error'); + return null; } - return null; } } diff --git a/lib/onboarding/Signup/View/Business/ViewModel/TellUsBusinessApi.dart b/lib/onboarding/Signup/View/Business/ViewModel/TellUsBusinessApi.dart index 13ca2e0..c6ac57d 100644 --- a/lib/onboarding/Signup/View/Business/ViewModel/TellUsBusinessApi.dart +++ b/lib/onboarding/Signup/View/Business/ViewModel/TellUsBusinessApi.dart @@ -8,17 +8,11 @@ class BusinessAPI { Future> tellUsBusinessApi(var data) async { SharedPreferences prefs = await SharedPreferences.getInstance(); - final response = await NetworkApiServices().postApi( - data, - ApiUrls.tellUsBusinessApi - // "https://regroup.betadelivery.com/api/v1/tell-us-about-your-business", - // optionalpar: true - ); + final response = + await NetworkApiServices().postApi(data, ApiUrls.tellUsBusinessApi); if (response.status == ResponseStatus.SUCCESS) { - //Map responseData = jsonDecode(response.data); if (response.data['status'] == 'success') { - // LoginModel loginObj = LoginModel.fromJson(response.data); } else { return ResponseData( response.data['message'], ResponseStatus.FAILED); @@ -27,16 +21,13 @@ class BusinessAPI { return response; } - - Future> letUsUnderstandApi(var data) async { + Future> letUsUnderstandApi(var data) async { final response = await NetworkApiServices().postApi( data, ApiUrls.letUsUnderstandApi, - // "https://regroup.betadelivery.com/api/v1/update-business-profile-step-1", ); if (response.status == ResponseStatus.SUCCESS) { - //Map responseData = jsonDecode(response.data); if (response.data['status'] == "success") { return ResponseData( response.data['message'], ResponseStatus.SUCCESS); diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index 6e51053..c987df1 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -495,7 +495,7 @@ class AppRoutes { ), GetPage( name: RouteName.verifygoogleapplepage, - page: () => const Verifygoogleandapple(), + page: () => Verifygoogleandapple(), ), ]; } -- 2.34.1 From dd878393c65bc8070a6aee4902f2bdd31e7e3877 Mon Sep 17 00:00:00 2001 From: kishan06 Date: Sat, 13 Jul 2024 11:28:58 +0530 Subject: [PATCH 2/4] apple ad facebook integrated --- android/app/src/main/res/values/strings.xml | 8 +- lib/Common/api_urls.dart | 3 +- lib/Login/View/loginscreen.dart | 109 +++++------ lib/Login/ViewModel/LoginApi.dart | 25 +-- lib/Utils/Common/AppleOAuthService.dart | 4 +- lib/onboarding/SplashScreen.dart | 203 ++++++++++---------- 6 files changed, 161 insertions(+), 191 deletions(-) diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index b304a14..87bac60 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,7 +1,7 @@ - ReGroup123 - 8076081959097016 - fb8076081959097016 - ca5a1805872edbec0d3a0a0b02229ba5 + Regroup + 803386025107790 + fb803386025107790 + fa69ee794ff94e50c7ddbfac1e035cb9 \ No newline at end of file diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index fdf45f3..fa63b98 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -27,10 +27,9 @@ class ApiUrls { static const postcommunities = "${baseUrl}select-communities"; static const googlelogin = "${baseUrl}sign-in-with-google-login"; - static const applelogin = "${baseUrl}sign-in-with-google-login"; + static const applelogin = "${baseUrl}apple-login-or-registration"; static const storeDetailsOfOAuth = "${baseUrl}update-user-account-type"; static const getuserdetails = "${baseUrl}get-auth-user-data"; - } diff --git a/lib/Login/View/loginscreen.dart b/lib/Login/View/loginscreen.dart index d5fd4b5..1f48c8d 100644 --- a/lib/Login/View/loginscreen.dart +++ b/lib/Login/View/loginscreen.dart @@ -13,6 +13,7 @@ import 'package:regroup/Utils/Common/googleOAuthService.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; +import 'package:regroup/onboarding/Signup/view_model/getUserprofile.dart'; import 'package:regroup/resources/routes/route_name.dart'; import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; import 'package:flutter_facebook_auth/flutter_facebook_auth.dart'; @@ -27,8 +28,8 @@ class LoginScreen extends StatefulWidget { } class _LoginScreenState extends State { - String _accessToken = ""; - Map _userData = {}; + Map? _userData; + AccessToken? _accessToken; bool _checking = true; final TextEditingController _emailController = TextEditingController(); RxBool isObscured = true.obs; @@ -50,16 +51,9 @@ class _LoginScreenState extends State { final resp = await LoginAPI().storeGoogleSignin( {"google_access_token": value, "one_signal_player_id": "ABCD"}); if (resp.message == "go-to-signin-via-oauth") { - // Get.to(()=> ); Get.toNamed(RouteName.verifygoogleapplepage, arguments: {"email": resp.data}); - logger.d("go to sign in"); - } else if (resp.message == "profile-incomplete") { - if (resp.data) { - - } - } - else if (value == null) { + } else if (value == null) { Get.snackbar( 'Error', 'Google Sign-In canceled', @@ -93,54 +87,54 @@ class _LoginScreenState extends State { }); } - // _checkIfisLoggedIn() async { - // //user token - // final accessToken = await FacebookAuth.instance.accessToken; + _checkIfisLoggedIn() async { + //user token + final accessToken = await FacebookAuth.instance.accessToken; - // setState(() { - // _checking = false; - // }); + setState(() { + _checking = false; + }); - // if (accessToken != null) { - // print("/////////////////////////////////////////xcheck"); - // print("worked"); - // print(accessToken.toJson()); - // final userData = await FacebookAuth.instance.getUserData(); - // // _accessToken = accessToken; - // setState(() { - // _userData = userData; - // }); - // } else { - // print("/////////////////////////////////////////check"); + if (accessToken != null) { + print("/////////////////////////////////////////xcheck"); + print("worked"); + print(accessToken.toJson()); + final userData = await FacebookAuth.instance.getUserData(); + // _accessToken = accessToken; + setState(() { + _userData = userData; + }); + } else { + print("/////////////////////////////////////////check"); - // print("not worked"); - // _login(); - // } - // } + print("not worked"); + _login(); + } + } - // _login() async { - // final LoginResult result = await FacebookAuth.instance.login(); + _login() async { + final LoginResult result = await FacebookAuth.instance.login(); - // if (result.status == LoginStatus.success) { - // _accessToken = result.accessToken; + 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; - // }); - // } + 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(() {}); - // } + _logout() async { + await FacebookAuth.instance.logOut(); + _accessToken = null; + _userData = null; + setState(() {}); + } _logincheck() async { if (_emailController.text.isBlank! || _passwordController.text.isBlank!) { @@ -414,8 +408,6 @@ class _LoginScreenState extends State { GestureDetector( onTap: () { _loginWithApple(); - // Get.toNamed( - // RouteName.verifygoogleapplepage); }, child: Container( width: 55, @@ -473,16 +465,7 @@ class _LoginScreenState extends State { const Spacer(), GestureDetector( onTap: () async { - /* FacebookAuth.instance.login( - permissions: ['public_profile', 'email'], - ).then((value) { - FacebookAuth.instance.getUserData().then((userData) { - setState(() { - /* _isLoggedIn = true; - _userObj = userData; */ - }); - }); - }); */ + _checkIfisLoggedIn(); }, child: Container( width: 55, diff --git a/lib/Login/ViewModel/LoginApi.dart b/lib/Login/ViewModel/LoginApi.dart index f47ae27..431e8ee 100644 --- a/lib/Login/ViewModel/LoginApi.dart +++ b/lib/Login/ViewModel/LoginApi.dart @@ -4,6 +4,7 @@ import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/data/network/network_api.dart'; import 'package:regroup/Global.dart'; import 'package:regroup/Login/Model/LoginModel.dart'; +import 'package:regroup/onboarding/Signup/view_model/getUserprofile.dart'; import 'package:regroup/resources/routes/route_name.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -41,18 +42,12 @@ class LoginAPI { if (accountype == "1") { print('tell us individyal'); Get.toNamed(RouteName.tellusindividualscreen, - arguments: { - 'pageroute' : "mainscreen" - } - ); + arguments: {'pageroute': "mainscreen"}); } else if (accountype == "2") { print('tell us business'); Get.toNamed(RouteName.tellusbusinessscreen, - arguments: { - 'pageroute' : "mainscreen" - } - ); + arguments: {'pageroute': "mainscreen"}); } } else { Get.toNamed(RouteName.mainscreen); @@ -76,14 +71,6 @@ class LoginAPI { return ResponseData( "go-to-signin-via-oauth", ResponseStatus.SUCCESS, data: response.data['data']['email']); - } - if (response.data['data']['is_account_type_updated'] == 2 || - response.data['data']['is_account_type_updated'] == 1) { - //get user data - - return ResponseData( - "profile-incomplete", ResponseStatus.SUCCESS, - data: response.data['data']['email']); } else { return ResponseData("go-to-login", ResponseStatus.SUCCESS); } @@ -92,14 +79,16 @@ class LoginAPI { return response; } - Future storeAppleSignin(var data) async { + Future storeAppleSignin(var data, + {String? emailReceived}) async { SharedPreferences prefs = await SharedPreferences.getInstance(); final response = await NetworkApiServices() .postApi(data, ApiUrls.applelogin, optionalpar: true); if (response.status == ResponseStatus.SUCCESS) { await prefs.setString('access-token', response.data['data']['token']); if (response.data['data']['is_account_type_updated'] == 3) { - Get.toNamed(RouteName.verifygoogleapplepage); + Get.toNamed(RouteName.verifygoogleapplepage, + arguments: {"email": emailReceived}); return ResponseData( "go-to-signin-via-oauth", ResponseStatus.SUCCESS); } else { diff --git a/lib/Utils/Common/AppleOAuthService.dart b/lib/Utils/Common/AppleOAuthService.dart index 0179e0d..3740a71 100644 --- a/lib/Utils/Common/AppleOAuthService.dart +++ b/lib/Utils/Common/AppleOAuthService.dart @@ -15,7 +15,9 @@ class AppleOAuthService { logger.d("email is ${credential.email}"); logger.d("fullname is ${credential.givenName}"); logger.d("token is ${credential.userIdentifier}"); - // LoginAPI().storeAppleSignin(); + + await LoginAPI() + .storeAppleSignin({"apple_auth_token": credential.userIdentifier}, emailReceived:credential.email ); } catch (e) { print("Error occured"); } diff --git a/lib/onboarding/SplashScreen.dart b/lib/onboarding/SplashScreen.dart index 0fcb10d..39e1d18 100644 --- a/lib/onboarding/SplashScreen.dart +++ b/lib/onboarding/SplashScreen.dart @@ -74,111 +74,108 @@ class _SplashScreenState extends State { initConnectivity(); log(_connectionStatus.toString()); - Future.delayed(Duration(seconds: 2), () async { - if (_connectionStatus.contains(ConnectivityResult.none)) { - var result = await Get.to(NoInternet()); - if (result != null && result) { - print('this is first'); - Timer(const Duration(seconds: 1), () async { - SharedPreferences prefs = await SharedPreferences.getInstance(); - - token = prefs.getString('access-token'); - emailid = prefs.getString('email'); - myusername = prefs.getString('username'); - fullname = prefs.getString('fullname'); - phonenumber = prefs.getString('phone'); - - if (token == null || token!.isEmpty) { - Get.toNamed(RouteName.onboarding1); - } else { - Getuserdetails().Getuser().then((value) { - print(getuserobj!.data!.userData!.isProfileUpdated!); - // .then((value) { - if (getuserobj?.data?.userData?.isProfileUpdated == 0) { - String? accountype = - getuserobj?.data?.userData?.principalTypeXid.toString(); - - if (accountype == "1") { - Get.toNamed(RouteName.tellusindividualscreen, - arguments: {'pageroute': "mainscreen"}); - } else if (accountype == "2") { - Get.toNamed(RouteName.tellusbusinessscreen, - arguments: {'pageroute': "mainscreen"}); - } - } else { - Get.toNamed(RouteName.mainscreen); - } - }); - // print(getuserobj!.data!.userData!.isProfileUpdated!); - - // // .then((value) { - // if (getuserobj?.data?.userData?.isProfileUpdated == 0) { - // String? accountype = - // getuserobj?.data?.userData?.principalTypeXid.toString(); - - // if (accountype == "1") { - // Get.toNamed(RouteName.tellusindividualscreen, - // arguments: { - // 'pageroute' : "mainscreen" - // } - // ); - // } else if (accountype == "2") { - // Get.toNamed(RouteName.tellusbusinessscreen); - // } - // } else { - // Get.toNamed(RouteName.mainscreen); - // } - // } - // ); - } - }); - } - } else { - Timer(const Duration(seconds: 2), () async { - print('this is second'); - - SharedPreferences prefs = await SharedPreferences.getInstance(); - - token = prefs.getString('access-token'); - emailid = prefs.getString('email'); - myusername = prefs.getString('username'); - fullname = prefs.getString('fullname'); - phonenumber = prefs.getString('phone'); - - if (token == null || token!.isEmpty) { - Get.toNamed(RouteName.onboarding1); - } else { - Getuserdetails().Getuser().then((value) { - print(getuserobj!.data!.userData!.isProfileUpdated!); - // .then((value) { - if (getuserobj?.data?.userData?.isProfileUpdated == 0) { - String? accountype = - getuserobj?.data?.userData?.principalTypeXid.toString(); - - if (accountype == "1") { - Get.toNamed(RouteName.tellusindividualscreen, - arguments: {'pageroute': "mainscreen"}); - } else if (accountype == "2") { - Get.toNamed(RouteName.tellusbusinessscreen, - arguments: {'pageroute': "mainscreen"}); - } - } else { - Get.toNamed(RouteName.mainscreen); - } - }); - - // } - // ); - } - }); - } - }); - // Future.delayed(Duration(seconds: 2), () async { - // Timer(const Duration(seconds: 1), () async { - // Get.toNamed(RouteName.onboarding1); - // }); + // if (_connectionStatus.contains(ConnectivityResult.none)) { + // var result = await Get.to(NoInternet()); + // if (result != null && result) { + // Timer(const Duration(seconds: 1), () async { + // SharedPreferences prefs = await SharedPreferences.getInstance(); + + // token = prefs.getString('access-token'); + // emailid = prefs.getString('email'); + // myusername = prefs.getString('username'); + // fullname = prefs.getString('fullname'); + // phonenumber = prefs.getString('phone'); + + // if (token == null || token!.isEmpty) { + // Get.toNamed(RouteName.onboarding1); + // } else { + // Getuserdetails().Getuser().then((value) { + // print(getuserobj!.data!.userData!.isProfileUpdated!); + // // .then((value) { + // if (getuserobj?.data?.userData?.isProfileUpdated == 0) { + // String? accountype = + // getuserobj?.data?.userData?.principalTypeXid.toString(); + + // if (accountype == "1") { + // Get.toNamed(RouteName.tellusindividualscreen, + // arguments: {'pageroute': "mainscreen"}); + // } else if (accountype == "2") { + // Get.toNamed(RouteName.tellusbusinessscreen, + // arguments: {'pageroute': "mainscreen"}); + // } + // } else { + // Get.toNamed(RouteName.mainscreen); + // } + // }); + // // print(getuserobj!.data!.userData!.isProfileUpdated!); + + // // // .then((value) { + // // if (getuserobj?.data?.userData?.isProfileUpdated == 0) { + // // String? accountype = + // // getuserobj?.data?.userData?.principalTypeXid.toString(); + + // // if (accountype == "1") { + // // Get.toNamed(RouteName.tellusindividualscreen, + // // arguments: { + // // 'pageroute' : "mainscreen" + // // } + // // ); + // // } else if (accountype == "2") { + // // Get.toNamed(RouteName.tellusbusinessscreen); + // // } + // // } else { + // // Get.toNamed(RouteName.mainscreen); + // // } + // // } + // // ); + // } + // }); + // } + // } else { + // Timer(const Duration(seconds: 2), () async { + // print('this is second'); + + // SharedPreferences prefs = await SharedPreferences.getInstance(); + + // token = prefs.getString('access-token'); + // emailid = prefs.getString('email'); + // myusername = prefs.getString('username'); + // fullname = prefs.getString('fullname'); + // phonenumber = prefs.getString('phone'); + + // if (token == null || token!.isEmpty) { + // Get.toNamed(RouteName.onboarding1); + // } else { + // Getuserdetails().Getuser().then((value) { + // print(getuserobj!.data!.userData!.isProfileUpdated!); + // // .then((value) { + // if (getuserobj?.data?.userData?.isProfileUpdated == 0) { + // String? accountype = + // getuserobj?.data?.userData?.principalTypeXid.toString(); + + // if (accountype == "1") { + // Get.toNamed(RouteName.tellusindividualscreen, + // arguments: {'pageroute': "mainscreen"}); + // } else if (accountype == "2") { + // Get.toNamed(RouteName.tellusbusinessscreen, + // arguments: {'pageroute': "mainscreen"}); + // } + // } else { + // Get.toNamed(RouteName.mainscreen); + // } + // }); + + // // } + // // ); + // } + // }); + // } // }); + + Future.delayed(Duration(seconds: 2), () async { + Get.toNamed(RouteName.onboarding1); + }); } @override -- 2.34.1 From 1af9882526ad585ec3c69199bcb98807321cf309 Mon Sep 17 00:00:00 2001 From: kishan06 Date: Sat, 13 Jul 2024 23:28:27 +0530 Subject: [PATCH 3/4] sprint 1 complete --- ios/Runner.xcodeproj/project.pbxproj | 4 + .../xcshareddata/swiftpm/Package.resolved | 15 + ios/Runner/Info.plist | 24 + lib/Common/api_urls.dart | 1 + .../ProfileTab/Settings/Settings.dart | 30 +- lib/Login/View/loginscreen.dart | 151 +++-- lib/Login/ViewModel/LoginApi.dart | 39 +- lib/Utils/Common/ImageUpload.dart | 8 +- lib/Utils/dialogs.dart | 16 +- lib/main.dart | 35 +- .../View/Business/View/tellusbusiness.dart | 343 ++++------ .../View/Individual/step2Selectactivity.dart | 588 +++++++++--------- .../View/Individual/tellusindividual.dart | 151 ++--- lib/onboarding/Signup/View/signupscreen.dart | 282 +++++---- lib/onboarding/SplashScreen.dart | 183 +----- .../forgotPass/View/ForgotPass.dart | 8 +- 16 files changed, 860 insertions(+), 1018 deletions(-) create mode 100644 ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index fd3d0e3..5d60154 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -151,6 +151,8 @@ dependencies = ( ); name = Runner; + packageProductDependencies = ( + ); productName = Runner; productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; @@ -179,6 +181,8 @@ Base, ); mainGroup = 97C146E51CF9000F007C117D; + packageReferences = ( + ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; projectRoot = ""; diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..70800b1 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "ca3cf5f8f83d297b47d2cb0edff3e06f294951e2e06fa55cfc82831103499b2a", + "pins" : [ + { + "identity" : "facebook-ios-sdk", + "kind" : "remoteSourceControl", + "location" : "https://github.com/facebook/facebook-ios-sdk", + "state" : { + "revision" : "c19607d535864533523d1f437c84035e5fb101cf", + "version" : "14.1.0" + } + } + ], + "version" : 3 +} diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 8b03d2b..abae9b0 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -51,5 +51,29 @@ Regroup get write-only access to the user photo library NSPhotoLibraryUsageDescription Allow access to photo library + NSCameraUsageDescription + To capture profile photo please grant camera access + +CFBundleURLTypes + + + CFBundleURLSchemes + + fb803386025107790 + + + +FacebookAppID +803386025107790 +FacebookClientToken +fa69ee794ff94e50c7ddbfac1e035cb9 +FacebookDisplayName +Regroup +LSApplicationQueriesSchemes + + fbapi + fb-messenger-share-api + + diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index 0e94d49..aeb0699 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -28,6 +28,7 @@ class ApiUrls { static const googlelogin = "${baseUrl}sign-in-with-google-login"; static const applelogin = "${baseUrl}apple-login-or-registration"; + static const facebooklogin = "${baseUrl}facebook-login"; static const storeDetailsOfOAuth = "${baseUrl}update-user-account-type"; diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Settings/Settings.dart b/lib/Feed Module/Main_Screens/ProfileTab/Settings/Settings.dart index 8dfdd7d..c9ce84e 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Settings/Settings.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Settings/Settings.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:glassmorphism/glassmorphism.dart'; @@ -9,6 +10,7 @@ import 'package:regroup/Utils/Common/blureffect.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/resources/routes/route_name.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class Settings extends StatefulWidget { const Settings({super.key}); @@ -146,18 +148,26 @@ class _SettingsState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - commonGlassContainer( - width: 140.w, - height: 40.h, - borderradius: 30.r, - opacity1: 0.05, - opacity2: 0.07, - customWidget: - Center(child: text14400white("Yes, I want to")), - border: 1), + GestureDetector( + onTap: () async { + SharedPreferences prefs = + await SharedPreferences.getInstance(); + await prefs.clear(); + Get.offAllNamed(RouteName.loginScreen); + }, + child: commonGlassContainer( + width: 130.w, + height: 40.h, + borderradius: 30.r, + opacity1: 0.05, + opacity2: 0.07, + customWidget: + Center(child: text14400white("Yes, I want to")), + border: 1), + ), Container( height: 40.h, - width: 140.w, + width: 130.w, decoration: BoxDecoration( color: Color(0xFFD90B2E), borderRadius: BorderRadius.circular(30.r), diff --git a/lib/Login/View/loginscreen.dart b/lib/Login/View/loginscreen.dart index 1f48c8d..232a523 100644 --- a/lib/Login/View/loginscreen.dart +++ b/lib/Login/View/loginscreen.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -28,9 +30,7 @@ class LoginScreen extends StatefulWidget { } class _LoginScreenState extends State { - Map? _userData; AccessToken? _accessToken; - bool _checking = true; final TextEditingController _emailController = TextEditingController(); RxBool isObscured = true.obs; final TextEditingController _passwordController = TextEditingController(); @@ -88,26 +88,17 @@ class _LoginScreenState extends State { } _checkIfisLoggedIn() async { - //user token + await _logout(); final accessToken = await FacebookAuth.instance.accessToken; - - setState(() { - _checking = false; - }); - if (accessToken != null) { print("/////////////////////////////////////////xcheck"); - print("worked"); - print(accessToken.toJson()); + final userData = await FacebookAuth.instance.getUserData(); - // _accessToken = accessToken; - setState(() { - _userData = userData; - }); + + logger.i(accessToken.token); + logger.i(userData.toString()); } else { print("/////////////////////////////////////////check"); - - print("not worked"); _login(); } } @@ -119,20 +110,21 @@ class _LoginScreenState extends State { _accessToken = result.accessToken; final userData = await FacebookAuth.instance.getUserData(); - _userData = userData; + logger.i(userData['email']); + logger.i(userData['id']); + + await LoginAPI().storeFacebookSignin( + {"facebook_auth_token": userData['id']}, + emailReceived: userData['email']); } else { print(result.status); print(result.message); } - setState(() { - _checking = false; - }); } _logout() async { await FacebookAuth.instance.logOut(); _accessToken = null; - _userData = null; setState(() {}); } @@ -404,65 +396,68 @@ class _LoginScreenState extends State { child: SizedBox( width: 220.w, child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - GestureDetector( - onTap: () { - _loginWithApple(); - }, - 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/login2.png'))), + if (Platform.isIOS) + GestureDetector( + onTap: () { + _loginWithApple(); + }, + 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/login2.png'))), + ), ), - ), - const Spacer(), - GestureDetector( - onTap: () { - _loginWithGoogle(); - }, - 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/login3.png'))), + // const Spacer(), + if (Platform.isAndroid) + GestureDetector( + onTap: () { + _loginWithGoogle(); + }, + 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/login3.png'))), + ), ), - ), - const Spacer(), + // const Spacer(), GestureDetector( onTap: () async { _checkIfisLoggedIn(); @@ -495,7 +490,7 @@ class _LoginScreenState extends State { ), ), ), - sizedBoxHeight(100) + // sizedBoxHeight(100) ], ), ), diff --git a/lib/Login/ViewModel/LoginApi.dart b/lib/Login/ViewModel/LoginApi.dart index b221af4..c4fb274 100644 --- a/lib/Login/ViewModel/LoginApi.dart +++ b/lib/Login/ViewModel/LoginApi.dart @@ -41,18 +41,20 @@ class LoginAPI { if (accountype == "1") { print('tell us individyal'); - Get.toNamed(RouteName.tellusindividualscreen, - // arguments: { - // 'pageroute' : "mainscreen" - // } + Get.toNamed( + RouteName.tellusindividualscreen, + // arguments: { + // 'pageroute' : "mainscreen" + // } ); } else if (accountype == "2") { print('tell us business'); - Get.toNamed(RouteName.tellusbusinessscreen, - // arguments: { - // 'pageroute' : "mainscreen" - // } + Get.toNamed( + RouteName.tellusbusinessscreen, + // arguments: { + // 'pageroute' : "mainscreen" + // } ); } } else { @@ -106,6 +108,27 @@ class LoginAPI { return response; } + Future storeFacebookSignin(var data, + {String? emailReceived}) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + final response = await NetworkApiServices() + .postApi(data, ApiUrls.facebooklogin, optionalpar: true); + if (response.status == ResponseStatus.SUCCESS) { + await prefs.setString('access-token', response.data['data']['token']); + if (response.data['data']['is_account_type_updated'] == 3) { + Get.toNamed(RouteName.verifygoogleapplepage, + arguments: {"email": emailReceived}); + return ResponseData( + "go-to-signin-via-oauth", ResponseStatus.SUCCESS); + } else { + Get.toNamed(RouteName.mainscreen); + return ResponseData("go-to-login", ResponseStatus.SUCCESS); + } + } + + return response; + } + Future storeUserDetailsWhenComingFromGoogleAppleSignin( var data) async { final response = await NetworkApiServices() diff --git a/lib/Utils/Common/ImageUpload.dart b/lib/Utils/Common/ImageUpload.dart index 2f3bc7a..94fcf99 100644 --- a/lib/Utils/Common/ImageUpload.dart +++ b/lib/Utils/Common/ImageUpload.dart @@ -53,7 +53,7 @@ class ImageUploadBottomSheet { .getImage(ImageSource.camera); onImagePicked(result); - Get.back(); + // Get.back(); }, child: Column( children: [ @@ -116,7 +116,7 @@ class ImageUploadBottomSheet { onTap: () async { var result = await FilePickerMethod().pickFile(); onImagePicked(result?.path ?? ""); - Get.back(); + // Get.back(); }, child: Column( children: [ @@ -155,7 +155,7 @@ class ImageUploadBottomSheet { .getImage(ImageSource.camera); onImagePicked(result); - Get.back(); + // Get.back(); }, child: Column( children: [ @@ -187,7 +187,7 @@ class ImageUploadBottomSheet { var result = await ImagePickerMethod() .getImage(ImageSource.gallery); onImagePicked(result); - Get.back(); + // Get.back(); }, child: Column( children: [ diff --git a/lib/Utils/dialogs.dart b/lib/Utils/dialogs.dart index 6cc75b5..065cd07 100644 --- a/lib/Utils/dialogs.dart +++ b/lib/Utils/dialogs.dart @@ -15,15 +15,13 @@ class utils { elevation: 0, backgroundColor: Colors.transparent, child: WillPopScope( - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CircularProgressIndicator( - color: Color(0xffc18948), - ), - ], - ), + child: const Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircularProgressIndicator( + color: Color(0xffc18948), + ), + ], ), onWillPop: () async => false), ), diff --git a/lib/main.dart b/lib/main.dart index 04e728d..d1aa8d7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:device_info_plus/device_info_plus.dart'; import 'package:firebase_core/firebase_core.dart'; @@ -45,10 +46,10 @@ class _MyAppState extends State with WidgetsBindingObserver { // final Connectivity _connectivity = Connectivity(); // late StreamSubscription _connectivitySubscription; - List _connectionStatus = [ConnectivityResult.none]; + List _connectionStatus = [ConnectivityResult.none]; final Connectivity _connectivity = Connectivity(); late StreamSubscription> _connectivitySubscription; - + // Future checkInternet() async { // final connectivityResult = await (Connectivity().checkConnectivity()); @@ -97,25 +98,25 @@ class _MyAppState extends State with WidgetsBindingObserver { // setState(() { // _connectionStatus = result; // }); - - if (result.contains(ConnectivityResult.wifi) || result.contains(ConnectivityResult.mobile)) { - setState(() { - _connectionStatus = result; - Get.back(result: true); - }); + if (result.contains(ConnectivityResult.wifi) || + result.contains(ConnectivityResult.mobile)) { + setState(() { + _connectionStatus = result; + Get.back(result: true); + }); } else { - setState(() { - _connectionStatus = result; - Get.toNamed(RouteName.nointernet); - }); + setState(() { + _connectionStatus = result; + Get.toNamed(RouteName.nointernet); + }); // Get.toNamed(RouteName.nointernet); } // ignore: avoid_print print('Connectivity changed: $_connectionStatus'); } - Future _getStoragePermission() async { + Future _getStoragePermission() async { DeviceInfoPlugin plugin = DeviceInfoPlugin(); AndroidDeviceInfo android = await plugin.androidInfo; if (android.version.sdkInt < 33) { @@ -155,13 +156,13 @@ class _MyAppState extends State with WidgetsBindingObserver { void initState() { initConnectivity(); WidgetsBinding.instance.addObserver(this); - _connectivitySubscription = + _connectivitySubscription = _connectivity.onConnectivityChanged.listen(_updateConnectionStatus); //do not remove this coomented code - // if (Platform.isAndroid) { - // _getStoragePermission(); - // } + if (Platform.isAndroid) { + _getStoragePermission(); + } super.initState(); } diff --git a/lib/onboarding/Signup/View/Business/View/tellusbusiness.dart b/lib/onboarding/Signup/View/Business/View/tellusbusiness.dart index f5a9d71..ded366e 100644 --- a/lib/onboarding/Signup/View/Business/View/tellusbusiness.dart +++ b/lib/onboarding/Signup/View/Business/View/tellusbusiness.dart @@ -38,7 +38,6 @@ class _TellusaboutBusinessState extends State { ]; String _selectedbusinesstype = ''; - // String business_type = ''; void _onItemSelected(String value) { setState(() { @@ -46,8 +45,6 @@ class _TellusaboutBusinessState extends State { }); } - // String pagename = Get.arguments["pageroute"]; - String getBusinessTypeId(String selectedBusinessType) { if (selectedBusinessType.contains("Retail")) { return '1'; @@ -91,244 +88,174 @@ class _TellusaboutBusinessState extends State { }; final data = await BusinessAPI().tellUsBusinessApi(updata); if (data.status == ResponseStatus.SUCCESS) { - // await global.setname(); Get.snackbar( "Success!", 'success!', - duration: Duration(seconds: 2), + duration: const Duration(seconds: 2), colorText: Colors.white, backgroundColor: Colors.green, - margin: EdgeInsets.all(8), + margin: const EdgeInsets.all(8), snackStyle: SnackStyle.FLOATING, snackPosition: SnackPosition.BOTTOM, ); - // if (pagename == "nextscreen") { - Get.toNamed(RouteName.businessletusunderstandstep1); - - // } else if (pagename == "mainscreen") { - // Get.toNamed(RouteName.mainscreen); - // } - + Get.toNamed(RouteName.businessletusunderstandstep1); } else if (data.status == ResponseStatus.FAILED) { Get.snackbar( "Error!", data.message, - duration: Duration(seconds: 2), + duration: const Duration(seconds: 2), colorText: Colors.white, backgroundColor: Colors.red, - margin: EdgeInsets.all(8), + margin: const EdgeInsets.all(8), snackStyle: SnackStyle.FLOATING, snackPosition: SnackPosition.BOTTOM, ); - // _controller.isTextFieldEnabled.value = true; } else { - // btnController.reset(); Get.snackbar( "Error!", data.data['message'], - duration: Duration(seconds: 2), + duration: const Duration(seconds: 2), colorText: Colors.white, backgroundColor: Colors.red, - margin: EdgeInsets.all(8), + margin: const EdgeInsets.all(8), snackStyle: SnackStyle.FLOATING, snackPosition: SnackPosition.BOTTOM, ); - // _controller.isTextFieldEnabled.value = true; } } } @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Color.fromARGB(255, 18, 32, 47), - body: Stack(children: [ - // Positioned(top: 90, left: -30, child: CommonBlurLeftSecond()), - // Positioned(top: 300, right: -30, child: CommonBlurRightSecond()), - // Positioned(top: 490, left: -30, child: CommonBlurLeftBlue()), - // GlassmorphicContainer( - // width: MediaQuery.of(context).size.width, - // height: - // // 500.h, - // MediaQuery.of(context).size.height, - // borderRadius: 2, - // blur: 6, - // alignment: Alignment.bottomLeft, - // border: 2, - // linearGradient: LinearGradient( - // begin: Alignment.topCenter, - // end: Alignment.bottomCenter, - // colors: [ - // Color(0XFF222935).withOpacity(0.60), - // Color(0XFF222935).withOpacity(0.60), - // Color(0XFF222935).withOpacity(0.60), - // Color(0XFF222935).withOpacity(0.60), - - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // ], - // ), - // borderGradient: LinearGradient( - // begin: Alignment.topCenter, - // end: Alignment.bottomCenter, - // colors: [ - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color(0XFF222935).withOpacity(0.60), - - // Color(0XFF222935).withOpacity(0.60), - // ], - // ), - // ), - - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), - ), - - ListView(physics: ScrollPhysics(), children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // const Spacer(flex: 1), - sizedBoxHeight(60.h), - Center(child: text20400white('Tell us about your business')), - sizedBoxHeight(10.w), - Center( - child: Container( - width: 154, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, - strokeAlign: BorderSide.strokeAlignCenter, - color: Color(0xFF858585), - ), - ), - )), - ), - sizedBoxHeight(40.h), - text16400white('Business owner name'), - sizedBoxHeight(10.h), - CustomTextFormField( - textEditingController: businessownerController, - texttype: TextInputType.text, - hintText: "Enter your business owner name", - leadingIcon: - // const Icon(Icons.mail_outline), - Image.asset( - width: 22.w, - height: 17.h, - 'assets/images/png/user.png', - ), - // validatorText: "Enter your business owner name", - validator: (value) { - if (value!.isEmpty) { - return 'Enter your business owner name'; - } - return null; - }, - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) - ], - ), - sizedBoxHeight(10.h), - text16400white('Business name'), - sizedBoxHeight(10.h), - CustomTextFormField( - textEditingController: businessNameController, - texttype: TextInputType.text, - hintText: "Enter your business name", - leadingIcon: - // const Icon(Icons.mail_outline), - Image.asset( - width: 22.w, - height: 17.h, - 'assets/images/png/briefcase.png', - ), - // validatorText: "Enter your business name", - validator: (value) { - if (value!.isEmpty) { - return 'Enter your business name '; - } - return null; - }, - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) - ], - ), - sizedBoxHeight(10.h), - text16400white('Business location'), - sizedBoxHeight(10.h), - CustomTextFormField( - textEditingController: businesslocationController, - texttype: TextInputType.text, - hintText: "Enter your business location", - leadingIcon: - // const Icon(Icons.mail_outline), - Image.asset( - width: 22.w, - height: 17.h, - 'assets/images/png/location.png', - ), - // validatorText: "Enter your business location", - validator: (value) { - if (value!.isEmpty) { - return 'Enter your business location '; - } - return null; - }, - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) - ], - ), - sizedBoxHeight(10.h), - text16400white('Type of business'), - sizedBoxHeight(10.h), - CustomDropDownWidgetSignup( - header: 'Select type of business', - title: '', - listData: _businesslist, - onItemSelected: _onItemSelected, - leadingImage: - Image.asset('assets/images/png/briefcase.png'), - ), - - sizedBoxHeight(50.h), - CustomButton( - text: "Continue", - onPressed: () { - _tellUsBusinessDone(); - // if (_selectedbusinesstype.isNotEmpty) { - // Get.toNamed(RouteName.businessletusunderstandstep1); - - // // Get.to(() => BusinessPage()); - // } else { - // // Handle case where no selection is made - // utils.showToast('Please select an gender type'); - // } - }), - sizedBoxHeight(30.h), - // const Spacer( - // flex: 3, - // ) - ], - ), + return WillPopScope( + onWillPop: () { + return Future.value(false); + }, + child: Scaffold( + backgroundColor: const Color.fromARGB(255, 18, 32, 47), + body: Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), ), - ]) - ])); + ListView(physics: const ScrollPhysics(), children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(60.h), + Center( + child: text20400white('Tell us about your business')), + sizedBoxHeight(10.w), + Center( + child: Container( + width: 154, + decoration: const ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide( + width: 1, + strokeAlign: BorderSide.strokeAlignCenter, + color: Color(0xFF858585), + ), + ), + )), + ), + sizedBoxHeight(40.h), + text16400white('Business owner name'), + sizedBoxHeight(10.h), + CustomTextFormField( + textEditingController: businessownerController, + texttype: TextInputType.text, + hintText: "Enter your business owner name", + leadingIcon: Image.asset( + width: 22.w, + height: 17.h, + 'assets/images/png/user.png', + ), + validator: (value) { + if (value!.isEmpty) { + return 'Enter your business owner name'; + } + return null; + }, + inputFormatters: [ + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) + ], + ), + sizedBoxHeight(10.h), + text16400white('Business name'), + sizedBoxHeight(10.h), + CustomTextFormField( + textEditingController: businessNameController, + texttype: TextInputType.text, + hintText: "Enter your business name", + leadingIcon: Image.asset( + width: 22.w, + height: 17.h, + 'assets/images/png/briefcase.png', + ), + validator: (value) { + if (value!.isEmpty) { + return 'Enter your business name '; + } + return null; + }, + inputFormatters: [ + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) + ], + ), + sizedBoxHeight(10.h), + text16400white('Business location'), + sizedBoxHeight(10.h), + CustomTextFormField( + textEditingController: businesslocationController, + texttype: TextInputType.text, + hintText: "Enter your business location", + leadingIcon: Image.asset( + width: 22.w, + height: 17.h, + 'assets/images/png/location.png', + ), + validator: (value) { + if (value!.isEmpty) { + return 'Enter your business location '; + } + return null; + }, + inputFormatters: [ + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) + ], + ), + sizedBoxHeight(10.h), + text16400white('Type of business'), + sizedBoxHeight(10.h), + CustomDropDownWidgetSignup( + header: 'Select type of business', + title: '', + listData: _businesslist, + onItemSelected: _onItemSelected, + leadingImage: + Image.asset('assets/images/png/briefcase.png'), + ), + sizedBoxHeight(50.h), + CustomButton( + text: "Continue", + onPressed: () { + _tellUsBusinessDone(); + }), + sizedBoxHeight(30.h), + ], + ), + ), + ]) + ])), + ); } } diff --git a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart index 9ccccf1..78ec2fb 100644 --- a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart +++ b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart @@ -74,7 +74,7 @@ class _SelectIndividualActivityState extends State { Color _getGradientColor(int id) { if (_selectedIndices.contains(id)) { - return Color(0XFFD90B2E); // Selected color + return const Color(0XFFD90B2E); // Selected color } return Colors.transparent; // Default color } @@ -108,7 +108,7 @@ class _SelectIndividualActivityState extends State { return GestureDetector( onTap: () => FocusManager.instance.primaryFocus?.unfocus(), child: Scaffold( - backgroundColor: Color.fromARGB(255, 18, 32, 47), + backgroundColor: const Color.fromARGB(255, 18, 32, 47), bottomNavigationBar: Padding( padding: const EdgeInsets.only(bottom: 10, left: 16, right: 16), child: CustomButton( @@ -129,311 +129,309 @@ class _SelectIndividualActivityState extends State { // RouteName.individualgroupstep3); }), ), - body: FutureBuilder( - future: Getonboard().getIndividualactivity(), - builder: (ctx, snapshot) { - if (snapshot.data == null) { - return const Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [Center(child: CircularProgressIndicator())], - ); - } - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - return Center( - child: Text( - '${snapshot.error} occured', - style: TextStyle(fontSize: 18.spMin), - ), + body: SafeArea( + child: FutureBuilder( + future: Getonboard().getIndividualactivity(), + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [Center(child: CircularProgressIndicator())], ); } - } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + } - return Stack( - children: [ - Positioned(top: 220, left: -30, child: CommonBlurLeftSecond()), - Positioned( - top: 450, right: -30, child: CommonBlurRightSecond()), - Positioned(top: 530, left: -30, child: CommonBlurLeftBlue()), - GlassmorphicContainer( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - borderRadius: 2, - blur: 6, - alignment: Alignment.bottomLeft, - border: 2, - linearGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - ], - ), - borderGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - Color(0XFF222935).withOpacity(0.60), - - Color(0XFF222935).withOpacity(0.60), - ], - ), - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.topRight, - child: GestureDetector( - onTap: () { - Get.toNamed(RouteName.communitycommitscreen); - }, - child: Text( - 'Skip', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w400, - decoration: TextDecoration.underline, - decorationColor: Colors.white), + return Stack( + children: [ + const Positioned( + top: 220, left: -30, child: CommonBlurLeftSecond()), + const Positioned( + top: 450, right: -30, child: CommonBlurRightSecond()), + const Positioned( + top: 530, left: -30, child: CommonBlurLeftBlue()), + GlassmorphicContainer( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + borderRadius: 2, + blur: 6, + alignment: Alignment.bottomLeft, + border: 2, + linearGradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + const Color(0XFF222935).withOpacity(0.60), + const Color(0XFF222935).withOpacity(0.60), + const Color(0XFF222935).withOpacity(0.60), + const Color(0XFF222935).withOpacity(0.60), + ], + ), + borderGradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + const Color(0XFF222935).withOpacity(0.60), + const Color(0XFF222935).withOpacity(0.60), + ], + ), + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Align( + alignment: Alignment.topRight, + child: GestureDetector( + onTap: () { + Get.toNamed(RouteName.communitycommitscreen); + }, + child: Text( + 'Skip', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400, + decoration: TextDecoration.underline, + decorationColor: Colors.white), + ), ), ), - ), - sizedBoxHeight(30.h), - Align( - alignment: Alignment.center, - child: text16400white('Step 1 of 3')), - sizedBoxHeight(20.h), - Container( - width: double.infinity, - height: 25.h, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, color: Color(0xFF434A53)), - borderRadius: BorderRadius.circular(30), + sizedBoxHeight(30.h), + Align( + alignment: Alignment.center, + child: text16400white('Step 1 of 3')), + sizedBoxHeight(20.h), + Container( + width: double.infinity, + height: 25.h, + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + side: const BorderSide( + width: 1, color: Color(0xFF434A53)), + borderRadius: BorderRadius.circular(30), + ), ), - ), - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 8.w, vertical: 2.h), - child: Row( - children: [ - Container( - width: 120.w, - height: 15.h, - decoration: ShapeDecoration( - gradient: LinearGradient( - begin: Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), - colors: [ - Color(0xA5D90B2E), - Color(0x42D90B2E) - ], - ), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(30), - ), - ), - child: Row( - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Container( - width: 15, - height: 15, - decoration: ShapeDecoration( - gradient: LinearGradient( - begin: Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), - colors: [ - Color(0xFFD90B2E), - Color(0x60D90B2E) - ], - ), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(30), - ), - ), - ) - ], - )) - ], - ), - ), - ), - sizedBoxHeight(40.h), - indiactivityobj!.data == null || - indiactivityobj!.data!.isEmpty - ? _buildNoDataBody(context) - : Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.w, vertical: 2.h), + child: Row( children: [ - Center( - child: _selectedIndices.isEmpty - ? text20400white( - 'What is your main activity ?') - : text20400white( - 'What else do you do?')), - sizedBoxHeight(10.w), - Center( - child: Container( - width: 154.w, + Container( + width: 120.w, + height: 15.h, decoration: ShapeDecoration( + gradient: const LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Color(0xA5D90B2E), + Color(0x42D90B2E) + ], + ), shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, - strokeAlign: - BorderSide.strokeAlignCenter, - color: Color(0xFF858585), + borderRadius: + BorderRadius.circular(30), + ), + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Container( + width: 15, + height: 15, + decoration: ShapeDecoration( + gradient: const LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Color(0xFFD90B2E), + Color(0x60D90B2E) + ], + ), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(30), + ), + ), + ) + ], + )) + ], + ), + ), + ), + sizedBoxHeight(40.h), + indiactivityobj!.data == null || + indiactivityobj!.data!.isEmpty + ? _buildNoDataBody(context) + : Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Center( + child: _selectedIndices.isEmpty + ? text20400white( + 'What is your main activity ?') + : text20400white( + 'What else do you do?')), + sizedBoxHeight(10.w), + Center( + child: Container( + width: 154.w, + decoration: const ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide( + width: 1, + strokeAlign: BorderSide + .strokeAlignCenter, + color: Color(0xFF858585), + ), ), ), ), ), - ), - sizedBoxHeight(30.h), - GridView.builder( - physics: ScrollPhysics(), - shrinkWrap: true, - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: - 3, // Number of items in each row - crossAxisSpacing: 12 - .w, // Horizontal spacing between items - mainAxisSpacing: 12 - .h, // Vertical spacing between items + sizedBoxHeight(30.h), + GridView.builder( + physics: const ScrollPhysics(), + shrinkWrap: true, + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: + 3, // Number of items in each row + crossAxisSpacing: 12 + .w, // Horizontal spacing between items + mainAxisSpacing: 12 + .h, // Vertical spacing between items + ), + itemCount: + indiactivityobj!.data!.length, + itemBuilder: (context, index) { + return ActivityContainer( + index: indiactivityobj! + .data![index].id!, + titleString: indiactivityobj! + .data![index].name!, + image: indiactivityobj! + .data![index].image, + // 'assets/images/svg/individualact7.svg', + isSelected: _selectedIndices + .contains(indiactivityobj! + .data![index].id!), + gradientColor: _getGradientColor( + indiactivityobj! + .data![index].id!), + onTap: _onContainerTap, + ); + }, ), - itemCount: indiactivityobj!.data!.length, - itemBuilder: (context, index) { - return ActivityContainer( - index: - indiactivityobj!.data![index].id!, - titleString: indiactivityobj! - .data![index].name!, - image: indiactivityobj! - .data![index].image, - // 'assets/images/svg/individualact7.svg', - isSelected: _selectedIndices.contains( - indiactivityobj! - .data![index].id!), - gradientColor: _getGradientColor( - indiactivityobj! - .data![index].id!), - onTap: _onContainerTap, - ); - }, - ), - sizedBoxHeight(30.h), - text20400FCFCFC("Add other activity"), - sizedBoxHeight(25.h), - CustomTextFormField( - textEditingController: - otheractivitycontroller, - texttype: TextInputType.text, - hintText: "Enter other activity", - // leadingIcon: - // // const Icon(Icons.mail_outline), - // Image.asset( - // width: 22.w, - // height: 17.h, - // 'assets/images/png/user.png', - // ), - // validatorText: "Enter your full name", - validator: (value) { - if (value!.isEmpty) { - return 'Enter your full name '; - } - return null; - }, - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - FilteringTextInputFormatter.allow( - RegExp('[a-zA-Z ]')) - ], - ), - // CustomDropDownRadio( - // header: "", - // title: "", - // listData: [ - // "American football", - // "Archery", - // "Athletics", - // "Baseball", - // "Basketball", - // "Boxing", - // "Canoeing", - // "Clay pigeon shooting", - // "Climbing", - // "Combat sports", - // "Cricket", - // "Dodgeball", - // "Equestrian", - // "Fencing", - // "Gaelic football", - // "Golf", - // "Gymnastics", - // "Handball", - // "Hockey", - // "Lacrosse", - // "Modern biathlon and pentathlon", - // "Netball", - // "Orienteering", - // "Pool and snooker", - // "Powerlifting", - // "Rifle", - // "Rugby league", - // "Rugby union", - // "Sailing", - // "Snowsports", - // "Squash", - // "Surfing", - // "Swimming", - // "Softball", - // "Table tennis", - // "Tennis", - // "Touch rugby", - // "Trampoline", - // "Triathlon", - // "Ultimate frisbee", - // "Volleyball", - // "Water polo", - // "Windsurfing" - // ], - // onItemSelected: (p0) {}, - // leadingImage: SizedBox()), - // // Spacer(flex: 1), + sizedBoxHeight(30.h), + text20400FCFCFC("Add other activity"), + sizedBoxHeight(25.h), + CustomTextFormField( + textEditingController: + otheractivitycontroller, + texttype: TextInputType.text, + hintText: "Enter other activity", + // leadingIcon: + // // const Icon(Icons.mail_outline), + // Image.asset( + // width: 22.w, + // height: 17.h, + // 'assets/images/png/user.png', + // ), + // validatorText: "Enter your full name", + validator: (value) { + if (value!.isEmpty) { + return 'Enter your full name '; + } + return null; + }, + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')) + ], + ), + // CustomDropDownRadio( + // header: "", + // title: "", + // listData: [ + // "American football", + // "Archery", + // "Athletics", + // "Baseball", + // "Basketball", + // "Boxing", + // "Canoeing", + // "Clay pigeon shooting", + // "Climbing", + // "Combat sports", + // "Cricket", + // "Dodgeball", + // "Equestrian", + // "Fencing", + // "Gaelic football", + // "Golf", + // "Gymnastics", + // "Handball", + // "Hockey", + // "Lacrosse", + // "Modern biathlon and pentathlon", + // "Netball", + // "Orienteering", + // "Pool and snooker", + // "Powerlifting", + // "Rifle", + // "Rugby league", + // "Rugby union", + // "Sailing", + // "Snowsports", + // "Squash", + // "Surfing", + // "Swimming", + // "Softball", + // "Table tennis", + // "Tennis", + // "Touch rugby", + // "Trampoline", + // "Triathlon", + // "Ultimate frisbee", + // "Volleyball", + // "Water polo", + // "Windsurfing" + // ], + // onItemSelected: (p0) {}, + // leadingImage: SizedBox()), + // // Spacer(flex: 1), - sizedBoxHeight(35.h), - ], - ) - ], + sizedBoxHeight(35.h), + ], + ) + ], + ), ), ), - ), - ) - ], - ); - }, + ) + ], + ); + }, + ), ), // @@ -471,12 +469,12 @@ class ActivityContainer extends StatelessWidget { return GestureDetector( onTap: () => onTap(index), child: Container( - width: 110.w, - height: 120.h, + // width: 110.w, + // height: 120.h, decoration: ShapeDecoration( gradient: LinearGradient( begin: const Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), + end: const Alignment(-0.98, 0.21), colors: isSelected ? [ gradientColor.withOpacity(0.80), @@ -490,12 +488,12 @@ class ActivityContainer extends StatelessWidget { ], ), shape: RoundedRectangleBorder( - side: BorderSide(width: 1, color: Color(0xFF434A53)), + side: const BorderSide(width: 1, color: Color(0xFF434A53)), borderRadius: BorderRadius.circular(10), ), ), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h), + padding: EdgeInsets.symmetric(horizontal: 0.w, vertical: 10.h), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -523,7 +521,7 @@ class ActivityContainer extends StatelessWidget { width: 50.w, height: 50.h, ), - Spacer(flex: 3), + const Spacer(flex: 3), SizedBox( child: Text( titleString, diff --git a/lib/onboarding/Signup/View/Individual/tellusindividual.dart b/lib/onboarding/Signup/View/Individual/tellusindividual.dart index 774d30a..cd2ff02 100644 --- a/lib/onboarding/Signup/View/Individual/tellusindividual.dart +++ b/lib/onboarding/Signup/View/Individual/tellusindividual.dart @@ -36,9 +36,6 @@ class _TellusaboutIndividualState extends State { TextEditingController datecontroller = TextEditingController(); TextEditingController locationcontroller = TextEditingController(); - // String pagename = Get.arguments["pageroute"]; - - DateTime? _selectedDate; final photographController = TextEditingController(); @@ -46,9 +43,9 @@ class _TellusaboutIndividualState extends State { Get.put(ProfileImageController()); Future _selectDate(BuildContext context) async { - DateTime yesterday = DateTime.now().subtract(Duration(days: 1)); + DateTime yesterday = DateTime.now().subtract(const Duration(days: 1)); DateTime eighteenYearsAgo = - DateTime.now().subtract(Duration(days: 365 * 18)); + DateTime.now().subtract(const Duration(days: 365 * 18)); final ThemeData customTheme = Theme.of(context).copyWith( colorScheme: const ColorScheme.light( @@ -60,7 +57,7 @@ class _TellusaboutIndividualState extends State { onSecondary: Colors.white), textButtonTheme: TextButtonThemeData( style: TextButton.styleFrom( - foregroundColor: Color(0xFFD90B2E), + foregroundColor: const Color(0xFFD90B2E), ), )); @@ -141,36 +138,20 @@ class _TellusaboutIndividualState extends State { filename: path.basename(editProfileImage.profilePicPath.value), ); } - // else { - // imageFile = await Helper.assetImageToMultipartFile( - // "assets/images/png/camera.png", "profile"); - // } FormData formData = FormData.fromMap({ "full_name": fullNameController.text, "username": userNameController.text, "date_of_birth": datecontroller.text, "gender": _selectedgendertype, - 'profile_photo': - // editProfileImage.profilePicPath.value.isNotEmpty ? - imageFile, - // : null, + 'profile_photo': imageFile, 'location': locationcontroller.text, }); - print("formData is $formData"); - log(formData.toString()); final data = await Onboard().PosttellusIndividual(formData); if (data.status == ResponseStatus.SUCCESS) { - utils.showToast("tell us done Successfully!"); Get.back(); - // Get.toNamed(RouteName.individualprofilestep1); - // if (pagename == "nextscreen") { - Get.toNamed(RouteName.individualactivitystep2); - - // } else if (pagename == "mainscreen") { - // Get.toNamed(RouteName.mainscreen); - // } + Get.toNamed(RouteName.individualactivitystep2); } else { Get.back(); return utils.showToast(data.message); @@ -182,54 +163,16 @@ class _TellusaboutIndividualState extends State { return GestureDetector( onTap: () => FocusManager.instance.primaryFocus?.unfocus(), child: Scaffold( - backgroundColor: Color.fromARGB(255, 18, 32, 47), + backgroundColor: const Color.fromARGB(255, 18, 32, 47), body: Stack( children: [ - // Positioned(top: 70, left: -30, child: CommonBlurLeftSecond()), - // Positioned(top: 310, right: -30, child: CommonBlurRightSecond()), - // Positioned(top: 510, left: -30, child: CommonBlurLeftBlue()), - // GlassmorphicContainer( - // width: MediaQuery.of(context).size.width, - // height: - // // 500.h, - // MediaQuery.of(context).size.height, - // borderRadius: 2, - // blur: 6, - // alignment: Alignment.bottomLeft, - // border: 2, - // linearGradient: LinearGradient( - // begin: Alignment.topCenter, - // end: Alignment.bottomCenter, - // colors: [ - // Color(0XFF222935).withOpacity(0.60), - // Color(0XFF222935).withOpacity(0.60), - // Color(0XFF222935).withOpacity(0.60), - // Color(0XFF222935).withOpacity(0.60), - - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // ], - // ), - // borderGradient: LinearGradient( - // begin: Alignment.topCenter, - // end: Alignment.bottomCenter, - // colors: [ - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color(0XFF222935).withOpacity(0.60), - - // Color(0XFF222935).withOpacity(0.60), - // ], - // ), Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("assets/images/png/Ellipse 1496.png"), fit: BoxFit.fill)), ), - ListView(physics: ScrollPhysics(), children: [ + ListView(physics: const ScrollPhysics(), children: [ Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), child: Column( @@ -242,7 +185,7 @@ class _TellusaboutIndividualState extends State { Center( child: Container( width: 154, - decoration: ShapeDecoration( + decoration: const ShapeDecoration( shape: RoundedRectangleBorder( side: BorderSide( width: 1, @@ -281,8 +224,8 @@ class _TellusaboutIndividualState extends State { shape: BoxShape.circle, color: Colors.transparent, border: Border.all( - color: - Color(0XFFD90B2E).withOpacity(0.50), + color: const Color(0XFFD90B2E) + .withOpacity(0.50), width: 2), ), ), @@ -294,8 +237,8 @@ class _TellusaboutIndividualState extends State { shape: BoxShape.circle, color: Colors.transparent, border: Border.all( - color: - Color(0XFFD90B2E).withOpacity(0.50), + color: const Color(0XFFD90B2E) + .withOpacity(0.50), width: 2), ), ), @@ -305,38 +248,32 @@ class _TellusaboutIndividualState extends State { shape: BoxShape.circle, color: Colors.transparent, border: Border.all( - color: Color(0XFFD90B2E) + color: const Color(0XFFD90B2E) .withOpacity(0.50), width: 2), ), - child: Obx(() => - // editProfileImage - // .profilePicPath.value != - // '' - // ? - editProfileImage - .profilePicPath.value != - '' - ? ClipOval( - child: SizedBox.fromSize( - size: - Size.fromRadius(50.r), - child: Image( - image: FileImage( - File( - editProfileImage - .profilePicPath - .value, - ), - ), - fit: BoxFit.cover, - width: 200.w, - height: 200.h, + child: Obx(() => editProfileImage + .profilePicPath.value != + '' + ? ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(50.r), + child: Image( + image: FileImage( + File( + editProfileImage + .profilePicPath + .value, ), ), - ) - : Image.asset( - "assets/images/png/camera.png") + fit: BoxFit.cover, + width: 200.w, + height: 200.h, + ), + ), + ) + : Image.asset( + "assets/images/png/camera.png") // : Image.asset( // "assets/images/png/camera.png") )), @@ -476,22 +413,12 @@ class _TellusaboutIndividualState extends State { CustomButton( text: "Continue", onPressed: () { - if ( - // isValid! - // fullNameController.text.isBlank! && - // userNameController.text.isBlank! && - // datecontroller.text.isBlank! && - // _selectedgendertype.isEmpty && - // locationcontroller.text.isBlank! && - // editProfileImage.profilePicPath.value == - // '' - fullNameController.text.isBlank! || - userNameController.text.isBlank! || - datecontroller.text.isBlank! || - _selectedgendertype.isEmpty || - locationcontroller.text.isBlank! || - editProfileImage.profilePicPath.value == - '') { + if (fullNameController.text.isBlank! || + userNameController.text.isBlank! || + datecontroller.text.isBlank! || + _selectedgendertype.isEmpty || + locationcontroller.text.isBlank! || + editProfileImage.profilePicPath.value == '') { utils.showToast('Please fill all fields'); } else { TellusUploadData(); diff --git a/lib/onboarding/Signup/View/signupscreen.dart b/lib/onboarding/Signup/View/signupscreen.dart index 590d9cb..cd41d17 100644 --- a/lib/onboarding/Signup/View/signupscreen.dart +++ b/lib/onboarding/Signup/View/signupscreen.dart @@ -1,11 +1,18 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_facebook_auth/flutter_facebook_auth.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Login/ViewModel/LoginApi.dart'; +import 'package:regroup/Utils/Common/AppleOAuthService.dart'; import 'package:regroup/Utils/Common/CommonDropdown.dart'; import 'package:regroup/Utils/Common/CustomTextformfield.dart'; import 'package:regroup/Utils/Common/CustomNextButton.dart'; +import 'package:regroup/Utils/Common/googleOAuthService.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; @@ -24,13 +31,10 @@ class _SignupScreenState extends State { TextEditingController emailidcontroller = TextEditingController(); TextEditingController passwordController = TextEditingController(); TextEditingController confirmpasscontroller = TextEditingController(); + AccessToken? _accessToken; final GlobalKey _formKey = GlobalKey(); - - List _dropdownProductItems = [ - 'Individual', - 'Business', - ]; + GoogleAuthService googleSigninController = Get.put(GoogleAuthService()); final Map _accountTypeMap = { 'Individual': 1, @@ -45,35 +49,92 @@ class _SignupScreenState extends State { }); } - // void _Signincheck() async { - // if (emailidcontroller.text.isBlank! || - // passwordController.text.isBlank! || - // confirmpasscontroller.text.isBlank!) { - // Get.snackbar( - // 'Error', - // 'Enter your credentials', - // snackPosition: SnackPosition.BOTTOM, - // backgroundColor: Colors.red, - // colorText: Colors.white, - // ); - // } else if (!emailidcontroller.text.isEmail) { - // Get.snackbar( - // 'Error', - // 'Enter a valid e-mail address', - // snackPosition: SnackPosition.BOTTOM, - // backgroundColor: Colors.red, - // colorText: Colors.white, - // ); - // } else if (_selectedAccountType == 'Individual') { - // print('individual selected'); - // Get.toNamed(RouteName.verifyusercreen, arguments: _selectedAccountType); - // } else if (_selectedAccountType == 'Business') { - // print('business selected'); - // Get.toNamed(RouteName.verifyusercreen, arguments: _selectedAccountType); - // } else { - // utils.showToast('Please select an account type'); - // } - // } + _loginWithApple() { + AppleOAuthService().logIn(); + } + + _loginWithGoogle() { + googleSigninController.handleGoogleSignIn().then((value) async { + if (value != 'Google Sign-In canceled') { + final resp = await LoginAPI().storeGoogleSignin( + {"google_access_token": value, "one_signal_player_id": "ABCD"}); + if (resp.message == "go-to-signin-via-oauth") { + Get.toNamed(RouteName.verifygoogleapplepage, + arguments: {"email": resp.data}); + } else if (value == null) { + Get.snackbar( + 'Error', + 'Google Sign-In canceled', + snackPosition: SnackPosition.BOTTOM, + backgroundColor: Colors.red, + colorText: Colors.white, + ); + } else { + Get.snackbar( + "Success!", + 'Login successful!', + duration: const Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.green, + margin: const EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + //Get.toNamed(RouteName.mainscreen); + logger.d("go to login"); + } + } else { + Get.snackbar( + 'Error', + 'Google Sign-In canceled', + snackPosition: SnackPosition.BOTTOM, + backgroundColor: Colors.red, + colorText: Colors.white, + ); + } + }); + } + + _checkIfisLoggedIn() async { + await _logout(); + final accessToken = await FacebookAuth.instance.accessToken; + if (accessToken != null) { + print("/////////////////////////////////////////xcheck"); + + final userData = await FacebookAuth.instance.getUserData(); + + logger.i(accessToken.token); + logger.i(userData.toString()); + } else { + print("/////////////////////////////////////////check"); + _login(); + } + } + + _login() async { + final LoginResult result = await FacebookAuth.instance.login(); + + if (result.status == LoginStatus.success) { + _accessToken = result.accessToken; + + final userData = await FacebookAuth.instance.getUserData(); + logger.i(userData['email']); + logger.i(userData['id']); + + await LoginAPI().storeFacebookSignin( + {"facebook_auth_token": userData['id']}, + emailReceived: userData['email']); + } else { + print(result.status); + print(result.message); + } + } + + _logout() async { + await FacebookAuth.instance.logOut(); + _accessToken = null; + setState(() {}); + } Uploadata() async { utils.loader(); @@ -97,31 +158,6 @@ class _SignupScreenState extends State { 'accountypenumber': accountTypeValue }); - // if (selectedCategory == "Individual") { - // Get.toNamed(RouteName.verifyusercreen, - // arguments: - // { - // "emailid" : emailidcontroller.text, - // "password" : passwordController.text, - // "accounttype" : selectedCategory, - // 'accountypenumber' : accountTypeValue - - // } - - // ); - // } else if (selectedCategory == "Individual") { - // Get.toNamed(RouteName.verifyusercreen, - // arguments: - // { - // "emailid" : emailidcontroller.text, - // "password" : passwordController.text, - // "accounttype" : selectedCategory, - // 'accountypenumber' : accountTypeValue - - // } - // ); - // } - return utils.showToast(data.message); } else { Get.back(); @@ -397,11 +433,74 @@ class _SignupScreenState extends State { child: SizedBox( width: 220.w, child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, children: [ + if (Platform.isIOS) + GestureDetector( + onTap: () { + _loginWithApple(); + }, + 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/login2.png'))), + ), + ), + if (Platform.isAndroid) + GestureDetector( + onTap: () { + _loginWithGoogle(); + }, + 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/login3.png'))), + ), + ), GestureDetector( - onTap: () { - Get.toNamed( - RouteName.verifygoogleapplepage); + onTap: () async { + _checkIfisLoggedIn(); }, child: Container( width: 55, @@ -426,66 +525,9 @@ class _SignupScreenState extends State { ), image: const DecorationImage( image: AssetImage( - 'assets/images/png/login2.png'))), + 'assets/images/png/login4.png'))), ), ), - const Spacer(), - GestureDetector( - onTap: () { - Get.toNamed( - RouteName.verifygoogleapplepage); - }, - 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/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'))), - ), ], ), ), diff --git a/lib/onboarding/SplashScreen.dart b/lib/onboarding/SplashScreen.dart index 39e1d18..99c4a71 100644 --- a/lib/onboarding/SplashScreen.dart +++ b/lib/onboarding/SplashScreen.dart @@ -22,159 +22,38 @@ class SplashScreen extends StatefulWidget { } class _SplashScreenState extends State { - // var _connectionStatus; - final Connectivity _connectivity = Connectivity(); - List _connectionStatus = [ConnectivityResult.none]; - - // Future checkInternet() async { - // final connectivityResult = await (Connectivity().checkConnectivity()); - - // if (connectivityResult == ConnectivityResult.wifi || - // connectivityResult == ConnectivityResult.mobile) { - // setState(() { - // _connectionStatus = connectivityResult; - // }); - // } else { - // setState(() { - // _connectionStatus = connectivityResult; - - // }); - // } - // } - - Future initConnectivity() async { - late List result; - try { - result = await _connectivity.checkConnectivity(); - } on PlatformException catch (e) { - log('Couldn\'t check connectivity status', error: e); - return; - } - - if (!mounted) { - return Future.value(null); - } - - return _updateConnectionStatus(result); - } - - Future _updateConnectionStatus(List result) async { - setState(() { - _connectionStatus = result; - }); - - // ignore: avoid_print - print('Connectivity changed: $_connectionStatus'); - } - @override void initState() { - // TODO: implement initState super.initState(); - initConnectivity(); - log(_connectionStatus.toString()); - // Future.delayed(Duration(seconds: 2), () async { - // if (_connectionStatus.contains(ConnectivityResult.none)) { - // var result = await Get.to(NoInternet()); - // if (result != null && result) { - // Timer(const Duration(seconds: 1), () async { - // SharedPreferences prefs = await SharedPreferences.getInstance(); + Future.delayed(const Duration(seconds: 2), () async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + token = prefs.getString('access-token'); + emailid = prefs.getString('email'); + myusername = prefs.getString('username'); + fullname = prefs.getString('fullname'); + phonenumber = prefs.getString('phone'); - // token = prefs.getString('access-token'); - // emailid = prefs.getString('email'); - // myusername = prefs.getString('username'); - // fullname = prefs.getString('fullname'); - // phonenumber = prefs.getString('phone'); + if (token == null || token!.isEmpty) { + Get.toNamed(RouteName.onboarding1); + } else { + await Getuserdetails().Getuser().then((value) { + if (getuserobj?.data?.userData?.isProfileUpdated == 0) { + String? accountype = + getuserobj?.data?.userData?.principalTypeXid.toString(); - // if (token == null || token!.isEmpty) { - // Get.toNamed(RouteName.onboarding1); - // } else { - // Getuserdetails().Getuser().then((value) { - // print(getuserobj!.data!.userData!.isProfileUpdated!); - // // .then((value) { - // if (getuserobj?.data?.userData?.isProfileUpdated == 0) { - // String? accountype = - // getuserobj?.data?.userData?.principalTypeXid.toString(); - - // if (accountype == "1") { - // Get.toNamed(RouteName.tellusindividualscreen, - // arguments: {'pageroute': "mainscreen"}); - // } else if (accountype == "2") { - // Get.toNamed(RouteName.tellusbusinessscreen, - // arguments: {'pageroute': "mainscreen"}); - // } - // } else { - // Get.toNamed(RouteName.mainscreen); - // } - // }); - // // print(getuserobj!.data!.userData!.isProfileUpdated!); - - // // // .then((value) { - // // if (getuserobj?.data?.userData?.isProfileUpdated == 0) { - // // String? accountype = - // // getuserobj?.data?.userData?.principalTypeXid.toString(); - - // // if (accountype == "1") { - // // Get.toNamed(RouteName.tellusindividualscreen, - // // arguments: { - // // 'pageroute' : "mainscreen" - // // } - // // ); - // // } else if (accountype == "2") { - // // Get.toNamed(RouteName.tellusbusinessscreen); - // // } - // // } else { - // // Get.toNamed(RouteName.mainscreen); - // // } - // // } - // // ); - // } - // }); - // } - // } else { - // Timer(const Duration(seconds: 2), () async { - // print('this is second'); - - // SharedPreferences prefs = await SharedPreferences.getInstance(); - - // token = prefs.getString('access-token'); - // emailid = prefs.getString('email'); - // myusername = prefs.getString('username'); - // fullname = prefs.getString('fullname'); - // phonenumber = prefs.getString('phone'); - - // if (token == null || token!.isEmpty) { - // Get.toNamed(RouteName.onboarding1); - // } else { - // Getuserdetails().Getuser().then((value) { - // print(getuserobj!.data!.userData!.isProfileUpdated!); - // // .then((value) { - // if (getuserobj?.data?.userData?.isProfileUpdated == 0) { - // String? accountype = - // getuserobj?.data?.userData?.principalTypeXid.toString(); - - // if (accountype == "1") { - // Get.toNamed(RouteName.tellusindividualscreen, - // arguments: {'pageroute': "mainscreen"}); - // } else if (accountype == "2") { - // Get.toNamed(RouteName.tellusbusinessscreen, - // arguments: {'pageroute': "mainscreen"}); - // } - // } else { - // Get.toNamed(RouteName.mainscreen); - // } - // }); - - // // } - // // ); - // } - // }); - // } - // }); - - Future.delayed(Duration(seconds: 2), () async { - Get.toNamed(RouteName.onboarding1); + if (accountype == "1") { + Get.toNamed(RouteName.tellusindividualscreen, + arguments: {'pageroute': "mainscreen"}); + } else if (accountype == "2") { + Get.toNamed(RouteName.tellusbusinessscreen, + arguments: {'pageroute': "mainscreen"}); + } + } else { + Get.toNamed(RouteName.mainscreen); + } + }); + } }); } @@ -190,11 +69,11 @@ class _SplashScreenState extends State { begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ - Color(0xff009DAB).withOpacity(0.25), - Color(0xff35798C).withOpacity(0.44), - Color(0xffD90B2E).withOpacity(0.33), - Color(0xffD90B2E).withOpacity(0.52), - Color(0xffD90B2E).withOpacity(0.59), + const Color(0xff009DAB).withOpacity(0.25), + const Color(0xff35798C).withOpacity(0.44), + const Color(0xffD90B2E).withOpacity(0.33), + const Color(0xffD90B2E).withOpacity(0.52), + const Color(0xffD90B2E).withOpacity(0.59), ], )), child: Column( diff --git a/lib/onboarding/forgotPass/View/ForgotPass.dart b/lib/onboarding/forgotPass/View/ForgotPass.dart index 63978f9..670b1e4 100644 --- a/lib/onboarding/forgotPass/View/ForgotPass.dart +++ b/lib/onboarding/forgotPass/View/ForgotPass.dart @@ -52,11 +52,9 @@ class _ForgotPassState extends State { snackPosition: SnackPosition.BOTTOM, ); prefs.setString('email', emailController.text); - prefs.setInt( - 'principal_xid', resp.data['data']['iam_principal_xid']); + prefs.setInt('principal_xid', resp.data['data']['iam_principal_xid']); Future.delayed(Duration(seconds: 1), () { - Get.toNamed(RouteName.forgotOtp, - arguments: emailController.text); + Get.toNamed(RouteName.forgotOtp, arguments: emailController.text); }); // print('success'); } else if (resp.status == ResponseStatus.FAILED) { @@ -134,7 +132,7 @@ class _ForgotPassState extends State { ), ), ), - hintText: "loremipsum@gmail.comess", + // hintText: "loremipsum@gmail.comess", validator: (value) { if (value!.isEmpty) { return 'Enter your e-mail address'; -- 2.34.1 From c45ee2e088384fdd141946751ab11bb7e28e58b0 Mon Sep 17 00:00:00 2001 From: cj201199 Date: Mon, 15 Jul 2024 19:27:16 +0530 Subject: [PATCH 4/4] bug fixing --- lib/Common/api_urls.dart | 7 + .../Settings/Model/FetchNotification.dart | 59 +++ .../ProfileTab/Settings/Notification.dart | 76 --- .../Settings/View/Notification.dart | 172 ++++++ .../Settings/ViewModel/NotificationApi.dart | 54 ++ .../Announcements/View/Announcements.dart | 82 +-- lib/Login/View/loginscreen.dart | 8 +- lib/Utils/Common/CommonDropdown.dart | 6 +- .../View/Business/View/tellusbusiness.dart | 8 +- .../View/Individual/step2Selectactivity.dart | 493 +++++++++--------- .../View/Individual/step3Selectyourgroup.dart | 450 +++++++--------- .../Individual/step4Selectyourcommunity.dart | 458 ++++++++-------- .../View/Individual/tellusindividual.dart | 2 +- .../Signup/View/communitycommitment.dart | 199 +++---- lib/onboarding/Signup/View/signupendpage.dart | 145 ++---- lib/onboarding/Signup/View/signupscreen.dart | 9 +- lib/onboarding/Signup/View/verifyuser.dart | 157 +++--- .../Signup/view_model/postmethod.dart | 37 +- lib/resources/routes/routes.dart | 2 +- 19 files changed, 1237 insertions(+), 1187 deletions(-) create mode 100644 lib/Feed Module/Main_Screens/ProfileTab/Settings/Model/FetchNotification.dart delete mode 100644 lib/Feed Module/Main_Screens/ProfileTab/Settings/Notification.dart create mode 100644 lib/Feed Module/Main_Screens/ProfileTab/Settings/View/Notification.dart create mode 100644 lib/Feed Module/Main_Screens/ProfileTab/Settings/ViewModel/NotificationApi.dart diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index aeb0699..ba6da23 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -33,4 +33,11 @@ class ApiUrls { static const storeDetailsOfOAuth = "${baseUrl}update-user-account-type"; static const getuserdetails = "${baseUrl}get-auth-user-data"; + + //profile + + static const postnotification = "${baseUrl}update-notification-settings"; + static const getnotification = "${baseUrl}fetch-notification-settings"; + + } diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Settings/Model/FetchNotification.dart b/lib/Feed Module/Main_Screens/ProfileTab/Settings/Model/FetchNotification.dart new file mode 100644 index 0000000..1158609 --- /dev/null +++ b/lib/Feed Module/Main_Screens/ProfileTab/Settings/Model/FetchNotification.dart @@ -0,0 +1,59 @@ +class FetchNotification { + String? status; + int? statusCode; + String? message; + Data? data; + + FetchNotification({this.status, this.statusCode, this.message, this.data}); + + FetchNotification.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + data = json['data'] != null ? new Data.fromJson(json['data']) : null; + } + + Map toJson() { + final Map data = new Map(); + data['status'] = this.status; + data['status_code'] = this.statusCode; + data['message'] = this.message; + if (this.data != null) { + data['data'] = this.data!.toJson(); + } + return data; + } +} + +class Data { + int? groupNotification; + int? communityNotification; + int? followerNotification; + int? newFollowerNotification; + int? directMessageNotification; + + Data( + {this.groupNotification, + this.communityNotification, + this.followerNotification, + this.newFollowerNotification, + this.directMessageNotification}); + + Data.fromJson(Map json) { + groupNotification = json['group_notification']; + communityNotification = json['community_notification']; + followerNotification = json['follower_notification']; + newFollowerNotification = json['new_follower_notification']; + directMessageNotification = json['direct_message_notification']; + } + + Map toJson() { + final Map data = new Map(); + data['group_notification'] = this.groupNotification; + data['community_notification'] = this.communityNotification; + data['follower_notification'] = this.followerNotification; + data['new_follower_notification'] = this.newFollowerNotification; + data['direct_message_notification'] = this.directMessageNotification; + return data; + } +} \ No newline at end of file diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Settings/Notification.dart b/lib/Feed Module/Main_Screens/ProfileTab/Settings/Notification.dart deleted file mode 100644 index 4c0577c..0000000 --- a/lib/Feed Module/Main_Screens/ProfileTab/Settings/Notification.dart +++ /dev/null @@ -1,76 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:regroup/Common/CommonWidget.dart'; -import 'package:regroup/Utils/Common/CommonAppbar.dart'; -import 'package:regroup/Utils/Common/blureffect.dart'; -import 'package:regroup/Utils/Common/sized_box.dart'; -import 'package:regroup/Utils/texts.dart'; - -class NotificationScreen extends StatefulWidget { - const NotificationScreen({super.key}); - - @override - State createState() => _NotificationScreenState(); -} - -class _NotificationScreenState extends State { - List switchValues = List.generate(5, (index) => false); - bool swichvalue = false; - @override - Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), - extendBody: true, - appBar: CommonAppbar( - titleTxt: "Notifications", - ), - body: Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), fit: BoxFit.fill)), - ), - SingleChildScrollView( - child: Column(children: [ - sizedBoxHeight(20.h), - rowTile(text: "Group notification", index: 0), - commonDivider(), - rowTile(text: "Community notification", index: 1), - commonDivider(), - rowTile(text: "Follower notification", index: 2), - commonDivider(), - rowTile(text: "New follower notification", index: 3), - commonDivider(), - rowTile(text: "Direct message notification", index: 4), - ])) - ])); - } - - Widget rowTile({required String text, required int index}) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h), - child: Row( - children: [ - text16w400_FCFCFC(text), - Spacer(), - Transform.scale( - scaleY: 1, - child: CupertinoSwitch( - value: switchValues[index], - trackColor: Colors.white.withOpacity(0.4), - activeColor: Color(0xFF34C759), - onChanged: (bool? value) { - setState(() { - switchValues[index] = value ?? false; - }); - }, - ), - ), - ], - ), - ); - } -} diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Settings/View/Notification.dart b/lib/Feed Module/Main_Screens/ProfileTab/Settings/View/Notification.dart new file mode 100644 index 0000000..98dd755 --- /dev/null +++ b/lib/Feed Module/Main_Screens/ProfileTab/Settings/View/Notification.dart @@ -0,0 +1,172 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:regroup/Common/CommonWidget.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/ViewModel/NotificationApi.dart'; +import 'package:regroup/Utils/Common/CommonAppbar.dart'; +import 'package:regroup/Utils/Common/blureffect.dart'; +import 'package:regroup/Utils/Common/sized_box.dart'; +import 'package:regroup/Utils/dialogs.dart'; +import 'package:regroup/Utils/texts.dart'; + +class NotificationScreen extends StatefulWidget { + const NotificationScreen({super.key}); + + @override + State createState() => _NotificationScreenState(); +} + +class _NotificationScreenState extends State { + var switchValues = List.generate(5, (index) => false).obs; + + void toggleSwitch(int index, bool value) { + switchValues[index] = value; + } + + String switchValueFinal(int index) { + return switchValues[index] ? '1' : '0'; + } + + void switchValueBool() { + final notifications = [ + fetchNoti!.data!.groupNotification, + fetchNoti!.data!.communityNotification, + fetchNoti!.data!.followerNotification, + fetchNoti!.data!.newFollowerNotification, + fetchNoti!.data!.directMessageNotification, + ]; + + for (int i = 0; i < notifications.length; i++) { + toggleSwitch(i, notifications[i] == 1); + } + } + + Future updateNotification() async { + Map updata = { + "group_notification": switchValueFinal(0), + "community_notification": switchValueFinal(1), + "follower_notification": switchValueFinal(2), + "new_follower_notification": switchValueFinal(3), + "direct_message_notification": switchValueFinal(4), + }; + final data = await NotificationAPI().notificationPostApi(updata); + if (data.status == ResponseStatus.SUCCESS) { + utils.showToast('Notification updated'); + } else { + Get.snackbar( + "Error!", + data.data['message'], + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.red, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + } + } + + late Future myfuture; + + @override + void initState() { + myfuture = NotificationAPI().getNotification(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: Color(0xFF222935), + extendBody: true, + appBar: CommonAppbar( + titleTxt: "Notifications", + ), + body: FutureBuilder( + future: myfuture, + builder: (ctx, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return Center( + child: CircularProgressIndicator( + color: Colors.blue, + ), + ); + } + + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occurred', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + switchValueBool(); + return Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill, + ), + ), + ), + SingleChildScrollView( + child: Column( + children: [ + sizedBoxHeight(20.h), + rowTile(text: "Group notification", index: 0), + commonDivider(), + rowTile(text: "Community notification", index: 1), + commonDivider(), + rowTile(text: "Follower notification", index: 2), + commonDivider(), + rowTile(text: "New follower notification", index: 3), + commonDivider(), + rowTile(text: "Direct message notification", index: 4), + ], + ), + ), + ], + ); + } + + return Container(); + }, + ), + ); + } + + Widget rowTile({required String text, required int index}) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h), + child: Row( + children: [ + text16w400_FCFCFC(text), + Spacer(), + Obx( + () => Transform.scale( + scaleY: 1, + child: CupertinoSwitch( + value: switchValues[index], + trackColor: Colors.white.withOpacity(0.4), + activeColor: Color(0xFF34C759), + onChanged: (bool? value) { + toggleSwitch(index, value ?? false); + updateNotification(); + }, + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Settings/ViewModel/NotificationApi.dart b/lib/Feed Module/Main_Screens/ProfileTab/Settings/ViewModel/NotificationApi.dart new file mode 100644 index 0000000..1226653 --- /dev/null +++ b/lib/Feed Module/Main_Screens/ProfileTab/Settings/ViewModel/NotificationApi.dart @@ -0,0 +1,54 @@ +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/Model/FetchNotification.dart'; + +FetchNotification? fetchNoti; + +class NotificationAPI { + NotificationAPI(); + // class otpAPI { + // otpAPI(this.data); + // var data; + Future> notificationPostApi(var data) async { + final response = await NetworkApiServices().postApi( + data, + ApiUrls.postnotification, + // "https://regroup.betadelivery.com/api/v1/forgot-password", + ); + + if (response.status == ResponseStatus.SUCCESS) { + //Map responseData = jsonDecode(response.data); + if (response.data['status'] == "success") { + return ResponseData( + response.data['message'], ResponseStatus.SUCCESS, + // data: response.data + ); + } else { + return ResponseData( + response.data['message'], ResponseStatus.FAILED); + } + } + + return response; + } + + Future> getNotification() async { + final response = await NetworkApiServices().getApi( + ApiUrls.getnotification, + ); + fetchNoti = FetchNotification.fromJson(response.data); + if (response.status == ResponseStatus.SUCCESS) { + if (response.data['success'] == true) { + return ResponseData( + response.data['message'], ResponseStatus.SUCCESS, + data: response.data); + } else { + return ResponseData( + response.data['message'], ResponseStatus.FAILED); + } + } + + return response; + } +} diff --git a/lib/Feed Module/sidemenu/Community/Announcements/View/Announcements.dart b/lib/Feed Module/sidemenu/Community/Announcements/View/Announcements.dart index d2c650d..2b2493a 100644 --- a/lib/Feed Module/sidemenu/Community/Announcements/View/Announcements.dart +++ b/lib/Feed Module/sidemenu/Community/Announcements/View/Announcements.dart @@ -50,46 +50,48 @@ class _AnnouncementsState extends State { titleTxt: "Announcements", ), body: Stack(children: [ - const CommonBlurLeftRed(), - const CommonBlurRightRed(), - const CommonBlurLeft(), - const CommonBlurRight(), - Positioned.fill( - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(25.h), - Row( - children: [ - Spacer(), - InkWell( - onTap: () { - Get.toNamed(RouteName.announcementrequest); - }, - child: text16w700_FCFCFCUnderline( - "View announcement requests"), - ), - ], - ), - sizedBoxHeight(30.h), - Column( - children: List.generate(announcement.length, (index) { - return Column( - children: [ - announcementWidget( - imagepath: announcement[index]["imagepath"], - title: announcement[index]["title"], - date: announcement[index]["date"], - subtitle: announcement[index]["subtitle"]), - sizedBoxHeight(16.h) - ], - ); - }), - ) - ])))) + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(25.h), + Row( + children: [ + Spacer(), + InkWell( + onTap: () { + Get.toNamed(RouteName.announcementrequest); + }, + child: text16w700_FCFCFCUnderline( + "View announcement requests"), + ), + ], + ), + sizedBoxHeight(30.h), + Column( + children: List.generate(announcement.length, (index) { + return Column( + children: [ + announcementWidget( + imagepath: announcement[index]["imagepath"], + title: announcement[index]["title"], + date: announcement[index]["date"], + subtitle: announcement[index]["subtitle"]), + sizedBoxHeight(16.h) + ], + ); + }), + ) + ])), + ), ]), floatingActionButton: Container( height: 55.h, diff --git a/lib/Login/View/loginscreen.dart b/lib/Login/View/loginscreen.dart index 232a523..8911609 100644 --- a/lib/Login/View/loginscreen.dart +++ b/lib/Login/View/loginscreen.dart @@ -47,16 +47,16 @@ class _LoginScreenState extends State { _loginWithGoogle() { googleSigninController.handleGoogleSignIn().then((value) async { + final resp = await LoginAPI().storeGoogleSignin( + {"google_access_token": value, "one_signal_player_id": "ABCD"}); if (value != 'Google Sign-In canceled') { - final resp = await LoginAPI().storeGoogleSignin( - {"google_access_token": value, "one_signal_player_id": "ABCD"}); if (resp.message == "go-to-signin-via-oauth") { Get.toNamed(RouteName.verifygoogleapplepage, arguments: {"email": resp.data}); } else if (value == null) { Get.snackbar( 'Error', - 'Google Sign-In canceled', + resp.data["message"][0], snackPosition: SnackPosition.BOTTOM, backgroundColor: Colors.red, colorText: Colors.white, @@ -78,7 +78,7 @@ class _LoginScreenState extends State { } else { Get.snackbar( 'Error', - 'Google Sign-In canceled', + resp.data["message"][0], snackPosition: SnackPosition.BOTTOM, backgroundColor: Colors.red, colorText: Colors.white, diff --git a/lib/Utils/Common/CommonDropdown.dart b/lib/Utils/Common/CommonDropdown.dart index 432fbc9..5e3af30 100644 --- a/lib/Utils/Common/CommonDropdown.dart +++ b/lib/Utils/Common/CommonDropdown.dart @@ -492,6 +492,8 @@ class _CustomDropDownTagState extends State { ); } } + +/// class CustomDropDownRadio extends StatefulWidget { const CustomDropDownRadio({ Key? key, @@ -664,7 +666,9 @@ class _CustomDropDownRadioState extends State { width: double.infinity, height: 50.h, padding: EdgeInsets.only( - top: 14.0, bottom: 14.0, right: 22.w, left: 12.w), + right: 22.w, + left: 12.w, + ), decoration: BoxDecoration( color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: onDropTap.value diff --git a/lib/onboarding/Signup/View/Business/View/tellusbusiness.dart b/lib/onboarding/Signup/View/Business/View/tellusbusiness.dart index ded366e..3d577e6 100644 --- a/lib/onboarding/Signup/View/Business/View/tellusbusiness.dart +++ b/lib/onboarding/Signup/View/Business/View/tellusbusiness.dart @@ -128,10 +128,8 @@ class _TellusaboutBusinessState extends State { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () { - return Future.value(false); - }, + return GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), child: Scaffold( backgroundColor: const Color.fromARGB(255, 18, 32, 47), body: Stack(children: [ @@ -236,7 +234,7 @@ class _TellusaboutBusinessState extends State { sizedBoxHeight(10.h), text16400white('Type of business'), sizedBoxHeight(10.h), - CustomDropDownWidgetSignup( + CustomDropDownRadio( header: 'Select type of business', title: '', listData: _businesslist, diff --git a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart index 78ec2fb..97a11dd 100644 --- a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart +++ b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart @@ -153,281 +153,254 @@ class _SelectIndividualActivityState extends State { return Stack( children: [ - const Positioned( - top: 220, left: -30, child: CommonBlurLeftSecond()), - const Positioned( - top: 450, right: -30, child: CommonBlurRightSecond()), - const Positioned( - top: 530, left: -30, child: CommonBlurLeftBlue()), - GlassmorphicContainer( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - borderRadius: 2, - blur: 6, - alignment: Alignment.bottomLeft, - border: 2, - linearGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - const Color(0XFF222935).withOpacity(0.60), - const Color(0XFF222935).withOpacity(0.60), - const Color(0XFF222935).withOpacity(0.60), - const Color(0XFF222935).withOpacity(0.60), - ], - ), - borderGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - const Color(0XFF222935).withOpacity(0.60), - const Color(0XFF222935).withOpacity(0.60), - ], - ), - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.topRight, - child: GestureDetector( - onTap: () { - Get.toNamed(RouteName.communitycommitscreen); - }, - child: Text( - 'Skip', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w400, - decoration: TextDecoration.underline, - decorationColor: Colors.white), - ), + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Align( + alignment: Alignment.topRight, + child: GestureDetector( + onTap: () { + Get.toNamed(RouteName.communitycommitscreen); + }, + child: Text( + 'Skip', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400, + decoration: TextDecoration.underline, + decorationColor: Colors.white), ), ), - sizedBoxHeight(30.h), - Align( - alignment: Alignment.center, - child: text16400white('Step 1 of 3')), - sizedBoxHeight(20.h), - Container( - width: double.infinity, - height: 25.h, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: const BorderSide( - width: 1, color: Color(0xFF434A53)), - borderRadius: BorderRadius.circular(30), - ), + ), + sizedBoxHeight(30.h), + Align( + alignment: Alignment.center, + child: text16400white('Step 1 of 3')), + sizedBoxHeight(20.h), + Container( + width: double.infinity, + height: 25.h, + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + side: const BorderSide( + width: 1, color: Color(0xFF434A53)), + borderRadius: BorderRadius.circular(30), ), - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 8.w, vertical: 2.h), - child: Row( - children: [ - Container( - width: 120.w, - height: 15.h, - decoration: ShapeDecoration( - gradient: const LinearGradient( - begin: Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), - colors: [ - Color(0xA5D90B2E), - Color(0x42D90B2E) - ], - ), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(30), - ), - ), - child: Row( - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Container( - width: 15, - height: 15, - decoration: ShapeDecoration( - gradient: const LinearGradient( - begin: Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), - colors: [ - Color(0xFFD90B2E), - Color(0x60D90B2E) - ], - ), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(30), - ), - ), - ) + ), + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.w, vertical: 2.h), + child: Row( + children: [ + Container( + width: 120.w, + height: 15.h, + decoration: ShapeDecoration( + gradient: const LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Color(0xA5D90B2E), + Color(0x42D90B2E) ], - )) - ], - ), + ), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(30), + ), + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Container( + width: 15, + height: 15, + decoration: ShapeDecoration( + gradient: const LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Color(0xFFD90B2E), + Color(0x60D90B2E) + ], + ), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(30), + ), + ), + ) + ], + )) + ], ), ), - sizedBoxHeight(40.h), - indiactivityobj!.data == null || - indiactivityobj!.data!.isEmpty - ? _buildNoDataBody(context) - : Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Center( - child: _selectedIndices.isEmpty - ? text20400white( - 'What is your main activity ?') - : text20400white( - 'What else do you do?')), - sizedBoxHeight(10.w), - Center( - child: Container( - width: 154.w, - decoration: const ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, - strokeAlign: BorderSide - .strokeAlignCenter, - color: Color(0xFF858585), - ), + ), + sizedBoxHeight(40.h), + indiactivityobj!.data == null || + indiactivityobj!.data!.isEmpty + ? _buildNoDataBody(context) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: _selectedIndices.isEmpty + ? text20400white( + 'What is your main activity ?') + : text20400white( + 'What else do you do?')), + sizedBoxHeight(10.w), + Center( + child: Container( + width: 154.w, + decoration: const ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide( + width: 1, + strokeAlign: + BorderSide.strokeAlignCenter, + color: Color(0xFF858585), ), ), ), ), - sizedBoxHeight(30.h), - GridView.builder( - physics: const ScrollPhysics(), - shrinkWrap: true, - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: - 3, // Number of items in each row - crossAxisSpacing: 12 - .w, // Horizontal spacing between items - mainAxisSpacing: 12 - .h, // Vertical spacing between items - ), - itemCount: - indiactivityobj!.data!.length, - itemBuilder: (context, index) { - return ActivityContainer( - index: indiactivityobj! - .data![index].id!, - titleString: indiactivityobj! - .data![index].name!, - image: indiactivityobj! - .data![index].image, - // 'assets/images/svg/individualact7.svg', - isSelected: _selectedIndices - .contains(indiactivityobj! - .data![index].id!), - gradientColor: _getGradientColor( - indiactivityobj! - .data![index].id!), - onTap: _onContainerTap, - ); - }, + ), + sizedBoxHeight(30.h), + GridView.builder( + physics: const ScrollPhysics(), + shrinkWrap: true, + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: + 3, // Number of items in each row + crossAxisSpacing: 12 + .w, // Horizontal spacing between items + mainAxisSpacing: 12 + .h, // Vertical spacing between items ), + itemCount: indiactivityobj!.data!.length, + itemBuilder: (context, index) { + return ActivityContainer( + index: + indiactivityobj!.data![index].id!, + titleString: indiactivityobj! + .data![index].name!, + image: indiactivityobj! + .data![index].image, + // 'assets/images/svg/individualact7.svg', + isSelected: _selectedIndices.contains( + indiactivityobj! + .data![index].id!), + gradientColor: _getGradientColor( + indiactivityobj! + .data![index].id!), + onTap: _onContainerTap, + ); + }, + ), - sizedBoxHeight(30.h), - text20400FCFCFC("Add other activity"), - sizedBoxHeight(25.h), - CustomTextFormField( - textEditingController: - otheractivitycontroller, - texttype: TextInputType.text, - hintText: "Enter other activity", - // leadingIcon: - // // const Icon(Icons.mail_outline), - // Image.asset( - // width: 22.w, - // height: 17.h, - // 'assets/images/png/user.png', - // ), - // validatorText: "Enter your full name", - validator: (value) { - if (value!.isEmpty) { - return 'Enter your full name '; - } - return null; - }, - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - FilteringTextInputFormatter.allow( - RegExp('[a-zA-Z ]')) - ], - ), - // CustomDropDownRadio( - // header: "", - // title: "", - // listData: [ - // "American football", - // "Archery", - // "Athletics", - // "Baseball", - // "Basketball", - // "Boxing", - // "Canoeing", - // "Clay pigeon shooting", - // "Climbing", - // "Combat sports", - // "Cricket", - // "Dodgeball", - // "Equestrian", - // "Fencing", - // "Gaelic football", - // "Golf", - // "Gymnastics", - // "Handball", - // "Hockey", - // "Lacrosse", - // "Modern biathlon and pentathlon", - // "Netball", - // "Orienteering", - // "Pool and snooker", - // "Powerlifting", - // "Rifle", - // "Rugby league", - // "Rugby union", - // "Sailing", - // "Snowsports", - // "Squash", - // "Surfing", - // "Swimming", - // "Softball", - // "Table tennis", - // "Tennis", - // "Touch rugby", - // "Trampoline", - // "Triathlon", - // "Ultimate frisbee", - // "Volleyball", - // "Water polo", - // "Windsurfing" - // ], - // onItemSelected: (p0) {}, - // leadingImage: SizedBox()), - // // Spacer(flex: 1), + sizedBoxHeight(30.h), + text20400FCFCFC("Add other activity"), + sizedBoxHeight(25.h), + CustomTextFormField( + textEditingController: + otheractivitycontroller, + texttype: TextInputType.text, + hintText: "Enter other activity", + // leadingIcon: + // // const Icon(Icons.mail_outline), + // Image.asset( + // width: 22.w, + // height: 17.h, + // 'assets/images/png/user.png', + // ), + // validatorText: "Enter your full name", + validator: (value) { + if (value!.isEmpty) { + return 'Enter your full name '; + } + return null; + }, + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')) + ], + ), + // CustomDropDownRadio( + // header: "", + // title: "", + // listData: [ + // "American football", + // "Archery", + // "Athletics", + // "Baseball", + // "Basketball", + // "Boxing", + // "Canoeing", + // "Clay pigeon shooting", + // "Climbing", + // "Combat sports", + // "Cricket", + // "Dodgeball", + // "Equestrian", + // "Fencing", + // "Gaelic football", + // "Golf", + // "Gymnastics", + // "Handball", + // "Hockey", + // "Lacrosse", + // "Modern biathlon and pentathlon", + // "Netball", + // "Orienteering", + // "Pool and snooker", + // "Powerlifting", + // "Rifle", + // "Rugby league", + // "Rugby union", + // "Sailing", + // "Snowsports", + // "Squash", + // "Surfing", + // "Swimming", + // "Softball", + // "Table tennis", + // "Tennis", + // "Touch rugby", + // "Trampoline", + // "Triathlon", + // "Ultimate frisbee", + // "Volleyball", + // "Water polo", + // "Windsurfing" + // ], + // onItemSelected: (p0) {}, + // leadingImage: SizedBox()), + // // Spacer(flex: 1), - sizedBoxHeight(35.h), - ], - ) - ], - ), + sizedBoxHeight(35.h), + ], + ) + ], ), ), - ) + ), ], ); }, diff --git a/lib/onboarding/Signup/View/Individual/step3Selectyourgroup.dart b/lib/onboarding/Signup/View/Individual/step3Selectyourgroup.dart index 1f7fae5..447b062 100644 --- a/lib/onboarding/Signup/View/Individual/step3Selectyourgroup.dart +++ b/lib/onboarding/Signup/View/Individual/step3Selectyourgroup.dart @@ -83,121 +83,85 @@ class _SelectIndividualGroupState extends State { onTap: () => FocusManager.instance.primaryFocus?.unfocus(), child: Scaffold( backgroundColor: Color.fromARGB(255, 18, 32, 47), - bottomNavigationBar: Padding( - padding: const EdgeInsets.only(bottom: 10, left: 16, right: 16), - child: CustomButton( - text: "Continue", - onPressed: () { - // Get.toNamed(RouteName.individualcommunitystep4); - if (_selectedIndices.isEmpty) { - utils.showToast('Please select activity'); - } else { - print(_selectedIndices.toString()); - // String selectedIndicesString = - // _selectedIndices.join(','); - // print( - // 'Selected Indices: [$selectedIndicesString]'); - Uploadata(); - } - }, - ), - ), body: Stack( children: [ - Positioned(top: 70, left: -30, child: CommonBlurLeftSecond()), - Positioned(top: 400, right: -30, child: CommonBlurRightSecond()), - Positioned(top: 630, left: -30, child: CommonBlurLeftBlue()), - SingleChildScrollView( - child: GlassmorphicContainer( - width: MediaQuery.of(context).size.width, - height: - // 500.h, - MediaQuery.of(context).size.height, - borderRadius: 2, - blur: 6, - alignment: Alignment.bottomLeft, - border: 2, - linearGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - ], + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 40.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Align( + alignment: Alignment.topRight, + child: GestureDetector( + onTap: () { + Get.toNamed(RouteName.communitycommitscreen); + }, + child: Text( + 'Skip', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400, + decoration: TextDecoration.underline, + decorationColor: Colors.white), + ), + ), ), - borderGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - Color(0XFF222935).withOpacity(0.60), - - Color(0XFF222935).withOpacity(0.60), - ], - ), - child: - Padding( - padding: EdgeInsets.symmetric( - horizontal: 16.w, vertical: 50.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.topRight, - child: GestureDetector( - onTap: () { - Get.toNamed(RouteName.communitycommitscreen); - }, - child: Text( - 'Skip', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w400, - decoration: TextDecoration.underline, - decorationColor: Colors.white), - ), - ), - ), - sizedBoxHeight(30.h), - Align( - alignment: Alignment.center, - child: text16400white('Step 2 of 3')), - sizedBoxHeight(20.h), - Container( - width: double.infinity, - height: 25.h, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, color: Color(0xFF434A53)), - borderRadius: BorderRadius.circular(30), - ), - ), - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 8.w, vertical: 2.h), - child: Row( - children: [ - Container( - width: 216.w, - height: 15.h, + sizedBoxHeight(30.h), + Align( + alignment: Alignment.center, + child: text16400white('Step 2 of 3')), + sizedBoxHeight(20.h), + Container( + width: double.infinity, + height: 25.h, + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide(width: 1, color: Color(0xFF434A53)), + borderRadius: BorderRadius.circular(30), + ), + ), + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.w, vertical: 2.h), + child: Row( + children: [ + Container( + width: 216.w, + height: 15.h, + decoration: ShapeDecoration( + gradient: LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Color(0xA5D90B2E), + Color(0x42D90B2E) + ], + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + width: 15, + height: 15, decoration: ShapeDecoration( gradient: LinearGradient( begin: Alignment(0.98, -0.21), end: Alignment(-0.98, 0.21), colors: [ - Color(0xA5D90B2E), - Color(0x42D90B2E) + Color(0xFFD90B2E), + Color(0x60D90B2E) ], ), shape: RoundedRectangleBorder( @@ -205,152 +169,142 @@ class _SelectIndividualGroupState extends State { BorderRadius.circular(30), ), ), - child: Row( - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Container( - width: 15, - height: 15, - decoration: ShapeDecoration( - gradient: LinearGradient( - begin: Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), - colors: [ - Color(0xFFD90B2E), - Color(0x60D90B2E) - ], - ), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(30), - ), - ), - ) - ], - )) - ], - ), + ) + ], + )) + ], + ), + ), + ), + sizedBoxHeight(40.h), + Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + text20400white('Find your group'), + sizedBoxWidth(5.w), + Image.asset('assets/images/png/informationicon.png') + ], + )), + sizedBoxHeight(10.w), + Center( + child: Container( + width: 108.w, + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide( + width: 1, + strokeAlign: BorderSide.strokeAlignCenter, + color: Color(0xFF858585), ), ), - sizedBoxHeight(40.h), - Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - text20400white('Find your group'), - sizedBoxWidth(5.w), - Image.asset( - 'assets/images/png/informationicon.png') - ], - )), - sizedBoxHeight(10.w), - Center( - child: Container( - width: 108.w, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, - strokeAlign: BorderSide.strokeAlignCenter, - color: Color(0xFF858585), - ), - ), - ), + ), + ), + ), + sizedBoxHeight(30.h), + CustomTextFormField( + // textEditingController: searchcontroller, + texttype: TextInputType.text, + hintText: "Search groups", + leadingIcon: + // const Icon(Icons.mail_outline), + // SvgPicture.asset( + // // width: 23.w, + // // height: 23.h, + // 'assets/images/svg/search.svg', + // ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Icon( + Icons.search, + size: 35, + color: Colors.white, + ), + ), + // validatorText: "Enter your full name", + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + ], + onInput: (value) { + // Onboard().postGroupsearch({"search": value}, + // streamController: searchcontroller); + // searchGroups(value!); + Getonboard().getGroupsearch(value, + streamController: searchcontroller); + }, + ), + sizedBoxHeight(30.h), + StreamBuilder( + stream: searchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == + ConnectionState.waiting) { + // Display shimmer effect while waiting for data + return Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + // Handle error state + return Center( + child: Text( + '${snapshot.error} occurred', + style: TextStyle(fontSize: 18), ), - ), - sizedBoxHeight(30.h), - CustomTextFormField( - // textEditingController: searchcontroller, - texttype: TextInputType.text, - hintText: "Search groups", - leadingIcon: - // const Icon(Icons.mail_outline), - // SvgPicture.asset( - // // width: 23.w, - // // height: 23.h, - // 'assets/images/svg/search.svg', - // ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Icon( - Icons.search, - size: 35, - color: Colors.white, - ), - ), - // validatorText: "Enter your full name", - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - ], - onInput: (value) { - // Onboard().postGroupsearch({"search": value}, - // streamController: searchcontroller); - // searchGroups(value!); - Getonboard().getGroupsearch(value, - streamController: searchcontroller); - }, - ), - sizedBoxHeight(30.h), - StreamBuilder( - stream: searchcontroller.stream, - builder: (ctx, snapshot) { - if (snapshot.connectionState == - ConnectionState.waiting) { - // Display shimmer effect while waiting for data - return Center( - child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - // Handle error state - return Center( - child: Text( - '${snapshot.error} occurred', - style: TextStyle(fontSize: 18), - ), - ); - } else { - // Data has been loaded, show actual UI - return grouplistobj!.data!.isEmpty - ? _buildNoDataBody(context) - : Expanded( - child: GridView.builder( - physics: ScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 12.0, - mainAxisSpacing: 12.0, - ), - itemCount: grouplistobj!.data!.length, - itemBuilder: (context, index) { - return SizedBox( - height: - 150.0, // Adjust this height according to your design - child: GroupSelect( - titleString: grouplistobj! - .data![index].title!, - image: grouplistobj - ?.data?[index] - ?.groupImage ?? - '', - index: grouplistobj! - .data![index].id!, - isSelected: _selectedIndices - .contains(grouplistobj! - .data![index].id!), - onTap: _onContainerTap, - ), - ); - }, + ); + } else { + // Data has been loaded, show actual UI + return grouplistobj!.data!.isEmpty + ? _buildNoDataBody(context) + : Expanded( + child: GridView.builder( + physics: ScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 12.0, + mainAxisSpacing: 12.0, + ), + itemCount: grouplistobj!.data!.length, + itemBuilder: (context, index) { + return SizedBox( + height: + 150.0, // Adjust this height according to your design + child: GroupSelect( + titleString: + grouplistobj!.data![index].title!, + image: grouplistobj + ?.data?[index]?.groupImage ?? + '', + index: grouplistobj!.data![index].id!, + isSelected: _selectedIndices.contains( + grouplistobj!.data![index].id!), + onTap: _onContainerTap, ), ); - } - }, - ), - ], - ), - )), + }, + ), + ); + } + }, + ), + // sizedBoxHeight(40.h), + CustomButton( + text: "Continue", + onPressed: () { + // Get.toNamed(RouteName.individualcommunitystep4); + if (_selectedIndices.isEmpty) { + utils.showToast('Please select activity'); + } else { + print(_selectedIndices.toString()); + // String selectedIndicesString = + // _selectedIndices.join(','); + // print( + // 'Selected Indices: [$selectedIndicesString]'); + Uploadata(); + } + }, + ), + ], + ), ), ], )), diff --git a/lib/onboarding/Signup/View/Individual/step4Selectyourcommunity.dart b/lib/onboarding/Signup/View/Individual/step4Selectyourcommunity.dart index 7d8f6d5..ccfb471 100644 --- a/lib/onboarding/Signup/View/Individual/step4Selectyourcommunity.dart +++ b/lib/onboarding/Signup/View/Individual/step4Selectyourcommunity.dart @@ -84,121 +84,86 @@ class _SelectIndividualCommunityState extends State { onTap: () => FocusManager.instance.primaryFocus?.unfocus(), child: Scaffold( backgroundColor: Color.fromARGB(255, 18, 32, 47), - bottomNavigationBar: Padding( - padding: const EdgeInsets.only(bottom: 10, left: 16, right: 16), - child: CustomButton( - text: "Continue", - onPressed: () { - // Get.toNamed(RouteName.individualcommunitystep4); - if (_selectedIndices.isEmpty) { - utils.showToast('Please select activity'); - } else { - print(_selectedIndices.toString()); - // String selectedIndicesString = - // _selectedIndices.join(','); - // print( - // 'Selected Indices: [$selectedIndicesString]'); - Uploadata(); - } - }, - ), - ), body: Stack( children: [ - Positioned(top: 70, left: -30, child: CommonBlurLeftSecond()), - Positioned(top: 400, right: -30, child: CommonBlurRightSecond()), - Positioned(top: 630, left: -30, child: CommonBlurLeftBlue()), - SingleChildScrollView( - child: GlassmorphicContainer( - width: MediaQuery.of(context).size.width, - height: - // 500.h, - MediaQuery.of(context).size.height, - borderRadius: 2, - blur: 6, - alignment: Alignment.bottomLeft, - border: 2, - linearGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - ], + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 40.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Align( + alignment: Alignment.topRight, + child: GestureDetector( + onTap: () { + Get.toNamed(RouteName.communitycommitscreen); + }, + child: Text( + 'Skip', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400, + decoration: TextDecoration.underline, + decorationColor: Colors.white), + ), + ), ), - borderGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - Color(0XFF222935).withOpacity(0.60), - - Color(0XFF222935).withOpacity(0.60), - ], - ), - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 16.w, vertical: 50.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.topRight, - child: GestureDetector( - onTap: () { - Get.toNamed(RouteName.communitycommitscreen); - }, - child: Text( - 'Skip', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w400, - decoration: TextDecoration.underline, - decorationColor: Colors.white), - ), - ), - ), - sizedBoxHeight(30.h), - Align( - alignment: Alignment.center, - child: text16400white('Step 3 of 3')), - sizedBoxHeight(20.h), - Container( - width: double.infinity, - height: 25.h, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, color: Color(0xFF434A53)), - borderRadius: BorderRadius.circular(30), - ), - ), - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 8.w, vertical: 2.h), - child: Row( - children: [ - Expanded( - child: Container( - // width: 216.w, - height: 15.h, + sizedBoxHeight(30.h), + Align( + alignment: Alignment.center, + child: text16400white('Step 3 of 3')), + sizedBoxHeight(20.h), + Container( + width: double.infinity, + height: 25.h, + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide(width: 1, color: Color(0xFF434A53)), + borderRadius: BorderRadius.circular(30), + ), + ), + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.w, vertical: 2.h), + child: Row( + children: [ + Expanded( + child: Container( + // width: 216.w, + height: 15.h, + decoration: ShapeDecoration( + gradient: LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Color(0xA5D90B2E), + Color(0x42D90B2E) + ], + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + width: 15, + height: 15, decoration: ShapeDecoration( gradient: LinearGradient( begin: Alignment(0.98, -0.21), end: Alignment(-0.98, 0.21), colors: [ - Color(0xA5D90B2E), - Color(0x42D90B2E) + Color(0xFFD90B2E), + Color(0x60D90B2E) ], ), shape: RoundedRectangleBorder( @@ -206,156 +171,145 @@ class _SelectIndividualCommunityState extends State { BorderRadius.circular(30), ), ), - child: Row( - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Container( - width: 15, - height: 15, - decoration: ShapeDecoration( - gradient: LinearGradient( - begin: - Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), - colors: [ - Color(0xFFD90B2E), - Color(0x60D90B2E) - ], - ), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular( - 30), - ), - ), - ) - ], - ))) - ], - ), + ) + ], + ))) + ], + ), + ), + ), + sizedBoxHeight(40.h), + Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + text20400white('Find your community'), + sizedBoxWidth(5.w), + Image.asset( + 'assets/images/png/informationicon.png', + ) + ], + )), + sizedBoxHeight(10.w), + Center( + child: Container( + width: 108.w, + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide( + width: 1, + strokeAlign: BorderSide.strokeAlignCenter, + color: Color(0xFF858585), ), ), - sizedBoxHeight(40.h), - Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - text20400white('Find your community'), - sizedBoxWidth(5.w), - Image.asset( - 'assets/images/png/informationicon.png', - ) - ], - )), - sizedBoxHeight(10.w), - Center( - child: Container( - width: 108.w, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, - strokeAlign: BorderSide.strokeAlignCenter, - color: Color(0xFF858585), - ), - ), - ), + ), + ), + ), + sizedBoxHeight(30.h), + CustomTextFormField( + texttype: TextInputType.text, + hintText: "Search community", + leadingIcon: + // const Icon(Icons.mail_outline), + // SvgPicture.asset( + // // width: 23.w, + // // height: 23.h, + // 'assets/images/svg/search.svg', + // ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Icon( + Icons.search, + size: 35, + color: Colors.white, + ), + ), + // validatorText: "Enter your full name", + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + ], + onInput: (value) { + // Onboard().postGroupsearch({"search": value}, + // streamController: searchcontroller); + // searchGroups(value!); + Getonboard().getCommunitysearch(value, + streamController: searchcontroller); + }, + ), + sizedBoxHeight(30.h), + StreamBuilder( + stream: searchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == + ConnectionState.waiting) { + // Display shimmer effect while waiting for data + return Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + // Handle error state + return Center( + child: Text( + '${snapshot.error} occurred', + style: TextStyle(fontSize: 18), ), - ), - sizedBoxHeight(30.h), - CustomTextFormField( - texttype: TextInputType.text, - hintText: "Search community", - leadingIcon: - // const Icon(Icons.mail_outline), - // SvgPicture.asset( - // // width: 23.w, - // // height: 23.h, - // 'assets/images/svg/search.svg', - // ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Icon( - Icons.search, - size: 35, - color: Colors.white, - ), - ), - // validatorText: "Enter your full name", - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - ], - onInput: (value) { - // Onboard().postGroupsearch({"search": value}, - // streamController: searchcontroller); - // searchGroups(value!); - Getonboard().getCommunitysearch(value, - streamController: searchcontroller); - }, - ), - sizedBoxHeight(30.h), - StreamBuilder( - stream: searchcontroller.stream, - builder: (ctx, snapshot) { - if (snapshot.connectionState == - ConnectionState.waiting) { - // Display shimmer effect while waiting for data - return Center( - child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - // Handle error state - return Center( - child: Text( - '${snapshot.error} occurred', - style: TextStyle(fontSize: 18), - ), - ); - } else { - // Data has been loaded, show actual UI - return communitylistobj!.data!.isEmpty - ? _buildNoDataBody(context) - : Expanded( - child: GridView.builder( - physics: ScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 12.0, - mainAxisSpacing: 12.0, - ), - itemCount: - communitylistobj!.data!.length, - itemBuilder: (context, index) { - return SizedBox( - height: - 150.0, // Adjust this height according to your design - child: CommunitySelect( - titleString: communitylistobj! - .data![index] - .communityName!, - image: communitylistobj - ?.data?[index] - ?.communityProfilePhoto ?? - '', - index: communitylistobj! - .data![index].id!, - isSelected: _selectedIndices - .contains(communitylistobj! - .data![index].id!), - onTap: _onContainerTap, - ), - ); - }, + ); + } else { + // Data has been loaded, show actual UI + return communitylistobj!.data!.isEmpty + ? _buildNoDataBody(context) + : Expanded( + child: GridView.builder( + physics: ScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 12.0, + mainAxisSpacing: 12.0, + ), + itemCount: communitylistobj!.data!.length, + itemBuilder: (context, index) { + return SizedBox( + height: + 150.0, // Adjust this height according to your design + child: CommunitySelect( + titleString: communitylistobj! + .data![index].communityName!, + image: communitylistobj?.data?[index] + ?.communityProfilePhoto ?? + '', + index: communitylistobj! + .data![index].id!, + isSelected: _selectedIndices.contains( + communitylistobj! + .data![index].id!), + onTap: _onContainerTap, ), ); - } - }, - ), - ], - ), - )), + }, + ), + ); + } + }, + ), + // sizedBoxHeight(30), + CustomButton( + text: "Continue", + onPressed: () { + // Get.toNamed(RouteName.individualcommunitystep4); + if (_selectedIndices.isEmpty) { + utils.showToast('Please select activity'); + } else { + print(_selectedIndices.toString()); + // String selectedIndicesString = + // _selectedIndices.join(','); + // print( + // 'Selected Indices: [$selectedIndicesString]'); + Uploadata(); + } + }, + ), + ], + ), ), ], )), diff --git a/lib/onboarding/Signup/View/Individual/tellusindividual.dart b/lib/onboarding/Signup/View/Individual/tellusindividual.dart index cd2ff02..a698d8a 100644 --- a/lib/onboarding/Signup/View/Individual/tellusindividual.dart +++ b/lib/onboarding/Signup/View/Individual/tellusindividual.dart @@ -368,7 +368,7 @@ class _TellusaboutIndividualState extends State { sizedBoxHeight(10.h), text16400white('Gender'), sizedBoxHeight(10.h), - CustomDropDownWidgetSignup( + CustomDropDownRadio( header: 'Select gender', title: '', listData: _gender, diff --git a/lib/onboarding/Signup/View/communitycommitment.dart b/lib/onboarding/Signup/View/communitycommitment.dart index 63eb617..7c441c5 100644 --- a/lib/onboarding/Signup/View/communitycommitment.dart +++ b/lib/onboarding/Signup/View/communitycommitment.dart @@ -23,130 +23,95 @@ class _CommunitycommitmentState extends State { backgroundColor: Color.fromARGB(255, 18, 32, 47), body: Stack( children: [ - // Positioned(top: 220, left: -30, child: CommonBlurLeftSecond()), - Positioned(top: 230, right: -30, child: CommonBlurRightSecond()), - // Positioned(top: 530, left: -30, child: CommonBlurLeftBlue()), - GlassmorphicContainer( - width: MediaQuery.of(context).size.width, - height: - // 500.h, - MediaQuery.of(context).size.height, - borderRadius: 2, - blur: 6, - alignment: Alignment.bottomLeft, - border: 2, - linearGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - ], - ), - borderGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - Color(0XFF222935).withOpacity(0.60), - - Color(0XFF222935).withOpacity(0.60), - ], - ), - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 16.w, vertical: 50.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // SvgPicture.asset('assets/images/svg/redregroupicon.svg'), - Image.asset('assets/images/png/redregroup.png'), - sizedBoxHeight(30.h), - Container( - width: 358.w, - height: 519.h, - decoration: ShapeDecoration( - gradient: LinearGradient( - begin: Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), - colors: [ - Colors.white.withOpacity(0.05999999865889549), - Colors.white.withOpacity(0.07999999821186066) - ], - ), - shape: RoundedRectangleBorder( - side: BorderSide( - width: 0.80, color: Color(0xFF434A53)), - borderRadius: BorderRadius.circular(5), - ), - ), - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 16.w, vertical: 0.h), - child: Scrollbar( - thumbVisibility: true, - radius: Radius.circular(20.r), - // thickness: 6, - controller: _scrollController, - child: SingleChildScrollView( - controller: _scrollController, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(10.h), - text16400white('Our community commitment'), - sizedBoxHeight(10.h), - Container( - width: 222.w, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1, - strokeAlign: - BorderSide.strokeAlignCenter, - color: Color(0xFF858585), - ), - ), + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 50.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // SvgPicture.asset('assets/images/svg/redregroupicon.svg'), + Image.asset('assets/images/png/redregroup.png'), + sizedBoxHeight(30.h), + Container( + width: 358.w, + height: 519.h, + decoration: ShapeDecoration( + gradient: LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Colors.white.withOpacity(0.05999999865889549), + Colors.white.withOpacity(0.07999999821186066) + ], + ), + shape: RoundedRectangleBorder( + side: BorderSide(width: 0.80, color: Color(0xFF434A53)), + borderRadius: BorderRadius.circular(5), + ), + ), + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), + child: Scrollbar( + thumbVisibility: true, + radius: Radius.circular(20.r), + // thickness: 6, + controller: _scrollController, + child: SingleChildScrollView( + controller: _scrollController, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(10.h), + text16400white('Our community commitment'), + sizedBoxHeight(10.h), + Container( + width: 222.w, + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide( + width: 1, + strokeAlign: BorderSide.strokeAlignCenter, + color: Color(0xFF858585), ), ), - sizedBoxHeight(20.h), - text20400white( - 'Regroup is a community where everyone ca belong'), - sizedBoxHeight(15.h), - text16400white( - '''Lorem ipsum dolor sit amet, consectetur adipis elit. Ut et massa mi. Aliquam in hendrerit urna.\n\nPellentesque sit amet sapien fringilla, mattis ligula consectetur, ultrices mauris. Maecenas vitae mattis tellus. Nullam quis imperdiet augue. Vestibulum auctor ornare leo, non suscipit magna interdum eu. Curabitur pellentesque nibh nibh, at maximus ante fermentum sit amet. Pellentesque commodo lacus at sodales sodales. Quisque sagittis orci ut diam condimentum, vel euismod erat placerat. In iaculis arcu eros, Quisque sagittis orci ut diam condimentum, vel euismod erat placerat. In iaculis arcu eros, Quisque sagittis orci ut diam condimentum, vel euismod erat placerat. '''), - sizedBoxHeight(10.h), - ], + ), ), - ), + sizedBoxHeight(20.h), + text20400white( + 'Regroup is a community where everyone ca belong'), + sizedBoxHeight(15.h), + text16400white( + '''Lorem ipsum dolor sit amet, consectetur adipis elit. Ut et massa mi. Aliquam in hendrerit urna.\n\nPellentesque sit amet sapien fringilla, mattis ligula consectetur, ultrices mauris. Maecenas vitae mattis tellus. Nullam quis imperdiet augue. Vestibulum auctor ornare leo, non suscipit magna interdum eu. Curabitur pellentesque nibh nibh, at maximus ante fermentum sit amet. Pellentesque commodo lacus at sodales sodales. Quisque sagittis orci ut diam condimentum, vel euismod erat placerat. In iaculis arcu eros, Quisque sagittis orci ut diam condimentum, vel euismod erat placerat. In iaculis arcu eros, Quisque sagittis orci ut diam condimentum, vel euismod erat placerat. '''), + sizedBoxHeight(10.h), + ], ), ), ), - Spacer( - flex: 2, - ), - CustomButton( - text: 'Agree & continue', - onPressed: () { - Get.toNamed(RouteName.signupendpage); - }), - sizedBoxHeight(20.h), - CustomButton2( - text: 'Decline', - onPressed: () { - Get.offAllNamed(RouteName.loginScreen); - }) - ], + ), ), - )), + Spacer( + flex: 2, + ), + CustomButton( + text: 'Agree & continue', + onPressed: () { + Get.toNamed(RouteName.signupendpage); + }), + sizedBoxHeight(20.h), + CustomButton2( + text: 'Decline', + onPressed: () { + Get.offAllNamed(RouteName.loginScreen); + }) + ], + ), + ) ], )); } diff --git a/lib/onboarding/Signup/View/signupendpage.dart b/lib/onboarding/Signup/View/signupendpage.dart index 9da949c..68f0340 100644 --- a/lib/onboarding/Signup/View/signupendpage.dart +++ b/lib/onboarding/Signup/View/signupendpage.dart @@ -23,97 +23,62 @@ class _SignupendPageState extends State { backgroundColor: Color.fromARGB(255, 18, 32, 47), body: Stack( children: [ - Positioned(top: 100, left: -30, child: CommonBlurLeftSecond()), - Positioned(top: 300, right: -30, child: CommonBlurRightSecond()), - Positioned(top: 530, left: -30, child: CommonBlurLeftBlue()), - Positioned(top: 750, right: 40, child: CommonBlurRightSecond()), - GlassmorphicContainer( - width: MediaQuery.of(context).size.width, - height: - // 500.h, - MediaQuery.of(context).size.height, - borderRadius: 2, - blur: 6, - alignment: Alignment.bottomLeft, - border: 2, - linearGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - ], - ), - borderGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - Color(0XFF222935).withOpacity(0.60), - - Color(0XFF222935).withOpacity(0.60), - ], - ), - child: Center( - child: Container( - width: 358.w, - height: 519.h, - decoration: ShapeDecoration( - gradient: LinearGradient( - begin: Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), - colors: [ - Colors.white.withOpacity(0.05999999865889549), - Colors.white.withOpacity(0.07999999821186066) - ], + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Center( + child: Container( + width: 358.w, + height: 519.h, + decoration: ShapeDecoration( + gradient: LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Colors.white.withOpacity(0.05999999865889549), + Colors.white.withOpacity(0.07999999821186066) + ], + ), + shape: RoundedRectangleBorder( + side: BorderSide(width: 0.80, color: Color(0xFF434A53)), + borderRadius: BorderRadius.circular(5), + ), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 30.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset('assets/images/png/regroupredtexticon.png'), + sizedBoxHeight(30.h), + text25700white('Welcome Edward '), + sizedBoxHeight(20.h), + // text16400white( + // '''Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.'''), + Text( + '''Congratulations, your account has been successfully created. Get ready to regroup with your community''', + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xCCFCFCFC), + fontSize: 16.sp, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400, + ), ), - shape: RoundedRectangleBorder( - side: - BorderSide(width: 0.80, color: Color(0xFF434A53)), - borderRadius: BorderRadius.circular(5), - ), - ), - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 30.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/png/regroupredtexticon.png'), - sizedBoxHeight(30.h), - text25700white('Welcome Edward '), - sizedBoxHeight(20.h), - // text16400white( - // '''Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.'''), - Text( - '''Congratulations, your account has been successfully created. Get ready to regroup with your community''', - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xCCFCFCFC), - fontSize: 16.sp, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w400, - ), - ), - sizedBoxHeight(20.h), - CustomButton( - text: "Let's begin", - onPressed: () { - Get.toNamed(RouteName.mainscreen); - }) - ], - ), - )), - )), + sizedBoxHeight(20.h), + CustomButton( + text: "Let's begin", + onPressed: () { + Get.toNamed(RouteName.mainscreen); + }) + ], + ), + )), + ) ], )); } diff --git a/lib/onboarding/Signup/View/signupscreen.dart b/lib/onboarding/Signup/View/signupscreen.dart index cd41d17..778b929 100644 --- a/lib/onboarding/Signup/View/signupscreen.dart +++ b/lib/onboarding/Signup/View/signupscreen.dart @@ -55,16 +55,17 @@ class _SignupScreenState extends State { _loginWithGoogle() { googleSigninController.handleGoogleSignIn().then((value) async { + final resp = await LoginAPI().storeGoogleSignin( + {"google_access_token": value, "one_signal_player_id": "ABCD"}); if (value != 'Google Sign-In canceled') { - final resp = await LoginAPI().storeGoogleSignin( - {"google_access_token": value, "one_signal_player_id": "ABCD"}); if (resp.message == "go-to-signin-via-oauth") { Get.toNamed(RouteName.verifygoogleapplepage, arguments: {"email": resp.data}); } else if (value == null) { Get.snackbar( 'Error', - 'Google Sign-In canceled', + resp.data["message"][0], + duration: const Duration(seconds: 2), snackPosition: SnackPosition.BOTTOM, backgroundColor: Colors.red, colorText: Colors.white, @@ -86,7 +87,7 @@ class _SignupScreenState extends State { } else { Get.snackbar( 'Error', - 'Google Sign-In canceled', + resp.data["message"][0], snackPosition: SnackPosition.BOTTOM, backgroundColor: Colors.red, colorText: Colors.white, diff --git a/lib/onboarding/Signup/View/verifyuser.dart b/lib/onboarding/Signup/View/verifyuser.dart index c6cf12d..fd4f506 100644 --- a/lib/onboarding/Signup/View/verifyuser.dart +++ b/lib/onboarding/Signup/View/verifyuser.dart @@ -2,22 +2,16 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:glassmorphism/glassmorphism.dart'; import 'package:pin_code_fields/pin_code_fields.dart'; import 'package:regroup/Common/base_manager.dart'; - -import 'package:regroup/Global.dart'; - import 'package:regroup/Utils/Common/CommonAppbar.dart'; import 'package:regroup/Utils/Common/CustomNextButton.dart'; -import 'package:regroup/Utils/Common/blureffect.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/onboarding/Signup/view_model/postmethod.dart'; import 'package:regroup/resources/routes/route_name.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:timer_button/timer_button.dart'; class VerifyuserScreenState extends StatefulWidget { @@ -38,50 +32,53 @@ class _VerifyuserScreenStateState extends State { int accounttypenumber = Get.arguments["accountypenumber"]; Uploadata() async { - utils.loader(); + // utils.loader(); Map updata = { "email_address": email, "password": userpassword, "account_type": accounttypenumber, "otp": pincode.text }; - final data = await Onboard().Postverifyregisteration(updata); - if (data.status == ResponseStatus.SUCCESS) { + // final data = res + final res = await Onboard().Postverifyregisteration(updata); + if (res.status == ResponseStatus.SUCCESS) { Get.back(); print("verification done"); if (accounttype == 'Individual') { print('individual selected'); - Get.toNamed(RouteName.tellusindividualscreen, - // arguments: { - // 'pageroute' : "nextscreen" - // } + Get.toNamed( + RouteName.tellusindividualscreen, + // arguments: { + // 'pageroute' : "nextscreen" + // } ); } else if (accounttype == 'Business') { print('business selected'); - Get.toNamed(RouteName.tellusbusinessscreen, - // arguments: { - // 'pageroute' : "nextscreen" - // } + Get.toNamed( + RouteName.tellusbusinessscreen, + // arguments: { + // 'pageroute' : "nextscreen" + // } ); } - return utils.showToast(data.message); - } - else { - // btnController.error(); - // btnController.reset(); - Get.snackbar( - "Error!", - data.data['message'], - duration: Duration(seconds: 2), - colorText: Colors.white, - backgroundColor: Colors.red, - margin: EdgeInsets.all(8), - snackStyle: SnackStyle.FLOATING, - snackPosition: SnackPosition.BOTTOM, - ); - } + return utils.showToast(res.message); + } else { + // btnController.error(); + // btnController.reset(); + Get.snackbar( + "Error!", + res.data['message'], + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.red, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + } + // else { // Get.back(); // print("verification not done"); @@ -90,7 +87,7 @@ class _VerifyuserScreenStateState extends State { } Uploadataresendotp() async { - utils.loader(); + // utils.loader(); Map updata = { "email_address": email, "password": userpassword, @@ -98,13 +95,43 @@ class _VerifyuserScreenStateState extends State { }; final data = await Onboard().Postregisteration(updata); if (data.status == ResponseStatus.SUCCESS) { - Get.back(); - print("resend up done"); - return utils.showToast(data.message); - } else { - Get.back(); - print("resend not done"); - return utils.showToast(data.message); + // Get.back(); + // print("resend up done"); + // return utils.showToast(data.message); + Get.snackbar( + "Success!", + 'OTP has been sent to your email address!', + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.green, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + setState(() { + pincode.clear(); + // turnValidation = false; + }); + } + // else { + // Get.back(); + // print("resend not done"); + // return utils.showToast(data.message); + // } + + else { + // btnController.error(); + // btnController.reset(); + Get.snackbar( + "Error!", + data.data['message'], + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.red, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); } } @@ -117,45 +144,13 @@ class _VerifyuserScreenStateState extends State { ), body: Stack( children: [ - // CommonBlurLeftSecond(), - Positioned(top: 150, right: -30, child: CommonBlurRightSecond()), - Positioned(top: 350, left: -30, child: CommonBlurLeftBlue()), - GlassmorphicContainer( - width: MediaQuery.of(context).size.width, - height: - // 500.h, - MediaQuery.of(context).size.height, - borderRadius: 2, - blur: 6, - alignment: Alignment.bottomLeft, - border: 2, - linearGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), - - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - ], - ), - borderGradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - Color(0XFF222935).withOpacity(0.60), - - Color(0XFF222935).withOpacity(0.60), - ], - ), - child: Padding( + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -273,7 +268,7 @@ class _VerifyuserScreenStateState extends State { ), ], ), - )), + ) ], ), ); diff --git a/lib/onboarding/Signup/view_model/postmethod.dart b/lib/onboarding/Signup/view_model/postmethod.dart index 548b479..e4396d9 100644 --- a/lib/onboarding/Signup/view_model/postmethod.dart +++ b/lib/onboarding/Signup/view_model/postmethod.dart @@ -4,6 +4,7 @@ import 'package:regroup/Common/api_urls.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/data/network/network_api.dart'; import 'package:regroup/Global.dart'; +import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/onboarding/Signup/Model/Onboarding/Individual/tellusIndividual.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -16,6 +17,12 @@ class Onboard { .postApi(updata, ApiUrls.registeration, optionalpar: true); print("response is ${response.data}"); print("response message is ${response.message}"); + if (response.status == ResponseStatus.SUCCESS) { + //Map responseData = jsonDecode(response.data); + + return ResponseData( + response.data['message'], ResponseStatus.SUCCESS); + } return response; } @@ -25,18 +32,34 @@ class Onboard { .postApi(updata, ApiUrls.verifyregisteration, optionalpar: true); print("response is ${response.data}"); print("response message is ${response.message}"); - final SharedPreferences prefs = await SharedPreferences.getInstance(); - Map res = response.data; - print("res is $res"); - await prefs.setString('access-token', res['data']['token']); + // final SharedPreferences prefs = await SharedPreferences.getInstance(); + // Map res = response.data; + // print("res is $res"); + // await prefs.setString('access-token', res['data']['token']); // await prefs.setInt('isprofileupdate', res['data']['is_profile_updated']); - token = res['data']['token']; + // token = res['data']['token']; print("token is $token"); print("email is $emailid"); print("profile update value is $isprofileupdated"); + if (response.status == ResponseStatus.SUCCESS) { + //Map responseData = jsonDecode(response.data); + final SharedPreferences prefs = await SharedPreferences.getInstance(); + Map res = response.data; + print("res is $res"); + await prefs.setString('access-token', res['data']['token']); + token = res['data']['token']; + + // if (response.data['status'] == "error") { + // // return ResponseData( + // // response.data['message'], ResponseStatus.SUCCESS); + // return utils.showToast(response.data['message']); + // } + return ResponseData( + response.data['message'], ResponseStatus.SUCCESS); + } return response; } @@ -50,7 +73,8 @@ class Onboard { if (response.status == ResponseStatus.SUCCESS) { if (response.data['status'] == 'success') { - TellusIndividualModel tellusindiObj = TellusIndividualModel.fromJson(response.data); + TellusIndividualModel tellusindiObj = + TellusIndividualModel.fromJson(response.data); // await prefs.setString('fullname', tellusindiObj.data?.profile?.fullName ?? ""); // await prefs.setString('username', tellusindiObj.data?.profile?.userName ?? ""); // await prefs.setString('email', tellusindiObj.data?.profile?.emailAddress ?? ""); @@ -60,7 +84,6 @@ class Onboard { // myusername = tellusindiObj.data?.profile?.userName; // fullname = tellusindiObj.data?.profile?.fullName; // phonenumber = tellusindiObj.data?.profile?.phoneNumber; - } else { return ResponseData( response.data['message'], ResponseStatus.FAILED); diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index c987df1..21aacea 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -45,7 +45,7 @@ import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/ContactUs import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/DeleteAccount.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/FaqScreen.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/HelpAndSupport.dart'; -import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/Notification.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/View/Notification.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/PrivacyPolicy.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/ReportABug.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/Settings.dart'; -- 2.34.1