From 93e07b3cc07f2b7ef7cd915e3c5a90698e3128c6 Mon Sep 17 00:00:00 2001 From: Dakshesh42 Date: Thu, 1 Aug 2024 15:59:47 +0530 Subject: [PATCH 1/5] minor changes --- .../View/Individual/step2Selectactivity.dart | 15 ++++++++++----- .../View/Individual/step3Selectyourgroup.dart | 4 +--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart index b381b2f..89c76e2 100644 --- a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart +++ b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart @@ -450,10 +450,15 @@ class _SelectIndividualActivityState extends State { Row( children: [ Spacer(), - Image.asset( - "assets/images/png/x-circle.png", - height: 28.h, - width: 28.w, + InkWell( + onTap: () { + Get.back(); + }, + child: Image.asset( + "assets/images/png/x-circle.png", + height: 28.h, + width: 28.w, + ), ) ], ), @@ -466,7 +471,7 @@ class _SelectIndividualActivityState extends State { texttype: TextInputType.text, validator: (value) { if (value!.isEmpty) { - return 'Enter your full name '; + return 'Enter your interest'; } return null; }, diff --git a/lib/onboarding/Signup/View/Individual/step3Selectyourgroup.dart b/lib/onboarding/Signup/View/Individual/step3Selectyourgroup.dart index 76f1299..0146056 100644 --- a/lib/onboarding/Signup/View/Individual/step3Selectyourgroup.dart +++ b/lib/onboarding/Signup/View/Individual/step3Selectyourgroup.dart @@ -1,8 +1,6 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:regroup/Common/CommonButton.dart'; @@ -66,7 +64,7 @@ class _SelectIndividualGroupState extends State { final data = await Onboard().postGroups(updata); if (data.status == ResponseStatus.SUCCESS) { - Get.back(); + // Get.back(); print("groups selected"); // Get.toNamed(RouteName.individualcommunitystep4); Get.toNamed(RouteName.communitycommitscreen); From 01cb284b436e9853ce96f7266212d9c40e53f913 Mon Sep 17 00:00:00 2001 From: Shubhamshirva Date: Thu, 1 Aug 2024 17:52:40 +0530 Subject: [PATCH 2/5] community post completed for individual and business --- assets/images/png/add 1.png | Bin 0 -> 594 bytes assets/images/svg/add 1.svg | 9 + lib/Common/api_urls.dart | 11 + .../Main_Screens/Community/Community.dart | 44 +- .../Community/Model/communitylistModel.dart | 83 + .../Community/Model/populartagsListModel.dart | 53 + .../Community/Model/tagsmainModel.dart | 53 + .../Main_Screens/Community/PostScreen.dart | 1376 ++++++++++++++--- .../Community/view_model/getApi.dart | 12 + .../Community/view_model/postApi.dart | 29 + .../Community/view_model/postinList.dart | 52 + .../ProfileTab/Settings/ContactUs.dart | 2 +- lib/Utils/Common/CommonDropdown.dart | 45 +- lib/Utils/Common/CustomTextformfield.dart | 15 +- 14 files changed, 1508 insertions(+), 276 deletions(-) create mode 100644 assets/images/png/add 1.png create mode 100644 assets/images/svg/add 1.svg create mode 100644 lib/Feed Module/Main_Screens/Community/Model/communitylistModel.dart create mode 100644 lib/Feed Module/Main_Screens/Community/Model/populartagsListModel.dart create mode 100644 lib/Feed Module/Main_Screens/Community/Model/tagsmainModel.dart create mode 100644 lib/Feed Module/Main_Screens/Community/view_model/getApi.dart create mode 100644 lib/Feed Module/Main_Screens/Community/view_model/postApi.dart create mode 100644 lib/Feed Module/Main_Screens/Community/view_model/postinList.dart diff --git a/assets/images/png/add 1.png b/assets/images/png/add 1.png new file mode 100644 index 0000000000000000000000000000000000000000..babf94f6f7ee283068f69a929bdad1fa3c9be111 GIT binary patch literal 594 zcmV-Y0P000>X1^@s6#OZ}&00009a7bBm000XU z000XU0RWnu7ytkO0drDELIAGL9O(c600d`2O+f$vv5yPwB8>nlsbPdoyF=Tc0_-cfaSHx%a($AJHGk@-i4>{0ITi586R9NP<@o1!2pwE~p%F zad2*m(-W90wZXb7kO2F@2Hn61`al4Lz?u%>bjy&5cv@dM0L zX|tb{S+h0^nf&VCEKnIj-k7T4&u4g$!CjXk{5+08kBetR>fBI)S@1IXTna3SZ_mZk zq?XOk_o`$pAn_FMe4KtE8_r?ln_3-mqwG6%` z=L|G@HK|gsD(l6hzl{7P?3Ini%*f0W%FEX^RKoOaet4!h#lR?)D^3Qx;NGM^1*{}^ g1Un|*$LT-x1KgFcD*Kv;cmMzZ07*qoM6N<$f;5H*v;Y7A literal 0 HcmV?d00001 diff --git a/assets/images/svg/add 1.svg b/assets/images/svg/add 1.svg new file mode 100644 index 0000000..8b79a3f --- /dev/null +++ b/assets/images/svg/add 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index 11613b9..6bb3795 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -112,4 +112,15 @@ class ApiUrls { static const getGuestfollowers = "${baseUrl}get-guest-user-followers"; static const getGuestfollowing = "${baseUrl}get-guest-user-following"; + + //community + static const getpostcommunitylist = "${baseUrl}fetch-communities-with-tags"; + static const getpopulartagscommunity = "${baseUrl}fetch-popular-tags"; + + static const postnewtags = "${baseUrl}store-tags"; + static const postupload = "${baseUrl}store-post"; + + + + } diff --git a/lib/Feed Module/Main_Screens/Community/Community.dart b/lib/Feed Module/Main_Screens/Community/Community.dart index 784968b..259e554 100644 --- a/lib/Feed Module/Main_Screens/Community/Community.dart +++ b/lib/Feed Module/Main_Screens/Community/Community.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_reaction_button/flutter_reaction_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; import 'package:regroup/Common/CommonBottomNavigationBar.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; @@ -132,10 +133,11 @@ class _CommunityScreenState extends State { ])) ]), floatingActionButton: Container( - height: 55.h, - width: 55.w, - decoration: const BoxDecoration( - shape: BoxShape.circle, + height: 40.h, + width: 164.w, + decoration: BoxDecoration( + // shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(30.r), boxShadow: [ BoxShadow( color: Color(0x40000000), // Hex color with 40% opacity @@ -145,18 +147,30 @@ class _CommunityScreenState extends State { ], ), child: FloatingActionButton( - onPressed: () { - Get.toNamed(RouteName.postscreen); - }, - backgroundColor: const Color(0xFFD90B2E), - autofocus: true, - shape: const CircleBorder(), - child: Image.asset( - "assets/images/png/iconamoon_edit-thin.png", - height: 30.h, - width: 30.w, - ), + onPressed: () { + Get.toNamed(RouteName.postscreen); + }, + backgroundColor: const Color(0xFFD90B2E), + autofocus: true, + // shape: const OvalBorder(), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.r), ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // SvgPicture.asset('assets/images/svg/add 1.svg'), + Image.asset('assets/images/png/add 1.png'), + sizedBoxWidth(4.w), + text16400white('Create posts') + ], + ) + // Image.asset( + // "assets/images/png/iconamoon_edit-thin.png", + // height: 30.h, + // width: 30.w, + // ), + ), ), bottomNavigationBar: bottomnavigationbar(mainController), diff --git a/lib/Feed Module/Main_Screens/Community/Model/communitylistModel.dart b/lib/Feed Module/Main_Screens/Community/Model/communitylistModel.dart new file mode 100644 index 0000000..e0a2596 --- /dev/null +++ b/lib/Feed Module/Main_Screens/Community/Model/communitylistModel.dart @@ -0,0 +1,83 @@ +class CommunityListModel { + String? status; + int? statusCode; + String? message; + List? data; + + CommunityListModel({this.status, this.statusCode, this.message, this.data}); + + CommunityListModel.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + if (json['data'] != null) { + data = []; + json['data'].forEach((v) { + data!.add(new Data.fromJson(v)); + }); + } + } + + 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!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Data { + int? id; + int? iamPrincipalXid; + int? manageCommunityXid; + Community? community; + + Data( + {this.id, this.iamPrincipalXid, this.manageCommunityXid, this.community}); + + Data.fromJson(Map json) { + id = json['id']; + iamPrincipalXid = json['iam_principal_xid']; + manageCommunityXid = json['manage_community_xid']; + community = json['community'] != null + ? new Community.fromJson(json['community']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['iam_principal_xid'] = this.iamPrincipalXid; + data['manage_community_xid'] = this.manageCommunityXid; + if (this.community != null) { + data['community'] = this.community!.toJson(); + } + return data; + } +} + +class Community { + int? id; + String? communityName; + String? communityProfilePhoto; + + Community({this.id, this.communityName, this.communityProfilePhoto}); + + Community.fromJson(Map json) { + id = json['id']; + communityName = json['community_name']; + communityProfilePhoto = json['community_profile_photo']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['community_name'] = this.communityName; + data['community_profile_photo'] = this.communityProfilePhoto; + return data; + } +} diff --git a/lib/Feed Module/Main_Screens/Community/Model/populartagsListModel.dart b/lib/Feed Module/Main_Screens/Community/Model/populartagsListModel.dart new file mode 100644 index 0000000..48c5c79 --- /dev/null +++ b/lib/Feed Module/Main_Screens/Community/Model/populartagsListModel.dart @@ -0,0 +1,53 @@ +class PopulartagsListModel { + String? status; + int? statusCode; + String? message; + List? data; + + PopulartagsListModel({this.status, this.statusCode, this.message, this.data}); + + PopulartagsListModel.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + if (json['data'] != null) { + data = []; + json['data'].forEach((v) { + data!.add(new Data.fromJson(v)); + }); + } + } + + 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!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Data { + int? id; + String? name; + int? tagPopularity; + + Data({this.id, this.name, this.tagPopularity}); + + Data.fromJson(Map json) { + id = json['id']; + name = json['name']; + tagPopularity = json['tag_popularity']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['tag_popularity'] = this.tagPopularity; + return data; + } +} diff --git a/lib/Feed Module/Main_Screens/Community/Model/tagsmainModel.dart b/lib/Feed Module/Main_Screens/Community/Model/tagsmainModel.dart new file mode 100644 index 0000000..a80f350 --- /dev/null +++ b/lib/Feed Module/Main_Screens/Community/Model/tagsmainModel.dart @@ -0,0 +1,53 @@ +class TagsMainModel { + String? status; + int? statusCode; + String? message; + List? data; + + TagsMainModel({this.status, this.statusCode, this.message, this.data}); + + TagsMainModel.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + if (json['data'] != null) { + data = []; + json['data'].forEach((v) { + data!.add(new Data.fromJson(v)); + }); + } + } + + 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!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Data { + int? id; + String? name; + int? tagPopularity; + + Data({this.id, this.name, this.tagPopularity}); + + Data.fromJson(Map json) { + id = json['id']; + name = json['name']; + tagPopularity = json['tag_popularity']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['tag_popularity'] = this.tagPopularity; + return data; + } +} diff --git a/lib/Feed Module/Main_Screens/Community/PostScreen.dart b/lib/Feed Module/Main_Screens/Community/PostScreen.dart index bd8b154..0d983f2 100644 --- a/lib/Feed Module/Main_Screens/Community/PostScreen.dart +++ b/lib/Feed Module/Main_Screens/Community/PostScreen.dart @@ -1,22 +1,38 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:developer'; import 'dart:io'; +import 'package:dio/dio.dart'; import 'package:dotted_border/dotted_border.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; +import 'package:get/get.dart' hide MultipartFile, FormData; import 'package:regroup/Common/CommonButton.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/Community/Model/communitylistModel.dart' + as communitylist; +import 'package:regroup/Feed%20Module/Main_Screens/Community/Model/tagsmainModel.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/Community/view_model/postApi.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/Community/view_model/postinList.dart'; +import 'package:regroup/Global.dart'; import 'package:regroup/Utils/Common/CommonAppbar.dart'; import 'package:regroup/Utils/Common/CommonDropdown.dart'; +import 'package:regroup/Utils/Common/CustomNextButton.dart'; import 'package:regroup/Utils/Common/CustomTextformfield.dart'; import 'package:regroup/Utils/Common/ImageUpload.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; +import 'package:regroup/Utils/colors.dart'; +import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/resources/routes/route_name.dart'; import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:path/path.dart' as path; class PostScreen extends StatefulWidget { const PostScreen({super.key}); @@ -38,245 +54,698 @@ class _PostScreenState extends State { } } + TextEditingController captioncontroller = TextEditingController(); + TextEditingController ctatitilecontroller = TextEditingController(); + TextEditingController ctalinkcontroller = TextEditingController(); + + bool _isSecondDropdownEnabled = false; + + communitylist.CommunityListModel? communityModel; + List postcommunity = []; + List _postindrop = []; + List _postindropimages = []; + + Future fetchCommunitylist() async { + CommunityLsitApi abilityLsitAPI = CommunityLsitApi(); + ResponseData response = await abilityLsitAPI.getPostinList(); + + if (response.status == ResponseStatus.SUCCESS) { + communityModel = + communitylist.CommunityListModel.fromJson(response.data!); + setState(() { + postcommunity = communityModel!.data ?? []; // Store the fetched cities + _postindrop = postcommunity + .map((platform) => platform.community!.communityName.toString()) + .toList(); + _postindropimages = postcommunity + .map((platform) => + platform.community!.communityProfilePhoto.toString()) + .toList(); + }); + log(postcommunity.toString()); + // Check if there are no communities and show a toast message + if (_postindrop.isEmpty) { + utils.showToast('Please join a community to post.'); + } + } else { + print('Failed to fetch abilities'); + } + } + + List selectedabilityid = []; + int? communityid; + + void getCatIdFromName(List selectedAbilities) { + selectedabilityid.clear(); // Clear existing selections + for (var name in selectedAbilities) { + for (var i = 0; i < postcommunity.length; i++) { + if (name == postcommunity[i].community!.communityName) { + selectedabilityid.add(postcommunity[i].community!.id!); + communityid = postcommunity[i].community!.id!; + // fetchPopularlist(postcommunity[i].id!); + fetchPopularTags(communityid!); + _isSecondDropdownEnabled = true; + + break; // Assuming each name is unique, we break after finding a match + } + } + } + print('Selected IDs: $selectedabilityid'); + } + + List tags = []; // Change the type to List + + Future fetchPopularTags(int communityId) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + token = prefs.getString('access-token'); + String basicAuth = 'Basic ' + + base64.encode(utf8 + .encode('RegroupUserName:71%@L%es^bUX94`J9XT*@bh,._WWM{\$%^^&&')); + + try { + final response = await Dio().get( + // 'https://regroup.betadelivery.com/api/v1/fetch-popular-tags?manage_community_xid=$communityId&name=', + 'https://regroup.betadelivery.com/api/v1/fetch-popular-tags?manage_community_xid=$communityId&name=', + options: Options( + headers: {'authorization': basicAuth, 'access-token': token}, + )); + if (response.statusCode == 200) { + List data = response.data['data']; + + // Map the data to a list of Data objects + tags = data.map((tag) => Data.fromJson(tag)).toList(); + + // Now you can use the tags for your dropdown or any other purpose + setState(() {}); // Trigger a rebuild to update the UI + } else { + print('Failed to fetch tags'); + } + } catch (e) { + print('Error: $e'); + } + } + + List selectedpopularid = []; + + void getPopularIdFromName(List selectedTagNames) { + selectedpopularid.clear(); // Clear existing selections + for (var name in selectedTagNames) { + for (var i = 0; i < tags.length; i++) { + if (name == tags[i].name) { + selectedpopularid.add(tags[i].id!); + break; // Assuming each name is unique, we break after finding a match + } + } + } + + // You can now use the selectedpopularid list as needed + print('Selected IDs: $selectedpopularid'); + } + @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: const Color(0xFF222935), - extendBody: true, - resizeToAvoidBottomInset: false, - appBar: const CommonAppbar( - titleTxt: "Create a post", - ), - body: Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), + void initState() { + // TODO: implement initState + fetchCommunitylist(); + super.initState(); + } + + String _selectedPostas = ''; + + void _onItemSelected(String value) { + setState(() { + _selectedPostas = value; + }); + } + + TextEditingController _tagController = TextEditingController(); + + tagUploadata() async { + utils.loader(); + Map updata = { + 'manage_community_xid': communityid, + "name": _tagController.text, + }; + final data = await Communitypostmethod().postCreatedTag(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + print("Tag created done"); + _tagController.clear(); + utils.showToast(data.message); + + final tagData = data.data; + + // Create a Data object and add it to createdtags + final newTag = CreateData( + id: tagData['data']["id"], + name: tagData['data']["name"], + ); + + setState(() { + createdtags.add(newTag); + selectedpopularid + .add(newTag.id); // Add the new tag ID to selectedpopularid + }); + } else { + Get.back(); + print("tag not created"); + return utils.showToast(data.message); + } + } + + void _showCreateTagDialog() { + showDialog( + barrierDismissible: false, + // barrierColor: Colors.transparent, + context: context, + builder: (BuildContext context) { + return AlertDialog( + backgroundColor: Color(0xFF222935).withOpacity(0.9), + title: Text( + "Add Tag", + style: TextStyle(color: Colors.white), ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(20.h), - - text16w400_FCFCFC("Caption"), - - sizedBoxHeight(18.h), - CustomTextFormField2( - maxlines: 3, - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Media"), - sizedBoxHeight(18.h), - GestureDetector( - onTap: () { - ImageUploadBottomSheet().showModal( - context, - false, - (result) { - var file = File(result); - - bannerPath.add(file); - isbannerAdded = true; - setState(() {}); - }, - ); - }, - child: DottedBorder( - strokeWidth: 1, - dashPattern: const [7, 4], - borderType: BorderType.RRect, - radius: Radius.circular(14.r), - color: const Color(0xFF434A53), - child: commonGlassUI( - width: double.infinity, - height: 130.h, - borderRadius: BorderRadius.circular(10.r), - borderColor: Colors.transparent, - customWidget: bannerPath.isNotEmpty && isbannerAdded - ? Stack(children: [ - Image.file( - bannerPath[0]!, - fit: BoxFit.cover, - width: double.infinity, - ), - Positioned( - right: 5, - bottom: 5, - child: GestureDetector( - onTap: () { - bannerPath.clear(); - isbannerAdded = false; - setState(() {}); - }, - child: Container( - width: 27, - height: 27, - decoration: ShapeDecoration( - color: const Color(0xFF7E7E7E), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular( - 5)), - ), - child: const Icon( - Icons.delete_outline_outlined, - color: Colors.white, - ))), - ), - ]) - : Padding( - padding: - EdgeInsets.symmetric(vertical: 16.h), - child: Column( - children: [ - Image.asset( - "assets/images/png/bi_download.png", - height: 36.h, - width: 36.w, - ), - sizedBoxHeight(10.h), - text14w400_FCFCFC("Upload image"), - sizedBoxHeight(8.h), - text8w400_8A8A8A( - "Allowed file extensions: jpg, png, gif Max file size: 10 MB"), - ], - ), - )), - ), - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Tags"), - sizedBoxHeight(18.h), - CustomDropDownTag1( - header: "Enter tags", - title: "Enter tags", - listData: const [ - "#Race", - "#Swimming", - "#Cycle", - "#Swimming", - "#Race" - ], - rowData: const [ - "23,233 Recently use tags", - "15,123 Recently use tags", - "15,123 Recently use tags", - "15,123 Available tags", - "15,123 Available tags" - ], - onItemSelected: (p0) {}, - leadingImage: const SizedBox()), - // CustomTextFormField( - // suffixIcon: Container( - // height: 20.h, - // width: 20.w, - // child: Center( - // child: Image.asset( - // "assets/images/png/Frame 58575.png", - // height: 20.h, - // width: 20.w, - // fit: BoxFit.cover, - // ), - // ), - // )), - sizedBoxHeight(25.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - containerTile(text: "# Race", index: 0), - containerTile(text: "# Swimming", index: 1), - containerTile(text: "# Cycle", index: 2), - ], - ), - sizedBoxHeight(16.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - containerTile(text: "# Race", index: 3), - containerTile(text: "# Swimming", index: 4), - containerTile(text: "# Cycle", index: 5), - ], - ), - sizedBoxHeight(30.h), - text16w400_FCFCFC("CTA Title"), - sizedBoxHeight(18.h), - CustomTextFormField( - // validationMessage: "Enter a CTA Title", - validator: (val) { - if (val == null || val.isEmpty) { - return 'Enter a CTA Title'; - } - return null; - }, - inputFormatters: [ - LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter() - ], - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Post as"), - sizedBoxHeight(18.h), - CustomDropDownRadio( - header: "", - title: "", - listData: const ['Individual', 'Anonymous'], - onItemSelected: (p0) {}, - leadingImage: const SizedBox()), - // CommonDropdownradioBtn( - // hint: '', items: ['Individual', 'Anonymous']), - - sizedBoxHeight(25.h), - text16w400_FCFCFC("Post in"), - sizedBoxHeight(18.h), - CustomDropDownCheckBox( - header: "", - title: "", - listData: const [ - 'Active alliance network', - 'Fitfam federation', - 'The athletic town', - 'Football fever' - ], - onItemSelected: (p0) {}, - images: const [ - 'assets/images/png/Rectangle 65.png', - 'assets/images/png/Rectangle 66.png', - 'assets/images/png/Rectangle 60.png', - 'assets/images/png/Rectangle 68.png' - ], - leadingImage: const SizedBox()), - // CommonDropdownCheckbox( - // hint: '', - // items: [ - // 'Active alliance network', - // 'Fitfam federation', - // 'The athletic town', - // 'Football fever' - // ], - // images: [ - // 'assets/images/png/Rectangle 65.png', - // 'assets/images/png/Rectangle 66.png', - // 'assets/images/png/Rectangle 60.png', - // 'assets/images/png/Rectangle 68.png' - // ], - // ), - sizedBoxHeight(40.h), - CommonBtn( - text: 'Submit post', - onTap: () { - successBottomsheet(); - }, - ), - - sizedBoxHeight(150.h), - ]), + content: TextField( + style: TextStyle(color: Colors.white), + controller: _tagController, + decoration: InputDecoration( + labelText: "Tag", + labelStyle: TextStyle(color: AppColors.white), + disabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: AppColors.black), + ), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: AppColors.black)), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: AppColors.black)), ), ), - ])); + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text("Cancel", style: TextStyle(color: AppColors.white)), + ), + TextButton( + onPressed: () async { + tagUploadata(); + Navigator.of(context).pop(); + }, + child: Text("Submit", style: TextStyle(color: AppColors.white)), + ), + ], + ); + }, + ); + } + + List createdtags = []; + + Widget buildSelectedTags() { + return Wrap( + spacing: 8.0, + runSpacing: 4.0, + children: createdtags + .where((tag) => selectedpopularid.contains(tag.id)) + .map((tag) { + return Chip( + label: + Text('#${tag.name}', style: const TextStyle(color: Colors.white)), + backgroundColor: const Color(0xFFD90B2E).withOpacity(0.9), + side: BorderSide(color: Colors.black), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.r), + side: BorderSide(width: 1, color: Colors.white)), + onDeleted: () { + setState(() { + selectedpopularid.remove(tag.id); + createdtags.removeWhere((t) => t.id == tag.id); + print(selectedpopularid + .toString()); // Remove the tag from createdtags + }); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + padding: const EdgeInsets.symmetric(horizontal: 16), + ); + }).toList(), + ); + } + + bool isValidWebBannerLink(String link) { + RegExp urlRegExp = RegExp( + r"^(http(s)?://)?" + r"((([a-zA-Z0-9-]+)\.)+[a-zA-Z]{2,}|" + r"((\d{1,3}\.){3}\d{1,3}))" + r"(:\d{1,5})?(/([a-zA-Z0-9-._?,'+&%\$#=~])*)?$", + ); + + return urlRegExp.hasMatch(link); + } + + indiUploadata() async { + utils.loader(); + List medialist = []; + + for (var file in bannerPath.where((file) => file != null)) { + medialist.add( + await MultipartFile.fromFile( + file!.path, + filename: path.basename(file.path), + ), + ); + } + + String selectedtags = '[${selectedpopularid.join(',')}]'; + print('Selected tags: $selectedtags'); + + FormData formdata = FormData.fromMap({ + "caption": captioncontroller.text, + "file": medialist[0], + "post_in": communityid, + "manage_tags_xids": selectedtags, + "post_as": _selectedPostas, + }); + final data = await Communitypostmethod().postUpload(formdata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + print("post done"); + successdialog(); + + return utils.showToast(data.message); + } else { + Get.back(); + print("post not done"); + return utils.showToast(data.message); + } + } + + busUploadata() async { + utils.loader(); + List medialist = []; + + for (var file in bannerPath.where((file) => file != null)) { + medialist.add( + await MultipartFile.fromFile( + file!.path, + filename: path.basename(file.path), + ), + ); + } + + String selectedtags = '[${selectedpopularid.join(',')}]'; + print('Selected tags: $selectedtags'); + + FormData formdata = FormData.fromMap({ + "caption": captioncontroller.text, + "file": medialist[0], + "post_in": communityid, + "manage_tags_xids": selectedtags, + "post_as": _selectedPostas, + "cta_title": ctatitilecontroller.text, + "cta_link": ctalinkcontroller.text, + }); + final data = await Communitypostmethod().postUpload(formdata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + print("post done"); + successdialog(); + + return utils.showToast(data.message); + } else { + Get.back(); + print("post not done"); + return utils.showToast(data.message); + } + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + child: Scaffold( + backgroundColor: const Color(0xFF222935), + extendBody: true, + resizeToAvoidBottomInset: false, + appBar: const CommonAppbar( + titleTxt: "Create a post", + ), + body: Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(20.h), + text16w400_FCFCFC("Post in"), + sizedBoxHeight(18.h), + CustomDropDownCheckBoxPostNew( + header: "Select post in", + title: "", + listData: _postindrop, + + onItemSelected: getCatIdFromName, + // (p0) {}, + images: _postindropimages, + + leadingImage: const SizedBox(), + ), + sizedBoxHeight(20.h), + text16w400_FCFCFC("Caption"), + sizedBoxHeight(18.h), + CustomTextFormField2( + maxlines: 3, + hintText: "Enter caption", + validator: (value) { + if (value!.isEmpty) { + return 'Enter caption'; + } + return null; + }, + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) + ], + textEditingController: captioncontroller, + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Media"), + sizedBoxHeight(18.h), + GestureDetector( + onTap: () { + ImageUploadBottomSheet().showModal( + context, + false, + (result) { + var file = File(result); + + bannerPath.add(file); + isbannerAdded = true; + setState(() {}); + if (Platform.isAndroid) { + Get.back(); + } + }, + ); + }, + child: DottedBorder( + strokeWidth: 1, + dashPattern: const [7, 4], + borderType: BorderType.RRect, + radius: Radius.circular(14.r), + color: const Color(0xFF434A53), + child: commonGlassUI( + width: double.infinity, + height: 339.h, + borderRadius: BorderRadius.circular(10.r), + borderColor: Colors.transparent, + customWidget: bannerPath.isNotEmpty && + isbannerAdded + ? Stack(children: [ + Image.file( + bannerPath[0]!, + fit: BoxFit.cover, + width: double.infinity, + ), + Positioned( + right: 5, + bottom: 5, + child: GestureDetector( + onTap: () { + bannerPath.clear(); + isbannerAdded = false; + setState(() {}); + }, + child: Container( + width: 27, + height: 27, + decoration: ShapeDecoration( + color: + const Color(0xFF7E7E7E), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 5)), + ), + child: const Icon( + Icons.delete_outline_outlined, + color: Colors.white, + ))), + ), + ]) + : Padding( + padding: + EdgeInsets.symmetric(vertical: 16.h), + child: Center( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + "assets/images/png/bi_download.png", + height: 36.h, + width: 36.w, + ), + sizedBoxHeight(10.h), + text14w400_FCFCFC("Upload image"), + sizedBoxHeight(8.h), + text8w400_8A8A8A( + "Allowed file extensions: jpg, png, gif Max file size: 10 MB"), + ], + ), + ), + )), + ), + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Tags"), + sizedBoxHeight(18.h), + _isSecondDropdownEnabled == true + ? CustomDropDownPopularTag( + tags: tags, + onItemSelected: (selectedTags) { + List selectedTagNames = selectedTags + .map((tag) => tag.name!) + .toList(); + getPopularIdFromName(selectedTagNames); + // Handle selected tags here + }, + isFirstDropdownSelected: _isSecondDropdownEnabled, + ) + : Center(child: text14400white('Select community')), + sizedBoxHeight(25.h), + _isSecondDropdownEnabled == true + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildSelectedTags(), + sizedBoxHeight(10.h), + GestureDetector( + onTap: () { + _showCreateTagDialog(); + }, + child: Container( + height: 35, + width: 178.w, + decoration: BoxDecoration( + color: const Color(0xFFFFFFFF) + .withOpacity(0.2), + borderRadius: BorderRadius.circular(30), + border: Border.all( + color: const Color(0xFFD90B2E), + width: 1)), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 20), + child: Center( + child: text14w400_FCFCFC( + '+create new interest')), + ), + ), + ), + ], + ) + : SizedBox(), + sizedBoxHeight(25.h), + globalAccountType == '1' + ? SizedBox() + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text16w400_FCFCFC("CTA Title"), + sizedBoxHeight(18.h), + CustomTextFormField( + // maxlines: 3, + hintText: "Enter cta title", + validator: (value) { + if (value!.isEmpty) { + return 'Enter cta title'; + } + return null; + }, + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')) + ], + textEditingController: ctatitilecontroller, + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("CTA Link"), + sizedBoxHeight(18.h), + CustomTextFormField( + // maxlines: 3, + hintText: "Enter cta link", + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter a web banner link.'; + } else if (!isValidWebBannerLink(value)) { + return 'Please enter a valid web banner link.'; + } + return null; + }, + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + // FilteringTextInputFormatter.allow( + // RegExp('[a-zA-Z ]')) + ], + textEditingController: ctalinkcontroller, + ), + ], + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Post as"), + sizedBoxHeight(18.h), + CustomDropDownRadio( + header: "Select post as", + title: "", + listData: const ['Individual', 'Anonymous'], + onItemSelected: _onItemSelected, + leadingImage: const SizedBox()), + sizedBoxHeight(25.h), + sizedBoxHeight(40.h), + CustomButton( + text: 'Submit post', + onPressed: () { + if (globalAccountType == '1') { + // Condition for account type 1 + if (selectedabilityid.isEmpty || + selectedpopularid.isEmpty || + bannerPath.isEmpty || + captioncontroller.text.isEmpty || + _selectedPostas.isEmpty) { + print('Tags selected are $selectedpopularid'); + print( + 'Community selected are $selectedabilityid'); + print('Post as selected are $_selectedPostas'); + utils.showToast('Please fill all fields'); + } else { + print('Tags selected are $selectedpopularid'); + print( + 'Community selected are $selectedabilityid'); + print('Post as selected are $_selectedPostas'); + indiUploadata(); + // indisuccess(); + } + } else if (globalAccountType == '2') { + // Condition for account type 2 + // You can define different validation criteria here for account type 2 + if (selectedabilityid.isEmpty || + selectedpopularid.isEmpty || + bannerPath.isEmpty || + captioncontroller.text.isEmpty || + _selectedPostas.isEmpty || + ctalinkcontroller.text.isEmpty || + ctatitilecontroller.text.isEmpty) { + print('Tags selected are $selectedpopularid'); + print( + 'Community selected are $selectedabilityid'); + utils.showToast('Please fill all fields'); + } else { + print('Tags selected are $selectedpopularid'); + print( + 'Community selected are $selectedabilityid'); + busUploadata(); + } + } else { + utils.showToast('Unknown account type'); + } + }, + ), + sizedBoxHeight(150.h), + ]), + ), + ), + ])), + ); + } + + void successdialog() { + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return AlertDialog( + insetPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 15), + contentPadding: EdgeInsets.fromLTRB(24, 8, 24, 24), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(14.r))), + backgroundColor: const Color(0xFF222935), + content: Padding( + padding: EdgeInsets.symmetric(horizontal: 30.w), + child: Column(mainAxisSize: MainAxisSize.min, children: [ + sizedBoxHeight(20.h), + Image.asset( + 'assets/images/png/Frame 1000004082.png', + width: 199.w, + height: 158.h, + ), + sizedBoxHeight(20.h), + text18w500Center_FCFCFC( + 'Your post has been succesfully uploaded'), + sizedBoxHeight(20.h), + InkWell( + onTap: () { + Get.toNamed(RouteName.mainscreen, arguments: 0); + }, + child: Container( + height: 35.h, + width: 216.w, + decoration: BoxDecoration( + border: Border.all( + color: const Color(0xFF434A53), width: 1), + gradient: const LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + Color.fromRGBO(255, 255, 255, 0.054), + Color.fromRGBO(255, 255, 255, 0.072), + ], + stops: [0.0233, 1.0], + transform: GradientRotation(271.14 * + (3.141592653589793 / + 180)), // Converting degrees to radians + ), + borderRadius: BorderRadius.circular(30.r), + ), + child: Center(child: text14w400_FCFCFC('View post')), + ), + ), + sizedBoxHeight(40.h) + ]))); + }, + ); } void successBottomsheet() { @@ -299,13 +768,14 @@ class _PostScreenState extends State { sizedBoxHeight(20.h), InkWell( onTap: () { - Get.toNamed(RouteName.mainscreen); + Get.toNamed(RouteName.mainscreen, arguments: 0); }, child: Container( height: 35.h, width: 216.w, decoration: BoxDecoration( - border: Border.all(color: const Color(0xFF434A53), width: 1), + border: + Border.all(color: const Color(0xFF434A53), width: 1), gradient: const LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, @@ -353,3 +823,433 @@ class _PostScreenState extends State { }); } } + +class CustomDropDownCheckBoxPostNew extends StatefulWidget { + const CustomDropDownCheckBoxPostNew({ + Key? key, + required this.header, + required this.title, + required this.listData, + required this.onItemSelected, + required this.images, + required this.leadingImage, + }) : super(key: key); + + final String header; + final String title; + final List listData; + final Function(List) onItemSelected; + final List? images; + final Widget? leadingImage; + + @override + State createState() => + _CustomDropDownCheckBoxPostNewState(); +} + +class _CustomDropDownCheckBoxPostNewState + extends State { + RxBool onDropTap = false.obs; + RxString selectedValue = + ''.obs; // Use a single string to track the selected value + + @override + Widget build(BuildContext context) { + return Obx( + () => Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + onTap: () { + onDropTap.value = !onDropTap.value; + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.only( + top: 14.0, bottom: 14.0, right: 22.w, left: 12.w), + decoration: BoxDecoration( + color: const Color(0xFFFFFFFF).withOpacity(0.10), + borderRadius: onDropTap.value + ? BorderRadius.vertical(top: Radius.circular(30.r)) + : BorderRadius.circular(30.r), + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFffffff).withOpacity(0.50), + const Color(0xFFFFFFFF).withOpacity(0.50), + ], + ), + border: Border.all(color: const Color(0xFF434A53)), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Row( + children: [ + if (widget.leadingImage != null) widget.leadingImage!, + SizedBox(width: 16.w), + Expanded( + child: Text( + selectedValue.value.isEmpty + ? widget.header + : selectedValue.value, + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ), + onDropTap.value + ? Image.asset('assets/images/png/arrowup.png') + : Image.asset('assets/images/png/arrowdown.png'), + ], + ), + ), + ), + if (onDropTap.value) + Container( + width: double.infinity, + decoration: BoxDecoration( + color: const Color(0xFFFFFFFF).withOpacity(0.10), + borderRadius: + BorderRadius.vertical(bottom: Radius.circular(30.r)), + border: Border.all(color: const Color(0xFF434A53)), + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFffffff).withOpacity(0.50), + const Color(0xFFFFFFFF).withOpacity(0.50), + ], + ), + ), + child: widget.listData.isEmpty + ? Padding( + padding: const EdgeInsets.symmetric( + vertical: 10.0, horizontal: 20.0), + child: Center( + child: Text( + 'No communities available', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400, + ), + ), + ), + ) + : ListView.builder( + shrinkWrap: true, + itemCount: widget.listData.length, + itemBuilder: (context, index) { + String item = widget.listData[index]; + String image = widget.images![index]; + return InkWell( + onTap: () { + setState(() { + selectedValue.value = + item; // Set the selected value + onDropTap.value = false; // Close the dropdown + }); + widget.onItemSelected( + [item]); // Pass the selected item + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric( + vertical: 10.0, horizontal: 20.0), + child: Row( + children: [ + Container( + width: 40.w, + height: 40.h, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(8.r), + image: image.isEmpty + ? null + : DecorationImage( + image: NetworkImage(image), + fit: BoxFit.cover, + )), + ), + SizedBox(width: 8.w), + Expanded( + child: Text( + item, + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontFamily: 'hiragino', + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + ), + ), + Checkbox( + side: const BorderSide( + color: Color(0xFF434A53)), + value: selectedValue.value == + item, // Check if item is selected + activeColor: const Color(0xFF434A53), + checkColor: Colors.white, + onChanged: (bool? value) { + if (value == true) { + setState(() { + selectedValue.value = + item; // Set the selected value + onDropTap.value = + false; // Close the dropdown + }); + widget.onItemSelected( + [item]); // Pass the selected item + } + }, + ), + ], + ), + ), + if (index != widget.listData.length - 1) + const Divider( + thickness: 1, color: Color(0xFF434A53)), + ], + ), + ); + }, + ), + ), + ], + ), + ); + } +} + +class CustomDropDownPopularTag extends StatefulWidget { + final List tags; + final Function(List) onItemSelected; + final bool isFirstDropdownSelected; + + CustomDropDownPopularTag({ + required this.tags, + required this.onItemSelected, + required this.isFirstDropdownSelected, + }); + + @override + _CustomDropDownPopularTagState createState() => + _CustomDropDownPopularTagState(); +} + +class _CustomDropDownPopularTagState extends State { + RxBool onDropTap = false.obs; + RxList selectedTags = [].obs; + RxList filteredTags = [].obs; + TextEditingController textEditingController = TextEditingController(); + + @override + void initState() { + super.initState(); + filteredTags.value = widget.tags; + textEditingController.addListener(() { + filterTags(); + }); + } + + void _handleDropdownTap() { + if (widget.isFirstDropdownSelected) { + onDropTap.value = !onDropTap.value; + } else { + utils.showToast('Please select an item from the first dropdown.'); + } + } + + void filterTags() { + String query = textEditingController.text.toLowerCase(); + if (query.isNotEmpty) { + filteredTags.value = widget.tags + .where((tag) => + tag.name!.toLowerCase().contains(query) && + !selectedTags.contains(tag)) + .toList(); + } else { + filteredTags.value = + widget.tags.where((tag) => !selectedTags.contains(tag)).toList(); + } + onDropTap.value = filteredTags.isNotEmpty; + } + + @override + Widget build(BuildContext context) { + return Obx( + () => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Dropdown Search Input + Container( + width: double.infinity, + height: 50, + padding: const EdgeInsets.symmetric(horizontal: 12), + decoration: BoxDecoration( + color: const Color(0xFFFFFFFF).withOpacity(0.10), + borderRadius: onDropTap.value && filteredTags.isNotEmpty + ? const BorderRadius.vertical( + top: Radius.circular(30), + ) + : BorderRadius.circular(30), + border: Border.all(color: const Color(0xFF434A53)), + ), + child: Center( + child: TextFormField( + controller: textEditingController, + style: const TextStyle( + fontSize: 16, + color: Colors.white, + fontFamily: 'Helvetica', + ), + cursorColor: Colors.red, + obscureText: false, + decoration: InputDecoration( + hintText: 'Search Tags', + hintStyle: const TextStyle( + fontSize: 16, + color: Colors.white, + fontWeight: FontWeight.w400, + fontFamily: 'Helvetica', + ), + suffixIcon: GestureDetector( + onTap: _handleDropdownTap, + // () { + // onDropTap.value = !onDropTap.value; + + // }, + child: SizedBox( + height: 20, + width: 20, + child: Center( + child: Icon( + onDropTap.value + ? Icons.arrow_drop_up + : Icons.arrow_drop_down, + color: Colors.white, + ), + ), + ), + ), + border: InputBorder.none, + ), + onTap: _handleDropdownTap + // () { + // onDropTap.value = !onDropTap.value; + // }, + ), + ), + ), + + // Dropdown List + if (onDropTap.value && filteredTags.isNotEmpty) + Container( + width: double.infinity, + decoration: BoxDecoration( + color: const Color(0xFFFFFFFF).withOpacity(0.10), + borderRadius: const BorderRadius.vertical( + bottom: Radius.circular(30), + ), + border: Border.all(color: const Color(0xFF434A53)), + ), + child: ListView.builder( + shrinkWrap: true, + itemCount: filteredTags.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Data selectedItem = filteredTags[index]; + if (selectedTags.contains(selectedItem)) { + selectedTags.remove(selectedItem); + } else { + selectedTags.add(selectedItem); + } + textEditingController.clear(); + widget.onItemSelected(selectedTags.toList()); + filterTags(); // Update the filtered list + }, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Text( + filteredTags[index].name!, + style: const TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.w400, + fontFamily: 'Helvetica', + ), + ), + const Spacer(), + Text( + 'Popularity: ${filteredTags[index].tagPopularity}', + style: const TextStyle( + color: Colors.white70, + fontSize: 12, + ), + ), + ], + ), + ), + ); + }, + ), + ), + sizedBoxHeight(20.h), + + // Selected Tags Displayed as Chips + if (selectedTags.isNotEmpty) + Wrap( + spacing: 8.0, + runSpacing: 4.0, + children: selectedTags.map((tag) { + return Chip( + label: Text('#${tag.name!}', + style: const TextStyle(color: Colors.white)), + backgroundColor: const Color(0xFFD90B2E).withOpacity(0.9), + // Color(0xFFD90B2E).withOpacity(0.90), + + // Colors.transparent, // Make Chip background transparent + side: BorderSide(color: Colors.black), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.r), + side: BorderSide(width: 1, color: Colors.white)), + onDeleted: () { + selectedTags.remove(tag); + widget.onItemSelected(selectedTags.toList()); + filterTags(); // Update the filtered list after removing a tag + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + padding: const EdgeInsets.symmetric(horizontal: 16), + ); + }).toList(), + ), + ], + ), + ); + } +} + +class CreateData { + final int id; + final String name; + + CreateData({required this.id, required this.name}); +} diff --git a/lib/Feed Module/Main_Screens/Community/view_model/getApi.dart b/lib/Feed Module/Main_Screens/Community/view_model/getApi.dart new file mode 100644 index 0000000..6948edd --- /dev/null +++ b/lib/Feed Module/Main_Screens/Community/view_model/getApi.dart @@ -0,0 +1,12 @@ +import 'dart:async'; + +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; + +// FollowersModel? communitytagssobj; + + +class Communitygetmethod { + + +} \ No newline at end of file diff --git a/lib/Feed Module/Main_Screens/Community/view_model/postApi.dart b/lib/Feed Module/Main_Screens/Community/view_model/postApi.dart new file mode 100644 index 0000000..3c268ba --- /dev/null +++ b/lib/Feed Module/Main_Screens/Community/view_model/postApi.dart @@ -0,0 +1,29 @@ +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; + +class Communitypostmethod { + Communitypostmethod(); + + Future> postCreatedTag(updata) async { + print("updata is $updata"); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postnewtags, + ); + print("response is ${response.data}"); + print("response message is ${response.message}"); + return response; + } + + Future> postUpload(updata) async { + print("updata is $updata"); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postupload, + ); + print("response is ${response.data}"); + print("response message is ${response.message}"); + return response; + } +} \ No newline at end of file diff --git a/lib/Feed Module/Main_Screens/Community/view_model/postinList.dart b/lib/Feed Module/Main_Screens/Community/view_model/postinList.dart new file mode 100644 index 0000000..6973e25 --- /dev/null +++ b/lib/Feed Module/Main_Screens/Community/view_model/postinList.dart @@ -0,0 +1,52 @@ +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/Community/Model/communitylistModel.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/Community/Model/populartagsListModel.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/timelineabilityModel.dart'; + +class CommunityLsitApi { + CommunityLsitApi(); + var data = ""; + Future> getPostinList() async { + final response = await NetworkApiServices().getApi( + ApiUrls.getpostcommunitylist, + ); + + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + print("success"); + CommunityListModel communitylistobj = + CommunityListModel.fromJson(responseData); + } else { + // return ResponseData( + // responseData['message'], ResponseStatus.FAILED); + } + } + return response; + } + + Future> getPopulartagsList(updata) async { + final response = await NetworkApiServices().getApi( + 'https://regroup.betadelivery.com/api/v1/fetch-popular-tags?manage_community_xid=$updata&name='); + // '${ApiUrls.getpopulartagscommunity}?manage_community_xid=$updata&name=', + + // ); + + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + print("success"); + PopulartagsListModel populartagslistobj = + PopulartagsListModel.fromJson(responseData); + } else { + // return ResponseData( + // responseData['message'], ResponseStatus.FAILED); + } + } + return response; + } +} diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Settings/ContactUs.dart b/lib/Feed Module/Main_Screens/ProfileTab/Settings/ContactUs.dart index f8d0d96..bedc8ac 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Settings/ContactUs.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Settings/ContactUs.dart @@ -174,7 +174,7 @@ class _ContactUsState extends State { hintText: "Enter query", validator: (value) { if (value!.isEmpty) { - return 'Enter your full name '; + return 'Enter your query'; } return null; }, diff --git a/lib/Utils/Common/CommonDropdown.dart b/lib/Utils/Common/CommonDropdown.dart index 9e4648f..8a9b9d5 100644 --- a/lib/Utils/Common/CommonDropdown.dart +++ b/lib/Utils/Common/CommonDropdown.dart @@ -539,10 +539,12 @@ class _CustomDropDownRadioState extends State { value: item, child: InkWell( onTap: () { - selectedValue.value = item; - _textController.clear(); - widget.onItemSelected(item); - onDropTap.value = !onDropTap.value; + setState(() { + selectedValue.value = item; + _textController.clear(); + widget.onItemSelected(item); + onDropTap.value = false; // Close the dropdown + }); }, child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -555,9 +557,12 @@ class _CustomDropDownRadioState extends State { activeColor: Colors.white, groupValue: selectedValue.value, onChanged: (value) { - selectedValue.value = value!; - _textController.clear(); - widget.onItemSelected(value); + setState(() { + selectedValue.value = value!; + _textController.clear(); + widget.onItemSelected(value); + onDropTap.value = false; // Close the dropdown + }); }, ); }), @@ -597,9 +602,12 @@ class _CustomDropDownRadioState extends State { activeColor: Colors.white, groupValue: selectedValue.value, onChanged: (value) { - selectedValue.value = value!; - _textController.clear(); - widget.onItemSelected(value); + setState(() { + selectedValue.value = value!; + _textController.clear(); + widget.onItemSelected(value); + onDropTap.value = false; // Close the dropdown + }); }, ); }), @@ -633,8 +641,11 @@ class _CustomDropDownRadioState extends State { TextButton( onPressed: () { if (_textController.text.trim().isNotEmpty) { - selectedValue.value = _textController.text; - widget.onItemSelected(_textController.text); + setState(() { + selectedValue.value = _textController.text; + widget.onItemSelected(_textController.text); + onDropTap.value = false; // Close the dropdown + }); } }, child: const Text( @@ -667,7 +678,9 @@ class _CustomDropDownRadioState extends State { children: [ GestureDetector( onTap: () { - onDropTap.value = !onDropTap.value; + setState(() { + onDropTap.value = !onDropTap.value; + }); }, child: Container( width: double.infinity, @@ -1031,7 +1044,7 @@ class CustomDropDownCheckBox extends StatefulWidget { final String header; final String title; final List listData; - final Function(String) onItemSelected; + final Function(List) onItemSelected; final List images; final Widget? leadingImage; @@ -1135,7 +1148,7 @@ class _CustomDropDownCheckBoxState extends State { } else { selectedValues.add(item); } - widget.onItemSelected(selectedValues.join(', ')); + widget.onItemSelected(selectedValues); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -1182,7 +1195,7 @@ class _CustomDropDownCheckBoxState extends State { selectedValues.remove(item); } widget.onItemSelected( - selectedValues.join(', ')); + selectedValues); }, ), ], diff --git a/lib/Utils/Common/CustomTextformfield.dart b/lib/Utils/Common/CustomTextformfield.dart index eb78628..ea846a7 100644 --- a/lib/Utils/Common/CustomTextformfield.dart +++ b/lib/Utils/Common/CustomTextformfield.dart @@ -238,7 +238,7 @@ class _CustomTextFormField2State extends State { void validateField(String value) { setState(() { widget.validationMessage = widget.validator?.call(value) ?? - (value.isEmpty ? "Empty value" : null); + (value.isEmpty ? "" : null); }); } @@ -333,15 +333,18 @@ class _CustomTextFormField2State extends State { inputFormatters: widget.inputFormatters, onChanged: (value) { widget.onInput?.call(value); + validateField(value); }, ), ), sizedBoxHeight(5.h), - Text( - widget.validationMessage ?? '', - style: TextStyle(color: Colors.red, fontSize: 12.sp), - overflow: TextOverflow.ellipsis, - ), + widget.validationMessage == null + ? const SizedBox() + : Text( + widget.validationMessage ?? '', + style: TextStyle(color: Colors.red, fontSize: 12.sp), + overflow: TextOverflow.ellipsis, + ), ], ); } From 857721abf9f7030c37383c4620cd8a1044c1fdd1 Mon Sep 17 00:00:00 2001 From: Shubhamshirva Date: Thu, 1 Aug 2024 17:55:42 +0530 Subject: [PATCH 3/5] conflicts resolved in post method for community --- .../Main_Screens/Community/view_model/postinList.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Feed Module/Main_Screens/Community/view_model/postinList.dart b/lib/Feed Module/Main_Screens/Community/view_model/postinList.dart index 6973e25..1380772 100644 --- a/lib/Feed Module/Main_Screens/Community/view_model/postinList.dart +++ b/lib/Feed Module/Main_Screens/Community/view_model/postinList.dart @@ -3,7 +3,6 @@ import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/data/network/network_api.dart'; import 'package:regroup/Feed%20Module/Main_Screens/Community/Model/communitylistModel.dart'; import 'package:regroup/Feed%20Module/Main_Screens/Community/Model/populartagsListModel.dart'; -import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/timelineabilityModel.dart'; class CommunityLsitApi { CommunityLsitApi(); From 0ce171917960443dae329e0a11c68eb6645de1b5 Mon Sep 17 00:00:00 2001 From: kishan06 Date: Thu, 1 Aug 2024 17:57:15 +0530 Subject: [PATCH 4/5] comment tree added --- lib/Common/controller/MainController.dart | 2 +- .../Community.dart | 65 +--- .../CycleScreen.dart | 2 +- .../View/PostDetailScreen.dart | 353 ++++++++++++++---- .../PostDetailScreen/View/ReactionView.dart | 181 +++++---- .../PostScreen.dart | 0 .../Certificate/AddCertificate.dart | 18 +- .../EditProfile/View/EditProfile.dart | 8 +- .../ProfileTab/My Network/MyNetwork.dart | 5 +- .../ProfileTab/Settings/PrivacyPolicy.dart | 6 +- lib/Utils/Common/CommonAppbar.dart | 11 +- lib/resources/routes/routes.dart | 10 +- pubspec.lock | 24 ++ pubspec.yaml | 1 + 14 files changed, 433 insertions(+), 253 deletions(-) rename lib/Main_Screens/{Community => Community_HomePage}/Community.dart (95%) rename lib/Main_Screens/{Community => Community_HomePage}/CycleScreen.dart (99%) rename lib/Main_Screens/{Community => Community_HomePage}/PostDetailScreen/View/PostDetailScreen.dart (55%) rename lib/Main_Screens/{Community => Community_HomePage}/PostDetailScreen/View/ReactionView.dart (61%) rename lib/Main_Screens/{Community => Community_HomePage}/PostScreen.dart (100%) diff --git a/lib/Common/controller/MainController.dart b/lib/Common/controller/MainController.dart index 759e536..c6c63da 100644 --- a/lib/Common/controller/MainController.dart +++ b/lib/Common/controller/MainController.dart @@ -1,7 +1,7 @@ import 'package:get/get.dart'; import 'package:regroup/Main_Screens/CalenderTab/CalenderTab.dart'; import 'package:regroup/Main_Screens/Chats/View/chatsmainscreen.dart'; -import 'package:regroup/Main_Screens/Community/Community.dart'; +import 'package:regroup/Main_Screens/Community_HomePage/Community.dart'; import 'package:regroup/Main_Screens/GroupTab/View/GroupTab.dart'; import 'package:regroup/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart'; diff --git a/lib/Main_Screens/Community/Community.dart b/lib/Main_Screens/Community_HomePage/Community.dart similarity index 95% rename from lib/Main_Screens/Community/Community.dart rename to lib/Main_Screens/Community_HomePage/Community.dart index 9a0336a..33b3e1d 100644 --- a/lib/Main_Screens/Community/Community.dart +++ b/lib/Main_Screens/Community_HomePage/Community.dart @@ -35,7 +35,6 @@ class _CommunityScreenState extends State { resizeToAvoidBottomInset: false, key: _scaffoldKey1, backgroundColor: const Color(0xFF222935), - // drawerEnableOpenDragGesture: false, drawer: SizedBox(width: 300.w, child: const SideMenu()), extendBody: true, appBar: AppBar( @@ -101,7 +100,6 @@ class _CommunityScreenState extends State { Expanded( child: DefaultTabController( length: 3, - // initialIndex: selectedIndex.value, child: Column( children: [ const CommonTabBar(tabs: [ @@ -138,7 +136,7 @@ class _CommunityScreenState extends State { shape: BoxShape.circle, boxShadow: [ BoxShadow( - color: Color(0x40000000), // Hex color with 40% opacity + color: Color(0x40000000), offset: Offset(0, 6), blurRadius: 8, ), @@ -158,7 +156,6 @@ class _CommunityScreenState extends State { ), ), ), - bottomNavigationBar: bottomnavigationbar(mainController), ); } @@ -244,30 +241,6 @@ Widget feedTab() { }, ), ), - // 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), ]); } @@ -573,9 +546,7 @@ Widget normalcardtile2({ itemAnimationDuration: const Duration(milliseconds: 500), hoverDuration: const Duration(milliseconds: 700), - // toggle: false, direction: ReactionsBoxAlignment.rtl, - child: _buildReactionsIcon(mainImage.value), ); }) @@ -919,9 +890,7 @@ Widget normalcardtile({ itemAnimationDuration: const Duration(milliseconds: 500), hoverDuration: const Duration(milliseconds: 700), - // toggle: false, direction: ReactionsBoxAlignment.rtl, - child: _buildReactionsIcon(mainImage.value), ); }) @@ -982,7 +951,6 @@ Widget announcecardtile({ } } -// MediaQuery.of(context).size.height return Column( children: [ commonGlassUIBlue( @@ -1132,9 +1100,7 @@ Widget announcecardtile({ ), sizedBoxHeight(20.h), GestureDetector( - onTap: () { - // Get.toNamed(RouteName.postdetailsScreen); - }, + onTap: () {}, child: SizedBox( height: 163.h, width: double.infinity, @@ -1157,9 +1123,7 @@ Widget announcecardtile({ return Padding( padding: EdgeInsets.only(right: 12.w), child: GestureDetector( - onTap: () { - // Get.toNamed(RouteName.cyclescreen); - }, + onTap: () {}, child: containertile2(text: containerTitle[index])), ); @@ -1171,9 +1135,7 @@ Widget announcecardtile({ "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s . . ."), Row(children: [ InkWell( - onTap: () { - // Get.toNamed(RouteName.reactionview); - }, + onTap: () {}, child: stackReaction(number: '20', containerImages: [ 'assets/images/png/f7_hand-thumbsup.png', 'assets/images/png/heart 2.png', @@ -1275,17 +1237,13 @@ Widget announcecardtile({ itemAnimationDuration: const Duration(milliseconds: 500), hoverDuration: const Duration(milliseconds: 700), - // toggle: false, - child: _buildReactionsIcon(mainImage.value), ); }) ], ), GestureDetector( - onTap: () { - // Get.toNamed(RouteName.postdetailsScreen); - }, + onTap: () {}, child: Column( children: [ Image.asset( @@ -1526,18 +1484,5 @@ Widget latestTab() { }, ), ), - - // 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/Main_Screens/Community/CycleScreen.dart b/lib/Main_Screens/Community_HomePage/CycleScreen.dart similarity index 99% rename from lib/Main_Screens/Community/CycleScreen.dart rename to lib/Main_Screens/Community_HomePage/CycleScreen.dart index 3849ef3..225b36c 100644 --- a/lib/Main_Screens/Community/CycleScreen.dart +++ b/lib/Main_Screens/Community_HomePage/CycleScreen.dart @@ -5,7 +5,7 @@ import 'package:get/get.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/CommonTabBar.dart'; import 'package:regroup/Common/CommonWidget.dart'; -import 'package:regroup/Main_Screens/Community/Community.dart'; +import 'package:regroup/Main_Screens/Community_HomePage/Community.dart'; import 'package:regroup/Utils/Common/CommonAppbar.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/texts.dart'; diff --git a/lib/Main_Screens/Community/PostDetailScreen/View/PostDetailScreen.dart b/lib/Main_Screens/Community_HomePage/PostDetailScreen/View/PostDetailScreen.dart similarity index 55% rename from lib/Main_Screens/Community/PostDetailScreen/View/PostDetailScreen.dart rename to lib/Main_Screens/Community_HomePage/PostDetailScreen/View/PostDetailScreen.dart index d028ed2..e443cd5 100644 --- a/lib/Main_Screens/Community/PostDetailScreen/View/PostDetailScreen.dart +++ b/lib/Main_Screens/Community_HomePage/PostDetailScreen/View/PostDetailScreen.dart @@ -1,4 +1,6 @@ +import 'package:comment_tree/comment_tree.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_reaction_button/flutter_reaction_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -18,6 +20,8 @@ class PostDetailsScreen extends StatefulWidget { } class _PostDetailsScreenState extends State { + List _hideReplies = List.filled(5, true); + // bool _hideReplies = true; @override Widget build(BuildContext context) { return Scaffold( @@ -50,60 +54,265 @@ class _PostDetailsScreenState extends State { 'Events' ]), sizedBoxHeight(35.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column(children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CircleAvatar( - radius: 20.r, - foregroundImage: const AssetImage( - "assets/images/png/Ellipse 48.png", - ), - ), - sizedBoxWidth(15.w), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - text12w400_FCFCFC_blur("Roger Saris"), - text14w400_FCFCFC( - "Lorem Ipsum has been the industry's standard dummy text 😍"), - text10w400_FCFCFC_blur("Reply. . . ") - ], - ), - ), + ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: 2, + itemBuilder: (context, index) { + return Container( + padding: const EdgeInsets.symmetric( + vertical: 12, horizontal: 16), + child: CommentTreeWidget( + Comment( + avatar: 'assets/images/png/Ellipse 52.png', + userName: 'Krishna', + content: + 'felangel made felangel/cubit_and_beyond public'), + [ + Comment( + avatar: 'assets/images/png/Ellipse 52.png', + userName: 'Kishan', + content: 'Sample comment from kishan'), + Comment( + avatar: 'assets/images/png/Ellipse 52.png', + userName: 'Ram', + content: + 'A Dart template generator which helps teams generator which helps teams generator which helps teams'), + // Comment( + // avatar: 'null', + // userName: 'null', + // content: + // 'A Dart template generator which helps teams'), + // Comment( + // avatar: 'null', + // userName: 'null', + // content: + // 'A Dart template generator which helps teams generator which helps teams '), ], - ), - sizedBoxHeight(50.h), - Align( - alignment: Alignment.bottomCenter, - child: Padding( - padding: const EdgeInsets.only(top: 15, bottom: 15), - child: Row( - children: [ - Expanded( - child: CustomTextFormField( - hintText: "Add comment", - suffixIcon: SizedBox( - height: 20.h, - width: 25.w, - child: Center( - child: Image.asset( - "assets/images/png/iconoir_send.png", - height: 20.h, - width: 25.w, - ), - ), + treeThemeData: const TreeThemeData( + lineColor: Color(0xFFD90B2E), lineWidth: 2.5), + avatarRoot: (context, data) => const PreferredSize( + preferredSize: Size.fromRadius(18), + child: CircleAvatar( + radius: 18, + backgroundColor: Colors.grey, + backgroundImage: AssetImage( + 'assets/images/png/Ellipse 52.png', + ), + ), + ), + avatarChild: (context, data) => const PreferredSize( + preferredSize: Size.fromRadius(12), + child: CircleAvatar( + radius: 12, + backgroundColor: Colors.grey, + backgroundImage: AssetImage( + 'assets/images/png/Ellipse 52.png', + ), + ), + ), + contentChild: (context, data) { + print("printing"); + return data.userName! == "Ram" && _hideReplies[index] + ? GestureDetector( + onTap: () { + setState(() { + _hideReplies[index] = false; + }); + }, + child: Container( + child: const Text( + "View more", + style: TextStyle(color: Colors.white), ), ), ) - ], - ), - )), - sizedBoxHeight(85.h) - ])) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: const EdgeInsets.symmetric( + vertical: 8, horizontal: 8), + decoration: BoxDecoration( + color: Colors.grey[100], + borderRadius: + BorderRadius.circular(12)), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + '${data.userName}', + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + fontWeight: FontWeight.w600, + color: Colors.black), + ), + const SizedBox( + height: 4, + ), + Text( + '${data.content}', + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + fontWeight: FontWeight.w300, + color: Colors.black), + ), + ], + ), + ), + DefaultTextStyle( + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith( + color: Colors.grey[700], + fontWeight: FontWeight.bold), + child: const Padding( + padding: EdgeInsets.only(top: 4), + child: Row( + children: [ + SizedBox( + width: 8, + ), + Text('Like'), + SizedBox( + width: 24, + ), + Text('Reply'), + ], + ), + ), + ) + ], + ); + }, + contentRoot: (context, data) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: const EdgeInsets.symmetric( + vertical: 8, horizontal: 8), + decoration: BoxDecoration( + color: Colors.grey[100], + borderRadius: BorderRadius.circular(12)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'dangngocduc', + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith( + fontWeight: FontWeight.w600, + color: Colors.black), + ), + const SizedBox( + height: 4, + ), + Text( + '${data.content}', + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith( + fontWeight: FontWeight.w300, + color: Colors.black), + ), + ], + ), + ), + DefaultTextStyle( + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith( + color: Colors.grey[700], + fontWeight: FontWeight.bold), + child: const Padding( + padding: EdgeInsets.only(top: 4), + child: Row( + children: [ + SizedBox( + width: 8, + ), + Text('Like'), + SizedBox( + width: 24, + ), + Text('Reply'), + ], + ), + ), + ) + ], + ); + }, + ), + ); + }, + ), + + // Padding( + // padding: EdgeInsets.symmetric(horizontal: 16.w), + // child: Column(children: [ + // Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // CircleAvatar( + // radius: 20.r, + // foregroundImage: const AssetImage( + // "assets/images/png/Ellipse 48.png", + // ), + // ), + // sizedBoxWidth(15.w), + // Expanded( + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // text12w400_FCFCFC_blur("Roger Saris"), + // text14w400_FCFCFC( + // "Lorem Ipsum has been the industry's standard dummy text 😍"), + // text10w400_FCFCFC_blur("Reply. . . ") + // ], + // ), + // ), + // ], + // ), + // sizedBoxHeight(50.h), + // Align( + // alignment: Alignment.bottomCenter, + // child: Padding( + // padding: const EdgeInsets.only(top: 15, bottom: 15), + // child: Row( + // children: [ + // Expanded( + // child: CustomTextFormField( + // hintText: "Add comment", + // suffixIcon: SizedBox( + // height: 20.h, + // width: 25.w, + // child: Center( + // child: Image.asset( + // "assets/images/png/iconoir_send.png", + // height: 20.h, + // width: 25.w, + // ), + // ), + // ), + // ), + // ) + // ], + // ), + // )), + // sizedBoxHeight(85.h) + // ])) ])) ])); } @@ -125,11 +334,11 @@ class _PostDetailsScreenState extends State { } } - return commonGlassContainer( + return commonGlassUI( width: double.infinity, height: 570.h, - border: 0, - borderradius: 0, + borderwidth: 0.5, + borderRadius: BorderRadius.circular(0.r), customWidget: Column( children: [ sizedBoxHeight(25.h), @@ -151,14 +360,15 @@ class _PostDetailsScreenState extends State { children: [ text16w400_FCFCFC(title), const Spacer(), - commonGlassContainer( - width: 72.w, - height: 26.h, - borderradius: 5.r, - borderColor: const Color(0xFFD90B2E), - customWidget: - Center(child: text14400white("Follow")), - border: 1), + commonGlassUI( + width: 72.w, + height: 26.h, + borderRadius: BorderRadius.circular(5.r), + borderColor: const Color(0xFFD90B2E), + customWidget: + Center(child: text14400white("Follow")), + borderwidth: 0.9, + ), sizedBoxWidth(6.w), PopupMenuButton( surfaceTintColor: const Color(0xFF222935), @@ -329,11 +539,11 @@ class _PostDetailsScreenState extends State { 'assets/images/png/party-popper 2.png' ]), const Spacer(), - commonGlassContainer( - border: 0.9, + commonGlassUI( + borderwidth: 0.9, width: 30.w, height: 30.h, - borderradius: 100, + borderRadius: BorderRadius.circular(100.r), customWidget: Center( child: Image.asset( 'assets/images/png/Frame 1000004088.png', @@ -345,11 +555,11 @@ class _PostDetailsScreenState extends State { sizedBoxWidth(12.w), text14w400_FCFCFC('20'), sizedBoxWidth(20.w), - commonGlassContainer( - border: 0.9, + commonGlassUI( + borderwidth: 0.9, width: 30.w, height: 30.h, - borderradius: 100, + borderRadius: BorderRadius.circular(100.r), customWidget: Center( child: Image.asset( 'assets/images/png/Vector (1).png', @@ -419,7 +629,8 @@ class _PostDetailsScreenState extends State { const Duration(milliseconds: 200), itemAnimationDuration: const Duration(milliseconds: 500), - hoverDuration: const Duration(milliseconds: 700), + hoverDuration: + const Duration(milliseconds: 700), // toggle: false, child: _buildReactionsIcon(mainImage.value), @@ -452,11 +663,11 @@ class _PostDetailsScreenState extends State { } Widget containertile({required String text}) { - return commonGlassContainer( - border: 0.9, + return commonGlassUI( + borderwidth: 0.9, width: 100.w, height: 30.h, - borderradius: 30.r, + borderRadius: BorderRadius.circular(30.r), borderColor: const Color(0xFFD90B2E), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 10.w), diff --git a/lib/Main_Screens/Community/PostDetailScreen/View/ReactionView.dart b/lib/Main_Screens/Community_HomePage/PostDetailScreen/View/ReactionView.dart similarity index 61% rename from lib/Main_Screens/Community/PostDetailScreen/View/ReactionView.dart rename to lib/Main_Screens/Community_HomePage/PostDetailScreen/View/ReactionView.dart index 8519d05..8c2ee07 100644 --- a/lib/Main_Screens/Community/PostDetailScreen/View/ReactionView.dart +++ b/lib/Main_Screens/Community_HomePage/PostDetailScreen/View/ReactionView.dart @@ -73,102 +73,101 @@ class _ReactionViewState extends State { ), resizeToAvoidBottomInset: false, body: Stack(children: [ - Container( + Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("assets/images/png/Ellipse 1496.png"), fit: BoxFit.fill)), - ), Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(10.h), - Expanded( - child: DefaultTabController( - length: 4, - // initialIndex: selectedIndex.value, - child: Column(children: [ - CommonTabBar(tabs: [ - const Tab( - text: 'All', - ), - Tab( - child: Row(children: [ - commonGlassContainer( - borderColor: const Color(0xFF1E3A46), - opacity1: 0.05, - opacity2: 0.06, - width: 30.w, - height: 30.h, - borderradius: 100, - customWidget: Center( - child: Image.asset( - "assets/images/png/f7_hand-thumbsup.png", - height: 17.h, - width: 17.w, - ), - ), - border: 1.71), - const Spacer(), - text14400white("110K"), - ]), - ), - Tab( - child: Row(children: [ - commonGlassContainer( - borderColor: const Color(0xFF1E3A46), - opacity1: 0.05, - opacity2: 0.06, - width: 30.w, - height: 30.h, - borderradius: 100, - customWidget: Center( - child: Image.asset( - "assets/images/png/heart 2.png", - height: 17.h, - width: 17.w, - ), - ), - border: 1.71), - const Spacer(), - text14400white("9.7K"), - ]), - ), - Tab( - child: Row(children: [ - commonGlassContainer( - borderColor: const Color(0xFF1E3A46), - opacity1: 0.05, - opacity2: 0.06, - width: 30.w, - height: 30.h, - borderradius: 100, - customWidget: Center( - child: Image.asset( - "assets/images/png/party-popper 2.png", - height: 17.h, - width: 17.w, - ), - ), - border: 1.71), - const Spacer(), - text14400white("7.4K"), - ]), - ), + ), + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + sizedBoxHeight(10.h), + Expanded( + child: DefaultTabController( + length: 4, + // initialIndex: selectedIndex.value, + child: Column(children: [ + CommonTabBar(tabs: [ + const Tab( + text: 'All', + ), + Tab( + child: Row(children: [ + commonGlassContainer( + borderColor: const Color(0xFF1E3A46), + opacity1: 0.05, + opacity2: 0.06, + width: 30.w, + height: 30.h, + borderradius: 100, + customWidget: Center( + child: Image.asset( + "assets/images/png/f7_hand-thumbsup.png", + height: 17.h, + width: 17.w, + ), + ), + border: 1.71), + const Spacer(), + text14400white("110K"), ]), - Expanded( - child: TabBarView( - children: [ - allTab(), - likeTab(), - favouriteTab(), - partyTab(), - ], - ), - ), - sizedBoxHeight(20.h) - ])), - ) - ]) + ), + Tab( + child: Row(children: [ + commonGlassContainer( + borderColor: const Color(0xFF1E3A46), + opacity1: 0.05, + opacity2: 0.06, + width: 30.w, + height: 30.h, + borderradius: 100, + customWidget: Center( + child: Image.asset( + "assets/images/png/heart 2.png", + height: 17.h, + width: 17.w, + ), + ), + border: 1.71), + const Spacer(), + text14400white("9.7K"), + ]), + ), + Tab( + child: Row(children: [ + commonGlassContainer( + borderColor: const Color(0xFF1E3A46), + opacity1: 0.05, + opacity2: 0.06, + width: 30.w, + height: 30.h, + borderradius: 100, + customWidget: Center( + child: Image.asset( + "assets/images/png/party-popper 2.png", + height: 17.h, + width: 17.w, + ), + ), + border: 1.71), + const Spacer(), + text14400white("7.4K"), + ]), + ), + ]), + Expanded( + child: TabBarView( + children: [ + allTab(), + likeTab(), + favouriteTab(), + partyTab(), + ], + ), + ), + sizedBoxHeight(20.h) + ])), + ) + ]) ])); } diff --git a/lib/Main_Screens/Community/PostScreen.dart b/lib/Main_Screens/Community_HomePage/PostScreen.dart similarity index 100% rename from lib/Main_Screens/Community/PostScreen.dart rename to lib/Main_Screens/Community_HomePage/PostScreen.dart diff --git a/lib/Main_Screens/ProfileTab/Certificate/AddCertificate.dart b/lib/Main_Screens/ProfileTab/Certificate/AddCertificate.dart index 2cc96d6..970e945 100644 --- a/lib/Main_Screens/ProfileTab/Certificate/AddCertificate.dart +++ b/lib/Main_Screens/ProfileTab/Certificate/AddCertificate.dart @@ -131,9 +131,9 @@ class _AddCertificateState extends State { onTap: () => FocusManager.instance.primaryFocus?.unfocus(), child: Scaffold( // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), + backgroundColor: const Color(0xFF222935), extendBody: true, - appBar: CommonAppbar( + appBar: const CommonAppbar( titleTxt: "Add certifications", ), body: Stack(children: [ @@ -248,8 +248,8 @@ class _AddCertificateState extends State { width: double.infinity, decoration: ShapeDecoration( gradient: LinearGradient( - begin: Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), + begin: const Alignment(0.98, -0.21), + end: const Alignment(-0.98, 0.21), colors: [ Colors.white .withOpacity(0.30000001192092896), @@ -258,7 +258,7 @@ class _AddCertificateState extends State { ], ), shape: RoundedRectangleBorder( - side: BorderSide( + side: const BorderSide( width: 0.50, color: Color(0xFF7E7E7E)), borderRadius: BorderRadius.circular(10), @@ -292,7 +292,7 @@ class _AddCertificateState extends State { BorderRadius.circular( 5)), ), - child: Icon( + child: const Icon( Icons.delete_outline_outlined, color: Colors.white, ))), @@ -337,8 +337,8 @@ class _AddCertificateState extends State { height: 167, decoration: ShapeDecoration( gradient: LinearGradient( - begin: Alignment(0.98, -0.21), - end: Alignment(-0.98, 0.21), + begin: const Alignment(0.98, -0.21), + end: const Alignment(-0.98, 0.21), colors: [ Colors.white .withOpacity(0.30000001192092896), @@ -347,7 +347,7 @@ class _AddCertificateState extends State { ], ), shape: RoundedRectangleBorder( - side: BorderSide( + side: const BorderSide( width: 0.50, color: Color(0xFF7E7E7E)), borderRadius: BorderRadius.circular(10), diff --git a/lib/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart b/lib/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart index 3a512b3..a269c07 100644 --- a/lib/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart +++ b/lib/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart @@ -353,7 +353,7 @@ class _EditProfileState extends State { sizedBoxHeight(16.h), CustomTextFormField( textEditingController: fullNameController, - leadingIcon: Container( + leadingIcon: SizedBox( width: 18.w, height: 17.h, child: Center( @@ -375,7 +375,7 @@ class _EditProfileState extends State { sizedBoxHeight(16.h), CustomTextFormField( textEditingController: userNameController, - leadingIcon: Container( + leadingIcon: SizedBox( width: 18.w, height: 17.h, child: Center( @@ -400,7 +400,7 @@ class _EditProfileState extends State { datePicker(context, dateController), child: AbsorbPointer( child: CustomTextFormField( - leadingIcon: Container( + leadingIcon: SizedBox( width: 18.0, height: 17.0, child: Center( @@ -452,7 +452,7 @@ class _EditProfileState extends State { sizedBoxHeight(16.h), CustomTextFormField( textEditingController: locationController, - leadingIcon: Container( + leadingIcon: SizedBox( width: 18.w, height: 17.h, child: Center( diff --git a/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart b/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart index ed11f14..b6041ab 100644 --- a/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart +++ b/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart @@ -407,7 +407,7 @@ class _FollowersTabState extends State { ), ), ], - child: Container( + child: SizedBox( height: 20, width: 20, child: Center( @@ -495,7 +495,6 @@ class _FollowingTabState extends State { @override void initState() { - // TODO: implement initState var updata = ""; Profilegetmethod().getFollowing(updata, streamController: searchcontroller); @@ -750,7 +749,7 @@ class _FollowingTabState extends State { ), ), ], - child: Container( + child: SizedBox( height: 20, width: 20, child: Center( diff --git a/lib/Main_Screens/ProfileTab/Settings/PrivacyPolicy.dart b/lib/Main_Screens/ProfileTab/Settings/PrivacyPolicy.dart index 7f7b775..143bd0a 100644 --- a/lib/Main_Screens/ProfileTab/Settings/PrivacyPolicy.dart +++ b/lib/Main_Screens/ProfileTab/Settings/PrivacyPolicy.dart @@ -21,17 +21,17 @@ class _PrivacyPolicyState extends State { Widget build(BuildContext context) { return Scaffold( // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), + backgroundColor: const Color(0xFF222935), extendBody: true, resizeToAvoidBottomInset: false, - appBar: CommonAppbar( + appBar: const CommonAppbar( titleTxt: "Privacy policy", ), body: FutureBuilder( future: Profilegetmethod().getPrivacypolicy(), builder: (ctx, snapshot) { if (snapshot.data == null) { - return Center(child: CircularProgressIndicator()); + return const Center(child: CircularProgressIndicator()); } if (snapshot.connectionState == ConnectionState.done) { if (snapshot.hasError) { diff --git a/lib/Utils/Common/CommonAppbar.dart b/lib/Utils/Common/CommonAppbar.dart index 614fd4b..6079eca 100644 --- a/lib/Utils/Common/CommonAppbar.dart +++ b/lib/Utils/Common/CommonAppbar.dart @@ -59,10 +59,11 @@ class CommonAppbar extends StatelessWidget implements PreferredSizeWidget { @override Widget build(BuildContext context) { return PreferredSize( - preferredSize: Size.fromHeight(80), + preferredSize: const Size.fromHeight(80), child: AppBar( + centerTitle: false, scrolledUnderElevation: 0.0, - backgroundColor: Color(0xFF222935).withOpacity(0.50), + backgroundColor: const Color(0xFF222935).withOpacity(0.50), elevation: 0, automaticallyImplyLeading: false, titleSpacing: 0, @@ -86,7 +87,7 @@ class CommonAppbar extends StatelessWidget implements PreferredSizeWidget { fontFamily: 'Helvetica', fontSize: 20.sp, fontWeight: FontWeight.w400, - color: Color(0xFFFCFCFC), + color: const Color(0xFFFCFCFC), ), ), ), @@ -96,7 +97,7 @@ class CommonAppbar extends StatelessWidget implements PreferredSizeWidget { ) : SingleChildScrollView( scrollDirection: Axis.horizontal, - padding: EdgeInsets.only(top: 10), + padding: const EdgeInsets.only(top: 10), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -112,7 +113,7 @@ class CommonAppbar extends StatelessWidget implements PreferredSizeWidget { fontFamily: 'Helvetica', fontSize: 20.sp, fontWeight: FontWeight.w400, - color: Color(0xFFFCFCFC), + color: const Color(0xFFFCFCFC), ), ), ), diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index 6eb2bed..e641a4d 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -11,11 +11,11 @@ import 'package:regroup/Main_Screens/Chats/View/groupchat.dart'; import 'package:regroup/Main_Screens/Chats/View/newchatpage.dart'; import 'package:regroup/Main_Screens/Chats/View/newgroup.dart'; import 'package:regroup/Main_Screens/Chats/View/userchat.dart'; -import 'package:regroup/Main_Screens/Community/Community.dart'; -import 'package:regroup/Main_Screens/Community/CycleScreen.dart'; -import 'package:regroup/Main_Screens/Community/PostDetailScreen/View/PostDetailScreen.dart'; -import 'package:regroup/Main_Screens/Community/PostDetailScreen/View/ReactionView.dart'; -import 'package:regroup/Main_Screens/Community/PostScreen.dart'; +import 'package:regroup/Main_Screens/Community_HomePage/Community.dart'; +import 'package:regroup/Main_Screens/Community_HomePage/CycleScreen.dart'; +import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/View/PostDetailScreen.dart'; +import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/View/ReactionView.dart'; +import 'package:regroup/Main_Screens/Community_HomePage/PostScreen.dart'; import 'package:regroup/Main_Screens/ExploreDesign/DetailExplore.dart'; import 'package:regroup/Main_Screens/ExploreDesign/ExploreScreen.dart'; import 'package:regroup/Main_Screens/ExploreDesign/SearchGroup.dart'; diff --git a/pubspec.lock b/pubspec.lock index 0919602..35f959c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -89,6 +89,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + comment_tree: + dependency: "direct main" + description: + name: comment_tree + sha256: f99978c6f4a47f9aec284753cc10442e509851d7d86192b963db70e6873f2ddb + url: "https://pub.dev" + source: hosted + version: "0.3.0" connectivity_plus: dependency: "direct main" description: @@ -808,6 +816,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" nm: dependency: transitive description: @@ -968,6 +984,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + provider: + dependency: transitive + description: + name: provider + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + url: "https://pub.dev" + source: hosted + version: "6.1.2" remove_emoji_input_formatter: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 0772b32..2f9ba08 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -76,6 +76,7 @@ dependencies: sign_in_with_apple: any timer_button: ^2.1.1 flutter_html: ^3.0.0-beta.2 + comment_tree: ^0.3.0 From 2a7c866639e1079bbe5a4accbbd65b43637951fd Mon Sep 17 00:00:00 2001 From: Shubhamshirva Date: Fri, 2 Aug 2024 17:30:58 +0530 Subject: [PATCH 5/5] pin for sidebar and unpin done --- assets/images/png/sidemenu/price-tag 1.png | Bin 0 -> 493 bytes assets/images/png/sidemenu/rightarrow.png | Bin 0 -> 215 bytes lib/Common/api_urls.dart | 4 + .../Community_HomePage/Community.dart | 3 +- .../ProfileTab/My Network/MyNetwork.dart | 1 - lib/resources/routes/route_name.dart | 9 + lib/resources/routes/routes.dart | 15 + lib/sidemenu/Model/userpinnedlist.dart | 219 ++++++ lib/sidemenu/communities.dart | 227 ++++++ lib/sidemenu/sidemenu.dart | 716 ++++++++++++++---- lib/sidemenu/tags.dart | 178 +++++ lib/sidemenu/users.dart | 203 +++++ lib/sidemenu/view_model/getmethod.dart | 15 +- lib/sidemenu/view_model/postmethod.dart | 18 + 14 files changed, 1438 insertions(+), 170 deletions(-) create mode 100644 assets/images/png/sidemenu/price-tag 1.png create mode 100644 assets/images/png/sidemenu/rightarrow.png create mode 100644 lib/sidemenu/Model/userpinnedlist.dart create mode 100644 lib/sidemenu/communities.dart create mode 100644 lib/sidemenu/tags.dart create mode 100644 lib/sidemenu/users.dart diff --git a/assets/images/png/sidemenu/price-tag 1.png b/assets/images/png/sidemenu/price-tag 1.png new file mode 100644 index 0000000000000000000000000000000000000000..3f094bc43b7a5e0833184acbe10cf14163aad94e GIT binary patch literal 493 zcmV-J2=$urJUp`45#1)ETWr^5u3v>1KOBB6H7~Z9allj9gm1u zB+hzUbbgd&Tr-ZMDq{WM1Kfgf@T~LF%==P|7ceB3Q8SN%H2`Ap1U^9*d{LfYJi%Q( zg3*k;hB%h}w9ZS$0=@ln?n-xjV>3tW0QvWL90o1CUvOxU$Jp#-+IGf1!rD4_UQZ?_ z!TTQ=hkVHo`Z<}r``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eBevYS$V@L(#+5Ur^4F&=%;U28}au4#cXn%NZ zZT9f`jm5G*wzn4ZGySsRXO@(hbo}ihrlkTCJLi=g4wvZq^gzqwt0>FeqvZx=F`Wk2^H?s`{~>sQLYSbN4{W!o2B`*$+VKR1g { sizedBoxWidth(16.w), ], ), - body: Stack(clipBehavior: Clip.none, children: [ + body: + Stack(clipBehavior: Clip.none, children: [ Container( decoration: const BoxDecoration( image: DecorationImage( diff --git a/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart b/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart index b6041ab..95f96e0 100644 --- a/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart +++ b/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart @@ -495,7 +495,6 @@ class _FollowingTabState extends State { @override void initState() { - var updata = ""; Profilegetmethod().getFollowing(updata, streamController: searchcontroller); diff --git a/lib/resources/routes/route_name.dart b/lib/resources/routes/route_name.dart index ebb1e53..868c0c6 100644 --- a/lib/resources/routes/route_name.dart +++ b/lib/resources/routes/route_name.dart @@ -135,5 +135,14 @@ class RouteName { static const String addcertificate = '/addusercertificate'; + static const String viewalltags = '/viewalltags'; + + static const String viewallcommunitiespinned = '/viewallcommunitiespinned'; + + static const String viewalluserspinned = '/viewallusersspinned'; + + + + } diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index 6068313..38600c7 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -86,6 +86,7 @@ import 'package:regroup/sidemenu/Community/MyCommunity/Community_Info-Page/view/ import 'package:regroup/sidemenu/Community/MyCommunity/View/CommunityDetails.dart'; import 'package:regroup/sidemenu/Community/MyCommunity/View/MyCommunity.dart'; import 'package:regroup/sidemenu/SavedPosts/SavedPosts.dart'; +import 'package:regroup/sidemenu/communities.dart'; import 'package:regroup/sidemenu/sidemenu.dart'; import 'package:regroup/Login/View/verifygoogleapple.dart'; @@ -109,6 +110,8 @@ 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'; +import 'package:regroup/sidemenu/tags.dart'; +import 'package:regroup/sidemenu/users.dart'; class AppRoutes { static appRoutes() => [ @@ -519,5 +522,17 @@ class AppRoutes { name: RouteName.addcertificate, page: () => const AddCertificate(), ), + GetPage( + name: RouteName.viewalltags, + page: () => const Viewtags(), + ), + GetPage( + name: RouteName.viewallcommunitiespinned, + page: () => const Communitiespinned(), + ), + GetPage( + name: RouteName.viewalluserspinned, + page: () => const Viewtusertags(), + ), ]; } diff --git a/lib/sidemenu/Model/userpinnedlist.dart b/lib/sidemenu/Model/userpinnedlist.dart new file mode 100644 index 0000000..6d726a3 --- /dev/null +++ b/lib/sidemenu/Model/userpinnedlist.dart @@ -0,0 +1,219 @@ +class UserpinnedModelList { + String? status; + int? statusCode; + String? message; + Data? data; + + UserpinnedModelList({this.status, this.statusCode, this.message, this.data}); + + UserpinnedModelList.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 { + List? pinnedTag; + List? pinnedCommunity; + List? pinnedUser; + + Data({this.pinnedTag, this.pinnedCommunity, this.pinnedUser}); + + Data.fromJson(Map json) { + if (json['pinned_tag'] != null) { + pinnedTag = []; + json['pinned_tag'].forEach((v) { + pinnedTag!.add(new PinnedTag.fromJson(v)); + }); + } + if (json['pinned_community'] != null) { + pinnedCommunity = []; + json['pinned_community'].forEach((v) { + pinnedCommunity!.add(new PinnedCommunity.fromJson(v)); + }); + } + if (json['pinned_user'] != null) { + pinnedUser = []; + json['pinned_user'].forEach((v) { + pinnedUser!.add(new PinnedUser.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.pinnedTag != null) { + data['pinned_tag'] = this.pinnedTag!.map((v) => v.toJson()).toList(); + } + if (this.pinnedCommunity != null) { + data['pinned_community'] = + this.pinnedCommunity!.map((v) => v.toJson()).toList(); + } + if (this.pinnedUser != null) { + data['pinned_user'] = this.pinnedUser!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class PinnedTag { + int? id; + int? manageTagsXid; + Tag? tag; + + PinnedTag({this.id, this.manageTagsXid, this.tag}); + + PinnedTag.fromJson(Map json) { + id = json['id']; + manageTagsXid = json['manage_tags_xid']; + tag = json['tag'] != null ? new Tag.fromJson(json['tag']) : null; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['manage_tags_xid'] = this.manageTagsXid; + if (this.tag != null) { + data['tag'] = this.tag!.toJson(); + } + return data; + } +} + +class Tag { + int? id; + String? name; + + Tag({this.id, this.name}); + + Tag.fromJson(Map json) { + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + return data; + } +} + +class PinnedCommunity { + int? id; + int? manageCommunitiesXid; + Community? community; + + PinnedCommunity({this.id, this.manageCommunitiesXid, this.community}); + + PinnedCommunity.fromJson(Map json) { + id = json['id']; + manageCommunitiesXid = json['manage_communities_xid']; + community = json['community'] != null + ? new Community.fromJson(json['community']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['manage_communities_xid'] = this.manageCommunitiesXid; + if (this.community != null) { + data['community'] = this.community!.toJson(); + } + return data; + } +} + +class Community { + int? id; + String? communityProfilePhoto; + String? communityBannerImage; + String? communityName; + + Community( + {this.id, + this.communityProfilePhoto, + this.communityBannerImage, + this.communityName}); + + Community.fromJson(Map json) { + id = json['id']; + communityProfilePhoto = json['community_profile_photo']; + communityBannerImage = json['community_banner_image']; + communityName = json['community_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['community_profile_photo'] = this.communityProfilePhoto; + data['community_banner_image'] = this.communityBannerImage; + data['community_name'] = this.communityName; + return data; + } +} + +class PinnedUser { + int? id; + int? pinIamPrincipalXid; + PinUser? pinUser; + + PinnedUser({this.id, this.pinIamPrincipalXid, this.pinUser}); + + PinnedUser.fromJson(Map json) { + id = json['id']; + pinIamPrincipalXid = json['pin_iam_principal_xid']; + pinUser = json['pin_user'] != null + ? new PinUser.fromJson(json['pin_user']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['pin_iam_principal_xid'] = this.pinIamPrincipalXid; + if (this.pinUser != null) { + data['pin_user'] = this.pinUser!.toJson(); + } + return data; + } +} + +class PinUser { + int? id; + String? userName; + String? fullName; + String? profilePhoto; + + PinUser({this.id, this.userName, this.fullName, this.profilePhoto}); + + PinUser.fromJson(Map json) { + id = json['id']; + userName = json['user_name']; + fullName = json['full_name']; + profilePhoto = json['profile_photo']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['user_name'] = this.userName; + data['full_name'] = this.fullName; + data['profile_photo'] = this.profilePhoto; + return data; + } +} diff --git a/lib/sidemenu/communities.dart b/lib/sidemenu/communities.dart new file mode 100644 index 0000000..8ab2e8b --- /dev/null +++ b/lib/sidemenu/communities.dart @@ -0,0 +1,227 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:regroup/Common/CommonGlassmorphism.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Utils/Common/CommonAppbar.dart'; +import 'package:regroup/Utils/Common/sized_box.dart'; +import 'package:regroup/Utils/dialogs.dart'; +import 'package:regroup/Utils/texts.dart'; +import 'package:regroup/sidemenu/view_model/getmethod.dart'; +import 'package:regroup/sidemenu/view_model/postmethod.dart'; + +class Communitiespinned extends StatefulWidget { + const Communitiespinned({super.key}); + + @override + State createState() => _Communitiespinned(); +} + +class _Communitiespinned extends State { + late Future myfuture; + + @override + void initState() { + // TODO: implement initState + myfuture = Sidegetmethod().getUserpinnedList(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xFF222935), + appBar: const CommonAppbar( + titleTxt: "Pinned interest", + ), + body: FutureBuilder( + future: myfuture, + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), + ), + ) + ], + ); + } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + } + return userpinnedobj!.data!.pinnedCommunity!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + pinunpinCommunities(int communityid) async { + utils.loader(); + Map updata = { + "manage_communities_xid": communityid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + Widget _buildBody(context) { + return Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + userpinnedobj!.data!.pinnedCommunity!.isEmpty + ? Center(child: text16400white("Pinned Communities")) + : ListView.builder( + shrinkWrap: true, + physics: const ScrollPhysics(), + itemCount: userpinnedobj!.data!.pinnedCommunity!.length, + itemBuilder: (context, index) { + final commnityid = userpinnedobj! + .data!.pinnedCommunity![index].manageCommunitiesXid!; + + return Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: commonGlassUI( + borderwidth: 0.9, + width: double.infinity, + height: 101.h, + borderRadius: BorderRadius.circular(10.r), + customWidget: Padding( + padding: EdgeInsets.symmetric( + horizontal: 16.w, vertical: 16.h), + child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 65.h, + width: 65.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + // color: Colors.amber, + ), + child: + // Center( + // child: Image.asset(imagepath, fit: BoxFit.cover)), + userpinnedobj! + .data! + .pinnedCommunity![ + index] + .community! + .communityProfilePhoto == + null || + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityProfilePhoto! + .isEmpty + ? CircleAvatar( + backgroundImage: AssetImage( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + ), + ) + : CircleAvatar( + backgroundImage: NetworkImage( + userpinnedobj! + .data! + .pinnedCommunity![ + index] + .community! + .communityProfilePhoto!), + )), + sizedBoxWidth(13.w), + userpinnedobj!.data!.pinnedCommunity![index] + .community!.communityName == + null || + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityName! + .isEmpty + ? text18w700_FCFCFC('Regroup') + : SizedBox( + width: 200.w, + child: text18w700_FCFCFC( + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityName!), + ), + // ), + Spacer(), + InkWell( + onTap: () async { + setState(() { + pinunpinCommunities(commnityid); + userpinnedobj!.data!.pinnedCommunity! + .removeWhere((item) => + item.manageCommunitiesXid == + commnityid); + }); + }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + ), + ], + ), + )), + ); + }, + ), + ], + ) + ], + ); + } +} diff --git a/lib/sidemenu/sidemenu.dart b/lib/sidemenu/sidemenu.dart index 25bb7aa..9a83ac2 100644 --- a/lib/sidemenu/sidemenu.dart +++ b/lib/sidemenu/sidemenu.dart @@ -1,10 +1,15 @@ import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; +import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; +import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/resources/routes/route_name.dart'; +import 'package:regroup/sidemenu/view_model/getmethod.dart'; +import 'package:regroup/sidemenu/view_model/postmethod.dart'; class SideMenu extends StatefulWidget { const SideMenu({super.key}); @@ -14,9 +19,13 @@ class SideMenu extends StatefulWidget { } class _SideMenuState extends State { + late Future myfuture; + @override void initState() { // TODO: implement initState + myfuture = Sidegetmethod().getUserpinnedList(); + super.initState(); } @@ -54,7 +63,17 @@ class _SideMenuState extends State { Color sideBarBackgroundColor = const Color(0xFF222935); Color whitecolor = Colors.white; - var selectedIndices = {}.obs; + // var selectedIndices = {}.obs; + + // void toggleSelectedIndex(int index) { + // if (selectedIndices.contains(index)) { + // selectedIndices.remove(index); + // } else { + // selectedIndices.add(index); + // } + // } + + final RxSet selectedIndices = {}.obs; void toggleSelectedIndex(int index) { if (selectedIndices.contains(index)) { @@ -64,179 +83,542 @@ class _SideMenuState extends State { } } + final RxSet selectedIndicescommunity = {}.obs; + + void toggleSelectedIndexComunity(int index) { + if (selectedIndicescommunity.contains(index)) { + selectedIndicescommunity.remove(index); + } else { + selectedIndicescommunity.add(index); + } + } + + final RxSet selectedIndicesuser = {}.obs; + + void toggleSelectedIndexUser(int index) { + if (selectedIndicesuser.contains(index)) { + selectedIndicesuser.remove(index); + } else { + selectedIndicesuser.add(index); + } + } + + pinunpinTag(int tagid) async { + utils.loader(); + Map updata = { + "manage_tags_xid": tagid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + toggleSelectedIndex(tagid); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + pinunpinCommunities(int communityid) async { + utils.loader(); + Map updata = { + "manage_communities_xid": communityid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + toggleSelectedIndexComunity(communityid); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + pinunpinUser(int userid) async { + utils.loader(); + Map updata = { + "pin_iam_principal_xid": userid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + toggleSelectedIndexUser(userid); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: const Color(0xFF222935), - body: Column( - children: [ - sizedBoxHeight(50.h), - Expanded( - child: ListView(children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: text16w400_FCFCFC("My pinned content"), - ), - const Spacer(), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Container( - height: 1, - margin: EdgeInsets.symmetric(vertical: 10.h), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: const Color.fromRGBO(255, 255, 255, 0.3), - width: 1.w, - ), - ), - ), + backgroundColor: const Color(0xFF222935), + body: FutureBuilder( + future: myfuture, + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), ), + ) + ], + ); + } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), ), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - children: [ - text16w400_FCFCFC("Tags"), - const Spacer(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.mycommunity); - }, - child: text14w400_FCFCFC("View all")), - ], - ), + ); + } + } + return userpinnedobj!.data!.isBlank! + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + Widget _buildBody(context) { + return Column( + children: [ + sizedBoxHeight(50.h), + Expanded( + child: ListView(physics: ScrollPhysics(), children: [ + GestureDetector( + onTap: () { + Get.toNamed(RouteName.mycommunity); + }, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + text16w400_FCFCFC("My communities"), + sizedBoxWidth(4.w), + Image.asset('assets/images/png/sidemenu/rightarrow.png') + ], ), - sizedBoxHeight(20.h), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 4), - firstRowTile( - text: "Advice", - leadingimage: - "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 5), - firstRowTile( - text: "Crush", - leadingimage: "assets/images/png/sidemenu/Vector (4).png", - index: 6), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 7), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Container( - height: 1, - margin: EdgeInsets.symmetric(vertical: 10.h), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: const Color.fromRGBO(255, 255, 255, 0.3), - width: 1.w, - ), - ), - ), - ), - ), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - children: [ - text16w400_FCFCFC("Communities"), - const Spacer(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.mycommunity); - }, - child: text14w400_FCFCFC("View all")), - ], - ), - ), - sizedBoxHeight(20.h), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 4), - firstRowTile( - text: "Advice", - leadingimage: - "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 5), - firstRowTile( - text: "Crush", - leadingimage: "assets/images/png/sidemenu/Vector (4).png", - index: 6), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 7), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Container( - height: 1, - margin: EdgeInsets.symmetric(vertical: 10.h), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: const Color.fromRGBO(255, 255, 255, 0.3), - width: 1.w, - ), - ), - ), - ), - ), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - children: [ - text16w400_FCFCFC("Users"), - const Spacer(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.mycommunity); - }, - child: text14w400_FCFCFC("View all")), - ], - ), - ), - sizedBoxHeight(20.h), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 8), - firstRowTile( - text: "Advice", - leadingimage: - "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 9), - firstRowTile( - text: "Crush", - leadingimage: "assets/images/png/sidemenu/Vector (4).png", - index: 10), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 11), - sizedBoxHeight(18.h), - sizedBoxHeight(80.h), - ]), + ), ), - ], - )); + const Spacer(), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 10.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color.fromRGBO(255, 255, 255, 0.3), + width: 1.w, + ), + ), + ), + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: text16w400_FCFCFC("My pinned content"), + ), + const Spacer(), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 10.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color.fromRGBO(255, 255, 255, 0.3), + width: 1.w, + ), + ), + ), + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + text16w400_FCFCFC("interest"), + const Spacer(), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.viewalltags); + }, + child: text14w400_FCFCFC("View all")), + ], + ), + ), + sizedBoxHeight(20.h), + userpinnedobj!.data!.pinnedTag!.isEmpty + ? Center(child: text16400white("Pin tags")) + : SizedBox( + height: 200.h, + child: + // Obx( () { + // return + ListView.builder( + shrinkWrap: true, + itemCount: userpinnedobj!.data!.pinnedTag!.take(5).length, + itemBuilder: (context, index) { + final tagid = userpinnedobj! + .data!.pinnedTag![index].manageTagsXid!; + + return ListTile( + leading: commonContainer( + width: 29.w, + height: 29.h, + borderwidth: 0.9, + boxShape: BoxShape.circle, + customWidget: Center( + child: Image.asset( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + width: 13.w, + height: 13.h, + ), + )), + title: userpinnedobj!.data!.pinnedTag![index].tag == + null || + userpinnedobj!.data!.pinnedTag![index].tag! + .name!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data!.pinnedTag![index].tag!.name!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinTag(tagid); + userpinnedobj!.data!.pinnedTag!.removeWhere( + (item) => item.manageTagsXid == tagid); + }); + + // toggleSelectedIndex(tagid); + }, + child: + // Obx( + // () { + // return selectedIndices.contains(tagid) + // ? + // Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill (1).png", + // width: 19, + // height: 19, + // ) + // : + Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + // }, + // ), + ), + // onTap: () {}, + ); + }, + ), + // } + + // ) + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 10.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color.fromRGBO(255, 255, 255, 0.3), + width: 1.w, + ), + ), + ), + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + text16w400_FCFCFC("Communities"), + const Spacer(), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.viewallcommunitiespinned); + }, + child: text14w400_FCFCFC("View all")), + ], + ), + ), + sizedBoxHeight(20.h), + userpinnedobj!.data!.pinnedCommunity!.isEmpty + ? Center(child: text16400white("Pin communities")) + : SizedBox( + height: 200.h, + child: ListView.builder( + shrinkWrap: true, + itemCount: + userpinnedobj!.data!.pinnedCommunity!.take(5).length, + itemBuilder: (context, index) { + final commnityid = userpinnedobj!.data! + .pinnedCommunity![index].manageCommunitiesXid!; + + return ListTile( + leading: Container( + width: 29.w, + height: 29.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + // color: Colors.amber, + ), + child: + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityProfilePhoto == + null || + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityProfilePhoto! + .isEmpty + ? CircleAvatar( + backgroundImage: AssetImage( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + ), + ) + : CircleAvatar( + backgroundImage: NetworkImage( + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityProfilePhoto!), + ) + + ), + title: userpinnedobj!.data!.pinnedCommunity![index] + .community == + null || + userpinnedobj!.data!.pinnedCommunity![index] + .community!.communityName!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityName!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinCommunities(commnityid); + userpinnedobj!.data!.pinnedCommunity! + .removeWhere((item) => + item.manageCommunitiesXid == + commnityid); + }); + + // toggleSelectedIndex(tagid); + }, + // () { + // pinunpinTag(tagid); + // // toggleSelectedIndex(tagid); + // }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + // Obx( + // () { + // return selectedIndicescommunity.contains(tagid) + // ? Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill (1).png", + // width: 19, + // height: 19, + // ) + // : Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill.png", + // width: 19, + // height: 19, + // ); + // }, + // ), + ), + ); + }, + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 10.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color.fromRGBO(255, 255, 255, 0.3), + width: 1.w, + ), + ), + ), + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + text16w400_FCFCFC("Users"), + const Spacer(), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.viewalluserspinned); + }, + child: text14w400_FCFCFC("View all")), + ], + ), + ), + sizedBoxHeight(20.h), + userpinnedobj!.data!.pinnedUser!.isEmpty + ? Center(child: text16400white("Pin users")) + : SizedBox( + height: 200.h, + child: ListView.builder( + shrinkWrap: true, + itemCount: + userpinnedobj!.data!.pinnedUser!.take(5).length, + itemBuilder: (context, index) { + final userid = userpinnedobj! + .data!.pinnedUser![index].pinIamPrincipalXid!; + + return ListTile( + leading: commonContainer( + width: 29.w, + height: 29.h, + borderwidth: 0.9, + boxShape: BoxShape.circle, + customWidget: Center( + child: userpinnedobj!.data!.pinnedUser![index] + .pinUser!.profilePhoto == + null || + userpinnedobj! + .data! + .pinnedUser![index] + .pinUser! + .profilePhoto! + .isEmpty + ? Image.asset( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + width: 13.w, + height: 13.h, + ) + : Image.network( + userpinnedobj! + .data! + .pinnedUser![index] + .pinUser! + .profilePhoto!, + width: 13.w, + height: 13.h, + errorBuilder: + (context, error, stackTrace) { + // Error handling when image fails to load + return Image.asset( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + width: 13.w, + height: 13.h, + ); + }, + ))), + title: userpinnedobj!.data!.pinnedUser![index] + .pinUser!.fullName == + null || + userpinnedobj!.data!.pinnedUser![index] + .pinUser!.fullName!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data!.pinnedUser![index].pinUser!.fullName!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinUser(userid); + userpinnedobj!.data!.pinnedUser!.removeWhere( + (item) => + item.pinIamPrincipalXid == userid); + }); + + // toggleSelectedIndex(tagid); + }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + // Obx( + // () { + // return selectedIndicesuser.contains(userid) + // ? Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill (1).png", + // width: 19, + // height: 19, + // ) + // : Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill.png", + // width: 19, + // height: 19, + // ); + // }, + // ), + ), + ); + }, + ), + ), + sizedBoxHeight(18.h), + sizedBoxHeight(80.h), + ]), + ), + ], + ); } Widget firstRowTile({ diff --git a/lib/sidemenu/tags.dart b/lib/sidemenu/tags.dart new file mode 100644 index 0000000..a6a11fa --- /dev/null +++ b/lib/sidemenu/tags.dart @@ -0,0 +1,178 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:regroup/Common/CommonGlassmorphism.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Utils/Common/CommonAppbar.dart'; +import 'package:regroup/Utils/Common/sized_box.dart'; +import 'package:regroup/Utils/dialogs.dart'; +import 'package:regroup/Utils/texts.dart'; +import 'package:regroup/sidemenu/view_model/getmethod.dart'; +import 'package:regroup/sidemenu/view_model/postmethod.dart'; + +class Viewtags extends StatefulWidget { + const Viewtags({super.key}); + + @override + State createState() => _ViewtagsState(); +} + +class _ViewtagsState extends State { + late Future myfuture; + + @override + void initState() { + // TODO: implement initState + myfuture = Sidegetmethod().getUserpinnedList(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xFF222935), + appBar: const CommonAppbar( + titleTxt: "Pinned interest", + ), + body: FutureBuilder( + future: myfuture, + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), + ), + ) + ], + ); + } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + } + return userpinnedobj!.data!.pinnedTag!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + pinunpinTag(int tagid) async { + utils.loader(); + Map updata = { + "manage_tags_xid": tagid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + Widget _buildBody(context) { + return Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + userpinnedobj!.data!.pinnedTag!.isEmpty + ? Center(child: text16400white("Pin tags")) + : ListView.separated( + separatorBuilder: (context, index) { + return Divider( + thickness: 1, + color: const Color.fromRGBO(255, 255, 255, 0.3), + ); + }, + shrinkWrap: true, + physics: const ScrollPhysics(), + itemCount: userpinnedobj!.data!.pinnedTag!.length, + itemBuilder: (context, index) { + final tagid = + userpinnedobj!.data!.pinnedTag![index].manageTagsXid!; + return ListTile( + leading: commonContainer( + width: 29.w, + height: 29.h, + borderwidth: 0.9, + boxShape: BoxShape.circle, + customWidget: Center( + child: Image.asset( + 'assets/images/png/sidemenu/price-tag 1.png', + width: 13.w, + height: 13.h, + ), + )), + title: userpinnedobj!.data!.pinnedTag![index].tag == + null || + userpinnedobj! + .data!.pinnedTag![index].tag!.name!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data!.pinnedTag![index].tag!.name!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinTag(tagid); + userpinnedobj!.data!.pinnedTag!.removeWhere( + (item) => item.manageTagsXid == tagid); + }); + }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + ), + ); + }, + ), + Divider( + thickness: 1, + color: const Color.fromRGBO(255, 255, 255, 0.3), + ), + ], + ) + ], + ); + } +} diff --git a/lib/sidemenu/users.dart b/lib/sidemenu/users.dart new file mode 100644 index 0000000..c091dc9 --- /dev/null +++ b/lib/sidemenu/users.dart @@ -0,0 +1,203 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:regroup/Common/CommonGlassmorphism.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Utils/Common/CommonAppbar.dart'; +import 'package:regroup/Utils/dialogs.dart'; +import 'package:regroup/Utils/texts.dart'; +import 'package:regroup/sidemenu/view_model/getmethod.dart'; +import 'package:regroup/sidemenu/view_model/postmethod.dart'; + +class Viewtusertags extends StatefulWidget { + const Viewtusertags({super.key}); + + @override + State createState() => _ViewtusertagsState(); +} + +class _ViewtusertagsState extends State { + late Future myfuture; + + @override + void initState() { + // TODO: implement initState + myfuture = Sidegetmethod().getUserpinnedList(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xFF222935), + appBar: const CommonAppbar( + titleTxt: "Pinned users", + ), + body: FutureBuilder( + future: myfuture, + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), + ), + ) + ], + ); + } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + } + return userpinnedobj!.data!.pinnedUser!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + pinunpinUser(int userid) async { + utils.loader(); + Map updata = { + "pin_iam_principal_xid": userid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + Widget _buildBody(context) { + return Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + userpinnedobj!.data!.pinnedUser!.isEmpty + ? Center(child: text16400white("Pin tags")) + : ListView.separated( + separatorBuilder: (context, index) { + return Divider( + thickness: 1, + color: const Color.fromRGBO(255, 255, 255, 0.3), + ); + }, + shrinkWrap: true, + physics: const ScrollPhysics(), + itemCount: userpinnedobj!.data!.pinnedUser!.length, + itemBuilder: (context, index) { + final tagid = + userpinnedobj!.data!.pinnedUser![index].pinIamPrincipalXid!; + return ListTile( + leading: + Container( + height: 65.h, + width: 65.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + // color: Colors.amber, + ), + child: + // Center( + // child: Image.asset(imagepath, fit: BoxFit.cover)), + userpinnedobj! + .data! + .pinnedUser![ + index] + .pinUser! + .profilePhoto == + null || + userpinnedobj! + .data! + .pinnedUser![index] + .pinUser! + .profilePhoto! + .isEmpty + ? CircleAvatar( + backgroundImage: AssetImage( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + ), + ) + : CircleAvatar( + backgroundImage: NetworkImage( + userpinnedobj! + .data! + .pinnedUser![ + index] + .pinUser! + .profilePhoto!), + )), + title: userpinnedobj!.data!.pinnedUser![index].pinUser == + null || + userpinnedobj! + .data!.pinnedUser![index].pinUser!.fullName!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data!.pinnedUser![index].pinUser!.fullName!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinUser(tagid); + userpinnedobj!.data!.pinnedUser!.removeWhere( + (item) => item.pinIamPrincipalXid == tagid); + }); + }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + ), + ); + }, + ), + Divider( + thickness: 1, + color: const Color.fromRGBO(255, 255, 255, 0.3), + ), + ], + ) + ], + ); + } +} diff --git a/lib/sidemenu/view_model/getmethod.dart b/lib/sidemenu/view_model/getmethod.dart index dc0f42b..ae5dbfd 100644 --- a/lib/sidemenu/view_model/getmethod.dart +++ b/lib/sidemenu/view_model/getmethod.dart @@ -4,9 +4,10 @@ import 'package:regroup/Common/api_urls.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/data/network/network_api.dart'; import 'package:regroup/sidemenu/Model/joineGroupsModel.dart'; +import 'package:regroup/sidemenu/Model/userpinnedlist.dart'; GetmyJoinedGroupsModel? joinedgroupsobj; - +UserpinnedModelList? userpinnedobj; class Sidegetmethod { @@ -22,5 +23,17 @@ class Sidegetmethod { return response; } + Future> getUserpinnedList() async { + final response = await NetworkApiServices().getApi( + ApiUrls.getuserpinlist, + // optionalpar: false + ); + if (response.status == ResponseStatus.SUCCESS) { + userpinnedobj = UserpinnedModelList.fromJson(response.data); + log(userpinnedobj!.data.toString()); + } + return response; + } + } \ No newline at end of file diff --git a/lib/sidemenu/view_model/postmethod.dart b/lib/sidemenu/view_model/postmethod.dart index e69de29..7de1519 100644 --- a/lib/sidemenu/view_model/postmethod.dart +++ b/lib/sidemenu/view_model/postmethod.dart @@ -0,0 +1,18 @@ +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; + +class SidebarTags { + SidebarTags(); + + + Future> postUserpin(updata) async { + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postusertag, + ); + return response; + } + + +} \ No newline at end of file