diff --git a/assets/images/png/Group 1000004149.png b/assets/images/png/Group 1000004149.png new file mode 100644 index 0000000..855035d Binary files /dev/null and b/assets/images/png/Group 1000004149.png differ diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index c62be9c..0cbc08f 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -180,6 +180,10 @@ class ApiUrls { static const geteditcommunity = "${baseUrl}edit-community"; + static const posteditcommunity = "${baseUrl}update-community"; + + static const getactivitieslist = "${baseUrl}get_activity"; + diff --git a/lib/Main_Screens/Community_HomePage/Community.dart b/lib/Main_Screens/Community_HomePage/Community.dart index 75dcd10..4adbe04 100644 --- a/lib/Main_Screens/Community_HomePage/Community.dart +++ b/lib/Main_Screens/Community_HomePage/Community.dart @@ -229,7 +229,7 @@ class _FeedTabState extends State { } } - setValues() { + Future setValues() async { if (mounted) { combinedList.clear(); combinedListGlobal.clear(); @@ -239,7 +239,7 @@ class _FeedTabState extends State { combinedListGlobal.addAll(combinedList); _setModel(); countersHelper.setListsPopular(); - _fetchIcons(); + await _fetchIcons(); } } diff --git a/lib/Utils/Helper.dart b/lib/Utils/Helper.dart index 6e5f658..78c737c 100644 --- a/lib/Utils/Helper.dart +++ b/lib/Utils/Helper.dart @@ -7,6 +7,7 @@ import 'package:flutter/services.dart'; import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:path_provider/path_provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:path/path.dart' as path; class Helper { static Future networkImageToMultipartFile( @@ -16,14 +17,24 @@ class Helper { Response response = await dio.get(imageUrl, options: Options(responseType: ResponseType.bytes)); + final cleanedFileName = _cleanFileName(imageUrl); + MultipartFile multipartFile = MultipartFile.fromBytes( response.data!, - filename: imageUrl.substring(imageUrl.lastIndexOf("/") + 1), + filename: cleanedFileName, + // imageUrl.substring(imageUrl.lastIndexOf("/") + 1), ); return multipartFile; } +static String _cleanFileName(String url) { + // Parse the URL and extract the path + final uri = Uri.parse(url); + // Extract the base name from the path, removing any query parameters + return path.basename(uri.path); +} + static Future assetImageToMultipartFile( String assetImagePath, String fileName) async { ByteData assetByteData = await rootBundle.load(assetImagePath); diff --git a/lib/sidemenu/Community/Admin/PopupItem/Community settings/EditCommunity/EditCommunity.dart b/lib/sidemenu/Community/Admin/PopupItem/Community settings/EditCommunity/EditCommunity.dart index 4e23501..ff27986 100644 --- a/lib/sidemenu/Community/Admin/PopupItem/Community settings/EditCommunity/EditCommunity.dart +++ b/lib/sidemenu/Community/Admin/PopupItem/Community settings/EditCommunity/EditCommunity.dart @@ -1,14 +1,13 @@ 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_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; +import 'package:get/get.dart' hide MultipartFile, FormData; import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/base_manager.dart'; -import 'package:regroup/Main_Screens/ProfileTab/EditProfile/Model/InterestModel.dart' - as primaryactlist; import 'package:regroup/Utils/Common/CommonAppbar.dart'; import 'package:regroup/Utils/Common/CommonDropdown.dart'; import 'package:regroup/Utils/Common/CustomNextButton.dart'; @@ -19,9 +18,13 @@ import 'package:regroup/Utils/Helper.dart'; import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/Utils/Common/CustomTextformfield.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/Model/activitiesListModel.dart' + as primaryactlist; import 'package:regroup/sidemenu/Community/MyCommunity/view_model/getmethod.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/view_model/postmethod.dart'; import 'package:regroup/sidemenu/Community/MyCommunity/view_model/primaryactivity.dart'; import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; +import 'package:path/path.dart' as path; class EditCommunity extends StatefulWidget { const EditCommunity({super.key}); @@ -42,9 +45,6 @@ class _EditCommunityState extends State { @override void initState() { myfuture = Getcommunity().getCommunityeditpage(communityid); - // communitynameController.text = 'Active alliance network'; - // descriptionController.text = - // "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer ."; super.initState(); } @@ -94,497 +94,631 @@ class _EditCommunityState extends State { }); } - primaryactlist.InterestModel? abilityModel; - List activity = []; + primaryactlist.ActivitiesListsModel? abilityModel; + List activity = []; List _activitydrop = []; - String? selectedActivityName; + String? selectedActivityName = ''; + + bool isDataLoaded = false; + + List> _abilityMap = []; Future fetchActivitylist() async { PrimaryActivityListApi abilityListAPI = PrimaryActivityListApi(); ResponseData response = await abilityListAPI.getActivitylistApi(); if (response.status == ResponseStatus.SUCCESS) { - abilityModel = primaryactlist.InterestModel.fromJson(response.data!); + abilityModel = + primaryactlist.ActivitiesListsModel.fromJson(response.data!); setState(() { activity = abilityModel!.data ?? []; _activitydrop = - activity.map((platform) => platform.name.toString()).toList(); + activity.map((platform) => platform.title.toString()).toList(); + _abilityMap = activity.map((platform) { + return { + "id": platform.id, + "name": platform.title.toString(), + }; + }).toList(); }); - // Ensure dropdown list updates after setting the initial value - setState(() { - // Set the initial selected activity if data is available - int activitiesXids = - communityeditobj!.data!.communityData!.activityData!.id!; - selectedactivityid = activitiesXids; - selectedActivityName = activity - .firstWhere((item) => item.id == activitiesXids, - orElse: () => activity.first) - .name; - isactivityLoaded = true; - }); - log(activity.toString()); + // Debugging log for _abilityMap + print('Ability Map: $_abilityMap'); + + if (communityeditobj != null && communityeditobj!.data != null) { + int abilitiesXids = communityeditobj!.data!.communityData!.activityXid!; + selectedactivityid = abilitiesXids; + + String? name = await getSelectedName(selectedactivityid!); + setState(() { + selectedActivityName = name ?? ''; + isactivityLoaded = true; + isDataLoaded = true; // Mark data as loaded + }); + + // Debugging log for selectedActivityName + print('Selected activity ID is $selectedactivityid'); + print('Selected activity name is $selectedActivityName'); + } } else { - print('Failed to fetch abilities'); + print('Failed to fetch activities'); + setState(() { + isDataLoaded = false; // Ensure loader is not hidden in case of error + }); } } + Future getSelectedName(int selectedId) async { + print('Searching for ID: $selectedId in _abilityMap'); + + for (Map ability in _abilityMap) { + if (ability["id"] == selectedId) { + print('Found ability: ${ability["name"]}'); + return ability["name"] as String; + } + } + return null; + } + int? selectedactivityid; void getCatIdFromName(String selectedAbility) { selectedactivityid = activity - .firstWhere((item) => item.name == selectedAbility, + .firstWhere((item) => item.title == selectedAbility, orElse: () => activity.first) .id; print('Selected activity ID is $selectedactivityid'); } + String _cleanFileName(String filePath) { + return path + .basename(filePath) + .split('?') + .first; + } + + Uploadata() async { + utils.loader(); + List bannermedialist = []; + List profielpicturelist = []; + MultipartFile? imageFile; + + // for (var file in bannerPath.where((file) => file != null)) { + // bannermedialist.add( + // await MultipartFile.fromFile( + // file!.path, + // filename: path.basename(file.path), + // ), + // ); + // } + + for (var file in bannerPath.where((file) => file != null)) { + final filePath = file!.path; + final cleanedFileName = _cleanFileName(filePath); + + print('Original File Path: $filePath'); + print('Cleaned File Name: $cleanedFileName'); + + bannermedialist.add( + await MultipartFile.fromFile( + filePath, + filename: cleanedFileName, + ), + ); + } + + if (filePath.isNotEmpty && filePath[0] != null) { + var profileFile = filePath[0]; + if (profileFile!.path.isNotEmpty) { + // Convert local file to MultipartFile + imageFile = await MultipartFile.fromFile( + profileFile.path, + filename: path.basename(profileFile.path), + ); + } else { + // Handle case where file path is empty + imageFile = await Helper.networkImageToMultipartFile( + communityeditobj!.data!.communityData!.communityProfilePhoto!, + ); + } + } else if (communityeditobj!.data!.communityData!.communityProfilePhoto != + null) { + // Handle case where no file is provided, fallback to network image + imageFile = await Helper.networkImageToMultipartFile( + communityeditobj!.data!.communityData!.communityProfilePhoto!, + ); + } else { + // Handle case where no profile picture is provided + print('No profile picture provided.'); + return; + } + + int communityTypeValue = _typeCommunityMap[_selectedtypecommunity] ?? 0; + print('Image File: ${imageFile.filename}'); + print( + 'Banner Media List: ${bannermedialist.map((file) => file.filename).toList()}'); + + FormData formdata = FormData.fromMap({ + "community_profile_photo": imageFile, + "community_banner_image": bannermedialist[0], + "community_name": communitynameController.text, + "community_location": locationcontroller.text, + "community_description": descriptionController.text, + 'community_type_xid': communityTypeValue, + 'activity_xid': selectedactivityid, + 'community_id': communityid, + }); + print('updata is ${formdata.toString()}'); + log('log is ${formdata.toString()}'); + final data = await PostMethodCommunity().postEditcommunity(formdata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + print("community updated"); + // Get.toNamed(RouteName.mycommunity); + Get.back(); + return utils.showToast(data.message); + } else { + Get.back(); + print("community not updated"); + return utils.showToast(data.message); + } + } + @override Widget build(BuildContext context) { - return Scaffold( - // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), - extendBody: true, - appBar: CommonAppbar( - titleTxt: "Edit community info", - ), - resizeToAvoidBottomInset: false, - 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), + return GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + child: Scaffold( + // key: _scaffoldKey1, + backgroundColor: Color(0xFF222935), + extendBody: true, + appBar: CommonAppbar( + titleTxt: "Edit community info", + ), + resizeToAvoidBottomInset: true, + 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), ), - ) - ], - ); - } - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - return Center( - child: Text( - '${snapshot.error} occured', - style: TextStyle(fontSize: 18.spMin), + ); + } + } + if (!isBannerLoaded) { + bannerimage = communityeditobj! + .data!.communityData!.communityBannerImage!; + _loadBannerImage(); // Call only if not already loaded + } + communitynameController.text = + communityeditobj!.data!.communityData!.communityName!; + descriptionController.text = + communityeditobj!.data!.communityData!.communityDescription!; + locationcontroller.text = + communityeditobj!.data!.communityData!.communityLocation!; + websitelinkcontroller.text = + communityeditobj!.data!.communityData!.communityDescription!; + var communityType = communityeditobj! + .data!.communityData!.communityTypeData!.name; + if (_selectedtypecommunity.isEmpty) { + _selectedtypecommunity = communityType ?? 'Public'; + } + if (!isactivityLoaded) { + fetchActivitylist(); + } + if (!isDataLoaded) { + // Show a loader or a placeholder until data is fully loaded + return const Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), ), ); } - } - if (!isBannerLoaded) { - bannerimage = - communityeditobj!.data!.communityData!.communityBannerImage!; - _loadBannerImage(); // Call only if not already loaded - } - communitynameController.text = - communityeditobj!.data!.communityData!.communityName!; - descriptionController.text = - communityeditobj!.data!.communityData!.communityDescription!; - locationcontroller.text = - communityeditobj!.data!.communityData!.communityLocation!; - websitelinkcontroller.text = - communityeditobj!.data!.communityData!.communityDescription!; - var communityType = - communityeditobj!.data!.communityData!.communityTypeData!.name; - if (_selectedtypecommunity.isEmpty) { - _selectedtypecommunity = communityType ?? 'Public'; - } - if (!isactivityLoaded) { - fetchActivitylist(); - } - return Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), - ), - SingleChildScrollView( - child: Column(children: [ - // sizedBoxHeight(30.h), - Stack( - clipBehavior: Clip.none, - children: [ - Container( - height: 100.h, - width: 100.w, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: Color(0xFF434A53), width: 0.5.w), + return Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: + AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Column(children: [ + // sizedBoxHeight(30.h), + Stack( + clipBehavior: Clip.none, + children: [ + Container( + height: 100.h, + width: 100.w, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: Color(0xFF434A53), width: 0.5.w), + ), + child: Center( + child: filePath.isNotEmpty + ? ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(50.r), + child: filePath.isNotEmpty + ? Image.file( + filePath[0]!, + fit: BoxFit.cover, + width: double.infinity, + ) + : Image.asset( + 'assets/images/png/Ellipse 37.png', + fit: BoxFit.cover), + ), + ) + : ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(50.r), + child: communityeditobj! + .data! + .communityData! + .communityProfilePhoto! + .isNotEmpty + ? Image.network( + communityeditobj! + .data! + .communityData! + .communityProfilePhoto!, + fit: BoxFit.cover, + errorBuilder: (context, error, + stackTrace) { + // Error handling when image fails to load + return Image.asset( + "assets/images/png/Ellipse 37.png", + fit: BoxFit.cover, + ); + }, + ) + : Image.asset( + 'assets/images/png/Ellipse 37.png', + fit: BoxFit.cover), + ), + )), ), - child: Center( - child: filePath.isNotEmpty - ? ClipOval( - child: SizedBox.fromSize( - size: Size.fromRadius(50.r), - child: filePath.isNotEmpty - ? Image.file( - filePath[0]!, - fit: BoxFit.cover, - width: double.infinity, - ) - : Image.asset( - 'assets/images/png/Ellipse 37.png', - fit: BoxFit.cover), - ), - ) - : ClipOval( - child: SizedBox.fromSize( - size: Size.fromRadius(50.r), - child: communityeditobj! - .data! - .communityData! - .communityProfilePhoto! - .isNotEmpty - ? Image.network( - communityeditobj! - .data! - .communityData! - .communityProfilePhoto!, - fit: BoxFit.cover, - errorBuilder: - (context, error, stackTrace) { - // Error handling when image fails to load - return Image.asset( - "assets/images/png/Ellipse 37.png", - fit: BoxFit.cover, - ); - }, - ) - : Image.asset( - 'assets/images/png/Ellipse 37.png', - fit: BoxFit.cover), - ), - )), - ), - Positioned( - right: -10, - bottom: 0, - 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(); + Positioned( + right: -10, + bottom: 0, + 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 { + filePath.clear(); + isImageAdded = false; + setState(() {}); } - } else { - filePath.clear(); - isImageAdded = false; - setState(() {}); - } - }, - ); - }, - child: Container( - height: 35.h, - width: 35.w, - decoration: BoxDecoration( - color: Color(0xFFD90B2E), - shape: BoxShape.circle, - border: Border.all( - color: Color(0xFFD90B2E), width: 0.5.w)), - child: Center( - child: Image.asset( - 'assets/images/png/cameraicon.png', - height: 14.h, - width: 15.w, + }, + ); + }, + child: Container( + height: 35.h, + width: 35.w, + decoration: BoxDecoration( + color: Color(0xFFD90B2E), + shape: BoxShape.circle, + border: Border.all( + color: Color(0xFFD90B2E), + width: 0.5.w)), + child: Center( + child: Image.asset( + 'assets/images/png/cameraicon.png', + height: 14.h, + width: 15.w, + ), ), ), - ), - )) - ], - ), - sizedBoxHeight(25.h), - text16w400_white("Edit community profile picture"), - sizedBoxHeight(30.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - text16w400_FCFCFC("Community banner image"), - sizedBoxHeight(16.h), - 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: 150.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: InkWell( - // onTap: () { - // setState(() { - // bannerPath.clear(); - // isbannerAdded = false; - // }); - // }, - // 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, - // ), - // ), - // ), - // ), - ], - ) - : GestureDetector( - onTap: () { - ImageUploadBottomSheet().showModal( - context, - false, - (result) { - if (result != null && - result.isNotEmpty) { - var file = File(result); + )) + ], + ), + sizedBoxHeight(25.h), + text16w400_white("Edit community profile picture"), + sizedBoxHeight(30.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text16w400_FCFCFC("Community banner image"), + sizedBoxHeight(16.h), + 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: 150.h, + borderRadius: BorderRadius.circular(10.r), + customWidget: + bannerPath.isNotEmpty && isbannerAdded + ? Stack( + children: [ + Image.file( + bannerPath[0]!, + fit: BoxFit.cover, + width: double.infinity, + ), + ], + ) + : GestureDetector( + onTap: () { + ImageUploadBottomSheet().showModal( + context, + false, + (result) { + 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); + // 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: Padding( - padding: - EdgeInsets.symmetric(vertical: 16.h), - child: Column( - children: [ - Image.asset( - "assets/images/png/cameraicon2.png", - height: 36.h, - width: 36.w, + 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: Padding( + padding: EdgeInsets.symmetric( + vertical: 16.h), + child: Column( + children: [ + Image.asset( + "assets/images/png/cameraicon2.png", + height: 36.h, + width: 36.w, + ), + SizedBox(height: 10.h), + text14w400white( + 'Upload banner image'), + SizedBox(height: 8.h), + SizedBox( + width: 270.w, + child: Center( + child: text8w400_8A8A8A( + "Allowed file extensions: jpg, png, gif Max file size: 10 MB"), + ), + ), + ], + ), ), - SizedBox(height: 10.h), - text14w400white( - 'Upload banner image'), - SizedBox(height: 8.h), - SizedBox( - width: 270.w, - child: text8w400_8A8A8A( - "Allowed file extensions: jpg, png, gif Max file size: 10 MB"), + ), + ), + ), + sizedBoxHeight(16.w), + bannerPath.isNotEmpty && isbannerAdded + ? commonGlassUI( + width: double.infinity, + height: 60.h, + borderRadius: BorderRadius.circular(10.r), + customWidget: Center( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.w), + child: Row( + children: [ + // Conditionally render image or placeholder + if (bannerPath.isNotEmpty && + isbannerAdded) + Container( + height: 40.h, + width: 40.w, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(5.r), + ), + child: Image.file( + bannerPath[0]!, + fit: BoxFit.cover, + width: double.infinity, + ), + ) + else + Container( + height: 40.h, + width: 40.w, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(5.r), + ), + child: Image.asset( + 'assets/images/png/img2.png', + fit: BoxFit.cover, + width: double.infinity, + ), + ), + SizedBox(width: 8.w), + Spacer(), + InkWell( + onTap: () { + setState(() { + // Clear the image and update the state + bannerPath.clear(); + isbannerAdded = false; + }); + // Optionally debug state values + print("bannerPath: $bannerPath"); + print( + "isbannerAdded: $isbannerAdded"); + }, + child: Image.asset( + 'assets/images/png/cancelicon.png', + height: 20.h, + width: 20.w, + ), ), ], ), ), ), + borderwidth: 1, + ) + : SizedBox(), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Community name*"), + sizedBoxHeight(14.h), + CustomTextFormField( + textEditingController: communitynameController, + validator: (val) { + if (val == null || val.isEmpty) { + return 'Enter Community name'; + } + return null; + }, + hintText: 'Enter type of community', ), - ), - sizedBoxHeight(16.w), - bannerPath.isNotEmpty && isbannerAdded - ? commonGlassUI( - width: double.infinity, - height: 60.h, - borderRadius: BorderRadius.circular(10.r), - customWidget: Center( - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 12.w), - child: Row( - children: [ - // Conditionally render image or placeholder - if (bannerPath.isNotEmpty && - isbannerAdded) - Container( - height: 40.h, - width: 40.w, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(5.r), - ), - child: Image.file( - bannerPath[0]!, - fit: BoxFit.cover, - width: double.infinity, - ), - ) - else - Container( - height: 40.h, - width: 40.w, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(5.r), - ), - child: Image.asset( - 'assets/images/png/img2.png', - fit: BoxFit.cover, - width: double.infinity, - ), - ), - SizedBox(width: 8.w), - Spacer(), - InkWell( - onTap: () { - setState(() { - // Clear the image and update the state - bannerPath.clear(); - isbannerAdded = false; - }); - // Optionally debug state values - print("bannerPath: $bannerPath"); - print( - "isbannerAdded: $isbannerAdded"); - }, - child: Image.asset( - 'assets/images/png/cancelicon.png', - height: 20.h, - width: 20.w, - ), - ), - ], - ), - ), - ), - borderwidth: 1, - ) - : SizedBox(), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Community name*"), - sizedBoxHeight(14.h), - CustomTextFormField( - textEditingController: communitynameController, - validator: (val) { - if (val == null || val.isEmpty) { - return 'Enter Community name'; - } - return null; - }, - hintText: 'Enter type of community', - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Group description"), - sizedBoxHeight(14.h), - CustomTextFormField( - // maxlines: 3, - hintText: 'Enter description', - textEditingController: descriptionController, - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Type of community*"), - sizedBoxHeight(14.h), - CustomDropDownRadio( - header: "", - title: "", - listData: _typeCommunityMap.keys.toList(), - onItemSelected: _onItemSelected, - leadingImage: SizedBox(), - initialSelectedValue: _selectedtypecommunity, - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Location*"), - sizedBoxHeight(14.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(14.h), - CustomDropDownRadio( - showOtherOption: true, - header: "", - title: "", - listData: _activitydrop, - onItemSelected: getCatIdFromName, - leadingImage: SizedBox(), - initialSelectedValue: selectedActivityName.toString(), - ), - sizedBoxHeight(25.h), - text16w400_FCFCFC("Website link"), - sizedBoxHeight(14.h), - CustomTextFormField( - textEditingController: websitelinkcontroller, - validator: (val) { - if (!isValidWebBannerLink(val)) { - return 'Please enter a valid web banner link.'; - } - return null; - }, - hintText: 'Enter website link', - ), - sizedBoxHeight(25.h), - sizedBoxHeight(50.h), - CustomButton(text: 'Save changes', onPressed: () {}), - sizedBoxHeight(50.h), - ], - ), - ) - ]), - ) - ]); - }, - )); + sizedBoxHeight(25.h), + text16w400_FCFCFC("Group description"), + sizedBoxHeight(14.h), + CustomTextFormField( + // maxlines: 3, + hintText: 'Enter description', + textEditingController: descriptionController, + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Type of community*"), + sizedBoxHeight(14.h), + CustomDropDownRadio( + header: "", + title: "", + listData: _typeCommunityMap.keys.toList(), + onItemSelected: _onItemSelected, + leadingImage: SizedBox(), + initialSelectedValue: _selectedtypecommunity, + ), + sizedBoxHeight(25.h), + text16w400_FCFCFC("Location*"), + sizedBoxHeight(14.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(14.h), + CustomDropDownRadio( + showOtherOption: false, + header: "", + title: "", + listData: _activitydrop, + onItemSelected: getCatIdFromName, + leadingImage: SizedBox(), + initialSelectedValue: selectedActivityName ?? '', + ), + sizedBoxHeight(25.h), + // text16w400_FCFCFC("Website link"), + // sizedBoxHeight(14.h), + // CustomTextFormField( + // textEditingController: websitelinkcontroller, + // validator: (val) { + // if (!isValidWebBannerLink(val)) { + // return 'Please enter a valid web banner link.'; + // } + // return null; + // }, + // hintText: 'Enter website link', + // ), + // sizedBoxHeight(25.h), + sizedBoxHeight(50.h), + CustomButton( + text: 'Save changes', + onPressed: () { + if (bannerPath.isEmpty || + communitynameController.text.isEmpty || + _selectedtypecommunity.isEmpty || + locationcontroller.text.isEmpty || + selectedactivityid.isBlank!) { + utils.showToast('Please fill all fields'); + } + // else if (filePath.isEmpty) { + // utils.showToast( + // 'Please add community profile picture'); + // } + else { + print('done'); + + Uploadata(); + } + }), + sizedBoxHeight(50.h), + ], + ), + ) + ]), + ) + ]); + }, + )), + ); } } diff --git a/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageGroup.dart b/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageGroup.dart index 30c24e8..7665380 100644 --- a/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageGroup.dart +++ b/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageGroup.dart @@ -53,26 +53,26 @@ class _ManageGroupsState extends State { resizeToAvoidBottomInset: false, appBar: CommonAppbar( titleTxt: "Manage groups", - customActionWidget: InkWell( - onTap: () {}, - child: Container( - height: 35.h, - width: 35.w, - decoration: BoxDecoration( - color: Color(0xFFD90B2E), - shape: BoxShape.circle, - boxShadow: [ - BoxShadow( - color: Color(0x40000000), - offset: Offset(0, 6), - blurRadius: 8, - spreadRadius: 0, - ), - ], - ), - child: Icon(Icons.add, color: Colors.white, weight: 2), - ), - ), + // customActionWidget: InkWell( + // onTap: () {}, + // child: Container( + // height: 35.h, + // width: 35.w, + // decoration: BoxDecoration( + // color: Color(0xFFD90B2E), + // shape: BoxShape.circle, + // boxShadow: [ + // BoxShadow( + // color: Color(0x40000000), + // offset: Offset(0, 6), + // blurRadius: 8, + // spreadRadius: 0, + // ), + // ], + // ), + // child: Icon(Icons.add, color: Colors.white, weight: 2), + // ), + // ), ), body: Stack(children: [ Container( @@ -111,7 +111,7 @@ class _ManageGroupsState extends State { opacity2: 0.24, width: 50.w, height: 50.h, - borderRadius: BorderRadius.circular( 100), + borderRadius: BorderRadius.circular(100), customWidget: Center( child: Image.asset( "assets/images/png/Black.png", @@ -178,11 +178,14 @@ Widget groupWidget({ ], ), Spacer(), - Icon( - Icons.clear, - color: Color(0xFFFFFFFF), - weight: 1.88, + Image.asset( + 'assets/images/png/Group 1000004149.png', ) + // Icon( + // Icons.clear, + // color: Color(0xFFFFFFFF), + // weight: 1.88, + // ) ], ), ); diff --git a/lib/sidemenu/Community/MyCommunity/AddGroups.dart b/lib/sidemenu/Community/MyCommunity/AddGroups.dart index babe215..5c07b2c 100644 --- a/lib/sidemenu/Community/MyCommunity/AddGroups.dart +++ b/lib/sidemenu/Community/MyCommunity/AddGroups.dart @@ -152,151 +152,154 @@ class _AddGroupState extends State { @override Widget build(BuildContext context) { - return Scaffold( - // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), - extendBody: true, - appBar: CommonAppbar( - titleTxt: "Add groups", - ), - resizeToAvoidBottomInset: false, - bottomNavigationBar: Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h), - child: CustomButton( - text: "Add", - onPressed: () { - // Get.toNamed(RouteName.mycommunity); - print('selected groups are ${_selectedIndices.toString()}'); - Uploadata(); - }, + return GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + child: Scaffold( + // key: _scaffoldKey1, + backgroundColor: Color(0xFF222935), + extendBody: true, + appBar: CommonAppbar( + titleTxt: "Add groups", ), - ), - body: Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), + resizeToAvoidBottomInset: false, + bottomNavigationBar: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h), + child: CustomButton( + text: "Add", + onPressed: () { + // Get.toNamed(RouteName.mycommunity); + print('selected groups are ${_selectedIndices.toString()}'); + Uploadata(); + }, + ), ), - SingleChildScrollView( - child: Column(children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(20.h), - CustomTextFormField( - leadingIcon: SizedBox( - height: 23, - width: 23, - child: Center( - child: Image.asset( - "assets/images/png/ion_search-outline.png", - height: 23, - width: 23, + body: Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Column(children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(20.h), + CustomTextFormField( + leadingIcon: SizedBox( + height: 23, + width: 23, + child: Center( + child: Image.asset( + "assets/images/png/ion_search-outline.png", + height: 23, + width: 23, + ), ), ), + hintText: "Search groups", + onInput: (value) { + Getcommunity().getCommunityAddGroupsearch(value, + streamController: searchcontroller); + }, ), - hintText: "Search groups", - onInput: (value) { - Getcommunity().getCommunityAddGroupsearch(value, - streamController: searchcontroller); - }, - ), - sizedBoxHeight(25.h), - // Row( - // children: [ - // commonGlassUI( - // opacity1: 0.24, - // opacity2: 0.24, - // width: 50.w, - // height: 50.h, - // borderRadius: BorderRadius.circular( 100), - // customWidget: Center( - // child: Image.asset( - // "assets/images/png/Black.png", - // height: 30.h, - // width: 30.w, - // )), - // borderwidth: 0.5), - // sizedBoxWidth(8.w), - // text18w400_FCFCFC("Create group"), - // Spacer(), - // Icon( - // Icons.arrow_forward_ios_outlined, - // color: Colors.white, - // size: 14.sp, - // ), - // ], - // ), - // sizedBoxHeight(25.h), - sizedBoxHeight(30.h), - text18w700white("Existing Groups"), - sizedBoxHeight(20.h), - ]), - ), - StreamBuilder( - stream: searchcontroller.stream, - builder: (ctx, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CircularProgressIndicator(), - ], - ), - ); - } else if (snapshot.hasError) { - return Center( - child: Text( - '${snapshot.error} occured', - style: TextStyle(fontSize: 18.sp), - ), - ); - } else { - return communityaddgroupobj!.data.isEmpty - ? _buildNoDataBody(context) - : ListView.builder( - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: communityaddgroupobj!.data.length, - itemBuilder: (context, index) { - final isChecked = _selectedIndices.contains( - communityaddgroupobj!.data[index].id!); - return Column( - children: [ - groupWidget( - index: - communityaddgroupobj!.data[index].id!, - imagePath: communityaddgroupobj! - .data[index].groupImage ?? - '', - title: communityaddgroupobj! - .data[index].title!, - subtitle: communityaddgroupobj! - .data[index].description!, - isChecked: isChecked, - // isCheckedList[index], - onCheckedChanged: (bool? value) { - // isCheckedList[index] = value ?? false; - _onContainerTap(communityaddgroupobj! - .data[index].id!); - }, - ), - commonDivider(), - ], - ); - }, - ); - } - }), - sizedBoxHeight(50.h), - ]), - ) - ])); + sizedBoxHeight(25.h), + // Row( + // children: [ + // commonGlassUI( + // opacity1: 0.24, + // opacity2: 0.24, + // width: 50.w, + // height: 50.h, + // borderRadius: BorderRadius.circular( 100), + // customWidget: Center( + // child: Image.asset( + // "assets/images/png/Black.png", + // height: 30.h, + // width: 30.w, + // )), + // borderwidth: 0.5), + // sizedBoxWidth(8.w), + // text18w400_FCFCFC("Create group"), + // Spacer(), + // Icon( + // Icons.arrow_forward_ios_outlined, + // color: Colors.white, + // size: 14.sp, + // ), + // ], + // ), + // sizedBoxHeight(25.h), + sizedBoxHeight(30.h), + text18w700white("Existing Groups"), + sizedBoxHeight(20.h), + ]), + ), + StreamBuilder( + stream: searchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircularProgressIndicator(), + ], + ), + ); + } else if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.sp), + ), + ); + } else { + return communityaddgroupobj!.data.isEmpty + ? _buildNoDataBody(context) + : ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: communityaddgroupobj!.data.length, + itemBuilder: (context, index) { + final isChecked = _selectedIndices.contains( + communityaddgroupobj!.data[index].id!); + return Column( + children: [ + groupWidget( + index: + communityaddgroupobj!.data[index].id!, + imagePath: communityaddgroupobj! + .data[index].groupImage ?? + '', + title: communityaddgroupobj! + .data[index].title!, + subtitle: communityaddgroupobj! + .data[index].description!, + isChecked: isChecked, + // isCheckedList[index], + onCheckedChanged: (bool? value) { + // isCheckedList[index] = value ?? false; + _onContainerTap(communityaddgroupobj! + .data[index].id!); + }, + ), + commonDivider(), + ], + ); + }, + ); + } + }), + sizedBoxHeight(50.h), + ]), + ) + ])), + ); } Widget _buildNoDataBody(context) { diff --git a/lib/sidemenu/Community/MyCommunity/Model/ComPostModel.dart b/lib/sidemenu/Community/MyCommunity/Model/ComPostModel.dart index 0a1fbe1..4b348b7 100644 --- a/lib/sidemenu/Community/MyCommunity/Model/ComPostModel.dart +++ b/lib/sidemenu/Community/MyCommunity/Model/ComPostModel.dart @@ -80,7 +80,7 @@ class Datum { final bool? isILiked; final bool? isIFollow; final bool? isISaved; - final dynamic likeIcon; + final LikeIcon? likeIcon; final int? totalComment; final int? totalSave; final List tagsXid; @@ -116,7 +116,8 @@ class Datum { isILiked: json["is_i_liked"], isIFollow: json["is_i_follow"], isISaved: json["is_i_saved"], - likeIcon: json["likeIcon"], + // likeIcon: json["likeIcon"], + likeIcon: json["likeIcon"] == null ? null : LikeIcon.fromJson(json["likeIcon"]), totalComment: json["total_comment"], totalSave: json["total_save"], tagsXid: json["tags_xid"] == null @@ -164,6 +165,42 @@ class AttachTag { } } +class LikeIcon { + LikeIcon({ + required this.likeIconsXid, + required this.likeIcon, + }); + + final int? likeIconsXid; + final LikeIconClass? likeIcon; + + factory LikeIcon.fromJson(Map json){ + return LikeIcon( + likeIconsXid: json["like_icons_xid"], + likeIcon: json["like_icon"] == null ? null : LikeIconClass.fromJson(json["like_icon"]), + ); + } + +} + +class LikeIconClass { + LikeIconClass({ + required this.id, + required this.image, + }); + + final int? id; + final String? image; + + factory LikeIconClass.fromJson(Map json){ + return LikeIconClass( + id: json["id"], + image: json["image"], + ); + } + +} + class ManageTag { ManageTag({ required this.id, diff --git a/lib/sidemenu/Community/MyCommunity/Model/activitiesListModel.dart b/lib/sidemenu/Community/MyCommunity/Model/activitiesListModel.dart new file mode 100644 index 0000000..5824135 --- /dev/null +++ b/lib/sidemenu/Community/MyCommunity/Model/activitiesListModel.dart @@ -0,0 +1,44 @@ +class ActivitiesListsModel { + ActivitiesListsModel({ + required this.status, + required this.statusCode, + required this.message, + required this.data, + }); + + final String? status; + final int? statusCode; + final String? message; + final List data; + + factory ActivitiesListsModel.fromJson(Map json){ + return ActivitiesListsModel( + status: json["status"], + statusCode: json["status_code"], + message: json["message"], + data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Datum.fromJson(x))), + ); + } + +} + +class Datum { + Datum({ + required this.id, + required this.title, + required this.image, + }); + + final int? id; + final String? title; + final String? image; + + factory Datum.fromJson(Map json){ + return Datum( + id: json["id"], + title: json["title"], + image: json["image"], + ); + } + +} diff --git a/lib/sidemenu/Community/MyCommunity/NewCommunity.dart b/lib/sidemenu/Community/MyCommunity/NewCommunity.dart index 7c39a31..59b7d66 100644 --- a/lib/sidemenu/Community/MyCommunity/NewCommunity.dart +++ b/lib/sidemenu/Community/MyCommunity/NewCommunity.dart @@ -2,17 +2,12 @@ import 'dart:developer'; import 'dart:io'; import 'dart:async'; -import 'package:dio/dio.dart'; import 'package:dotted_border/dotted_border.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart' hide MultipartFile, FormData; -import 'package:get/get_connect/http/src/utils/utils.dart'; -import 'package:regroup/Common/CommonButton.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/base_manager.dart'; -import 'package:regroup/Main_Screens/ProfileTab/EditProfile/Model/InterestModel.dart' - as primaryactlist; import 'package:regroup/Utils/Common/CommonAppbar.dart'; import 'package:regroup/Utils/Common/CommonDropdown.dart'; import 'package:regroup/Utils/Common/CustomNextButton.dart'; @@ -23,7 +18,7 @@ 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/Community/MyCommunity/view_model/postmethod.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/Model/activitiesListModel.dart' as primaryactlist; import 'package:regroup/sidemenu/Community/MyCommunity/view_model/primaryactivity.dart'; import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; import 'package:path/path.dart' as path; @@ -60,8 +55,8 @@ class _NewCommunityState extends State { }); } - primaryactlist.InterestModel? abilityModel; - List activity = []; + primaryactlist.ActivitiesListsModel? abilityModel; + List activity = []; List _activitydrop = []; Future fetchActivitylist() async { @@ -69,11 +64,11 @@ class _NewCommunityState extends State { ResponseData response = await abilityLsitAPI.getActivitylistApi(); if (response.status == ResponseStatus.SUCCESS) { - abilityModel = primaryactlist.InterestModel.fromJson(response.data!); + abilityModel = primaryactlist.ActivitiesListsModel.fromJson(response.data!); setState(() { - activity = abilityModel!.data ?? []; // Store the fetched cities + activity = abilityModel?.data ?? []; // Store the fetched cities _activitydrop = - activity.map((platform) => platform.name.toString()).toList(); + activity.map((platform) => platform.title.toString()).toList(); }); log(activity.toString()); } else { @@ -89,7 +84,7 @@ class _NewCommunityState extends State { // Find and add the ID of the selected ability for (var activityItem in activity) { - if (selectedAbility == activityItem.name) { + if (selectedAbility == activityItem.title) { selectedactivityid = activityItem.id!; break; // Stop once the matching item is found } @@ -160,7 +155,7 @@ class _NewCommunityState extends State { // key: _scaffoldKey1, backgroundColor: Color(0xFF222935), extendBody: true, - resizeToAvoidBottomInset: false, + resizeToAvoidBottomInset: true, appBar: CommonAppbar( titleTxt: "New community", ), diff --git a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart index 2e06911..12fe0f3 100644 --- a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart @@ -205,6 +205,28 @@ class _CommunityDetailsState extends State { ), ), ), + PopupMenuDivider(), + PopupMenuItem( + onTap: () { + Get.toNamed(RouteName.communitysetting, arguments: { + 'communityid': CommunityId, + }); + }, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 8.w), + child: Row( + children: [ + text14w400white("Edit community"), + Spacer(), + Image.asset( + "assets/images/png/setting2.png", + height: 18.h, + width: 18.w, + ) + ], + ), + ), + ), ], child: Image.asset( 'assets/images/png/Group 1000004071.png', @@ -458,7 +480,11 @@ class _CommunityDetailsState extends State { sizedBoxHeight(20.h), GestureDetector( onTap: () { - Get.toNamed(RouteName.addgroup); + // Get.toNamed(RouteName.addgroup); + Get.toNamed(RouteName.group, arguments: { + 'id': CommunityId, + 'iscommunity': true, + }); }, child: commonGlassUI( width: double.infinity, @@ -678,6 +704,7 @@ class _PostsTabState extends State { likeIcon: LikeIcon1( likeIcon: LikeIconClass1( id: e.likeIcon?.likeIcon?.id, + // likeIcon?.id, image: e.likeIcon?.likeIcon?.image), likeIconsXid: e.likeIcon?.likeIconsXid, ), diff --git a/lib/sidemenu/Community/MyCommunity/view_model/postmethod.dart b/lib/sidemenu/Community/MyCommunity/view_model/postmethod.dart index 6e43862..5015f0a 100644 --- a/lib/sidemenu/Community/MyCommunity/view_model/postmethod.dart +++ b/lib/sidemenu/Community/MyCommunity/view_model/postmethod.dart @@ -15,4 +15,15 @@ class PostMethodCommunity { print("response message is ${response.message}"); return response; } + + Future> postEditcommunity(updata) async { + print("updata is $updata"); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.posteditcommunity, + ); + print("response is ${response.data}"); + print("response message is ${response.message}"); + return response; + } } \ No newline at end of file diff --git a/lib/sidemenu/Community/MyCommunity/view_model/primaryactivity.dart b/lib/sidemenu/Community/MyCommunity/view_model/primaryactivity.dart index 818fd9c..045a1b3 100644 --- a/lib/sidemenu/Community/MyCommunity/view_model/primaryactivity.dart +++ b/lib/sidemenu/Community/MyCommunity/view_model/primaryactivity.dart @@ -1,9 +1,9 @@ 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/Main_Screens/ProfileTab/EditProfile/Model/InterestModel.dart'; +import 'package:regroup/sidemenu/Community/MyCommunity/Model/activitiesListModel.dart'; -InterestModel? interestlistobj; +ActivitiesListsModel? interestlistobj; class PrimaryActivityListApi { @@ -11,7 +11,7 @@ class PrimaryActivityListApi { var data = ""; Future> getActivitylistApi() async { final response = await NetworkApiServices().getApi( - ApiUrls.getinterestlist, + ApiUrls.getactivitieslist, ); @@ -20,8 +20,8 @@ class PrimaryActivityListApi { Map.from(response.data); if (responseData['status'] == "success") { print("success"); - InterestModel interestlistobj = - InterestModel.fromJson(responseData); + ActivitiesListsModel interestlistobj = + ActivitiesListsModel.fromJson(responseData); } else { // return ResponseData( // responseData['message'], ResponseStatus.FAILED);