diff --git a/lib/Main_Screens/Community_HomePage/PostScreen.dart b/lib/Main_Screens/Community_HomePage/PostScreen.dart index f3c7427..35d2482 100644 --- a/lib/Main_Screens/Community_HomePage/PostScreen.dart +++ b/lib/Main_Screens/Community_HomePage/PostScreen.dart @@ -646,28 +646,26 @@ class _PostScreenState extends State { children: [ buildSelectedTags(), sizedBoxHeight(10.h), - Expanded( - child: GestureDetector( - onTap: () { - _showCreateTagDialog(); - }, - child: Container( - height: 35, - // width: 185.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: 10), - child: Center( - child: text14w400_FCFCFC( - '+create new interest')), - ), + GestureDetector( + onTap: () { + _showCreateTagDialog(); + }, + child: Container( + height: 35, + width: 185.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: 10), + child: Center( + child: text14w400_FCFCFC( + '+create new interest')), ), ), ), @@ -1235,7 +1233,7 @@ class _CustomDropDownPopularTagState extends State { cursorColor: Colors.red, obscureText: false, decoration: InputDecoration( - hintText: 'Search Tags', + hintText: 'Search Interest', hintStyle: const TextStyle( fontSize: 16, color: Colors.white, diff --git a/lib/sidemenu/Community/MyCommunity/NewCommunity.dart b/lib/sidemenu/Community/MyCommunity/NewCommunity.dart index 2017c3f..e7d6ad1 100644 --- a/lib/sidemenu/Community/MyCommunity/NewCommunity.dart +++ b/lib/sidemenu/Community/MyCommunity/NewCommunity.dart @@ -152,328 +152,339 @@ class _NewCommunityState extends State { @override Widget build(BuildContext context) { return WillPopScope( - onWillPop: () async{ - Get.back(result: true); - return true; - }, - child: GestureDetector( - onTap: () => FocusManager.instance.primaryFocus?.unfocus(), - child: Scaffold( - // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), - extendBody: true, - resizeToAvoidBottomInset: true, - appBar: CommonAppbar( - titleTxt: "New community", - customBack: true, - ), - body: Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), + onWillPop: () async { + Get.back(result: true); + return true; + }, + child: GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + child: Scaffold( + // key: _scaffoldKey1, + backgroundColor: Color(0xFF222935), + extendBody: true, + resizeToAvoidBottomInset: true, + appBar: CommonAppbar( + titleTxt: "New community", + customBack: true, ), - SingleChildScrollView( - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(20.h), - Center( - child: InkWell( + body: Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: + AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(20.h), + Center( + child: InkWell( + onTap: () { + ImageUploadBottomSheet().showModal( + context, + false, + (result) { + if (result != null && result.isNotEmpty) { + var file = File(result); + filePath.cast(); + filePath.add(file); + isImageAdded = true; + setState(() {}); + if (Platform.isAndroid) { + Get.back(); + } + } else { + // Handle case where no image is selected + filePath.clear(); + isImageAdded = false; + setState(() {}); + } + }, + ); + }, + child: commonGlassUI( + width: 95.w, + height: 95.h, + borderRadius: BorderRadius.circular(100), + opacity1: 0.24, + opacity2: 0.24, + customWidget: + filePath.isNotEmpty && isImageAdded + ? ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(47.5.r), + child: Image.file( + filePath[0]!, + fit: BoxFit.cover, + width: double.infinity, + ), + ), + ) + : Center( + child: Image.asset( + "assets/images/png/cameraicon2.png", + height: 30.h, + width: 30.w, + ), + ), + borderwidth: 0.5), + ), + ), + sizedBoxHeight(20.h), + Center( + child: text16w400_white( + "Add community profile picture")), + sizedBoxHeight(30.h), + text16w400_FCFCFC("Banner image"), + sizedBoxHeight(15.h), + InkWell( onTap: () { ImageUploadBottomSheet().showModal( context, false, (result) { + // var file = File(result); + + // bannerPath.add(file); + // isbannerAdded = true; + // setState(() {}); if (result != null && result.isNotEmpty) { var file = File(result); - filePath.cast(); - filePath.add(file); - isImageAdded = true; - setState(() {}); - if (Platform.isAndroid) { - Get.back(); + + // Check if the file size exceeds 10 MB + int fileSizeInBytes = file.lengthSync(); + double fileSizeInMB = + fileSizeInBytes / (1024 * 1024); + + if (fileSizeInMB > 10) { + // Show toast message if the file size exceeds 10 MB + + utils.showToast( + "The selected file is too large. Max file size is 10 MB."); + } else { + // Clear the existing image and add the new one + bannerPath.clear(); + bannerPath.add(file); + isbannerAdded = true; + setState(() {}); } } else { // Handle case where no image is selected - filePath.clear(); - isImageAdded = false; + bannerPath.clear(); + isbannerAdded = false; setState(() {}); } + if (Platform.isAndroid) { + Get.back(); + } }, ); }, - child: commonGlassUI( - width: 95.w, - height: 95.h, - borderRadius: BorderRadius.circular(100), - opacity1: 0.24, - opacity2: 0.24, - customWidget: filePath.isNotEmpty && isImageAdded - ? ClipOval( - child: SizedBox.fromSize( - size: Size.fromRadius(47.5.r), - child: Image.file( - filePath[0]!, - fit: BoxFit.cover, - width: double.infinity, - ), + child: DottedBorder( + strokeWidth: 1, + dashPattern: [7, 4], + borderType: BorderType.RRect, + radius: Radius.circular(14.r), + color: Color(0xFF434A53), + child: commonGlassUI( + borderwidth: 0, + width: double.infinity, + height: 130.h, + borderRadius: BorderRadius.circular(10.r), + customWidget: bannerPath.isNotEmpty && + isbannerAdded + ? Stack(children: [ + Image.file( + bannerPath[0]!, + fit: BoxFit.cover, + width: double.infinity, ), - ) - : Center( - child: Image.asset( - "assets/images/png/cameraicon2.png", - height: 30.h, - width: 30.w, + Positioned( + right: 5, + bottom: 5, + child: GestureDetector( + onTap: () { + bannerPath.clear(); + isbannerAdded = false; + setState(() {}); + }, + child: Container( + width: 27, + height: 27, + decoration: ShapeDecoration( + color: Color(0xFF7E7E7E), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 5)), + ), + child: 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), + text14w400white( + 'Upload banner image'), + sizedBoxHeight(8.h), + text8w400_8A8A8A( + "Allowed file extensions: jpg, png, gif Max file size: 10 MB"), + ], ), ), - borderwidth: 0.5), - ), - ), - sizedBoxHeight(20.h), - Center( - child: - text16w400_white("Add community profile picture")), - sizedBoxHeight(30.h), - text16w400_FCFCFC("Banner image"), - sizedBoxHeight(15.h), - InkWell( - onTap: () { - ImageUploadBottomSheet().showModal( - context, - false, - (result) { - // var file = File(result); - - // bannerPath.add(file); - // isbannerAdded = true; - // setState(() {}); - if (result != null && result.isNotEmpty) { - var file = File(result); - - // Check if the file size exceeds 10 MB - int fileSizeInBytes = file.lengthSync(); - double fileSizeInMB = - fileSizeInBytes / (1024 * 1024); - - if (fileSizeInMB > 10) { - // Show toast message if the file size exceeds 10 MB - - utils.showToast( - "The selected file is too large. Max file size is 10 MB."); - } else { - // Clear the existing image and add the new one - bannerPath.clear(); - bannerPath.add(file); - isbannerAdded = true; - setState(() {}); - } - } else { - // Handle case where no image is selected - bannerPath.clear(); - isbannerAdded = false; - setState(() {}); - } - if (Platform.isAndroid) { - Get.back(); - } - }, - ); - }, - child: DottedBorder( - strokeWidth: 1, - dashPattern: [7, 4], - borderType: BorderType.RRect, - radius: Radius.circular(14.r), - color: Color(0xFF434A53), - child: commonGlassUI( - borderwidth: 0, - width: double.infinity, - height: 130.h, - borderRadius: BorderRadius.circular(10.r), - 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: Color(0xFF7E7E7E), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5)), - ), - child: 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), - text14w400white('Upload banner image'), - sizedBoxHeight(8.h), - text8w400_8A8A8A( - "Allowed file extensions: jpg, png, gif Max file size: 10 MB"), - ], - ), - ), + ), ), ), - ), - - sizedBoxHeight(25.h), - text16w400_FCFCFC("Community name*"), - sizedBoxHeight(15.h), - CustomTextFormField( - textEditingController: communitycontroller, - inputFormatters: [ - RemoveEmojiInputFormatter(), - // FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) - ], - hintText: 'Enter community name', - validator: (val) { - if (val == null || val.isEmpty) { - return 'Enter Community name'; - } - return null; - }, - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Community description*"), - sizedBoxHeight(15.h), - CustomTextFormField( - textEditingController: communitydescrcontroller, - inputFormatters: [ - RemoveEmojiInputFormatter(), - // FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) - ], - hintText: 'Enter community description', - validator: (val) { - if (val == null || val.isEmpty) { - return 'Enter Community description'; - } - return null; - }, - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Type of community*"), - sizedBoxHeight(15.h), - CustomDropDownRadio( - header: "", - title: "", - listData: const ['Public', 'Private', 'Secret'], - onItemSelected: _onItemSelected, - // (p0) {}, - leadingImage: SizedBox()), - // CommonDropdownradioBtn( - // hint: '', - // items: ['Public', 'Private', 'Secret'], - // showOtherOption: false), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Location*"), - sizedBoxHeight(15.h), - CustomTextFormField( - textEditingController: locationcontroller, - inputFormatters: [ - RemoveEmojiInputFormatter(), - // FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) - ], - hintText: 'Enter location', - validator: (val) { - if (val == null || val.isEmpty) { - return 'Enter location'; - } - return null; - }, - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Primary activity*"), + sizedBoxHeight(25.h), - sizedBoxHeight(20.h), - CustomDropDownRadio( - header: "", - title: "", - listData: _activitydrop, - // [ - // 'Sports', - // 'Hobby', - // ], - showOtherOption: false, - onItemSelected: getCatIdFromName, - leadingImage: SizedBox()), + text16w400_FCFCFC("Community name*"), + sizedBoxHeight(15.h), + CustomTextFormField( + textEditingController: communitycontroller, + inputFormatters: [ + RemoveEmojiInputFormatter(), + // FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) + ], + hintText: 'Enter community name', + validator: (val) { + if (val == null || val.isEmpty) { + return 'Enter Community name'; + } + return null; + }, + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Community description*"), + sizedBoxHeight(15.h), + CustomTextFormField( + textEditingController: communitydescrcontroller, + inputFormatters: [ + RemoveEmojiInputFormatter(), + // FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) + ], + hintText: 'Enter community description', + validator: (val) { + if (val == null || val.isEmpty) { + return 'Enter Community description'; + } + return null; + }, + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Type of community*"), + sizedBoxHeight(15.h), + CustomDropDownRadio( + header: "", + title: "", + listData: const ['Public', 'Private', 'Secret'], + onItemSelected: _onItemSelected, + // (p0) {}, + leadingImage: SizedBox()), + // CommonDropdownradioBtn( + // hint: '', + // items: ['Public', 'Private', 'Secret'], + // showOtherOption: false), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Location*"), + sizedBoxHeight(15.h), + CustomTextFormField( + textEditingController: locationcontroller, + inputFormatters: [ + RemoveEmojiInputFormatter(), + // FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]')) + ], + hintText: 'Enter location', + validator: (val) { + if (val == null || val.isEmpty) { + return 'Enter location'; + } + return null; + }, + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Primary activity*"), - sizedBoxHeight(25.h), - sizedBoxHeight(25.h), - CustomButton( - text: "Create community", - onPressed: () { - // Get.toNamed(RouteName.addgroup); - if (filePath.isEmpty) { - utils.showToast( - 'Please add community profile picture'); - } else if (bannerPath.isEmpty) { - utils.showToast('Please add banner image'); - } else if (communitycontroller.text.isEmpty) { - utils.showToast('Please enter community name'); - } else if (communitydescrcontroller.text.isEmpty) { - utils.showToast('Please enter community description'); - } else if (_selectedtypecommunity.isEmpty) { - utils.showToast('Please select type of community'); - } else if (locationcontroller.text.isEmpty) { - utils.showToast('Please enter location'); - } else if (selectedactivityid == null) { - utils.showToast('Please select primary activity'); - } else { - print('done'); - // indiUploadata(); - // Uploadata(); - int communityTypeValue = - _TypecommunityMap[_selectedtypecommunity] ?? 0; + sizedBoxHeight(20.h), + CustomDropDownRadio( + header: "", + title: "", + listData: _activitydrop, + // [ + // 'Sports', + // 'Hobby', + // ], + showOtherOption: false, + onItemSelected: getCatIdFromName, + leadingImage: SizedBox()), - Get.toNamed(RouteName.addgroup, arguments: { - 'communityname': communitycontroller.text, - 'communitylocation': locationcontroller.text, - 'communitydescription': - communitydescrcontroller.text, - 'communitytype': communityTypeValue, - 'activityid': selectedactivityid, - 'communityprofilephoto': filePath, - 'communitybannerimage': bannerPath, - }); - } - }, - ), - sizedBoxHeight(25.h), - sizedBoxHeight(150.h), - ]), - )) - ])), - )); + sizedBoxHeight(25.h), + sizedBoxHeight(25.h), + CustomButton( + text: "Create community", + onPressed: () { + // Get.toNamed(RouteName.addgroup); + if (filePath.isEmpty) { + utils.showToast( + 'Please add community profile picture'); + } else if (bannerPath.isEmpty) { + utils.showToast('Please add banner image'); + } else if (communitycontroller.text.isEmpty) { + utils.showToast('Please enter community name'); + } else if (communitydescrcontroller.text.isEmpty) { + utils.showToast( + 'Please enter community description'); + } else if (_selectedtypecommunity.isEmpty) { + utils + .showToast('Please select type of community'); + } else if (locationcontroller.text.isEmpty) { + utils.showToast('Please enter location'); + } else if (selectedactivityid == null) { + utils.showToast('Please select primary activity'); + } else { + print('done'); + // indiUploadata(); + // Uploadata(); + int communityTypeValue = + _TypecommunityMap[_selectedtypecommunity] ?? + 0; + + Get.toNamed(RouteName.addgroup, arguments: { + 'communityname': communitycontroller.text, + 'communitylocation': locationcontroller.text, + 'communitydescription': + communitydescrcontroller.text, + 'communitytype': communityTypeValue, + 'activityid': selectedactivityid, + 'communityprofilephoto': filePath, + 'communitybannerimage': bannerPath, + 'isedited': false, + 'communityid': "", + }); + } + }, + ), + sizedBoxHeight(25.h), + sizedBoxHeight(150.h), + ]), + )) + ])), + )); } } diff --git a/lib/sidemenu/communities.dart b/lib/sidemenu/communities.dart index 120154e..e85e1b7 100644 --- a/lib/sidemenu/communities.dart +++ b/lib/sidemenu/communities.dart @@ -177,7 +177,13 @@ class _Communitiespinned extends State { )), sizedBoxWidth(13.w), userpinnedobj!.data!.pinnedCommunity![index] - .community!.communityName == + .community == + null || + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityName == null || userpinnedobj! .data! diff --git a/lib/sidemenu/sidemenu.dart b/lib/sidemenu/sidemenu.dart index 268aa7d..209e7c5 100644 --- a/lib/sidemenu/sidemenu.dart +++ b/lib/sidemenu/sidemenu.dart @@ -151,6 +151,12 @@ class _SideMenuState extends State { } } + void refreshData() { + setState(() { + myfuture = Sidegetmethod().getUserpinnedList(); + }); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -213,8 +219,12 @@ class _SideMenuState extends State { children: [ sizedBoxHeight(50.h), GestureDetector( - onTap: () { - Get.toNamed(RouteName.mycommunity); + onTap: () async { + var result = await Get.toNamed(RouteName.mycommunity); + if (result != null && result) { + refreshData(); + print("Updating community details..."); + } }, child: Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), @@ -309,7 +319,7 @@ class _SideMenuState extends State { userpinnedobj!.data!.pinnedTag![index].tag == null || userpinnedobj!.data!.pinnedTag![index].tag! .name!.isEmpty - ? text14w400_FCFCFC('') + ? text14w400_FCFCFC('Regroup') : text14w400_FCFCFC(userpinnedobj! .data!.pinnedTag![index].tag!.name!), trailing: InkWell( @@ -404,7 +414,7 @@ class _SideMenuState extends State { null || userpinnedobj!.data!.pinnedCommunity![index] .community!.communityName!.isEmpty - ? text14w400_FCFCFC('') + ? text14w400_FCFCFC('Regroup') : text14w400_FCFCFC(userpinnedobj! .data! .pinnedCommunity![index] @@ -509,7 +519,7 @@ class _SideMenuState extends State { null || userpinnedobj!.data!.pinnedUser![index].pinUser! .fullName!.isEmpty - ? text14w400_FCFCFC('') + ? text14w400_FCFCFC('Regroup') : text14w400_FCFCFC(userpinnedobj! .data!.pinnedUser![index].pinUser!.fullName!), trailing: InkWell( diff --git a/lib/sidemenu/users.dart b/lib/sidemenu/users.dart index c091dc9..23f3d6b 100644 --- a/lib/sidemenu/users.dart +++ b/lib/sidemenu/users.dart @@ -86,7 +86,7 @@ class _ViewtusertagsState extends State { ); } - pinunpinUser(int userid) async { + pinunpinUser(int userid) async { utils.loader(); Map updata = { "pin_iam_principal_xid": userid, @@ -126,54 +126,48 @@ class _ViewtusertagsState extends State { physics: const ScrollPhysics(), itemCount: userpinnedobj!.data!.pinnedUser!.length, itemBuilder: (context, index) { - final tagid = - userpinnedobj!.data!.pinnedUser![index].pinIamPrincipalXid!; + 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!), + 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 == + null || + userpinnedobj!.data!.pinnedUser![index] + .pinUser!.fullName!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj!.data! + .pinnedUser![index].pinUser!.fullName!), trailing: InkWell( onTap: () async { setState(() {