manage groups in communities completed and changes for create post using announcement or regular tags done
This commit is contained in:
BIN
assets/images/png/ion_add.png
Normal file
BIN
assets/images/png/ion_add.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 226 B |
@@ -182,6 +182,11 @@ class ApiUrls {
|
||||
|
||||
static const getactivitieslist = "${baseUrl}get_activity";
|
||||
|
||||
static const getcommunitymanagegroups = "${baseUrl}fetch-community-all-groups-list";
|
||||
|
||||
static const postremovegroupscommunity = "${baseUrl}remove-groups-from-community";
|
||||
|
||||
static const postmanageaddgroupscommunity = "${baseUrl}add-groups-in-community";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -95,23 +95,9 @@ class _PostScreenState extends State<PostScreen> {
|
||||
List<int> selectedabilityid = [];
|
||||
int? communityid;
|
||||
|
||||
// void getCatIdFromName(List<String> 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');
|
||||
// }
|
||||
String? _selectedPostType;
|
||||
int? posttagtype;
|
||||
bool isCommunitySelected = false;
|
||||
|
||||
void getCatIdFromName(List<String> selectedAbilities) {
|
||||
selectedabilityid.clear(); // Clear existing selections
|
||||
@@ -120,9 +106,17 @@ class _PostScreenState extends State<PostScreen> {
|
||||
if (name == postcommunity[i].community!.communityName) {
|
||||
selectedabilityid.add(postcommunity[i].community!.id!);
|
||||
communityid = postcommunity[i].community!.id!;
|
||||
setState(() {
|
||||
_selectedPostType = null;
|
||||
_isSecondDropdownEnabled = false;
|
||||
});
|
||||
// Fetch tags for the selected community
|
||||
fetchPopularTags(communityid!);
|
||||
_isSecondDropdownEnabled = true;
|
||||
// fetchPopularTags(communityid!, tagtype!);
|
||||
// _isSecondDropdownEnabled = true;
|
||||
// if (tagtype != null) {
|
||||
// fetchPopularTags(communityid!, tagtype!);
|
||||
// _isSecondDropdownEnabled = true;
|
||||
// }
|
||||
break; // Assuming each name is unique, we break after finding a match
|
||||
}
|
||||
}
|
||||
@@ -132,7 +126,7 @@ class _PostScreenState extends State<PostScreen> {
|
||||
|
||||
List<Data> tags = []; // Change the type to List<Data>
|
||||
|
||||
Future<void> fetchPopularTags(int communityId) async {
|
||||
Future<void> fetchPopularTags(int communityId, int tagtype) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
token = prefs.getString('access-token');
|
||||
String basicAuth = 'Basic ' +
|
||||
@@ -142,7 +136,7 @@ class _PostScreenState extends State<PostScreen> {
|
||||
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=',
|
||||
'https://regroup.betadelivery.com/api/v1/fetch-popular-tags?manage_community_xid=$communityId&is_special=$tagtype&name=',
|
||||
options: Options(
|
||||
headers: {'authorization': basicAuth, 'access-token': token},
|
||||
));
|
||||
@@ -341,6 +335,7 @@ class _PostScreenState extends State<PostScreen> {
|
||||
"post_in": communityid,
|
||||
"manage_tags_xids": selectedtags,
|
||||
"post_as": _selectedPostas,
|
||||
"is_announcement": posttagtype
|
||||
});
|
||||
final data = await Communitypostmethod().postUpload(formdata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
@@ -380,6 +375,7 @@ class _PostScreenState extends State<PostScreen> {
|
||||
"post_as": _selectedPostas,
|
||||
"cta_title": ctatitilecontroller.text,
|
||||
"cta_link": ctalinkcontroller.text,
|
||||
"is_announcement": posttagtype
|
||||
});
|
||||
final data = await Communitypostmethod().postUpload(formdata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
@@ -427,15 +423,67 @@ class _PostScreenState extends State<PostScreen> {
|
||||
title: "",
|
||||
listData: _postindrop,
|
||||
|
||||
onItemSelected: getCatIdFromName,
|
||||
onItemSelected:
|
||||
// getCatIdFromName,
|
||||
(List<String> selectedAbilities) {
|
||||
getCatIdFromName(selectedAbilities);
|
||||
isCommunitySelected = true;
|
||||
},
|
||||
// (p0) {},
|
||||
images: _postindropimages,
|
||||
|
||||
leadingImage: const SizedBox(),
|
||||
),
|
||||
sizedBoxHeight(20.h),
|
||||
text16w400_FCFCFC("Caption"),
|
||||
// sizedBoxHeight(20.h),
|
||||
text16w400_FCFCFC("Post type"),
|
||||
sizedBoxHeight(18.h),
|
||||
CustomRadioListTile(
|
||||
title: 'Regular',
|
||||
subtitle:
|
||||
'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
|
||||
value: 'Regular',
|
||||
groupValue: _selectedPostType,
|
||||
onChanged: (String? value) {
|
||||
if (isCommunitySelected && communityid != null) {
|
||||
setState(() {
|
||||
_selectedPostType = value!;
|
||||
posttagtype = 0;
|
||||
fetchPopularTags(communityid!,
|
||||
posttagtype!); // Call the API after both selections
|
||||
_isSecondDropdownEnabled = true;
|
||||
});
|
||||
} else {
|
||||
utils.showToast('Please select a community first.');
|
||||
}
|
||||
},
|
||||
activeColor: Color(0XFFD90B2E),
|
||||
),
|
||||
CustomRadioListTile(
|
||||
title: 'Announcement',
|
||||
subtitle:
|
||||
'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
|
||||
value: 'Announcement',
|
||||
groupValue: _selectedPostType,
|
||||
onChanged: (String? value) {
|
||||
if (isCommunitySelected && communityid != null) {
|
||||
setState(() {
|
||||
_selectedPostType = value!;
|
||||
posttagtype = 1;
|
||||
fetchPopularTags(communityid!,
|
||||
posttagtype!); // Call the API after both selections
|
||||
_isSecondDropdownEnabled = true;
|
||||
});
|
||||
} else {
|
||||
utils.showToast('Please select a community first.');
|
||||
}
|
||||
},
|
||||
activeColor: Color(0XFFD90B2E),
|
||||
),
|
||||
|
||||
sizedBoxHeight(38.h),
|
||||
// text16w400_FCFCFC("Caption"),
|
||||
// sizedBoxHeight(18.h),
|
||||
CustomTextFormField2(
|
||||
maxlines: 3,
|
||||
hintText: "Enter caption",
|
||||
@@ -455,90 +503,90 @@ class _PostScreenState extends State<PostScreen> {
|
||||
sizedBoxHeight(25.h),
|
||||
text16w400_FCFCFC("Media"),
|
||||
sizedBoxHeight(18.h),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
ImageUploadBottomSheet().showModal(
|
||||
context,
|
||||
false,
|
||||
(result) {
|
||||
if (result != null && result.isNotEmpty) {
|
||||
var file = File(result);
|
||||
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,
|
||||
))),
|
||||
),
|
||||
])
|
||||
: 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
|
||||
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: 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: () {
|
||||
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();
|
||||
isbannerAdded = false;
|
||||
bannerPath.add(file);
|
||||
isbannerAdded = true;
|
||||
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(
|
||||
}
|
||||
} 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: Center(
|
||||
@@ -561,11 +609,11 @@ class _PostScreenState extends State<PostScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
text16w400_FCFCFC("Tags"),
|
||||
text16w400_FCFCFC("Interest"),
|
||||
sizedBoxHeight(18.h),
|
||||
_isSecondDropdownEnabled == true
|
||||
? CustomDropDownPopularTag(
|
||||
@@ -579,7 +627,15 @@ class _PostScreenState extends State<PostScreen> {
|
||||
},
|
||||
isFirstDropdownSelected: _isSecondDropdownEnabled,
|
||||
)
|
||||
: Center(child: text14400white('Select community')),
|
||||
:
|
||||
// SizedBox(),
|
||||
Center(
|
||||
child:
|
||||
// isCommunitySelected == true
|
||||
// ? text14400white('Select post type')
|
||||
// :
|
||||
text14400white('No Interests')),
|
||||
|
||||
sizedBoxHeight(25.h),
|
||||
_isSecondDropdownEnabled == true
|
||||
? Column(
|
||||
@@ -680,14 +736,16 @@ class _PostScreenState extends State<PostScreen> {
|
||||
// Condition for account type 1
|
||||
if (selectedabilityid.isEmpty ||
|
||||
selectedpopularid.isEmpty ||
|
||||
bannerPath.isEmpty ||
|
||||
captioncontroller.text.isEmpty ||
|
||||
_selectedPostas.isEmpty) {
|
||||
_selectedPostas.isEmpty ||
|
||||
posttagtype.isBlank!) {
|
||||
print('Tags selected are $selectedpopularid');
|
||||
print(
|
||||
'Community selected are $selectedabilityid');
|
||||
print('Post as selected are $_selectedPostas');
|
||||
utils.showToast('Please fill all fields');
|
||||
} else if (bannerPath.isEmpty) {
|
||||
utils.showToast('Please add a media image');
|
||||
} else {
|
||||
print('Tags selected are $selectedpopularid');
|
||||
print(
|
||||
@@ -701,15 +759,17 @@ class _PostScreenState extends State<PostScreen> {
|
||||
// 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) {
|
||||
ctatitilecontroller.text.isEmpty ||
|
||||
posttagtype.isBlank!) {
|
||||
print('Tags selected are $selectedpopularid');
|
||||
print(
|
||||
'Community selected are $selectedabilityid');
|
||||
utils.showToast('Please fill all fields');
|
||||
} else if (bannerPath.isEmpty) {
|
||||
utils.showToast('Please add a media image');
|
||||
} else {
|
||||
print('Tags selected are $selectedpopularid');
|
||||
print(
|
||||
@@ -956,6 +1016,7 @@ class _CustomDropDownCheckBoxPostNewState
|
||||
if (onDropTap.value)
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 250.h,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFFFFFF).withOpacity(0.10),
|
||||
borderRadius:
|
||||
@@ -988,6 +1049,7 @@ class _CustomDropDownCheckBoxPostNewState
|
||||
)
|
||||
: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: ScrollPhysics(),
|
||||
itemCount: widget.listData.length,
|
||||
itemBuilder: (context, index) {
|
||||
String item = widget.listData[index];
|
||||
@@ -1198,6 +1260,7 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
|
||||
// Dropdown List
|
||||
if (onDropTap.value && filteredTags.isNotEmpty)
|
||||
Container(
|
||||
height: 250.h,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFFFFFF).withOpacity(0.10),
|
||||
@@ -1208,6 +1271,7 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
|
||||
),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: ScrollPhysics(),
|
||||
itemCount: filteredTags.length,
|
||||
itemBuilder: (context, index) {
|
||||
return InkWell(
|
||||
@@ -1282,220 +1346,55 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
|
||||
}
|
||||
}
|
||||
|
||||
// class CustomDropDownPopularTag extends StatefulWidget {
|
||||
// final List<Data> tags;
|
||||
// final Function(List<Data>) onItemSelected;
|
||||
// final bool isFirstDropdownSelected;
|
||||
|
||||
// CustomDropDownPopularTag({
|
||||
// required this.tags,
|
||||
// required this.onItemSelected,
|
||||
// required this.isFirstDropdownSelected,
|
||||
// });
|
||||
|
||||
// @override
|
||||
// _CustomDropDownPopularTagState createState() =>
|
||||
// _CustomDropDownPopularTagState();
|
||||
// }
|
||||
|
||||
// class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
|
||||
// RxBool onDropTap = false.obs;
|
||||
// RxList<Data> selectedTags = <Data>[].obs;
|
||||
// RxList<Data> filteredTags = <Data>[].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});
|
||||
}
|
||||
|
||||
class CustomRadioListTile extends StatelessWidget {
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final String value;
|
||||
final String? groupValue;
|
||||
final ValueChanged<String?> onChanged;
|
||||
final Color activeColor;
|
||||
|
||||
const CustomRadioListTile({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.value,
|
||||
required this.groupValue,
|
||||
required this.onChanged,
|
||||
required this.activeColor,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
onChanged(value);
|
||||
},
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: Transform.translate(
|
||||
offset: Offset(0, -10),
|
||||
child: Transform.scale(
|
||||
scale: 1.5,
|
||||
child: Radio<String>(
|
||||
value: value,
|
||||
groupValue: groupValue,
|
||||
onChanged: onChanged,
|
||||
activeColor: activeColor,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
),
|
||||
),
|
||||
title: text18w400white(title),
|
||||
subtitle: text14400white(subtitle),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,11 @@ class _CommunitySettingState extends State<CommunitySetting> {
|
||||
commonDivider(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.managegroups);
|
||||
Get.toNamed(RouteName.managegroups,
|
||||
arguments: {
|
||||
'communityid' : communityid,
|
||||
}
|
||||
);
|
||||
},
|
||||
child: rowTile(text: 'Manage groups')),
|
||||
commonDivider(),
|
||||
|
||||
@@ -1,12 +1,26 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
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/CommonGlassmorphism.dart';
|
||||
import 'package:regroup/Common/CommonWidget.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
||||
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communitymanageGroupsModel.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/view_model/getmethod.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/view_model/postmethod.dart';
|
||||
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
|
||||
|
||||
class ManageGroups extends StatefulWidget {
|
||||
const ManageGroups({super.key});
|
||||
@@ -16,73 +30,87 @@ class ManageGroups extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ManageGroupsState extends State<ManageGroups> {
|
||||
List groupData = [
|
||||
{
|
||||
"imagePath": "assets/images/png/img45.png",
|
||||
"title": "Iron titans fitness crew",
|
||||
"subtitle": "Lorem ipsum dummy text",
|
||||
},
|
||||
{
|
||||
"imagePath": "assets/images/png/Rectangle 25.png",
|
||||
"title": "Body blitz brigade",
|
||||
"subtitle": "Lorem ipsum dummy text",
|
||||
},
|
||||
{
|
||||
"imagePath": "assets/images/png/img2.png",
|
||||
"title": "Fit fusion squad",
|
||||
"subtitle": "Lorem ipsum dummy text",
|
||||
},
|
||||
{
|
||||
"imagePath": "assets/images/png/img2.png",
|
||||
"title": "Power pulse posse",
|
||||
"subtitle": "Lorem ipsum dummy text",
|
||||
},
|
||||
{
|
||||
"imagePath": "assets/images/png/img2.png",
|
||||
"title": "Wellness warriors collective",
|
||||
"subtitle": "Lorem ipsum dummy text",
|
||||
},
|
||||
];
|
||||
int communityid = Get.arguments['communityid'];
|
||||
StreamController<CommunityManageGroupsModel> searchcontroller =
|
||||
StreamController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
print(communityid);
|
||||
var updata = communityid;
|
||||
var updata2 = "";
|
||||
Getcommunity().getCommunityManageGroupssearch(updata, updata2,
|
||||
streamController: searchcontroller);
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
searchcontroller.close();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
int? removeid;
|
||||
|
||||
RemoveUploadata(int remove) async {
|
||||
utils.loader();
|
||||
Map<String, dynamic> updata = {
|
||||
"manage_community_xid": communityid,
|
||||
"manage_group_xid": removeid,
|
||||
};
|
||||
final data = await PostMethodCommunity().postGroupsRemove(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
Get.back();
|
||||
print("remove done");
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
Get.back();
|
||||
print("remove not done");
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: Color(0xFF222935),
|
||||
extendBody: true,
|
||||
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),
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
return GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: Color(0xFF222935),
|
||||
extendBody: true,
|
||||
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),
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Column(children: [
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
),
|
||||
Column(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Column(
|
||||
@@ -102,6 +130,14 @@ class _ManageGroupsState extends State<ManageGroups> {
|
||||
),
|
||||
),
|
||||
hintText: "Search groups",
|
||||
inputFormatters: [
|
||||
RemoveEmojiInputFormatter(),
|
||||
],
|
||||
onInput: (value) {
|
||||
Getcommunity().getCommunityManageGroupssearch(
|
||||
communityid, value,
|
||||
streamController: searchcontroller);
|
||||
},
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
Row(
|
||||
@@ -130,31 +166,266 @@ class _ManageGroupsState extends State<ManageGroups> {
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(30.h),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
List<File?> filePath = [];
|
||||
List<File?> bannerPath = [];
|
||||
var result =
|
||||
await Get.toNamed(RouteName.addgroup, arguments: {
|
||||
'communityname': "",
|
||||
'communitylocation': "",
|
||||
'communitydescription': "",
|
||||
'communitytype': 0,
|
||||
'activityid': 0,
|
||||
'communityprofilephoto': filePath,
|
||||
'communitybannerimage': bannerPath,
|
||||
'isedited': true,
|
||||
'communityid': communityid.toString(),
|
||||
});
|
||||
if (result != null && result) {
|
||||
setState(() {
|
||||
Getcommunity().getCommunityManageGroupssearch(
|
||||
communityid, '',
|
||||
streamController: searchcontroller);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: 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/ion_add.png",
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
)),
|
||||
borderwidth: 0.5),
|
||||
sizedBoxWidth(8.w),
|
||||
text18w400_FCFCFC("Add existing groups"),
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios_outlined,
|
||||
color: Colors.white,
|
||||
size: 14.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(30.h),
|
||||
text18w700white("Groups"),
|
||||
sizedBoxHeight(20.h),
|
||||
]),
|
||||
),
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: groupData.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Column(
|
||||
children: [
|
||||
groupWidget(
|
||||
imagePath: groupData[index]["imagePath"],
|
||||
title: groupData[index]["title"],
|
||||
subtitle: groupData[index]["subtitle"]),
|
||||
commonDivider(),
|
||||
],
|
||||
);
|
||||
},
|
||||
)
|
||||
]),
|
||||
)
|
||||
]));
|
||||
Expanded(
|
||||
child: StreamBuilder<CommunityManageGroupsModel>(
|
||||
stream: searchcontroller.stream,
|
||||
builder: (ctx, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
// Display shimmer effect while waiting for data
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError) {
|
||||
// Handle error state
|
||||
return Center(
|
||||
child: Text(
|
||||
'${snapshot.error} occurred',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// Data has been loaded, show actual UI
|
||||
return communitymanagegroupsobj!.data.isEmpty
|
||||
? _buildNoDataBody(context)
|
||||
: ListView.separated(
|
||||
physics: const ScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemCount: communitymanagegroupsobj!.data.length,
|
||||
separatorBuilder:
|
||||
(BuildContext context, int index) {
|
||||
return commonDivider();
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
var mainGroupsData =
|
||||
communitymanagegroupsobj!.data[index];
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 16.h, horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
mainGroupsData.groupsData!
|
||||
.groupImage ==
|
||||
null ||
|
||||
mainGroupsData.groupsData!
|
||||
.groupImage!.isEmpty
|
||||
? CircleAvatar(
|
||||
backgroundImage: AssetImage(
|
||||
'assets/images/png/img45.png'),
|
||||
radius: 20.r,
|
||||
)
|
||||
: CircleAvatar(
|
||||
backgroundImage:
|
||||
CachedNetworkImageProvider(
|
||||
mainGroupsData.groupsData!
|
||||
.groupImage!,
|
||||
),
|
||||
radius: 25.r,
|
||||
child: CachedNetworkImage(
|
||||
cacheKey: mainGroupsData
|
||||
.groupsData!.id
|
||||
.toString(),
|
||||
maxHeightDiskCache: 100,
|
||||
maxWidthDiskCache: 100,
|
||||
imageUrl: mainGroupsData
|
||||
.groupsData!
|
||||
.groupImage!,
|
||||
placeholder:
|
||||
(context, url) =>
|
||||
Container(),
|
||||
errorWidget:
|
||||
(context, url, error) =>
|
||||
Icon(Icons.error),
|
||||
imageBuilder: (context,
|
||||
imageProvider) =>
|
||||
CircleAvatar(
|
||||
backgroundImage:
|
||||
imageProvider,
|
||||
radius: 25.r,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
sizedBoxWidth(10.w),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
mainGroupsData.groupsData!
|
||||
.title ==
|
||||
null ||
|
||||
mainGroupsData
|
||||
.groupsData!
|
||||
.title!
|
||||
.isEmpty
|
||||
? text16w400_FCFCFC(
|
||||
'ReGroup')
|
||||
:
|
||||
// text16w400_FCFCFC( mainGroupsData.groupsData!.title!),
|
||||
Text(
|
||||
mainGroupsData
|
||||
.groupsData!.title!,
|
||||
overflow: TextOverflow
|
||||
.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: const Color(
|
||||
0xFFFCFCFC),
|
||||
fontFamily:
|
||||
'Helvetica',
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w400),
|
||||
),
|
||||
sizedBoxHeight(4.h),
|
||||
mainGroupsData.groupsData!
|
||||
.description ==
|
||||
null ||
|
||||
mainGroupsData
|
||||
.groupsData!
|
||||
.description!
|
||||
.isEmpty
|
||||
? text12w400_FCFCFC_blur(
|
||||
'ReGroup')
|
||||
: Text(
|
||||
mainGroupsData
|
||||
.groupsData!
|
||||
.description!,
|
||||
overflow: TextOverflow
|
||||
.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: const Color(
|
||||
0xFFFCFCFC)
|
||||
.withOpacity(
|
||||
0.8),
|
||||
fontFamily:
|
||||
'Helvetica',
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
removeid =
|
||||
communitymanagegroupsobj!
|
||||
.data[index]
|
||||
.manageGroupXid ??
|
||||
0;
|
||||
communitymanagegroupsobj!.data
|
||||
.removeWhere((item) =>
|
||||
item.manageGroupXid ==
|
||||
removeid);
|
||||
print(removeid.toString());
|
||||
|
||||
RemoveUploadata(removeid!);
|
||||
});
|
||||
},
|
||||
child: Image.asset(
|
||||
'assets/images/png/Group 1000004149.png',
|
||||
),
|
||||
)
|
||||
// Icon(
|
||||
// Icons.clear,
|
||||
// color: Color(0xFFFFFFFF),
|
||||
// weight: 1.88,
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
commonDivider(),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
])
|
||||
])),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildNoDataBody(context) {
|
||||
return Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"No Groups Found",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget groupWidget({
|
||||
required String imagePath,
|
||||
required String title,
|
||||
|
||||
@@ -46,204 +46,207 @@ class _CommunityMembersState extends State<CommunityMembers> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF222935),
|
||||
extendBody: true,
|
||||
appBar: const CommonAppbar(
|
||||
titleTxt: "Members",
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
return GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: Scaffold(
|
||||
backgroundColor: const Color(0xFF222935),
|
||||
extendBody: true,
|
||||
appBar: const CommonAppbar(
|
||||
titleTxt: "Members",
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Column(children: [
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: CustomTextFormField(
|
||||
leadingIcon: SizedBox(
|
||||
height: 23,
|
||||
width: 23,
|
||||
child: Center(
|
||||
child: Image.asset(
|
||||
"assets/images/png/ion_search-outline.png",
|
||||
height: 23,
|
||||
width: 23,
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Column(children: [
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: CustomTextFormField(
|
||||
leadingIcon: SizedBox(
|
||||
height: 23,
|
||||
width: 23,
|
||||
child: Center(
|
||||
child: Image.asset(
|
||||
"assets/images/png/ion_search-outline.png",
|
||||
height: 23,
|
||||
width: 23,
|
||||
),
|
||||
),
|
||||
),
|
||||
texttype: TextInputType.text,
|
||||
inputFormatters: [
|
||||
RemoveEmojiInputFormatter(),
|
||||
],
|
||||
onInput: (value) {
|
||||
Getcommunity().getCommunityMemberssearch(communityid, value,
|
||||
streamController: searchcontroller);
|
||||
},
|
||||
hintText: "Search people",
|
||||
),
|
||||
texttype: TextInputType.text,
|
||||
inputFormatters: [
|
||||
RemoveEmojiInputFormatter(),
|
||||
],
|
||||
onInput: (value) {
|
||||
Getcommunity().getCommunityMemberssearch(communityid, value,
|
||||
streamController: searchcontroller);
|
||||
},
|
||||
hintText: "Search people",
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
StreamBuilder<CommunityMembersModel>(
|
||||
stream: searchcontroller.stream,
|
||||
builder: (ctx, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
// Display shimmer effect while waiting for data
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError) {
|
||||
// Handle error state
|
||||
return Center(
|
||||
child: Text(
|
||||
'${snapshot.error} occurred',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// Data has been loaded, show actual UI
|
||||
return communitymembersobj!.data.isEmpty
|
||||
? _buildNoDataBody(context)
|
||||
: ListView.separated(
|
||||
physics: const ScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemCount: communitymembersobj!.data.length,
|
||||
separatorBuilder:
|
||||
(BuildContext context, int index) {
|
||||
return commonDivider();
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
var mainFollowersData =
|
||||
communitymembersobj!.data[index];
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
mainFollowersData
|
||||
.iamPrincipal!.principalTypeXid ==
|
||||
1
|
||||
? Get.toNamed(
|
||||
RouteName.profiletabindguest,
|
||||
arguments: {
|
||||
"FolloweridIndex":
|
||||
mainFollowersData
|
||||
.iamPrincipalXid!,
|
||||
})
|
||||
: Get.toNamed(
|
||||
RouteName.profiletabbusguest,
|
||||
arguments: {
|
||||
"FolloweridIndex":
|
||||
mainFollowersData
|
||||
.iamPrincipalXid!,
|
||||
});
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 16.h, horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
mainFollowersData.iamPrincipal!
|
||||
.profilePhoto ==
|
||||
null ||
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.profilePhoto!
|
||||
.isEmpty
|
||||
? CircleAvatar(
|
||||
backgroundImage: const AssetImage(
|
||||
'assets/images/png/Ellipse 43.png'),
|
||||
radius: 25.r,
|
||||
)
|
||||
: CircleAvatar(
|
||||
backgroundImage:
|
||||
CachedNetworkImageProvider(
|
||||
sizedBoxHeight(25.h),
|
||||
StreamBuilder<CommunityMembersModel>(
|
||||
stream: searchcontroller.stream,
|
||||
builder: (ctx, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
// Display shimmer effect while waiting for data
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError) {
|
||||
// Handle error state
|
||||
return Center(
|
||||
child: Text(
|
||||
'${snapshot.error} occurred',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// Data has been loaded, show actual UI
|
||||
return communitymembersobj!.data.isEmpty
|
||||
? _buildNoDataBody(context)
|
||||
: ListView.separated(
|
||||
physics: const ScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemCount: communitymembersobj!.data.length,
|
||||
separatorBuilder:
|
||||
(BuildContext context, int index) {
|
||||
return commonDivider();
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
var mainFollowersData =
|
||||
communitymembersobj!.data[index];
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
mainFollowersData
|
||||
.iamPrincipal!.principalTypeXid ==
|
||||
1
|
||||
? Get.toNamed(
|
||||
RouteName.profiletabindguest,
|
||||
arguments: {
|
||||
"FolloweridIndex":
|
||||
mainFollowersData
|
||||
.iamPrincipalXid!,
|
||||
})
|
||||
: Get.toNamed(
|
||||
RouteName.profiletabbusguest,
|
||||
arguments: {
|
||||
"FolloweridIndex":
|
||||
mainFollowersData
|
||||
.iamPrincipalXid!,
|
||||
});
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 16.h, horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
mainFollowersData.iamPrincipal!
|
||||
.profilePhoto ==
|
||||
null ||
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.profilePhoto!,
|
||||
),
|
||||
|
||||
// NetworkImage(
|
||||
// mainFollowersData
|
||||
// .iamPrincipal!
|
||||
// .profilePhoto!),
|
||||
radius: 25.r,
|
||||
child: CachedNetworkImage(
|
||||
cacheKey: mainFollowersData
|
||||
.iamPrincipalXid
|
||||
.toString(),
|
||||
maxHeightDiskCache: 100,
|
||||
maxWidthDiskCache: 100,
|
||||
imageUrl: mainFollowersData
|
||||
.iamPrincipal!
|
||||
.profilePhoto!,
|
||||
placeholder:
|
||||
(context, url) =>
|
||||
Container(),
|
||||
errorWidget:
|
||||
(context, url, error) =>
|
||||
Icon(Icons.error),
|
||||
imageBuilder: (context,
|
||||
imageProvider) =>
|
||||
CircleAvatar(
|
||||
backgroundImage:
|
||||
imageProvider,
|
||||
radius: 25.r,
|
||||
.profilePhoto!
|
||||
.isEmpty
|
||||
? CircleAvatar(
|
||||
backgroundImage: const AssetImage(
|
||||
'assets/images/png/Ellipse 43.png'),
|
||||
radius: 25.r,
|
||||
)
|
||||
: CircleAvatar(
|
||||
backgroundImage:
|
||||
CachedNetworkImageProvider(
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.profilePhoto!,
|
||||
),
|
||||
|
||||
// NetworkImage(
|
||||
// mainFollowersData
|
||||
// .iamPrincipal!
|
||||
// .profilePhoto!),
|
||||
radius: 25.r,
|
||||
child: CachedNetworkImage(
|
||||
cacheKey: mainFollowersData
|
||||
.iamPrincipalXid
|
||||
.toString(),
|
||||
maxHeightDiskCache: 100,
|
||||
maxWidthDiskCache: 100,
|
||||
imageUrl: mainFollowersData
|
||||
.iamPrincipal!
|
||||
.profilePhoto!,
|
||||
placeholder:
|
||||
(context, url) =>
|
||||
Container(),
|
||||
errorWidget:
|
||||
(context, url, error) =>
|
||||
Icon(Icons.error),
|
||||
imageBuilder: (context,
|
||||
imageProvider) =>
|
||||
CircleAvatar(
|
||||
backgroundImage:
|
||||
imageProvider,
|
||||
radius: 25.r,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
sizedBoxWidth(10.w),
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
mainFollowersData.iamPrincipal!
|
||||
.fullName ==
|
||||
null ||
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.fullName!
|
||||
.isEmpty ==
|
||||
true
|
||||
? text16w400_FCFCFC("Regroup")
|
||||
: text16w400_FCFCFC(
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.fullName!),
|
||||
sizedBoxHeight(4.h),
|
||||
mainFollowersData.iamPrincipal!
|
||||
.userName ==
|
||||
null ||
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.userName!
|
||||
.isEmpty ==
|
||||
true
|
||||
? text12w400_FCFCFC_blur(
|
||||
"regroup")
|
||||
: text12w400_FCFCFC_blur(
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.userName!)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
])
|
||||
]),
|
||||
)
|
||||
]),
|
||||
sizedBoxWidth(10.w),
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
mainFollowersData.iamPrincipal!
|
||||
.fullName ==
|
||||
null ||
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.fullName!
|
||||
.isEmpty ==
|
||||
true
|
||||
? text16w400_FCFCFC("Regroup")
|
||||
: text16w400_FCFCFC(
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.fullName!),
|
||||
sizedBoxHeight(4.h),
|
||||
mainFollowersData.iamPrincipal!
|
||||
.userName ==
|
||||
null ||
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.userName!
|
||||
.isEmpty ==
|
||||
true
|
||||
? text12w400_FCFCFC_blur(
|
||||
"regroup")
|
||||
: text12w400_FCFCFC_blur(
|
||||
mainFollowersData
|
||||
.iamPrincipal!
|
||||
.userName!)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
])
|
||||
]),
|
||||
)
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ class _AddGroupState extends State<AddGroup> {
|
||||
String communitydescription = Get.arguments["communitydescription"];
|
||||
List<File?> filepath = Get.arguments['communityprofilephoto'];
|
||||
List<File?> bannerPath = Get.arguments['communitybannerimage'];
|
||||
bool edited = Get.arguments['isedited'];
|
||||
String communityid = Get.arguments['communityid'];
|
||||
|
||||
StreamController<CommunityAddgroupsModel> searchcontroller =
|
||||
StreamController();
|
||||
@@ -72,8 +74,8 @@ class _AddGroupState extends State<AddGroup> {
|
||||
@override
|
||||
void initState() {
|
||||
var updata = "";
|
||||
Getcommunity()
|
||||
.getCommunityAddGroupsearch(updata, streamController: searchcontroller);
|
||||
Getcommunity().getCommunityAddGroupsearch(updata, communityid,
|
||||
streamController: searchcontroller);
|
||||
|
||||
super.initState();
|
||||
}
|
||||
@@ -150,155 +152,188 @@ class _AddGroupState extends State<AddGroup> {
|
||||
}
|
||||
}
|
||||
|
||||
ManageGroupsUploadata() async {
|
||||
utils.loader();
|
||||
String selectedIndicesString = '[${_selectedIndices.join(',')}]';
|
||||
print('Selected Indices: $selectedIndicesString');
|
||||
Map<String, dynamic> updata = {
|
||||
"manage_community_xid": communityid,
|
||||
"manage_groups_xid": selectedIndicesString,
|
||||
};
|
||||
print('updata is ${updata.toString()}');
|
||||
log('log is ${updata.toString()}');
|
||||
final data = await PostMethodCommunity().postmanageaddgroupscommunity(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
Get.back();
|
||||
print("groups added");
|
||||
// Get.back();
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
Get.back();
|
||||
print("groups not added");
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: 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 WillPopScope(
|
||||
onWillPop: () async {
|
||||
edited == true ? Get.back(result: true) : Get.back();
|
||||
return true;
|
||||
},
|
||||
child: 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()}');
|
||||
|
||||
edited == true ? ManageGroupsUploadata() : 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, communityid,
|
||||
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<CommunityAddgroupsModel>(
|
||||
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<CommunityAddgroupsModel>(
|
||||
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),
|
||||
]),
|
||||
)
|
||||
])),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
class CommunityManageGroupsModel {
|
||||
CommunityManageGroupsModel({
|
||||
required this.status,
|
||||
required this.statusCode,
|
||||
required this.message,
|
||||
required this.data,
|
||||
});
|
||||
|
||||
final String? status;
|
||||
final int? statusCode;
|
||||
final String? message;
|
||||
final List<Datum> data;
|
||||
|
||||
factory CommunityManageGroupsModel.fromJson(Map<String, dynamic> json){
|
||||
return CommunityManageGroupsModel(
|
||||
status: json["status"],
|
||||
statusCode: json["status_code"],
|
||||
message: json["message"],
|
||||
data: json["data"] == null ? [] : List<Datum>.from(json["data"]!.map((x) => Datum.fromJson(x))),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Datum {
|
||||
Datum({
|
||||
required this.id,
|
||||
required this.manageCommunityXid,
|
||||
required this.manageGroupXid,
|
||||
required this.groupsData,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final int? manageCommunityXid;
|
||||
final int? manageGroupXid;
|
||||
final GroupsData? groupsData;
|
||||
|
||||
factory Datum.fromJson(Map<String, dynamic> json){
|
||||
return Datum(
|
||||
id: json["id"],
|
||||
manageCommunityXid: json["manage_community_xid"],
|
||||
manageGroupXid: json["manage_group_xid"],
|
||||
groupsData: json["groups_data"] == null ? null : GroupsData.fromJson(json["groups_data"]),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class GroupsData {
|
||||
GroupsData({
|
||||
required this.id,
|
||||
required this.manageGroupTypeXid,
|
||||
required this.title,
|
||||
required this.backgroundImage,
|
||||
required this.groupImage,
|
||||
required this.description,
|
||||
required this.totalMember,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final int? manageGroupTypeXid;
|
||||
final String? title;
|
||||
final String? backgroundImage;
|
||||
final String? groupImage;
|
||||
final String? description;
|
||||
final int? totalMember;
|
||||
|
||||
factory GroupsData.fromJson(Map<String, dynamic> json){
|
||||
return GroupsData(
|
||||
id: json["id"],
|
||||
manageGroupTypeXid: json["manage_group_type_xid"],
|
||||
title: json["title"],
|
||||
backgroundImage: json["background_image"],
|
||||
groupImage: json["group_image"],
|
||||
description: json["description"],
|
||||
totalMember: json["total_member"],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,8 @@ 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/Model/activitiesListModel.dart' as primaryactlist;
|
||||
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;
|
||||
@@ -64,7 +65,8 @@ class _NewCommunityState extends State<NewCommunity> {
|
||||
ResponseData<dynamic> response = await abilityLsitAPI.getActivitylistApi();
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
abilityModel = primaryactlist.ActivitiesListsModel.fromJson(response.data!);
|
||||
abilityModel =
|
||||
primaryactlist.ActivitiesListsModel.fromJson(response.data!);
|
||||
setState(() {
|
||||
activity = abilityModel?.data ?? []; // Store the fetched cities
|
||||
_activitydrop =
|
||||
@@ -439,18 +441,21 @@ class _NewCommunityState extends State<NewCommunity> {
|
||||
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,
|
||||
});
|
||||
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' : "",
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -8,22 +8,24 @@ import 'package:regroup/sidemenu/Community/MyCommunity/Model/communityMebersMode
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communityaddgroupsModel.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communityeditpageModel.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communitygroupsModel.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communitymanageGroupsModel.dart';
|
||||
|
||||
CommunityAddgroupsModel? communityaddgroupobj;
|
||||
CommunitygroupsModel? communitygroupspobj;
|
||||
CommunityMembersModel? communitymembersobj;
|
||||
CommunityinfopageEditModel? communityeditobj;
|
||||
CommunityManageGroupsModel? communitymanagegroupsobj;
|
||||
|
||||
|
||||
|
||||
|
||||
class Getcommunity {
|
||||
|
||||
Future<ResponseData<dynamic>> getCommunityAddGroupsearch(updata,
|
||||
Future<ResponseData<dynamic>> getCommunityAddGroupsearch(updata,community,
|
||||
{required StreamController<CommunityAddgroupsModel> streamController}) async {
|
||||
final response =
|
||||
await NetworkApiServices().getApi(
|
||||
"${ApiUrls.getcommunityaddgroups}?search=$updata",
|
||||
"${ApiUrls.getcommunityaddgroups}?manage_community_xid=$community&search=$updata",
|
||||
|
||||
);
|
||||
|
||||
@@ -73,4 +75,19 @@ class Getcommunity {
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<ResponseData<dynamic>> getCommunityManageGroupssearch(updata,updata2,
|
||||
{required StreamController<CommunityManageGroupsModel> streamController}) async {
|
||||
final response =
|
||||
await NetworkApiServices().getApi(
|
||||
"${ApiUrls.getcommunitymanagegroups}?manage_community_xid=$updata&search=$updata2",
|
||||
|
||||
);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
communitymanagegroupsobj = CommunityManageGroupsModel.fromJson(response.data);
|
||||
if (!streamController.isClosed) streamController.sink.add(communitymanagegroupsobj!);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,4 +26,23 @@ class PostMethodCommunity {
|
||||
print("response message is ${response.message}");
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<ResponseData<dynamic>> postGroupsRemove(updata) async {
|
||||
final response = await NetworkApiServices().postApi(
|
||||
updata,
|
||||
ApiUrls.postremovegroupscommunity,
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<ResponseData<dynamic>> postmanageaddgroupscommunity(updata) async {
|
||||
print("updata is $updata");
|
||||
final response = await NetworkApiServices().postApi(
|
||||
updata,
|
||||
ApiUrls.postmanageaddgroupscommunity,
|
||||
);
|
||||
print("response is ${response.data}");
|
||||
print("response message is ${response.message}");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user