diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index 2e07d2b..a8c14e7 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -8,9 +8,6 @@ class ApiUrls { static const letUsUnderstandApi = "${baseUrl}update-business-profile-step-1"; static const resetpassword = "${baseUrl}reset-password"; - - - static const registeration = "${baseUrl}send_otp"; static const verifyregisteration = "${baseUrl}verify_otp"; @@ -29,11 +26,7 @@ class ApiUrls { static const postcommunities = "${baseUrl}select-communities"; - - - - - - static const googlelogin = "${baseUrl}sign-in-with-google-login"; + + static const storeDetailsOfOAuth = "${baseUrl}update-user-account-type"; } diff --git a/lib/Common/controller/data/network/network_api.dart b/lib/Common/controller/data/network/network_api.dart index 6179c3c..0ae9574 100644 --- a/lib/Common/controller/data/network/network_api.dart +++ b/lib/Common/controller/data/network/network_api.dart @@ -149,9 +149,7 @@ class NetworkApiServices { //New post api - @override - Future postApi(data, String url, {bool optionalpar = false}) async { if (kDebugMode) { @@ -175,11 +173,7 @@ class NetworkApiServices { }, ) : Options( - headers: { - 'authorization': basicAuth, - 'access-token': - "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3JlZ3JvdXAuYmV0YWRlbGl2ZXJ5LmNvbS9hcGkvdjEvdmVyaWZ5X290cCIsImlhdCI6MTcyMDYwNDQzNSwibmJmIjoxNzIwNjA0NDM1LCJqdGkiOiJIbG5qdFVqcnBXRldlMjBsIiwic3ViIjoiMzciLCJwcnYiOiI0MGJjM2ZkZTM0NjI1N2E4NTA5NTAyZmU2NDIzNTU5YTExMTY0YmQzIn0.rsaasWoorwiRMcJPO_oluIbfvw48h-P6tfEs8fCnzpM" - }, + headers: {'authorization': basicAuth, 'access-token': token}, ), ); log(response.toString()); @@ -202,7 +196,6 @@ class NetworkApiServices { ); } if (e.response!.statusCode == 403) { - if (e.response!.data['message'] is List) { return ResponseData( e.response!.data['message'][0]!, ResponseStatus.FAILED, @@ -212,7 +205,6 @@ class NetworkApiServices { e.response!.data['message'], ResponseStatus.FAILED, data: e.response!.data); } - } } return ResponseData( @@ -247,7 +239,7 @@ class NetworkApiServices { Response response; SharedPreferences prefs = await SharedPreferences.getInstance(); // ignore: unused_local_variable - String? token = prefs.getString('token').toString(); + String? token = prefs.getString('access-token').toString(); try { response = await dio.post(url, data: data, @@ -369,7 +361,7 @@ class NetworkApiServices { Response response; SharedPreferences prefs = await SharedPreferences.getInstance(); // String? token = prefs.getString('token'); - String? token = prefs.getString('token').toString(); + String? token = prefs.getString('access-token').toString(); print("token is $token"); try { response = await dio.post(url, diff --git a/lib/Login/View/loginscreen.dart b/lib/Login/View/loginscreen.dart index 021eadc..48821a7 100644 --- a/lib/Login/View/loginscreen.dart +++ b/lib/Login/View/loginscreen.dart @@ -50,7 +50,7 @@ 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); logger.d("go to sign in"); } else { Get.snackbar( @@ -155,7 +155,6 @@ class _LoginScreenState extends State { }; final data = await LoginAPI().loginApi(updata); if (data.status == ResponseStatus.SUCCESS) { - // await global.setname(); Get.snackbar( "Success!", @@ -402,7 +401,8 @@ class _LoginScreenState extends State { GestureDetector( onTap: () { _loginWithApple(); - Get.toNamed(RouteName.verifygoogleapplepage); + Get.toNamed( + RouteName.verifygoogleapplepage); }, child: Container( width: 55, @@ -412,10 +412,10 @@ class _LoginScreenState extends State { 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) + Colors.white.withOpacity( + 0.07999999821186066), + Colors.white.withOpacity( + 0.12999999523162842) ], ), shape: const OvalBorder( @@ -432,7 +432,6 @@ class _LoginScreenState extends State { GestureDetector( onTap: () { _loginWithGoogle(); - Get.toNamed(RouteName.verifygoogleapplepage); }, child: Container( width: 55, @@ -442,10 +441,10 @@ class _LoginScreenState extends State { 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) + Colors.white.withOpacity( + 0.07999999821186066), + Colors.white.withOpacity( + 0.12999999523162842) ], ), shape: const OvalBorder( diff --git a/lib/Login/View/verifygoogleapple.dart b/lib/Login/View/verifygoogleapple.dart index cff7003..2fac0b9 100644 --- a/lib/Login/View/verifygoogleapple.dart +++ b/lib/Login/View/verifygoogleapple.dart @@ -35,20 +35,22 @@ class _VerifygoogleandappleState extends State { }); } + + @override Widget build(BuildContext context) { return GestureDetector( onTap: () => FocusManager.instance.primaryFocus?.unfocus(), child: Scaffold( - appBar: CommonAppbar( + appBar: const CommonAppbar( titleTxt: '', ), - - backgroundColor: Color.fromARGB(255, 18, 32, 47), + backgroundColor: const Color.fromARGB(255, 18, 32, 47), body: Stack( children: [ - Positioned(top: 310, right: -30, child: CommonBlurRightSecond()), - Positioned(top: 510, left: -30, child: CommonBlurLeftBlue()), + const Positioned( + top: 310, right: -30, child: CommonBlurRightSecond()), + const Positioned(top: 510, left: -30, child: CommonBlurLeftBlue()), GlassmorphicContainer( width: MediaQuery.of(context).size.width, height: @@ -62,10 +64,10 @@ class _VerifygoogleandappleState extends State { 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), + const Color(0XFF222935).withOpacity(0.60), + const Color(0XFF222935).withOpacity(0.60), + const Color(0XFF222935).withOpacity(0.60), + const Color(0XFF222935).withOpacity(0.60), // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), @@ -79,9 +81,9 @@ class _VerifygoogleandappleState extends State { colors: [ // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), // Color.fromARGB(255, 18, 32, 47).withOpacity(0.50), - Color(0XFF222935).withOpacity(0.60), + const Color(0XFF222935).withOpacity(0.60), - Color(0XFF222935).withOpacity(0.60), + const Color(0XFF222935).withOpacity(0.60), ], ), child: Padding( @@ -94,7 +96,7 @@ class _VerifygoogleandappleState extends State { sizedBoxHeight(10.h), Container( width: 154, - decoration: ShapeDecoration( + decoration: const ShapeDecoration( shape: RoundedRectangleBorder( side: BorderSide( width: 1, @@ -152,7 +154,7 @@ class _VerifygoogleandappleState extends State { CustomDropDownRadio( header: '', title: '', - listData: [ + listData: const [ 'Individual', 'Business', ], @@ -161,7 +163,7 @@ class _VerifygoogleandappleState extends State { 'assets/images/png/user.png', ), ), - Spacer( + const Spacer( flex: 3, ), CustomButton( @@ -176,10 +178,7 @@ class _VerifygoogleandappleState extends State { // Uploadata(); } }), - Spacer( - - ) - + const Spacer() ], ), ), diff --git a/lib/Login/ViewModel/LoginApi.dart b/lib/Login/ViewModel/LoginApi.dart index c1da2dc..280d05b 100644 --- a/lib/Login/ViewModel/LoginApi.dart +++ b/lib/Login/ViewModel/LoginApi.dart @@ -7,22 +7,15 @@ import 'package:shared_preferences/shared_preferences.dart'; class LoginAPI { Future loginApi(var data) async { SharedPreferences prefs = await SharedPreferences.getInstance(); - final response = await NetworkApiServices().postApi(data, - ApiUrls.getlogin, - // 'https://regroup.betadelivery.com/api/v1/login', - optionalpar: true - - // "auth/login/", - ); + final response = await NetworkApiServices() + .postApi(data, ApiUrls.getlogin, optionalpar: true); if (response.status == ResponseStatus.SUCCESS) { - //Map responseData = jsonDecode(response.data); if (response.data['status'] == 'success') { LoginModel loginObj = LoginModel.fromJson(response.data); await prefs.setString('access-token', loginObj.data!.accessToken!); - // await prefs.setString('refreshToken', loginObj.data!.refresh!); + print("token is ${loginObj.data!.accessToken!}"); - // print("refresh-token is ${loginObj.data!.refresh!}"); } else { return ResponseData( response.data['message'], ResponseStatus.FAILED); @@ -48,4 +41,14 @@ class LoginAPI { return response; } + + 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) {} + + return response; + } } diff --git a/lib/Utils/Common/CommonDropdown.dart b/lib/Utils/Common/CommonDropdown.dart index 1c07bfd..0ba659c 100644 --- a/lib/Utils/Common/CommonDropdown.dart +++ b/lib/Utils/Common/CommonDropdown.dart @@ -48,7 +48,7 @@ class _CustomDropDownWidgetSignupState padding: EdgeInsets.only( top: 14.0, bottom: 14.0, right: 22.w, left: 12.w), decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: onDropTap.value ? BorderRadius.vertical( top: Radius.circular(30.r), @@ -98,7 +98,7 @@ class _CustomDropDownWidgetSignupState Container( width: double.infinity, decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: BorderRadius.vertical( bottom: Radius.circular(30.r), ), @@ -139,7 +139,7 @@ class _CustomDropDownWidgetSignupState ), // sizedBoxHeight(5.h), if (index != widget.listData.length - 1) - Divider(thickness: 1, color: const Color(0xFF434A53)), + const Divider(thickness: 1, color: Color(0xFF434A53)), ], ), ); @@ -216,7 +216,7 @@ class _CustomDropDownTag1State extends State { left: 12.w, ), decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, @@ -278,7 +278,7 @@ class _CustomDropDownTag1State extends State { Container( width: double.infinity, decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: BorderRadius.vertical( bottom: Radius.circular(30.r), ), @@ -320,14 +320,14 @@ class _CustomDropDownTag1State extends State { fontWeight: FontWeight.w400, fontFamily: 'Helvetica'), ), - Spacer(), + const Spacer(), text14400whiteblur(widget.rowData[widget.listData .indexOf(filteredListData[index])]), ], ), ), if (index != filteredListData.length - 1) - Divider(thickness: 1, color: const Color(0xFF434A53)), + const Divider(thickness: 1, color: Color(0xFF434A53)), ], ), ); @@ -383,7 +383,7 @@ class _CustomDropDownTagState extends State { padding: EdgeInsets.only( top: 14.0, bottom: 14.0, right: 22.w, left: 12.w), decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: onDropTap.value ? BorderRadius.vertical( top: Radius.circular(30.r), @@ -433,7 +433,7 @@ class _CustomDropDownTagState extends State { Container( width: double.infinity, decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: BorderRadius.vertical( bottom: Radius.circular(30.r), ), @@ -473,14 +473,14 @@ class _CustomDropDownTagState extends State { fontWeight: FontWeight.w400, fontFamily: 'Helvetica'), ), - Spacer(), + const Spacer(), text14400whiteblur(widget.rowData[index]), ], ), ), // sizedBoxHeight(5.h), if (index != widget.listData.length - 1) - Divider(thickness: 1, color: const Color(0xFF434A53)), + const Divider(thickness: 1, color: Color(0xFF434A53)), ], ), ); @@ -551,10 +551,10 @@ class _CustomDropDownRadioState extends State { }, ); }), - SizedBox(width: 8), + const SizedBox(width: 8), Text( item, - style: TextStyle( + style: const TextStyle( color: Colors.white, fontSize: 16, fontFamily: 'Helvetica', @@ -566,7 +566,7 @@ class _CustomDropDownRadioState extends State { ), // SizedBox(height: 5.h), if (index != widget.listData.length - 1) - Divider(thickness: 1, color: const Color(0xFF434A53)), + const Divider(thickness: 1, color: Color(0xFF434A53)), ], ), ), @@ -579,7 +579,7 @@ class _CustomDropDownRadioState extends State { value: _textController.text, child: Column( children: [ - Divider(thickness: 1, color: const Color(0xFF434A53)), + const Divider(thickness: 1, color: Color(0xFF434A53)), Row( children: [ Obx(() { @@ -594,8 +594,8 @@ class _CustomDropDownRadioState extends State { }, ); }), - SizedBox(width: 8), - Text( + const SizedBox(width: 8), + const Text( "Other: ", style: TextStyle( color: Colors.white, @@ -608,13 +608,13 @@ class _CustomDropDownRadioState extends State { Expanded( child: TextField( controller: _textController, - style: TextStyle( + style: const TextStyle( color: Colors.white, fontSize: 16, fontFamily: 'Helvetica', fontWeight: FontWeight.w500, ), - decoration: InputDecoration( + decoration: const InputDecoration( hintText: '', hintStyle: TextStyle(color: Colors.white70), border: UnderlineInputBorder(), @@ -628,7 +628,7 @@ class _CustomDropDownRadioState extends State { widget.onItemSelected(_textController.text); } }, - child: Text( + child: const Text( 'OK', style: TextStyle( color: Colors.white, @@ -666,7 +666,7 @@ class _CustomDropDownRadioState extends State { padding: EdgeInsets.only( top: 14.0, bottom: 14.0, right: 22.w, left: 12.w), decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: onDropTap.value ? BorderRadius.vertical( top: Radius.circular(30.r), @@ -715,7 +715,7 @@ class _CustomDropDownRadioState extends State { width: double.infinity, //height: widget.listData.length > 4 ? 250.h : null, decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: BorderRadius.vertical( bottom: Radius.circular(30.r), ), @@ -784,7 +784,7 @@ class _CustomDropDownCheckBoxState extends State { padding: EdgeInsets.only( top: 14.0, bottom: 14.0, right: 22.w, left: 12.w), decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: onDropTap.value ? BorderRadius.vertical(top: Radius.circular(30.r)) : BorderRadius.circular(30.r), @@ -834,7 +834,7 @@ class _CustomDropDownCheckBoxState extends State { Container( width: double.infinity, decoration: BoxDecoration( - color: Color(0xFFFFFFFF).withOpacity(0.10), + color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: BorderRadius.vertical(bottom: Radius.circular(30.r)), border: Border.all(color: const Color(0xFF434A53)), @@ -895,9 +895,10 @@ class _CustomDropDownCheckBoxState extends State { ), ), Checkbox( - side: BorderSide(color: Color(0xFF434A53)), + side: + const BorderSide(color: Color(0xFF434A53)), value: selectedValues.contains(item), - activeColor: Color(0xFF434A53), + activeColor: const Color(0xFF434A53), checkColor: Colors.white, onChanged: (bool? value) { if (value == true) { @@ -913,7 +914,7 @@ class _CustomDropDownCheckBoxState extends State { ), ), if (index != widget.listData.length - 1) - Divider(thickness: 1, color: const Color(0xFF434A53)), + const Divider(thickness: 1, color: Color(0xFF434A53)), ], ), ); diff --git a/lib/onboarding/Signup/view_model/postmethod.dart b/lib/onboarding/Signup/view_model/postmethod.dart index 2c4c922..d0558e8 100644 --- a/lib/onboarding/Signup/view_model/postmethod.dart +++ b/lib/onboarding/Signup/view_model/postmethod.dart @@ -6,8 +6,6 @@ import 'package:regroup/Common/controller/data/network/network_api.dart'; import 'package:regroup/Global.dart'; import 'package:shared_preferences/shared_preferences.dart'; - - class Onboard { Onboard(); @@ -29,7 +27,7 @@ class Onboard { final SharedPreferences prefs = await SharedPreferences.getInstance(); Map res = response.data; print("res is $res"); - await prefs.setString('token', res['data']['token']); + await prefs.setString('access-token', res['data']['token']); await prefs.setString('email', res['data']['email']); await prefs.setInt('isprofileupdate', res['data']['is_profile_updated']); @@ -54,32 +52,36 @@ class Onboard { return response; } - Future> PostIndividualActivity(updata) async { + Future> PostIndividualActivity(updata) async { print("updata is $updata"); - final response = await NetworkApiServices() - .postApi(updata, ApiUrls.postindividualactivity,); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postindividualactivity, + ); print("response is ${response.data}"); print("response message is ${response.message}"); return response; } - Future> postGroups(updata) async { + Future> postGroups(updata) async { print("updata is $updata"); - final response = await NetworkApiServices() - .postApi(updata, ApiUrls.postgroups,); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postgroups, + ); print("response is ${response.data}"); print("response message is ${response.message}"); return response; } - Future> postCommunities(updata) async { + Future> postCommunities(updata) async { print("updata is $updata"); - final response = await NetworkApiServices() - .postApi(updata, ApiUrls.postcommunities,); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postcommunities, + ); print("response is ${response.data}"); print("response message is ${response.message}"); return response; } - - }