diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6f26cbe..3ec8f23 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -35,10 +35,21 @@ PODS: - DKPhotoGallery/Resource (0.0.19): - SDWebImage - SwiftyGif + - FBAEMKit (16.3.1): + - FBSDKCoreKit_Basics (= 16.3.1) + - FBSDKCoreKit (16.3.1): + - FBAEMKit (= 16.3.1) + - FBSDKCoreKit_Basics (= 16.3.1) + - FBSDKCoreKit_Basics (16.3.1) + - FBSDKLoginKit (16.3.1): + - FBSDKCoreKit (= 16.3.1) - file_picker (0.0.1): - DKImagePickerController/PhotoGallery - Flutter - Flutter (1.0.0) + - flutter_facebook_auth (6.0.4): + - FBSDKLoginKit (~> 16.3.1) + - Flutter - fluttertoast (0.0.2): - Flutter - Toast @@ -79,6 +90,7 @@ DEPENDENCIES: - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) + - flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) @@ -93,6 +105,10 @@ SPEC REPOS: trunk: - DKImagePickerController - DKPhotoGallery + - FBAEMKit + - FBSDKCoreKit + - FBSDKCoreKit_Basics + - FBSDKLoginKit - GoogleMaps - SDWebImage - SwiftyGif @@ -108,6 +124,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/file_picker/ios" Flutter: :path: Flutter + flutter_facebook_auth: + :path: ".symlinks/plugins/flutter_facebook_auth/ios" fluttertoast: :path: ".symlinks/plugins/fluttertoast/ios" geolocator_apple: @@ -132,8 +150,13 @@ SPEC CHECKSUMS: device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 + FBAEMKit: 6c7b5eb77c96861bb59e040842c6e55bf39512ce + FBSDKCoreKit: 5e4dd478947ab1bcc887e8cfadeae0727af1a942 + FBSDKCoreKit_Basics: cd7b5f5d1e8868c26706917919d058999ca672c3 + FBSDKLoginKit: 572cca0bc6c90067ef197187697cb3b584310c52 file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655 - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + flutter_facebook_auth: c8700ab1770f3d8e5e7456220e4f3bbcdb831454 fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db geolocator_apple: 6cbaf322953988e009e5ecb481f07efece75c450 google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0577cba..cb13460 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -156,7 +156,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a6b826d..5e31d3d 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ getApi(String url); + Future postApi(var data, String url); +} \ No newline at end of file diff --git a/lib/Common/controller/network_api.dart b/lib/Common/controller/data/network/network_api.dart similarity index 65% rename from lib/Common/controller/network_api.dart rename to lib/Common/controller/data/network/network_api.dart index 079b474..9929ce2 100644 --- a/lib/Common/controller/network_api.dart +++ b/lib/Common/controller/data/network/network_api.dart @@ -5,17 +5,25 @@ import 'package:dio/dio.dart'; import 'package:flutter/foundation.dart'; import 'package:get/get.dart' hide Response; import 'package:regroup/Global.dart'; -import 'package:regroup/Utils/base_manager.dart'; +import 'package:regroup/Common/base_manager.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:http/http.dart' as http; -import 'entry_point_controller.dart'; +import '../../entry_point_controller.dart'; + +class NetworkApiServices { + // String basicAuth = 'Basic ' + + // base64.encode( + // utf8.encode('RegroupUserName:71%@L%es^bUX94`J9XT*@bh,._WWM{\$%^^&&')); -class NetworkApi { Dio dio = Dio(); final controllerEntryPoint = Get.put(EntryPointController()); + String basicAuth = 'Basic ' + + base64.encode( + utf8.encode('RegroupUserName:71%@L%es^bUX94`J9XT*@bh,._WWM{\$%^^&&')); + Future getApi(String url) async { if (kDebugMode) { print("api url is >>> $url"); @@ -51,45 +59,136 @@ class NetworkApi { } } - Future postApi({data, required String url}) async { + // Future postApi( + // data, + // String url, + // {bool optionalpar = false} + // ) async { + // if (kDebugMode) { + // print("data >>> $data"); + // print("api url is >>> $url"); + // } + // Response response; + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // // ignore: unused_local_variable + // String? token = prefs.getString('token').toString(); + // print("token is $token"); + // log(token.toString()); + // try { + // response = await dio.post(url, + // data: data, + // options: optionalpar + // ? + // Options( + // headers: { + // "authorization": basicAuth, + // }, + // ) + // : + // Options( + // headers: {'authorization': basicAuth, 'access-token': token}, + // ), + // ); + // log(response.toString()); + // } on Exception catch (e) { + // if (e is DioException) { + // log(e.response.toString()); + // } + // return ResponseData( + // 'Opps something went wrong', ResponseStatus.FAILED); + // } + + // // if (kDebugMode) { + // // print(response); + // // } + + // // print("response in post $response"); + + // if (response.statusCode == 200) { + // // print(response.data); + + // return ResponseData("success", ResponseStatus.SUCCESS, + // data: response.data); + // } else { + // try { + // return ResponseData( + // response.data['message'].toString(), ResponseStatus.FAILED); + // } catch (_) { + // return ResponseData( + // response.statusMessage!, ResponseStatus.FAILED); + // } + // } + // } + + //New post api + + Future postApi(data, String url, + {bool optionalpar = false}) async { if (kDebugMode) { print("data >>> $data"); print("api url is >>> $url"); } Response response; + SharedPreferences prefs = await SharedPreferences.getInstance(); - // ignore: unused_local_variable - String? token = prefs.getString('token').toString(); - print("token is $token"); + String? token = prefs.getString('access-token'); + log(token.toString()); + log(basicAuth); try { - response = await dio.post(url, - data: data, - options: Options( - headers: { - "authorization": "Bearer $token", - 'content-Type': 'application/json', - "Accept": 'application/json' - }, - )); + response = await dio.post( + url, + data: data, + options: optionalpar + ? Options( + headers: { + "authorization": basicAuth, + }, + ) + : Options( + headers: { + 'authorization': basicAuth, + // 'access-token': token + }, + ), + ); + log(response.toString()); } on Exception catch (e) { if (e is DioException) { log(e.response.toString()); + if (e.response == null) { + return ResponseData( + 'Oops something Went Wrong, Please try again!', + ResponseStatus.FAILED, + ); + } + if (e.response!.statusCode == 401) { + prefs.remove('token'); + prefs.remove('refreshToken'); + // Get.toNamed(RouteName.login); + return ResponseData( + 'Oops something Went Wrong, Please try again!', + ResponseStatus.FAILED, + ); + } + if (e.response!.statusCode == 403) { + return ResponseData( + e.response!.statusMessage!, ResponseStatus.PRIVATE, + data: e.response!.data); + } } return ResponseData( - 'Opps something went wrong', ResponseStatus.FAILED); + 'Oops something Went Wrong', + ResponseStatus.FAILED, + ); } - // if (kDebugMode) { - // print(response); - // } - - // print("response in post $response"); - - if (response.statusCode == 200) { - // print(response.data); - + if (response.statusCode == 200 || response.statusCode == 201) { return ResponseData("success", ResponseStatus.SUCCESS, data: response.data); + } else if (response.statusCode == 203) { + print(response.data); + return ResponseData("success", ResponseStatus.PRIVATE, + data: response.data); } else { try { return ResponseData( @@ -196,17 +295,18 @@ class NetworkApi { var resp = await response.stream.bytesToString(); var jsonResp = jsonDecode(resp); print(jsonResp); - var errorMessage = jsonResp["errors"]["email2"].join(", ") + "\n" + - jsonResp["errors"]["contact_number2"].join(", "); + var errorMessage = jsonResp["errors"]["email2"].join(", ") + + "\n" + + jsonResp["errors"]["contact_number2"].join(", "); // return ResponseData( // jsonResp["errors"][0]["email2"] + // jsonResp["errors"][0]["contact_number2"], // ResponseStatus.PRIVATE, // ); - return ResponseData( - errorMessage, - ResponseStatus.PRIVATE, - ); + return ResponseData( + errorMessage, + ResponseStatus.PRIVATE, + ); } else if (response.statusCode == 500) { var resp = await response.stream.bytesToString(); var jsonResp = jsonDecode(resp); diff --git a/lib/Common/global.dart b/lib/Common/global.dart index 02bf319..deb711c 100644 --- a/lib/Common/global.dart +++ b/lib/Common/global.dart @@ -1,5 +1,6 @@ import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:shared_preferences/shared_preferences.dart'; LatLng? latlong; @@ -25,3 +26,16 @@ getLocation() async { print('done'); } + +setname() async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + String? token = prefs.getString('token'); + if (token != null) { + // await ProfileAPI().getApi(); + // prefs.setString('email', getProfileObj!.data!.email!); + // prefs.setString('profile_img', getProfileObj!.data!.profilePhoto!); + // prefs.setString('firstName', getProfileObj!.data!.firstName!); + // prefs.setString('phoneNo', getProfileObj!.data!.phoneNo ?? ""); + // prefs.setInt('complete', getProfileObj!.data!.profileComplete ?? 0); + } +} diff --git a/lib/Feed Module/Main_Screens/CalenderTab/CalenderTab.dart b/lib/Feed Module/Main_Screens/CalenderTab/CalenderTab.dart index 5ab912c..a7bc2b9 100644 --- a/lib/Feed Module/Main_Screens/CalenderTab/CalenderTab.dart +++ b/lib/Feed Module/Main_Screens/CalenderTab/CalenderTab.dart @@ -58,9 +58,9 @@ class _CalenderTabState extends State { List? _appointments; // final List _nameCollection = []; // final List _userImages = []; - DateTime? _startDate; - DateTime? _endDate; - bool _isRangeSelection = false; + // DateTime? _startDate; + // DateTime? _endDate; + // bool _isRangeSelection = false; @override void initState() { super.initState(); @@ -257,7 +257,7 @@ class _CalenderTabState extends State { appointmentTextStyle: TextStyle(color: Colors.white), headerStyle: CalendarHeaderStyle( textStyle: TextStyle( - color: Colors.blue, + color: Color(0xFFD90B2E), )), // blackoutDatesTextStyle: TextStyle(color: Colors.white), @@ -282,7 +282,6 @@ class _CalenderTabState extends State { allowViewNavigation: true, allowDragAndDrop: true, showDatePickerButton: true, - monthViewSettings: MonthViewSettings( navigationDirection: MonthNavigationDirection.horizontal, ), @@ -360,20 +359,25 @@ class _CalenderTabState extends State { ), Positioned( top: 6.h, - left: 190.w, + left: 100.w, child: InkWell( onTap: () { Get.toNamed(RouteName.availability); }, child: Container( height: 25.h, - width: 50.w, decoration: BoxDecoration( border: Border.all( - color: Colors.blue, + color: Color(0xFFD90B2E), ), borderRadius: BorderRadius.circular(15.r)), - child: Center(child: text10400white("view")), + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 10.w, + ), + child: + Center(child: text10400white("view availability")), + ), ) // Image.asset( @@ -555,7 +559,7 @@ class _CalenderTabState extends State { appointmentTextStyle: TextStyle(color: Colors.white), headerStyle: CalendarHeaderStyle( textStyle: TextStyle( - color: Colors.blue, + color: Color(0xFFD90B2E), )), // blackoutDatesTextStyle: TextStyle(color: Colors.white), @@ -579,7 +583,7 @@ class _CalenderTabState extends State { showNavigationArrow: true, allowViewNavigation: true, allowDragAndDrop: true, - // showDatePickerButton: true, + showDatePickerButton: true, monthViewSettings: MonthViewSettings( navigationDirection: MonthNavigationDirection.horizontal, ), @@ -646,20 +650,6 @@ class _CalenderTabState extends State { ); }), ), - Positioned( - top: 8.h, - right: 110.w, - child: InkWell( - onTap: () { - Get.toNamed(RouteName.availability); - }, - child: Image.asset( - "assets/images/png/calender.png", - color: Colors.blue, - height: 18.h, - width: 18.w, - ), - )) ]), // SfCalendar( diff --git a/lib/Feed Module/Main_Screens/Community/Community.dart b/lib/Feed Module/Main_Screens/Community/Community.dart index b250f4e..a7ba48d 100644 --- a/lib/Feed Module/Main_Screens/Community/Community.dart +++ b/lib/Feed Module/Main_Screens/Community/Community.dart @@ -166,34 +166,110 @@ class _CommunityScreenState extends State { } Widget feedTab() { - return SingleChildScrollView( - child: Column(children: [ + List feedTabData = [ + { + "profileImg": "assets/images/png/Ellipse 43.png", + "title": "Edward Hackket", + "mainImg": "assets/images/png/Rectangle 24.png", + "containerTitle": ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events'], + }, + { + "profileImg": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwat", + "mainImg": "assets/images/png/Rectangle 25.png", + "containerTitle": [ + 'Football', + 'Teams player', + 'Events', + 'Marathon', + 'Events' + ], + }, + { + "profileImg": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwat", + "mainImg": "assets/images/png/Rectangle 25.png", + "containerTitle": [ + 'Football', + 'Teams player', + 'Events', + 'Marathon', + 'Events' + ], + }, + { + "profileImg": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwat", + "mainImg": "assets/images/png/Rectangle 25.png", + "containerTitle": [ + 'Football', + 'Teams player', + 'Events', + 'Marathon', + 'Events' + ], + }, + ]; + + return Column(children: [ sizedBoxHeight(16.h), - normalcardtile2( - profileImg: 'assets/images/png/Ellipse 43.png', - title: 'Edward Hackket', - mainImg: 'assets/images/png/Rectangle 24.png', - containerTitle: ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events']), - sizedBoxHeight(20.h), - announcecardtile( - profileImg: 'assets/images/png/Ellipse 48.png', - title: 'Jocelyn Dokidis', - mainImg: 'assets/images/png/Rectangle 46.png', - containerTitle: ['Race', 'Swimming', 'Events', 'Marathon', 'Events']), - sizedBoxHeight(20.h), - normalcardtile2( - profileImg: 'assets/images/png/Ellipse 52.png', - title: 'Ryan Dorwat', - mainImg: 'assets/images/png/Rectangle 25.png', - containerTitle: [ - 'Football', - 'Teams player', - 'Events', - 'Marathon', - 'Events' - ]), - sizedBoxHeight(20.h), - ])); + Expanded( + child: ListView.builder( + shrinkWrap: true, + itemCount: feedTabData.length, + itemBuilder: (context, index) { + if (index == 1) { + return announcecardtile( + profileImg: 'assets/images/png/Ellipse 48.png', + title: 'Jocelyn Dokidis', + mainImg: 'assets/images/png/Rectangle 46.png', + containerTitle: [ + 'Race', + 'Swimming', + 'Events', + 'Marathon', + 'Events' + ]); + } else { + return Column( + children: [ + normalcardtile2( + profileImg: feedTabData[index]["profileImg"], + title: feedTabData[index]["title"], + mainImg: feedTabData[index]["mainImg"], + containerTitle: feedTabData[index]["containerTitle"]), + sizedBoxHeight(20.h) + ], + ); + } + }, + ), + ), + // normalcardtile2( + // profileImg: 'assets/images/png/Ellipse 43.png', + // title: 'Edward Hackket', + // mainImg: 'assets/images/png/Rectangle 24.png', + // containerTitle: ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events']), + // sizedBoxHeight(20.h), + // announcecardtile( + // profileImg: 'assets/images/png/Ellipse 48.png', + // title: 'Jocelyn Dokidis', + // mainImg: 'assets/images/png/Rectangle 46.png', + // containerTitle: ['Race', 'Swimming', 'Events', 'Marathon', 'Events']), + // sizedBoxHeight(20.h), + // normalcardtile2( + // profileImg: 'assets/images/png/Ellipse 52.png', + // title: 'Ryan Dorwat', + // mainImg: 'assets/images/png/Rectangle 25.png', + // containerTitle: [ + // 'Football', + // 'Teams player', + // 'Events', + // 'Marathon', + // 'Events' + // ]), + // sizedBoxHeight(20.h), + ]); } Widget normalcardtile2({ @@ -404,13 +480,14 @@ Widget normalcardtile2({ ]), ), const Spacer(), - commonGlassUI( + commonContainer( width: 30.w, height: 30.h, - borderRadius: BorderRadius.circular(100), - mainOpacity: 0.4, - opacity1: 0.5, - opacity2: 0.6, + borderColor: Color(0xFF434A53), + borderwidth: 0.43, + opacity1: 0.2, + opacity2: 0.2, + boxShape: BoxShape.circle, customWidget: Center( child: Image.asset( 'assets/images/png/Frame 1000004088.png', @@ -422,13 +499,14 @@ Widget normalcardtile2({ sizedBoxWidth(12.w), text14w400_FCFCFC('20'), sizedBoxWidth(20.w), - commonGlassUI( + commonContainer( width: 30.w, height: 30.h, - borderRadius: BorderRadius.circular(100), - mainOpacity: 0.4, - opacity1: 0.5, - opacity2: 0.6, + borderColor: Color(0xFF434A53), + borderwidth: 0.43, + opacity1: 0.2, + opacity2: 0.2, + boxShape: BoxShape.circle, customWidget: Center( child: Image.asset( 'assets/images/png/Vector (1).png', @@ -906,336 +984,344 @@ Widget announcecardtile({ } // MediaQuery.of(context).size.height - return commonGlassUIBlue( - width: double.infinity, - height: 610.h, - mainOpacity: 1, - borderRadius: BorderRadius.circular(1), - customWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(25.h), - Padding( - padding: EdgeInsets.only(left: 16.w), - child: text16w700_FCFCFC("#Announcement"), - ), - sizedBoxHeight(25.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CircleAvatar( - foregroundImage: AssetImage(profileImg), - radius: 25.r, - ), - sizedBoxWidth(12.w), - Column( + return Column( + children: [ + commonGlassUIBlue( + width: double.infinity, + height: 610.h, + borderRadius: BorderRadius.circular(1), + customWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(25.h), + Padding( + padding: EdgeInsets.only(left: 16.w), + child: text16w700_FCFCFC("#Announcement"), + ), + sizedBoxHeight(25.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - text16w400_FCFCFC(title), - sizedBoxHeight(5.h), - Row( + CircleAvatar( + foregroundImage: AssetImage(profileImg), + radius: 25.r, + ), + sizedBoxWidth(12.w), + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset( - 'assets/images/png/community 1 (traced).png', - height: 14.w, - width: 14.w, - ), - sizedBoxWidth(7.w), - text12w400_FCFCFC('Active alliance network'), - sizedBoxWidth(7.w), - Icon( - Icons.circle, - color: const Color(0xFFFCFCFC), - size: 4.sp, - ), - sizedBoxWidth(6.w), - text12w400_FCFCFC('1 Hour ago'), + text16w400_FCFCFC(title), + sizedBoxHeight(5.h), + Row( + children: [ + Image.asset( + 'assets/images/png/community 1 (traced).png', + height: 14.w, + width: 14.w, + ), + sizedBoxWidth(7.w), + text12w400_FCFCFC('Active alliance network'), + sizedBoxWidth(7.w), + Icon( + Icons.circle, + color: const Color(0xFFFCFCFC), + size: 4.sp, + ), + sizedBoxWidth(6.w), + text12w400_FCFCFC('1 Hour ago'), + ], + ) ], - ) + ), + const Spacer(), + PopupMenuButton( + surfaceTintColor: const Color(0xFF222935), + constraints: BoxConstraints.tightFor(width: 176.w), + offset: const Offset(0, 50), + color: const Color(0xFF222935), + tooltip: "", + itemBuilder: (BuildContext context) => [ + PopupMenuItem( + onTap: () {}, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Row( + children: [ + Text( + 'Report Post', + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w800, + fontFamily: "Nunito Sans", + ), + ), + const Spacer(), + Image.asset( + "assets/images/png/Vector (5).png", + height: 15.h, + width: 15.w, + ) + ], + ), + ), + ), + const PopupMenuDivider(), + PopupMenuItem( + onTap: () {}, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Row( + children: [ + Text( + 'Share post', + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w800, + fontFamily: "Nunito Sans", + ), + ), + const Spacer(), + Image.asset( + "assets/images/png/share.png", + height: 20.h, + width: 20.w, + ) + ], + ), + ), + ), + const PopupMenuDivider(), + PopupMenuItem( + onTap: () {}, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Row( + children: [ + Text( + 'Pin', + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w800, + fontFamily: "Nunito Sans", + ), + ), + const Spacer(), + Image.asset( + "assets/images/png/f7_pin-fill (2).png", + height: 25.h, + width: 25.w, + ) + ], + ), + ), + ), + ], + child: Image.asset( + 'assets/images/png/Group 1000004071.png', + width: 16.w, + height: 18.h, + ), + ), + sizedBoxWidth(5.w) ], ), - const Spacer(), - PopupMenuButton( - surfaceTintColor: const Color(0xFF222935), - constraints: BoxConstraints.tightFor(width: 176.w), - offset: const Offset(0, 50), - color: const Color(0xFF222935), - tooltip: "", - itemBuilder: (BuildContext context) => [ - PopupMenuItem( - onTap: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12.w), - child: Row( - children: [ - Text( - 'Report Post', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w800, - fontFamily: "Nunito Sans", - ), - ), - const Spacer(), - Image.asset( - "assets/images/png/Vector (5).png", - height: 15.h, - width: 15.w, - ) - ], - ), - ), - ), - const PopupMenuDivider(), - PopupMenuItem( - onTap: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12.w), - child: Row( - children: [ - Text( - 'Share post', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w800, - fontFamily: "Nunito Sans", - ), - ), - const Spacer(), - Image.asset( - "assets/images/png/share.png", - height: 20.h, - width: 20.w, - ) - ], - ), - ), - ), - const PopupMenuDivider(), - PopupMenuItem( - onTap: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12.w), - child: Row( - children: [ - Text( - 'Pin', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w800, - fontFamily: "Nunito Sans", - ), - ), - const Spacer(), - Image.asset( - "assets/images/png/f7_pin-fill (2).png", - height: 25.h, - width: 25.w, - ) - ], - ), - ), - ), - ], - child: Image.asset( - 'assets/images/png/Group 1000004071.png', - width: 16.w, - height: 18.h, - ), - ), - sizedBoxWidth(5.w) - ], - ), - ), - sizedBoxHeight(20.h), - GestureDetector( - onTap: () { - // Get.toNamed(RouteName.postdetailsScreen); - }, - child: Container( - height: 163.h, - width: double.infinity, - child: Image.asset( - mainImg, - fit: BoxFit.cover, - ), - )), - sizedBoxHeight(20.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column(children: [ - SizedBox( - height: 30.h, - child: ListView.builder( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - itemCount: containerTitle.length, - itemBuilder: (context, index) { - return Padding( - padding: EdgeInsets.only(right: 12.w), - child: GestureDetector( - onTap: () { - // Get.toNamed(RouteName.cyclescreen); - }, - child: containertile(text: containerTitle[index])), - ); - }, - ), ), sizedBoxHeight(20.h), - text16w400_FCFCFC( - "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s . . ."), - Row(children: [ - InkWell( + GestureDetector( onTap: () { - // Get.toNamed(RouteName.reactionview); + // Get.toNamed(RouteName.postdetailsScreen); }, - child: stackReaction(number: '20', containerImages: [ - 'assets/images/png/f7_hand-thumbsup.png', - 'assets/images/png/heart 2.png', - 'assets/images/png/party-popper 2.png' - ]), - ), - const Spacer(), - commonGlassContainer( - border: 0.43, - width: 30.w, - height: 30.h, - opacity1: 0.05, - opacity2: 0.06, - borderradius: 100, - customWidget: Center( + child: Container( + height: 163.h, + width: double.infinity, child: Image.asset( - 'assets/images/png/Frame 1000004088.png', - height: 13.h, - width: 13.w, + mainImg, + fit: BoxFit.cover, ), - ), - ), - sizedBoxWidth(12.w), - text14w400_FCFCFC('20'), - sizedBoxWidth(20.w), - commonGlassContainer( - border: 0.43, - width: 30.w, - height: 30.h, - borderradius: 100, - opacity1: 0.05, - opacity2: 0.06, - customWidget: Center( - child: Image.asset( - 'assets/images/png/Vector (1).png', - height: 12.h, - width: 12.w, - ), - ), - ), - sizedBoxWidth(12.w), - text14w400_FCFCFC('10'), - ]), - sizedBoxHeight(12.h), - commonDivider(), - sizedBoxHeight(12.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Obx(() { - return ReactionButton( - onReactionChanged: (reaction) { - updateImage(reaction?.value ?? 'like'); - debugPrint('Selected value: ${reaction?.value}'); - }, - reactions: ?>[ - Reaction( - value: 'like', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - icon: _buildReactionsIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - ), - Reaction( - value: 'heart', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/heart 2.png'), - icon: _buildReactionsIcon( - 'assets/images/png/heart 2.png'), - ), - Reaction( - value: 'party', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/party-popper 2.png'), - icon: _buildReactionsIcon( - 'assets/images/png/party-popper 2.png'), - ), - ], - selectedReaction: Reaction( - value: 'like', - icon: _buildReactionsIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - ), - boxColor: Colors.white, - boxElevation: 9, - boxRadius: 30, - itemsSpacing: 8, - itemScale: 0.4, - itemSize: const Size(45, 45), - boxPadding: const EdgeInsets.all(8), - boxAnimationDuration: - const Duration(milliseconds: 200), - itemAnimationDuration: - const Duration(milliseconds: 500), - hoverDuration: const Duration(milliseconds: 700), - // toggle: false, - - child: _buildReactionsIcon(mainImage.value), + )), + sizedBoxHeight(20.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Column(children: [ + SizedBox( + height: 30.h, + child: ListView.builder( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + itemCount: containerTitle.length, + itemBuilder: (context, index) { + return Padding( + padding: EdgeInsets.only(right: 12.w), + child: GestureDetector( + onTap: () { + // Get.toNamed(RouteName.cyclescreen); + }, + child: + containertile2(text: containerTitle[index])), ); - }) - ], - ), - GestureDetector( - onTap: () { - // Get.toNamed(RouteName.postdetailsScreen); - }, - child: Column( - children: [ - Image.asset( - 'assets/images/png/Frame 1000004088.png', - height: 19.h, - width: 19.w, - ), - sizedBoxHeight(8.h), - text11w400_FCFCFC('Comment') - ], + }, ), ), - Column( - children: [ - Image.asset( - 'assets/images/png/Frame 1000004089.png', - height: 19.h, - width: 19.w, + sizedBoxHeight(20.h), + text16w400_FCFCFC( + "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s . . ."), + Row(children: [ + InkWell( + onTap: () { + // Get.toNamed(RouteName.reactionview); + }, + child: stackReaction(number: '20', containerImages: [ + 'assets/images/png/f7_hand-thumbsup.png', + 'assets/images/png/heart 2.png', + 'assets/images/png/party-popper 2.png' + ]), + ), + const Spacer(), + commonContainer( + width: 30.w, + height: 30.h, + borderColor: Color(0xFF434A53), + borderwidth: 0.43, + opacity1: 0.2, + opacity2: 0.2, + boxShape: BoxShape.circle, + customWidget: Center( + child: Image.asset( + 'assets/images/png/Frame 1000004088.png', + height: 13.h, + width: 13.w, + ), ), - sizedBoxHeight(8.h), - text11w400_FCFCFC('Save') + ), + sizedBoxWidth(12.w), + text14w400_FCFCFC('20'), + sizedBoxWidth(20.w), + commonContainer( + width: 30.w, + height: 30.h, + borderColor: Color(0xFF434A53), + borderwidth: 0.43, + opacity1: 0.2, + opacity2: 0.2, + boxShape: BoxShape.circle, + customWidget: Center( + child: Image.asset( + 'assets/images/png/Vector (1).png', + height: 12.h, + width: 12.w, + ), + ), + ), + sizedBoxWidth(12.w), + text14w400_FCFCFC('10'), + ]), + sizedBoxHeight(12.h), + commonDivider(), + sizedBoxHeight(12.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Obx(() { + return ReactionButton( + onReactionChanged: (reaction) { + updateImage(reaction?.value ?? 'like'); + debugPrint( + 'Selected value: ${reaction?.value}'); + }, + reactions: ?>[ + Reaction( + value: 'like', + previewIcon: _buildReactionsPreviewIcon( + 'assets/images/png/f7_hand-thumbsup.png'), + icon: _buildReactionsIcon( + 'assets/images/png/f7_hand-thumbsup.png'), + ), + Reaction( + value: 'heart', + previewIcon: _buildReactionsPreviewIcon( + 'assets/images/png/heart 2.png'), + icon: _buildReactionsIcon( + 'assets/images/png/heart 2.png'), + ), + Reaction( + value: 'party', + previewIcon: _buildReactionsPreviewIcon( + 'assets/images/png/party-popper 2.png'), + icon: _buildReactionsIcon( + 'assets/images/png/party-popper 2.png'), + ), + ], + selectedReaction: Reaction( + value: 'like', + icon: _buildReactionsIcon( + 'assets/images/png/f7_hand-thumbsup.png'), + ), + boxColor: Colors.white, + boxElevation: 9, + boxRadius: 30, + itemsSpacing: 8, + itemScale: 0.4, + itemSize: const Size(45, 45), + boxPadding: const EdgeInsets.all(8), + boxAnimationDuration: + const Duration(milliseconds: 200), + itemAnimationDuration: + const Duration(milliseconds: 500), + hoverDuration: const Duration(milliseconds: 700), + // toggle: false, + + child: _buildReactionsIcon(mainImage.value), + ); + }) + ], + ), + GestureDetector( + onTap: () { + // Get.toNamed(RouteName.postdetailsScreen); + }, + child: Column( + children: [ + Image.asset( + 'assets/images/png/Frame 1000004088.png', + height: 19.h, + width: 19.w, + ), + sizedBoxHeight(8.h), + text11w400_FCFCFC('Comment') + ], + ), + ), + Column( + children: [ + Image.asset( + 'assets/images/png/Frame 1000004089.png', + height: 19.h, + width: 19.w, + ), + sizedBoxHeight(8.h), + text11w400_FCFCFC('Save') + ], + ) ], - ) - ], + ), + sizedBoxHeight(12.h), + commonDivider(), + sizedBoxHeight(12.h), + ]), ), - sizedBoxHeight(12.h), - commonDivider(), - sizedBoxHeight(12.h), - ]), - ), - ], - )); + ], + )), + sizedBoxHeight(20.h), + ], + ); } Widget _buildReactionsPreviewIcon(String assetPath) { @@ -1277,14 +1363,13 @@ Widget containertile({required String text}) { } Widget containertile2({required String text}) { - return commonGlassUI( + return commonContainer( width: 130.w, height: 30.h, - // mainOpacity: 0.2, - opacity1: 0.5, - opacity2: 0.6, - borderColor: const Color(0xFFD90B2E), borderRadius: BorderRadius.circular(30.r), + borderColor: Color(0xFFD90B2E), + opacity1: 0.04, + opacity2: 0.05, customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 10.w), child: Center(child: text14w400_FCFCFC(text)), @@ -1292,65 +1377,168 @@ Widget containertile2({required String text}) { } Widget popularTab() { - return SingleChildScrollView( - child: Column( - children: [ - sizedBoxHeight(20.h), - normalcardtile2( - profileImg: 'assets/images/png/Ellipse 43.png', - title: 'Edward Hackket', - mainImg: 'assets/images/png/Rectangle 24.png', - containerTitle: [ - 'Race', - 'Swimming', - 'Events', - 'Marathon', - 'Events' - ]), - sizedBoxHeight(20.h), - normalcardtile2( - profileImg: 'assets/images/png/Ellipse 52.png', - title: 'Edward Hackket', - mainImg: 'assets/images/png/Rectangle 25.png', - containerTitle: [ - 'Football', - 'Teams player', - 'Events', - 'Marathon', - 'Events' - ]), - sizedBoxHeight(20.h), + List popularTabData = [ + { + "profileImg": "assets/images/png/Ellipse 43.png", + "title": "Edward Hackket", + "mainImg": "assets/images/png/Rectangle 24.png", + "containerTitle": ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events'], + }, + { + "profileImg": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwat", + "mainImg": "assets/images/png/Rectangle 25.png", + "containerTitle": [ + 'Football', + 'Teams player', + 'Events', + 'Marathon', + 'Events' ], - ), + }, + { + "profileImg": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwat", + "mainImg": "assets/images/png/Rectangle 25.png", + "containerTitle": [ + 'Football', + 'Teams player', + 'Events', + 'Marathon', + 'Events' + ], + }, + { + "profileImg": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwat", + "mainImg": "assets/images/png/Rectangle 25.png", + "containerTitle": [ + 'Football', + 'Teams player', + 'Events', + 'Marathon', + 'Events' + ], + }, + ]; + + return Column( + children: [ + sizedBoxHeight(20.h), + Expanded( + child: ListView.builder( + shrinkWrap: true, + itemCount: popularTabData.length, + itemBuilder: (context, index) { + return Column( + children: [ + normalcardtile2( + profileImg: popularTabData[index]["profileImg"], + title: popularTabData[index]["title"], + mainImg: popularTabData[index]["mainImg"], + containerTitle: popularTabData[index]["containerTitle"]), + sizedBoxHeight(20.h) + ], + ); + }, + ), + ), + ], ); } Widget latestTab() { - return SingleChildScrollView( - child: Column(children: [ + List latestTabData = [ + { + "profileImg": "assets/images/png/Ellipse 43.png", + "title": "Edward Hackket", + "mainImg": "assets/images/png/Rectangle 24.png", + "containerTitle": ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events'], + }, + { + "profileImg": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwat", + "mainImg": "assets/images/png/Rectangle 25.png", + "containerTitle": [ + 'Football', + 'Teams player', + 'Events', + 'Marathon', + 'Events' + ], + }, + { + "profileImg": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwat", + "mainImg": "assets/images/png/Rectangle 25.png", + "containerTitle": [ + 'Football', + 'Teams player', + 'Events', + 'Marathon', + 'Events' + ], + }, + { + "profileImg": "assets/images/png/Ellipse 52.png", + "title": "Ryan Dorwat", + "mainImg": "assets/images/png/Rectangle 25.png", + "containerTitle": [ + 'Football', + 'Teams player', + 'Events', + 'Marathon', + 'Events' + ], + }, + ]; + + return Column(children: [ sizedBoxHeight(16.h), - normalcardtile2( - profileImg: 'assets/images/png/Ellipse 43.png', - title: 'Edward Hackket', - mainImg: 'assets/images/png/Rectangle 24.png', - containerTitle: ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events']), - sizedBoxHeight(20.h), - announcecardtile( - profileImg: 'assets/images/png/Ellipse 48.png', - title: 'Jocelyn Dokidis', - mainImg: 'assets/images/png/Rectangle 46.png', - containerTitle: ['Race', 'Swimming', 'Events', 'Marathon', 'Events']), - sizedBoxHeight(20.h), - normalcardtile2( - profileImg: 'assets/images/png/Ellipse 52.png', - title: 'Ryan Dorwat', - mainImg: 'assets/images/png/Rectangle 25.png', - containerTitle: [ - 'Football', - 'Teams player', - 'Events', - 'Marathon', - 'Events' - ]), - ])); + Expanded( + child: ListView.builder( + shrinkWrap: true, + itemCount: latestTabData.length, + itemBuilder: (context, index) { + if (index == 1) { + return announcecardtile( + profileImg: 'assets/images/png/Ellipse 48.png', + title: 'Jocelyn Dokidis', + mainImg: 'assets/images/png/Rectangle 46.png', + containerTitle: [ + 'Race', + 'Swimming', + 'Events', + 'Marathon', + 'Events' + ]); + } else { + return Column( + children: [ + normalcardtile2( + profileImg: latestTabData[index]["profileImg"], + title: latestTabData[index]["title"], + mainImg: latestTabData[index]["mainImg"], + containerTitle: latestTabData[index]["containerTitle"]), + sizedBoxHeight(20.h) + ], + ); + } + }, + ), + ), + + // normalcardtile2( + // profileImg: 'assets/images/png/Ellipse 43.png', + // title: 'Edward Hackket', + // mainImg: 'assets/images/png/Rectangle 24.png', + // containerTitle: ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events']), + // sizedBoxHeight(20.h), + // announcecardtile( + // profileImg: 'assets/images/png/Ellipse 48.png', + // title: 'Jocelyn Dokidis', + // mainImg: 'assets/images/png/Rectangle 46.png', + // containerTitle: ['Race', 'Swimming', 'Events', 'Marathon', 'Events']), + // sizedBoxHeight(20.h), + ]); } diff --git a/lib/Feed Module/Main_Screens/GroupTab/View/GroupDetail.dart b/lib/Feed Module/Main_Screens/GroupTab/View/GroupDetail.dart index c1e53db..4e43c7d 100644 --- a/lib/Feed Module/Main_Screens/GroupTab/View/GroupDetail.dart +++ b/lib/Feed Module/Main_Screens/GroupTab/View/GroupDetail.dart @@ -315,33 +315,35 @@ class _GroupDetailState extends State { sizedBoxHeight(16.h), Row( children: [ - commonGlassContainer( - width: 35.w, - height: 35.h, - borderradius: 100, - opacity1: 0.24, - opacity2: 0.24, - customWidget: Center( - child: Image.asset( - "assets/images/png/community 1 (traced).png", - height: 20.h, - width: 20.w), - ), - border: 0.5), + commonContainer( + width: 35.w, + height: 35.h, + boxShape: BoxShape.circle, + opacity1: 0.24, + opacity2: 0.24, + borderwidth: 0.5, + customWidget: Center( + child: Image.asset( + "assets/images/png/community 1 (traced).png", + height: 20.h, + width: 20.w), + ), + ), sizedBoxWidth(7.w), text16w400_FCFCFCblur("The athlectic town"), sizedBoxWidth(20.w), - commonGlassContainer( - width: 35.w, - height: 35.h, - opacity1: 0.24, - opacity2: 0.24, - borderradius: 100, - customWidget: Center( - child: Image.asset("assets/images/png/img12.png", - height: 20.h, width: 20.w), - ), - border: 0.5), + commonContainer( + width: 35.w, + height: 35.h, + boxShape: BoxShape.circle, + opacity1: 0.24, + opacity2: 0.24, + borderwidth: 0.5, + customWidget: Center( + child: Image.asset("assets/images/png/img12.png", + height: 20.h, width: 20.w), + ), + ), sizedBoxWidth(7.w), text16w400_FCFCFCblur("Public"), ], @@ -349,19 +351,20 @@ class _GroupDetailState extends State { sizedBoxHeight(25.h), Row( children: [ - commonGlassContainer( - width: 35.w, - height: 35.h, - opacity1: 0.24, - opacity2: 0.24, - borderradius: 100, - customWidget: Center( - child: Image.asset( - "assets/images/png/Vector (4).png", - height: 20.h, - width: 20.w), - ), - border: 0.5), + commonContainer( + width: 35.w, + height: 35.h, + boxShape: BoxShape.circle, + opacity1: 0.24, + opacity2: 0.24, + borderwidth: 0.5, + customWidget: Center( + child: Image.asset( + "assets/images/png/Vector (4).png", + height: 20.h, + width: 20.w), + ), + ), sizedBoxWidth(7.w), text16w400_FCFCFCblur("Rowing, Football, Swimming"), ], @@ -594,11 +597,10 @@ class _GroupDetailState extends State { } // MediaQuery.of(context).size.height - return commonGlassContainerblue( + return commonGlassUIBlue( width: double.infinity, height: 610.h, - border: 0, - borderradius: 1, + borderRadius: BorderRadius.circular(1), customWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -790,13 +792,13 @@ class _GroupDetailState extends State { ]), ), Spacer(), - commonGlassContainer( - border: 0.43, + commonContainer( width: 30.w, height: 30.h, - opacity1: 0.05, - opacity2: 0.06, - borderradius: 100, + opacity1: 0.24, + opacity2: 0.24, + boxShape: BoxShape.circle, + borderwidth: 0.43, customWidget: Center( child: Image.asset( 'assets/images/png/Frame 1000004088.png', @@ -808,13 +810,13 @@ class _GroupDetailState extends State { sizedBoxWidth(12.w), text14w400_FCFCFC('20'), sizedBoxWidth(20.w), - commonGlassContainer( - border: 0.43, + commonContainer( width: 30.w, height: 30.h, - borderradius: 100, - opacity1: 0.05, - opacity2: 0.06, + opacity1: 0.24, + opacity2: 0.24, + boxShape: BoxShape.circle, + borderwidth: 0.43, customWidget: Center( child: Image.asset( 'assets/images/png/Vector (1).png', @@ -950,11 +952,11 @@ class _GroupDetailState extends State { } Widget containertile({required String text}) { - return commonGlassContainer( - border: 1, + return commonContainer( width: 100.w, height: 30.h, - borderradius: 30.r, + borderRadius: BorderRadius.circular(30.r), + borderwidth: 1, borderColor: Color(0xFFD90B2E), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 10.w), @@ -966,17 +968,16 @@ class _GroupDetailState extends State { return Column( children: [ sizedBoxHeight(40.h), - commonGlassContainer( + commonGlassUI( width: double.infinity, height: 500.h, - borderradius: 1, - border: 0, + borderRadius: BorderRadius.circular(1), customWidget: SfCalendar( view: CalendarView.day, appointmentTextStyle: TextStyle(color: Colors.white), headerStyle: CalendarHeaderStyle( textStyle: TextStyle( - color: Colors.blue, + color: Color(0xFFD90B2E), )), // blackoutDatesTextStyle: TextStyle(color: Colors.white), diff --git a/lib/Feed Module/Main_Screens/GroupTab/View/GroupTab.dart b/lib/Feed Module/Main_Screens/GroupTab/View/GroupTab.dart index aee892d..e077efb 100644 --- a/lib/Feed Module/Main_Screens/GroupTab/View/GroupTab.dart +++ b/lib/Feed Module/Main_Screens/GroupTab/View/GroupTab.dart @@ -168,11 +168,11 @@ class _GroupTabState extends State { padding: EdgeInsets.only(bottom: 25.h), child: GestureDetector( onTap: ontap, - child: commonGlassContainer( - border: 0.9, + child: commonGlassUI( width: double.infinity, height: 162.h, - borderradius: 10.r, + borderwidth: 0.9, + borderRadius: BorderRadius.circular(10.r), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h), child: Column( diff --git a/lib/Feed Module/Main_Screens/GroupTab/View/NewPost.dart b/lib/Feed Module/Main_Screens/GroupTab/View/NewPost.dart index acb9d69..111c005 100644 --- a/lib/Feed Module/Main_Screens/GroupTab/View/NewPost.dart +++ b/lib/Feed Module/Main_Screens/GroupTab/View/NewPost.dart @@ -152,7 +152,7 @@ class _NewPostState extends State { sizedBoxHeight(20.h), text16w400_FCFCFC("Tags"), sizedBoxHeight(18.h), - CustomDropDownTag( + CustomDropDownTag1( header: "Enter tags", title: "Enter tags", listData: [ diff --git a/lib/Feed Module/Main_Screens/GroupTab/View/RequestedGroups.dart b/lib/Feed Module/Main_Screens/GroupTab/View/RequestedGroups.dart index 692f3c1..31abd64 100644 --- a/lib/Feed Module/Main_Screens/GroupTab/View/RequestedGroups.dart +++ b/lib/Feed Module/Main_Screens/GroupTab/View/RequestedGroups.dart @@ -46,23 +46,28 @@ class _RequestedGroupsState extends State { Container( decoration: const BoxDecoration( image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), fit: BoxFit.fill)), + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), ), - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - sizedBoxHeight(20.h), - ListView.builder( - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemCount: groupData.length, - itemBuilder: (context, index) { - return groupCard( - ontap: () {}, - imagepath: groupData[index]['imagePath'], - title: groupData[index]['text'], - members: groupData[index]['members']); - }, - ) - ]) + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + sizedBoxHeight(20.h), + ListView.builder( + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemCount: groupData.length, + itemBuilder: (context, index) { + return groupCard( + ontap: () {}, + imagepath: groupData[index]['imagePath'], + title: groupData[index]['text'], + members: groupData[index]['members']); + }, + ) + ]), + ) ])); } @@ -76,11 +81,11 @@ class _RequestedGroupsState extends State { padding: EdgeInsets.only(bottom: 25.h), child: GestureDetector( onTap: ontap, - child: commonGlassContainer( - border: 0.9, + child: commonGlassUI( width: double.infinity, height: 162.h, - borderradius: 10.r, + borderwidth: 0.9, + borderRadius: BorderRadius.circular(10.r), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h), child: Column( diff --git a/lib/Feed Module/Main_Screens/ProfileTab/ProfileTab.dart b/lib/Feed Module/Main_Screens/ProfileTab/ProfileTab.dart index 59700f6..4808123 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/ProfileTab.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/ProfileTab.dart @@ -257,20 +257,20 @@ class _ProfileTabState extends State { sizedBoxHeight(25.h), Row( children: [ - commonGlassUI( - width: 25.w, - height: 25.h, - opacity1: 0.24, - opacity2: 0.24, - mainOpacity: 1, - borderRadius: BorderRadius.circular(100), - customWidget: Center( - child: Image.asset( - "assets/images/png/Group 58645.png", - height: 12.h, - width: 12.w, - )), - borderwidth: 0.5), + commonContainer( + width: 25.w, + height: 25.h, + opacity1: 0.26, + opacity2: 0.26, + borderwidth: 0.5, + boxShape: BoxShape.circle, + customWidget: Center( + child: Image.asset( + "assets/images/png/Group 58645.png", + height: 12.h, + width: 12.w, + )), + ), sizedBoxWidth(12.w), text14400whiteblur( "Elm street london, United Kingdom"), @@ -279,14 +279,13 @@ class _ProfileTabState extends State { sizedBoxHeight(20.h), Row( children: [ - commonGlassUI( + commonContainer( width: 25.w, height: 25.h, - opacity1: 0.24, - opacity2: 0.24, - mainOpacity: 1, - borderRadius: BorderRadius.circular(100), + opacity1: 0.26, + opacity2: 0.26, borderwidth: 0.5, + boxShape: BoxShape.circle, customWidget: Center( child: Image.asset( "assets/images/png/Vector (4).png", @@ -434,34 +433,19 @@ class _ProfileTabState extends State { children: [ sizedBoxHeight(20.h), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - commonGlassUI( - width: 40.w, - height: 40.h, - opacity1: 0.5, - opacity2: 0.4, - borderwidth: 0.5, - borderRadius: BorderRadius.circular(100.r), - customWidget: Center( - child: Image.asset( - 'assets/images/png/ph_arrow-up-thin.png', - height: 25.h, - width: 25.w, - )), - ), Spacer(), InkWell( onTap: () { Get.toNamed(RouteName.settings); }, - child: commonGlassContainer( - border: 0.5, + child: commonContainer( width: 40.w, height: 40.h, - borderradius: 100, + borderwidth: 0.5, + boxShape: BoxShape.circle, opacity1: 0.5, - opacity2: 0.4, + opacity2: 0.6, customWidget: Center( child: Image.asset( 'assets/images/png/setting2.png', @@ -749,13 +733,13 @@ class _ProfileTabState extends State { 'assets/images/png/party-popper 2.png' ]), Spacer(), - commonGlassUI( + commonContainer( width: 30.w, height: 30.h, - opacity1: 0.05, - opacity2: 0.06, + opacity1: 0.2, + opacity2: 0.2, borderwidth: 0.43, - borderRadius: BorderRadius.circular(100), + boxShape: BoxShape.circle, customWidget: Center( child: Image.asset( 'assets/images/png/Frame 1000004088.png', @@ -767,13 +751,13 @@ class _ProfileTabState extends State { sizedBoxWidth(12.w), text14w400_FCFCFC('20'), sizedBoxWidth(20.w), - commonGlassUI( + commonContainer( width: 30.w, height: 30.h, - opacity1: 0.05, - opacity2: 0.06, + opacity1: 0.2, + opacity2: 0.2, borderwidth: 0.43, - borderRadius: BorderRadius.circular(100), + boxShape: BoxShape.circle, customWidget: Center( child: Image.asset( 'assets/images/png/Vector (1).png', @@ -904,12 +888,12 @@ class _ProfileTabState extends State { } Widget containertile({required String text}) { - return commonGlassUI( + return commonContainer( width: 100.w, height: 30.h, + borderRadius: BorderRadius.circular(30.r), borderColor: Color(0xFFD90B2E), borderwidth: 0.9, - borderRadius: BorderRadius.circular(30.r), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 10.w), child: Center(child: text14w400_FCFCFC(text)), diff --git a/lib/Feed Module/sidemenu/Community/MyCommunity/View/MyCommunity.dart b/lib/Feed Module/sidemenu/Community/MyCommunity/View/MyCommunity.dart index d11062d..41c9543 100644 --- a/lib/Feed Module/sidemenu/Community/MyCommunity/View/MyCommunity.dart +++ b/lib/Feed Module/sidemenu/Community/MyCommunity/View/MyCommunity.dart @@ -102,51 +102,50 @@ class _MyCommunityState extends State { ), ), body: Stack(children: [ - Container( + 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: [ - text18w700_FCFCFC("Joined communities"), - sizedBoxHeight(15.h), - Column( - children: List.generate(JoinedcommunityData.length, - (index) { - return communityCard( - ontap: () { - Get.toNamed(RouteName.communityDetails); - }, - imagepath: JoinedcommunityData[index] - ['imagePath'], - title: JoinedcommunityData[index]['text'], - members: JoinedcommunityData[index] - ['members'], - index: JoinedcommunityData[index]['index']); - }), - ), - text18w700_FCFCFC("Requested communities"), - sizedBoxHeight(20.h), - Column( - children: List.generate(RequestcommunityData.length, - (index) { - return communityCard( - ontap: () {}, - imagepath: RequestcommunityData[index] - ['imagePath'], - title: RequestcommunityData[index]['text'], - members: RequestcommunityData[index] - ['members'], - index: RequestcommunityData[index]['index']); - }), - ) - ]), - )) + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text18w700_FCFCFC("Joined communities"), + sizedBoxHeight(15.h), + Column( + children: + List.generate(JoinedcommunityData.length, (index) { + return communityCard( + ontap: () { + Get.toNamed(RouteName.communityDetails); + }, + imagepath: JoinedcommunityData[index] + ['imagePath'], + title: JoinedcommunityData[index]['text'], + members: JoinedcommunityData[index]['members'], + index: JoinedcommunityData[index]['index']); + }), + ), + text18w700_FCFCFC("Requested communities"), + sizedBoxHeight(20.h), + Column( + children: + List.generate(RequestcommunityData.length, (index) { + return communityCard( + ontap: () {}, + imagepath: RequestcommunityData[index] + ['imagePath'], + title: RequestcommunityData[index]['text'], + members: RequestcommunityData[index]['members'], + index: RequestcommunityData[index]['index']); + }), + ) + ]), + )) ])); } @@ -161,11 +160,11 @@ class _MyCommunityState extends State { padding: EdgeInsets.only(bottom: 25.h), child: GestureDetector( onTap: ontap, - child: commonGlassContainer( - border: 0.9, + child: commonGlassUI( width: double.infinity, height: 162.h, - borderradius: 10.r, + borderwidth: 0.9, + borderRadius: BorderRadius.circular(10.r), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h), child: Column( diff --git a/lib/Feed Module/sidemenu/sidemenu.dart b/lib/Feed Module/sidemenu/sidemenu.dart index 03e57a7..46b1503 100644 --- a/lib/Feed Module/sidemenu/sidemenu.dart +++ b/lib/Feed Module/sidemenu/sidemenu.dart @@ -1,13 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_svg/svg.dart'; + import 'package:get/get.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/CommonWidget.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 SideMenu extends StatefulWidget { const SideMenu({super.key}); @@ -78,75 +77,75 @@ class _SideMenuState extends State { child: ListView(children: [ Padding( padding: EdgeInsets.symmetric(horizontal: 10.w), - child: commonGlassContainer( - width: double.infinity, - height: 330.h, - borderradius: 10, - customWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.symmetric( - horizontal: 16.w, vertical: 12.h), - child: Row( - children: [ - text16w400_FCFCFC("Pinned"), - Spacer(), - Icon( - Icons.arrow_drop_up, - color: Colors.white, - size: 25, - ) - ], - ), + child: commonGlassUI( + width: double.infinity, + height: 330.h, + borderRadius: BorderRadius.circular(10.r), + customWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 16.w, vertical: 12.h), + child: Row( + children: [ + text16w400_FCFCFC("Pinned"), + Spacer(), + Icon( + Icons.arrow_drop_up, + color: Colors.white, + size: 25, + ) + ], ), - commonDivider(), - sizedBoxHeight(10.h), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 1), - firstRowTile( - text: "Advice", - leadingimage: - "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 2), - firstRowTile( - text: "Crush", - leadingimage: - "assets/images/png/sidemenu/Vector (4).png", - index: 3), - ListTile( - leading: CircleAvatar( - radius: 15.r, - foregroundImage: AssetImage( - "assets/images/png/sidemenu/Ellipse 52.png"), - ), - title: text14w400_FCFCFC("Ryan Dorwart"), - trailing: Image.asset( - "assets/images/png/sidemenu/f7_pin-fill (1).png", - width: 19.w, - height: 19.h, - ), - onTap: () {}, + ), + commonDivider(), + sizedBoxHeight(10.h), + firstRowTile( + text: "Row bridge", + leadingimage: + "assets/images/png/sidemenu/rowing 1 (traced).png", + index: 1), + firstRowTile( + text: "Advice", + leadingimage: + "assets/images/png/sidemenu/solar_cloud-outline.png", + index: 2), + firstRowTile( + text: "Crush", + leadingimage: + "assets/images/png/sidemenu/Vector (4).png", + index: 3), + ListTile( + leading: CircleAvatar( + radius: 15.r, + foregroundImage: AssetImage( + "assets/images/png/sidemenu/Ellipse 52.png"), ), - ListTile( - leading: CircleAvatar( - radius: 15.r, - foregroundImage: AssetImage( - "assets/images/png/sidemenu/Ellipse 53.png"), - ), - title: text14w400_FCFCFC("Ahmad Rhiel Madsen"), - trailing: Image.asset( - "assets/images/png/sidemenu/f7_pin-fill (1).png", - width: 19.w, - height: 19.h, - ), - onTap: () {}, + title: text14w400_FCFCFC("Ryan Dorwart"), + trailing: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill (1).png", + width: 19.w, + height: 19.h, ), - ]), - border: 1), + onTap: () {}, + ), + ListTile( + leading: CircleAvatar( + radius: 15.r, + foregroundImage: AssetImage( + "assets/images/png/sidemenu/Ellipse 53.png"), + ), + title: text14w400_FCFCFC("Ahmad Rhiel Madsen"), + trailing: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill (1).png", + width: 19.w, + height: 19.h, + ), + onTap: () {}, + ), + ]), + ), ), sizedBoxHeight(18.h), Padding( @@ -366,11 +365,11 @@ class _SideMenuState extends State { required int index, }) { return ListTile( - leading: commonGlassContainer( - border: 0.9, + leading: commonContainer( width: 29.w, height: 29.h, - borderradius: 100, + borderwidth: 0.9, + boxShape: BoxShape.circle, customWidget: Center( child: Image.asset( leadingimage, diff --git a/lib/Login/Model/LoginModel.dart b/lib/Login/Model/LoginModel.dart new file mode 100644 index 0000000..9be84d1 --- /dev/null +++ b/lib/Login/Model/LoginModel.dart @@ -0,0 +1,45 @@ +class LoginModel { + String? status; + int? statusCode; + String? message; + Data? data; + + LoginModel({this.status, this.statusCode, this.message, this.data}); + + LoginModel.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 { + String? accessToken; + int? id; + + Data({this.accessToken, this.id}); + + Data.fromJson(Map json) { + accessToken = json['access-token']; + id = json['id']; + } + + Map toJson() { + final Map data = new Map(); + data['access-token'] = this.accessToken; + data['id'] = this.id; + return data; + } +} \ No newline at end of file diff --git a/lib/Login/View/loginscreen.dart b/lib/Login/View/loginscreen.dart index 1e1b530..498f531 100644 --- a/lib/Login/View/loginscreen.dart +++ b/lib/Login/View/loginscreen.dart @@ -1,19 +1,19 @@ - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; -import 'package:glassmorphism/glassmorphism.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Login/ViewModel/LoginApi.dart'; import 'package:regroup/Utils/Common/CustomNextButton.dart'; import 'package:regroup/Utils/Common/CustomTextformfield.dart'; -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:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; -import 'package:show_fps/show_fps.dart'; import 'package:flutter_facebook_auth/flutter_facebook_auth.dart'; +import 'package:regroup/Common/global.dart' as global; +// import 'package:regroup/Common/global.dart' as global; class LoginScreen extends StatefulWidget { const LoginScreen({super.key}); @@ -26,11 +26,13 @@ class _LoginScreenState extends State { Map? _userData; AccessToken? _accessToken; bool _checking = true; - final TextEditingController _email = TextEditingController(); + final TextEditingController _emailController = TextEditingController(); RxBool isObscured = true.obs; - final TextEditingController _password = TextEditingController(); + final TextEditingController _passwordController = TextEditingController(); // final GlobalKey _form = GlobalKey(); + // RxString errormsg = ''.obs; + // RxString errormsgpass = ''.obs; @override void initState() { // TODO: implement initState @@ -38,8 +40,8 @@ class _LoginScreenState extends State { super.initState(); } - _checkIfisLoggedIn() async { - //user token + _checkIfisLoggedIn() async { + //user token final accessToken = await FacebookAuth.instance.accessToken; setState(() { @@ -56,13 +58,14 @@ class _LoginScreenState extends State { _userData = userData; }); } else { - print("/////////////////////////////////////////check"); + print("/////////////////////////////////////////check"); print("not worked"); _login(); } } - _login() async { + + _login() async { final LoginResult result = await FacebookAuth.instance.login(); if (result.status == LoginStatus.success) { @@ -86,6 +89,75 @@ class _LoginScreenState extends State { setState(() {}); } + _logincheck() async { + if (_emailController.text.isBlank! || _passwordController.text.isBlank!) { + Get.snackbar( + 'Error', + 'Enter your credentials', + snackPosition: SnackPosition.BOTTOM, + backgroundColor: Colors.red, + colorText: Colors.white, + ); + } else if (!_emailController.text.isEmail) { + Get.snackbar( + 'Error', + 'Enter a valid e-mail address', + snackPosition: SnackPosition.BOTTOM, + backgroundColor: Colors.red, + colorText: Colors.white, + ); + } else { + Map updata = { + "email_address": _emailController.text, + "password": _passwordController.text, + // "access-token" : "" + // + // "player_id": global.player_id!, + }; + final data = await LoginAPI().loginApi(updata); + if (data.status == ResponseStatus.SUCCESS) { + // await global.setname(); + Get.snackbar( + "Success!", + 'Login successful!', + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.green, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + + Get.toNamed(RouteName.mainscreen); + } else if (data.status == ResponseStatus.FAILED) { + Get.snackbar( + "Error!", + data.message, + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.red, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + // _controller.isTextFieldEnabled.value = true; + } else { + // 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, + ); + // _controller.isTextFieldEnabled.value = true; + } + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -101,221 +173,193 @@ class _LoginScreenState extends State { image: AssetImage("assets/images/png/Choice screen.png"), fit: BoxFit.cover)), ), - Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 150.h, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 150.h, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Align( + alignment: Alignment.center, + child: Container( + width: 107.w, + height: 70.h, + child: SvgPicture.asset( + "assets/images/svg/onboarding2.svg", + fit: BoxFit.cover, + ), + ), ), - Padding( + ), + sizedBoxHeight(20.h), + Align( + alignment: Alignment.center, + child: text22400FCFCFC("Find your community")), + sizedBoxHeight(40.h), + Expanded( + child: Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.center, - child: Container( - width: 107.w, - height: 70.h, - child: SvgPicture.asset( - "assets/images/svg/onboarding2.svg", - fit: BoxFit.cover, + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text16400white('Email address'), + sizedBoxHeight(10.h), + CustomTextFormField( + textEditingController: _emailController, + hintText: "Enter your email address", + leadingIcon: + // const Icon(Icons.mail_outline), + SizedBox( + width: 22.w, + height: 17.h, + child: Image.asset( + 'assets/images/png/mail.png', + width: 22.w, + height: 17.h, + ), ), + // validationMessage: errormsg.value, + validator: (value) { + if (value!.isEmpty) { + return 'Enter your e-mail address'; + } + if (!RegExp( + r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$') + .hasMatch(value)) { + return 'Enter a valid e-mail address'; + } + return null; + }, + // onInput: (p0) { + // if (p0!.isEmpty) { + // errormsg.value = 'Enter your e-mail address'; + // } + // if (!RegExp( + // r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$') + // .hasMatch(p0!)) { + // errormsg.value = 'Enter a valid e-mail address'; + // } + // return null; + // }, + // validatorText: "Email Id", + + inputFormatters: [ + LengthLimitingTextInputFormatter(30), + RemoveEmojiInputFormatter() + ], ), - ), - sizedBoxHeight(20.h), - Align( - alignment: Alignment.center, - child: text22400FCFCFC("Find your community")), - sizedBoxHeight(40.h), - text16400white('Email address'), - sizedBoxHeight(10.h), - CustomTextFormField( - textEditingController: _email, - hintText: "Enter your email address", - leadingIcon: - // const Icon(Icons.mail_outline), - SizedBox( - width: 22.w, - height: 17.h, - child: Image.asset( - 'assets/images/png/mail.png', + sizedBoxHeight(10.h), + text16400white('Password'), + sizedBoxHeight(10.h), + CustomTextFormField( + isInputPassword: true, + textEditingController: _passwordController, + hintText: 'Enter your password', + leadingIcon: Image.asset( + 'assets/images/png/lock.png', width: 22.w, height: 17.h, ), - ), - // validatorText: "Email Id", - validator: (value) { - if (value!.isEmpty) { - return 'Enter your e-mail address'; - } - if (!RegExp( - r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$') - .hasMatch(value)) { - return 'Enter a valid e-mail address'; - } - return null; - }, - inputFormatters: [ - LengthLimitingTextInputFormatter(30), - RemoveEmojiInputFormatter() - ], - ), - sizedBoxHeight(10.h), - text16400white('Password'), - sizedBoxHeight(10.h), - CustomTextFormField( - isInputPassword: true, - textEditingController: _password, - hintText: 'Enter your password', - leadingIcon: Image.asset( - 'assets/images/png/lock.png', - width: 22.w, - height: 17.h, - ), - validator: (val) { - if (val == null || val.isEmpty) { - return 'Please enter your password'; - } - return null; - }, - inputFormatters: [ - LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter() - ], - ), - sizedBoxHeight(10.h), - Align( - alignment: Alignment.centerRight, - child: Padding( - padding: EdgeInsets.only(right: 6.w), - child: text14400white('Forgot password ?'), - )), - sizedBoxHeight(40.h), - CustomButton( - text: "Login", - onPressed: () { - Get.toNamed(RouteName.mainscreen); - }), - sizedBoxHeight(20.h), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.signupscreen); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - text14400white('Don’t have account ? '), - sizedBoxWidth(5.w), - text14700white('Sign up') + // validationMessage: errormsgpass.value, + validator: (value) { + if (value!.isEmpty) { + return 'Please enter your password'; + } + if (!RegExp( + r'^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{8,}$') + .hasMatch(value)) { + return 'Enter a valid password'; + } + + return null; + }, + // onInput: (p0) { + // if (p0 == null || p0.isEmpty) { + // errormsgpass.value = + // 'Please enter your password'; + // } + // return null; + // }, + inputFormatters: [ + LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter() ], ), - ), - sizedBoxHeight(30.h), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - width: 160, - decoration: const ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 0.50, - strokeAlign: BorderSide.strokeAlignCenter, - color: Color(0xFF434A53), - ), - ), - ), - ), - sizedBoxWidth(6.w), - text14400white('Or'), - sizedBoxWidth(6.w), - Container( - width: 160, - decoration: const ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 0.50, - strokeAlign: BorderSide.strokeAlignCenter, - color: Color(0xFF434A53), - ), - ), - ), - ), - ], - ), - sizedBoxHeight(20.h), - Center( - child: SizedBox( - width: 220.w, + sizedBoxHeight(10.h), + Align( + alignment: Alignment.centerRight, + child: Padding( + padding: EdgeInsets.only(right: 6.w), + child: GestureDetector( + onTap: () { + Get.toNamed(RouteName.forgotpass); + }, + child: text14400white('Forgot password ?')), + )), + sizedBoxHeight(40.h), + CustomButton( + text: "Login", + onPressed: () { + _logincheck(); + }), + sizedBoxHeight(20.h), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.signupscreen); + }, child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - 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'))), + text14400white('Don’t have account ? '), + sizedBoxWidth(5.w), + text14700white('Sign up') + ], + ), + ), + sizedBoxHeight(30.h), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 160, + decoration: const ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide( + width: 0.50, + strokeAlign: BorderSide.strokeAlignCenter, + color: Color(0xFF434A53), + ), + ), ), - 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/login3.png'))), + ), + sizedBoxWidth(6.w), + text14400white('Or'), + sizedBoxWidth(6.w), + Container( + width: 160, + decoration: const ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide( + width: 0.50, + strokeAlign: BorderSide.strokeAlignCenter, + color: Color(0xFF434A53), + ), + ), ), - const Spacer(), - GestureDetector( - onTap: () async { - _checkIfisLoggedIn(); - - /* FacebookAuth.instance.login( - permissions: ['public_profile', 'email'], - ).then((value) { - FacebookAuth.instance.getUserData().then((userData) { - setState(() { - /* _isLoggedIn = true; - _userObj = userData; */ - }); - }); - }); */ - }, - child: Container( + ), + ], + ), + sizedBoxHeight(20.h), + Center( + child: SizedBox( + width: 220.w, + child: Row( + children: [ + Container( width: 55, height: 55, decoration: ShapeDecoration( @@ -336,18 +380,83 @@ class _LoginScreenState extends State { ), image: const DecorationImage( image: AssetImage( - 'assets/images/png/login4.png'))), + 'assets/images/png/login2.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/login3.png'))), + ), + const Spacer(), + GestureDetector( + onTap: () async { + _checkIfisLoggedIn(); + + /* FacebookAuth.instance.login( + permissions: ['public_profile', 'email'], + ).then((value) { + FacebookAuth.instance.getUserData().then((userData) { + setState(() { + /* _isLoggedIn = true; + _userObj = userData; */ + }); + }); + }); */ + }, + child: Container( + width: 55, + height: 55, + decoration: ShapeDecoration( + gradient: LinearGradient( + begin: const Alignment(0.71, -0.70), + end: const Alignment(-0.71, 0.7), + colors: [ + Colors.white.withOpacity( + 0.07999999821186066), + Colors.white.withOpacity( + 0.12999999523162842) + ], + ), + shape: const OvalBorder( + side: BorderSide( + width: 0.50, + color: Color(0xFF434A53)), + ), + image: const DecorationImage( + image: AssetImage( + 'assets/images/png/login4.png'))), + ), + ), + ], + ), ), ), - ) - ], + sizedBoxHeight(100) + ], + ), ), - ) - ], - ), + ), + ), + ], ), ], ), diff --git a/lib/Login/ViewModel/LoginApi.dart b/lib/Login/ViewModel/LoginApi.dart new file mode 100644 index 0000000..f4306b5 --- /dev/null +++ b/lib/Login/ViewModel/LoginApi.dart @@ -0,0 +1,33 @@ +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:shared_preferences/shared_preferences.dart'; + +class LoginAPI { + LoginAPI(); + Future loginApi(var data) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + final response = await NetworkApiServices().postApi( + data, 'https://regroup.betadelivery.com/api/v1/login', + optionalpar: true + + // "auth/login/", + ); + + 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); + } + } + + return response; + } +} diff --git a/lib/Utils/Common/CustomTextformfield.dart b/lib/Utils/Common/CustomTextformfield.dart index a6caef8..f6ef482 100644 --- a/lib/Utils/Common/CustomTextformfield.dart +++ b/lib/Utils/Common/CustomTextformfield.dart @@ -33,7 +33,7 @@ class CustomTextFormField extends StatefulWidget { this.opacity2 = 0.05, }) : super(key: key); - final String? Function(String?)? validator; + dynamic validator; final TextEditingController? textEditingController; final String? hintText; final Widget? leadingIcon; @@ -46,7 +46,7 @@ class CustomTextFormField extends StatefulWidget { final TextInputType? texttype; final List? inputFormatters; final Color outlineColor; - final Function(String)? onInput; + final String? Function(String?)? onInput; final VoidCallback? onTap; final Widget? suffixIcon; final double opacity1; @@ -159,6 +159,7 @@ class _CustomTextFormFieldState extends State { ], ), ) + : widget.suffixIcon == null ? null : widget.suffixIcon!, @@ -168,6 +169,7 @@ class _CustomTextFormFieldState extends State { ), keyboardType: widget.texttype, inputFormatters: widget.inputFormatters, + // validator: widget.validator, onChanged: (value) { widget.onInput?.call(value); validateField(value); diff --git a/lib/Utils/Common/api_urls.dart b/lib/Utils/Common/api_urls.dart deleted file mode 100644 index 6cbb3a6..0000000 --- a/lib/Utils/Common/api_urls.dart +++ /dev/null @@ -1,6 +0,0 @@ -class ApiUrls { - static const baseUrl = ""; - - static const getfaq = "${baseUrl}faq-tags"; - -} diff --git a/lib/Utils/texts.dart b/lib/Utils/texts.dart index 40b5c1d..ab870e6 100644 --- a/lib/Utils/texts.dart +++ b/lib/Utils/texts.dart @@ -530,6 +530,16 @@ Widget text12w400_FCFCFC(String text) { fontWeight: FontWeight.w400), ); } +Widget text12w400_8E8E8E(String text) { + return Text( + text, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF8E8E8E), + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400), + ); +} Widget text12w700_FCFCFC(String text) { return Text( diff --git a/lib/main.dart b/lib/main.dart index 04d36bd..648e485 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,19 +16,19 @@ import 'package:statsfl/statsfl.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); - SystemChrome.setPreferredOrientations([ + SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, - ]).then( - (value) => - // runApp(MyApp()) - runApp(StatsFl( - align: Alignment.center, - width: 200, - height: 100, - child: const MyApp())), - ); -} + ]).then((value) => + // runApp(MyApp()) + runApp(const MyApp()) + // StatsFl( + // align: Alignment.center, + // width: 200, + // height: 100, + // child: const MyApp())), + ); +} class MyApp extends StatefulWidget { const MyApp({super.key}); diff --git a/lib/onboarding/NewPass/View/NewPass.dart b/lib/onboarding/NewPass/View/NewPass.dart new file mode 100644 index 0000000..b9aa428 --- /dev/null +++ b/lib/onboarding/NewPass/View/NewPass.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:regroup/Common/CommonButton.dart'; +import 'package:regroup/Utils/Common/CommonAppbar.dart'; +import 'package:regroup/Utils/Common/CustomTextformfield.dart'; +import 'package:regroup/Utils/Common/sized_box.dart'; +import 'package:regroup/Utils/texts.dart'; + +class NewPassword extends StatefulWidget { + const NewPassword({super.key}); + + @override + State createState() => _NewPasswordState(); +} + +class _NewPasswordState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + // key: _scaffoldKey1, + backgroundColor: Color(0xFF222935), + extendBody: true, + resizeToAvoidBottomInset: false, + appBar: CommonAppbar( + titleTxt: "", + ), + body: Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(30.h), + text22400white("Create password"), + sizedBoxHeight(15.h), + Container( + height: 1.h, + width: 250.w, + color: Color(0xFF858585), + ), + sizedBoxHeight(35.h), + text16w400_FCFCFC("Create new password"), + sizedBoxHeight(15.h), + CustomTextFormField(), + sizedBoxHeight(20.h), + text16w400_FCFCFC("Confirm password"), + sizedBoxHeight(15.h), + CustomTextFormField(), + sizedBoxHeight(90.h), + CommonBtn(text: 'Continue'), + ]))) + ])); + } +} diff --git a/lib/onboarding/Signup/View/signupscreen.dart b/lib/onboarding/Signup/View/signupscreen.dart index e160bb7..6e170c1 100644 --- a/lib/onboarding/Signup/View/signupscreen.dart +++ b/lib/onboarding/Signup/View/signupscreen.dart @@ -20,7 +20,7 @@ class SignupScreen extends StatefulWidget { class _SignupScreenState extends State { TextEditingController emailidcontroller = TextEditingController(); - TextEditingController _password = TextEditingController(); + TextEditingController passwordController = TextEditingController(); TextEditingController confirmpasscontroller = TextEditingController(); List _dropdownProductItems = [ @@ -36,6 +36,36 @@ 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'); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -102,7 +132,7 @@ class _SignupScreenState extends State { sizedBoxHeight(10.h), CustomTextFormField( isInputPassword: true, - textEditingController: _password, + textEditingController: passwordController, hintText: 'Enter your password', leadingIcon: Image.asset( 'assets/images/png/lock.png', @@ -140,7 +170,7 @@ class _SignupScreenState extends State { if (val == null || val.isEmpty) { return 'Please enter your password'; } - if (val != _password.text) { + if (val != passwordController.text) { return 'Password does not match'; } return null; @@ -167,7 +197,7 @@ class _SignupScreenState extends State { 'Individual', 'Business', ], - onItemSelected: (p0) {}, + onItemSelected: _onItemSelected, leadingImage: Image.asset( 'assets/images/png/user.png', ), @@ -238,22 +268,7 @@ class _SignupScreenState extends State { CustomButton( text: "Continue", onPressed: () { - if (_selectedAccountType == 'Individual') { - // Get.to(() => IndividualPage()); - print('individual selected'); - Get.toNamed(RouteName.verifyusercreen, - arguments: _selectedAccountType); - } else if (_selectedAccountType == 'Business') { - print('business selected'); - Get.toNamed(RouteName.verifyusercreen, - arguments: _selectedAccountType); - - // Get.to(() => BusinessPage()); - } else { - // Handle case where no selection is made - utils.showToast( - 'Please select an account type'); - } + _Signincheck(); }), sizedBoxHeight(20.h), Row( diff --git a/lib/onboarding/Signup/View/verifyuser.dart b/lib/onboarding/Signup/View/verifyuser.dart index fc1575a..33879ae 100644 --- a/lib/onboarding/Signup/View/verifyuser.dart +++ b/lib/onboarding/Signup/View/verifyuser.dart @@ -4,13 +4,16 @@ 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/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/forgotPass/ViewModel/ForgotPassAPI.dart'; import 'package:regroup/resources/routes/route_name.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class VerifyuserScreenState extends StatefulWidget { const VerifyuserScreenState({super.key}); @@ -20,8 +23,64 @@ class VerifyuserScreenState extends StatefulWidget { } class _VerifyuserScreenStateState extends State { - String accounttype = Get.arguments; + // String accounttype = Get.arguments; TextEditingController? pincode = TextEditingController(); + final String emailAddress = Get.arguments; + + String? principleId; + +// principleId = prefs.getString('email').toString(); + + checkValidation() async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + principleId = prefs.getString('principal_xid'); + if (pincode!.text.isEmpty) { + utils.showToast('Pin field is empty'); + } else { + Map updata = { + "iam_principal_xid": principleId.toString(), + "otp": pincode!.text, + }; + final data = await ForgotPassAPI().verifyotp(updata); + if (data.status == ResponseStatus.SUCCESS) { + // btnController.success(); + // btnController.reset(); + Get.snackbar( + "Success!", + 'OTP verification successful!', + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.green, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + Future.delayed(Duration(seconds: 1), () { + Get.toNamed(RouteName.newpassword, arguments: emailAddress); + }); + // print('success'); + } 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, + ); + } + } + } + + @override + void initState() { + print(emailAddress); + super.initState(); + } @override Widget build(BuildContext context) { @@ -80,7 +139,7 @@ class _VerifyuserScreenStateState extends State { text22400white('Check your email'), sizedBoxHeight(10.h), text14400white( - 'Enter the verification code that we sent to loremipsum@gmail.com'), + 'Enter the verification code that we sent to $emailAddress'), sizedBoxHeight(40.h), text16400white('Enter code'), sizedBoxHeight(20.h), @@ -147,17 +206,18 @@ class _VerifyuserScreenStateState extends State { CustomButton( text: 'Continue', onPressed: () { - if (pincode!.text.isEmpty) { - utils.showToast('Pin field is empty'); - } else { - if (accounttype == 'Individual') { - print('individual selected'); - Get.toNamed(RouteName.tellusindividualscreen); - } else if (accounttype == 'Business') { - print('business selected'); - Get.toNamed(RouteName.tellusbusinessscreen); - } - } + // if (pincode!.text.isEmpty) { + // utils.showToast('Pin field is empty'); + // } else { + // if (accounttype == 'Individual') { + // print('individual selected'); + // Get.toNamed(RouteName.tellusindividualscreen); + // } else if (accounttype == 'Business') { + // print('business selected'); + // Get.toNamed(RouteName.tellusbusinessscreen); + // } + // } + checkValidation(); }), const Spacer( // flex: 2, diff --git a/lib/onboarding/forgotPass/View/ForgotPass.dart b/lib/onboarding/forgotPass/View/ForgotPass.dart new file mode 100644 index 0000000..5f68756 --- /dev/null +++ b/lib/onboarding/forgotPass/View/ForgotPass.dart @@ -0,0 +1,161 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Utils/Common/CommonAppbar.dart'; +import 'package:regroup/Utils/Common/CustomNextButton.dart'; +import 'package:regroup/Utils/Common/CustomTextformfield.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/forgotPass/ViewModel/ForgotPassAPI.dart'; +import 'package:regroup/resources/routes/route_name.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class ForgotPass extends StatefulWidget { + const ForgotPass({super.key}); + + @override + State createState() => _ForgotPassState(); +} + +class _ForgotPassState extends State { + TextEditingController emailController = TextEditingController(); + // final _formKey = GlobalKey(); + + checkValidation() async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + + if (emailController.text.isEmpty) { + utils.showToast('Enter a email address'); + } else if (!emailController.text.isEmail) { + utils.showToast('Enter a valid email address'); + } else { + // Get.toNamed(RouteName.verifyusercreen, + // arguments: { + // "emailAddress": emailController.text + // }); + + Map updata = { + "email_address": emailController.text, + }; + final resp = await ForgotPassAPI().requestotp(updata); + if (resp.status == ResponseStatus.SUCCESS) { + Get.snackbar( + "Success!", + 'OTP sent successfully!', + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.green, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + prefs.setString('email', emailController.text); + prefs.setString('principal_xid', resp.data['data']['iam_principal_xid']); + Future.delayed(Duration(seconds: 1), () { + Get.toNamed(RouteName.verifyusercreen, + arguments: emailController.text); + }); + // print('success'); + } else if (resp.status == ResponseStatus.FAILED) { + Get.snackbar( + "Error!", + resp.message, + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.red, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + } else { + // btnController.error(); + // btnController.reset(); + Get.snackbar( + "Error!", + resp.data['message'], + duration: Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.red, + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + } + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + // key: _scaffoldKey1, + backgroundColor: Color(0xFF222935), + extendBody: true, + resizeToAvoidBottomInset: false, + appBar: CommonAppbar( + titleTxt: "", + ), + body: Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(30.h), + text22400white("Forgot password"), + sizedBoxHeight(15.h), + Container( + height: 1.h, + width: 250.w, + color: Color(0xFF858585), + ), + sizedBoxHeight(35.h), + text16w400_FCFCFC("Email address"), + sizedBoxHeight(15.h), + CustomTextFormField( + textEditingController: emailController, + leadingIcon: Container( + height: 18.h, + width: 23.w, + child: Center( + child: Image.asset( + "assets/images/png/Frame 12 (1).png", + height: 18.h, + width: 23.w, + ), + ), + ), + hintText: "loremipsum@gmail.comess", + validator: (value) { + if (value!.isEmpty) { + return 'Enter your e-mail address'; + } + if (!RegExp( + r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$') + .hasMatch(value)) { + return 'Enter a valid e-mail address'; + } + return null; + }, + ), + sizedBoxHeight(8.h), + text12w400_8E8E8E( + "We’ll send four digit code to the registered email"), + sizedBoxHeight(90.h), + CustomButton( + text: 'Continue', + onPressed: () { + checkValidation(); + }), + ]))) + ])); + } +} diff --git a/lib/onboarding/forgotPass/ViewModel/ForgotPassAPI.dart b/lib/onboarding/forgotPass/ViewModel/ForgotPassAPI.dart new file mode 100644 index 0000000..970afba --- /dev/null +++ b/lib/onboarding/forgotPass/ViewModel/ForgotPassAPI.dart @@ -0,0 +1,50 @@ +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class ForgotPassAPI { + ForgotPassAPI(); + // class otpAPI { + // otpAPI(this.data); + // var data; + Future> requestotp(var data) async { + final response = await NetworkApiServices().postApi( + data, + "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> verifyotp(var data) async { + final response = await NetworkApiServices().postApi( + data, + "https://regroup.betadelivery.com/api/v1/forgot-password/verify-otp", + ); + + if (response.status == ResponseStatus.SUCCESS) { + //Map responseData = jsonDecode(response.data); + if (response.data['status'] == "success") { + return ResponseData( + response.data['message'], ResponseStatus.SUCCESS); + } else { + return ResponseData( + response.data['message'], ResponseStatus.FAILED); + } + } + + return response; + } +} + diff --git a/lib/resources/routes/route_name.dart b/lib/resources/routes/route_name.dart index 243d916..127ca3c 100644 --- a/lib/resources/routes/route_name.dart +++ b/lib/resources/routes/route_name.dart @@ -8,6 +8,7 @@ class RouteName { static const String verifyusercreen = '/verifyuser'; static const String tellusindividualscreen = '/tellusindividualscreen'; static const String tellusbusinessscreen = '/tellusbusinessscreen'; + static const String forgotpass = '/forgotpass'; static const String individualprofilestep1 = '/individualprofilestep1'; static const String individualactivitystep2 = '/individualactivitystep2'; @@ -79,8 +80,9 @@ class RouteName { static const String changepassword = '/changepassword'; static const String addtimeline = '/addtimeline'; static const String verifycode = '/verifycode'; - static const String availability = '/availability'; + static const String newpassword = '/newpassword'; + static const String availability = '/availability'; //Group Tab @@ -96,8 +98,6 @@ class RouteName { static const String certificate = '/certificate'; static const String sessions = '/sessions'; - - //subgroup static const String subgroups = '/subgroups'; static const String subgroupinfo = '/subgroupinfo'; @@ -110,7 +110,5 @@ class RouteName { static const String searchgroup = '/searchgroup'; static const String detailexplore = '/detailexplore'; - - static const String notificaationpage = '/notificationpage'; } diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index 995d921..54774a3 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -83,6 +83,7 @@ import 'package:regroup/Feed%20Module/sidemenu/SavedPosts/SavedPosts.dart'; import 'package:regroup/Feed%20Module/sidemenu/sidemenu.dart'; import 'package:regroup/Utils/Common/NoInternet.dart'; +import 'package:regroup/onboarding/NewPass/View/NewPass.dart'; import 'package:regroup/onboarding/Signup/View/Business/step1Letusunderstandbetter.dart'; import 'package:regroup/onboarding/Signup/View/Business/step2Selectgroup.dart'; import 'package:regroup/onboarding/Signup/View/Business/step3SelectCommunity.dart'; @@ -96,6 +97,7 @@ import 'package:regroup/onboarding/Signup/View/communitycommitment.dart'; import 'package:regroup/onboarding/Signup/View/signupendpage.dart'; import 'package:regroup/onboarding/Signup/View/signupscreen.dart'; import 'package:regroup/onboarding/Signup/View/verifyuser.dart'; +import 'package:regroup/onboarding/forgotPass/View/ForgotPass.dart'; import 'package:regroup/onboarding/onboarding1.dart'; import 'package:regroup/onboarding/splashscreen.dart'; import 'package:regroup/resources/routes/route_name.dart'; @@ -476,5 +478,14 @@ class AppRoutes { name: RouteName.sessions, page: () => const Sessions(), ), + + GetPage( + name: RouteName.forgotpass, + page: () => const ForgotPass(), + ), + GetPage( + name: RouteName.newpassword, + page: () => const NewPassword(), + ), ]; }