create groups api implemnted
This commit is contained in:
BIN
assets/images/png/basil_sort-outline.png
Normal file
BIN
assets/images/png/basil_sort-outline.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 254 B |
BIN
assets/images/png/ph_camera-light.png
Normal file
BIN
assets/images/png/ph_camera-light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 603 B |
@@ -198,4 +198,8 @@ class ApiUrls {
|
||||
|
||||
static const postmanageaddgroupscommunity = "${baseUrl}add-groups-in-community";
|
||||
|
||||
static const getgroupsaddfollowers = "${baseUrl}fetch-follower-to-add";
|
||||
|
||||
static const postcreategroups = "${baseUrl}create-group";
|
||||
|
||||
}
|
||||
|
||||
77
lib/Main_Screens/GroupTab/Model/groupsAddFollowersModel.dart
Normal file
77
lib/Main_Screens/GroupTab/Model/groupsAddFollowersModel.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
class GroupsAddfollowersModel {
|
||||
GroupsAddfollowersModel({
|
||||
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 GroupsAddfollowersModel.fromJson(Map<String, dynamic> json){
|
||||
return GroupsAddfollowersModel(
|
||||
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.iamPrincipalXid,
|
||||
required this.followingIamPrincipalXid,
|
||||
required this.following,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final int? iamPrincipalXid;
|
||||
final int? followingIamPrincipalXid;
|
||||
final Following? following;
|
||||
|
||||
factory Datum.fromJson(Map<String, dynamic> json){
|
||||
return Datum(
|
||||
id: json["id"],
|
||||
iamPrincipalXid: json["iam_principal_xid"],
|
||||
followingIamPrincipalXid: json["following_iam_principal_xid"],
|
||||
following: json["following"] == null ? null : Following.fromJson(json["following"]),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Following {
|
||||
Following({
|
||||
required this.id,
|
||||
required this.principalTypeXid,
|
||||
required this.userName,
|
||||
required this.fullName,
|
||||
required this.profilePhoto,
|
||||
required this.isUserPinned,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final int? principalTypeXid;
|
||||
final String? userName;
|
||||
final String? fullName;
|
||||
final String? profilePhoto;
|
||||
final bool? isUserPinned;
|
||||
|
||||
factory Following.fromJson(Map<String, dynamic> json){
|
||||
return Following(
|
||||
id: json["id"],
|
||||
principalTypeXid: json["principal_type_xid"],
|
||||
userName: json["user_name"],
|
||||
fullName: json["full_name"],
|
||||
profilePhoto: json["profile_photo"],
|
||||
isUserPinned: json["is_user_pinned"],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
347
lib/Main_Screens/GroupTab/View/CreateGroups.dart
Normal file
347
lib/Main_Screens/GroupTab/View/CreateGroups.dart
Normal file
@@ -0,0 +1,347 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dotted_border/dotted_border.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart' hide MultipartFile, FormData;
|
||||
import 'package:regroup/Common/CommonGlassmorphism.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
import 'package:regroup/Utils/Common/CommonDropdown.dart';
|
||||
import 'package:regroup/Utils/Common/CustomNextButton.dart';
|
||||
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
||||
import 'package:regroup/Utils/Common/ImageUpload.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
|
||||
|
||||
class Creategroup extends StatefulWidget {
|
||||
const Creategroup({super.key});
|
||||
|
||||
@override
|
||||
State<Creategroup> createState() => _CreategroupState();
|
||||
}
|
||||
|
||||
class _CreategroupState extends State<Creategroup> {
|
||||
List<File?> filePath = [];
|
||||
List<File?> bannerPath = [];
|
||||
|
||||
bool isImageAdded = false;
|
||||
bool isbannerAdded = false;
|
||||
|
||||
TextEditingController grouptitlecontroller = TextEditingController();
|
||||
TextEditingController groupdescriptioncontroller = TextEditingController();
|
||||
|
||||
final Map<String, int> _TypecommunityMap = {
|
||||
'Public': 1,
|
||||
'Private': 2,
|
||||
'Secret': 3,
|
||||
};
|
||||
|
||||
String _selectedtypecommunity = '';
|
||||
|
||||
void _onItemSelected(String value) {
|
||||
setState(() {
|
||||
_selectedtypecommunity = value;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Get.back(result: true);
|
||||
return true;
|
||||
},
|
||||
child: GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: Scaffold(
|
||||
backgroundColor: Color(0xFF222935),
|
||||
extendBody: true,
|
||||
resizeToAvoidBottomInset: true,
|
||||
appBar: CommonAppbar(
|
||||
titleTxt: "New group",
|
||||
customBack: true,
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
sizedBoxHeight(20.h),
|
||||
Center(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
ImageUploadBottomSheet().showModal(
|
||||
context,
|
||||
false,
|
||||
(result) {
|
||||
if (result != null && result.isNotEmpty) {
|
||||
var file = File(result);
|
||||
filePath.cast();
|
||||
filePath.add(file);
|
||||
isImageAdded = true;
|
||||
setState(() {});
|
||||
if (Platform.isAndroid) {
|
||||
Get.back();
|
||||
}
|
||||
} else {
|
||||
// Handle case where no image is selected
|
||||
filePath.clear();
|
||||
isImageAdded = false;
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
child: commonGlassUI(
|
||||
width: 95.w,
|
||||
height: 95.h,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
opacity1: 0.24,
|
||||
opacity2: 0.24,
|
||||
customWidget:
|
||||
filePath.isNotEmpty && isImageAdded
|
||||
? ClipOval(
|
||||
child: SizedBox.fromSize(
|
||||
size: Size.fromRadius(47.5.r),
|
||||
child: Image.file(
|
||||
filePath[0]!,
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Center(
|
||||
child: Image.asset(
|
||||
"assets/images/png/cameraicon2.png",
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
),
|
||||
),
|
||||
borderwidth: 0.5),
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(20.h),
|
||||
Center(
|
||||
child: text16w400_white(
|
||||
"Add group profile picture")),
|
||||
sizedBoxHeight(30.h),
|
||||
text16w400_FCFCFC("Group banner image"),
|
||||
sizedBoxHeight(15.h),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
ImageUploadBottomSheet().showModal(
|
||||
context,
|
||||
false,
|
||||
(result) {
|
||||
// var file = File(result);
|
||||
|
||||
// bannerPath.add(file);
|
||||
// isbannerAdded = true;
|
||||
// setState(() {});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
var file = File(result);
|
||||
|
||||
// Check if the file size exceeds 10 MB
|
||||
// int fileSizeInBytes = file.lengthSync();
|
||||
// double fileSizeInMB =
|
||||
// fileSizeInBytes / (1024 * 1024);
|
||||
|
||||
// if (fileSizeInMB > 10) {
|
||||
// // Show toast message if the file size exceeds 10 MB
|
||||
|
||||
// utils.showToast(
|
||||
// "The selected file is too large. Max file size is 10 MB.");
|
||||
// } else {
|
||||
|
||||
// Clear the existing image and add the new one
|
||||
bannerPath.clear();
|
||||
bannerPath.add(file);
|
||||
isbannerAdded = true;
|
||||
setState(() {});
|
||||
// }
|
||||
} else {
|
||||
// Handle case where no image is selected
|
||||
bannerPath.clear();
|
||||
isbannerAdded = false;
|
||||
setState(() {});
|
||||
}
|
||||
if (Platform.isAndroid) {
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
child: DottedBorder(
|
||||
strokeWidth: 1,
|
||||
dashPattern: [7, 4],
|
||||
borderType: BorderType.RRect,
|
||||
radius: Radius.circular(14.r),
|
||||
color: Color(0xFF434A53),
|
||||
child: commonGlassUI(
|
||||
borderwidth: 0,
|
||||
width: double.infinity,
|
||||
height: 130.h,
|
||||
borderRadius: BorderRadius.circular(10.r),
|
||||
customWidget: bannerPath.isNotEmpty &&
|
||||
isbannerAdded
|
||||
? Stack(children: [
|
||||
Image.file(
|
||||
bannerPath[0]!,
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
),
|
||||
Positioned(
|
||||
right: 5,
|
||||
bottom: 5,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
bannerPath.clear();
|
||||
isbannerAdded = false;
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
width: 27,
|
||||
height: 27,
|
||||
decoration: ShapeDecoration(
|
||||
color: Color(0xFF7E7E7E),
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
5)),
|
||||
),
|
||||
child: Icon(
|
||||
Icons
|
||||
.delete_outline_outlined,
|
||||
color: Colors.white,
|
||||
))),
|
||||
),
|
||||
])
|
||||
: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 25.h),
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/png/ph_camera-light.png",
|
||||
height: 40.h,
|
||||
width: 40.w,
|
||||
),
|
||||
sizedBoxHeight(10.h),
|
||||
text14w400white(
|
||||
'Upload banner image'),
|
||||
sizedBoxHeight(8.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
text16w400_FCFCFC("Group title"),
|
||||
sizedBoxHeight(15.h),
|
||||
CustomTextFormField(
|
||||
textEditingController: grouptitlecontroller,
|
||||
inputFormatters: [
|
||||
RemoveEmojiInputFormatter(),
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp('[a-zA-Z ]'))
|
||||
],
|
||||
hintText: 'Enter group title',
|
||||
validator: (val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return 'Enter group title';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
text16w400_FCFCFC("Group description"),
|
||||
sizedBoxHeight(15.h),
|
||||
CustomTextFormField2(
|
||||
maxlines: 3,
|
||||
textEditingController: groupdescriptioncontroller,
|
||||
inputFormatters: [
|
||||
RemoveEmojiInputFormatter(),
|
||||
// FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]'))
|
||||
],
|
||||
hintText: 'Enter group description',
|
||||
validator: (val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return 'Enter group description';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
text16w400_FCFCFC("Type of group"),
|
||||
sizedBoxHeight(15.h),
|
||||
CustomDropDownRadio(
|
||||
header: "",
|
||||
title: "",
|
||||
listData: const ['Public', 'Private', 'Secret'],
|
||||
onItemSelected: _onItemSelected,
|
||||
// (p0) {},
|
||||
leadingImage: SizedBox()),
|
||||
sizedBoxHeight(25.h),
|
||||
sizedBoxHeight(25.h),
|
||||
CustomButton(
|
||||
text: "Create group",
|
||||
onPressed: () {
|
||||
// Get.toNamed(RouteName.addgroup);
|
||||
if (filePath.isEmpty) {
|
||||
utils.showToast(
|
||||
'Please add group profile picture');
|
||||
} else if (bannerPath.isEmpty) {
|
||||
utils.showToast('Please add banner image');
|
||||
} else if (grouptitlecontroller.text.isEmpty) {
|
||||
utils.showToast('Please enter group title');
|
||||
} else if (groupdescriptioncontroller
|
||||
.text.isEmpty) {
|
||||
utils.showToast(
|
||||
'Please enter group description');
|
||||
} else if (_selectedtypecommunity.isEmpty) {
|
||||
utils.showToast('Please select type of group');
|
||||
} else {
|
||||
print('done');
|
||||
// indiUploadata();
|
||||
// Uploadata();
|
||||
int groupTypeValue =
|
||||
_TypecommunityMap[_selectedtypecommunity] ??
|
||||
0;
|
||||
|
||||
Get.toNamed(RouteName.groupaddfollowers, arguments: {
|
||||
'groupname': grouptitlecontroller.text,
|
||||
'groupdescription':
|
||||
groupdescriptioncontroller.text,
|
||||
'grouptype': groupTypeValue,
|
||||
'groupprofilephoto': filePath,
|
||||
'groupbannerimage': bannerPath,
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
],
|
||||
)))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
422
lib/Main_Screens/GroupTab/View/GroupAddfollowers.dart
Normal file
422
lib/Main_Screens/GroupTab/View/GroupAddfollowers.dart
Normal file
@@ -0,0 +1,422 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart' hide MultipartFile, FormData;
|
||||
import 'package:regroup/Common/CommonGlassmorphism.dart';
|
||||
import 'package:regroup/Common/CommonWidget.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/Model/groupsAddFollowersModel.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/view_model/getmethod.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/view_model/postmethod.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
import 'package:regroup/Utils/Common/CustomNextButton.dart';
|
||||
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
class GroupAddFollowers extends StatefulWidget {
|
||||
const GroupAddFollowers({super.key});
|
||||
|
||||
@override
|
||||
State<GroupAddFollowers> createState() => _GroupAddFollowersState();
|
||||
}
|
||||
|
||||
class _GroupAddFollowersState extends State<GroupAddFollowers> {
|
||||
int grouptype = Get.arguments["grouptype"];
|
||||
String groupname = Get.arguments["groupname"];
|
||||
String groupdescription = Get.arguments["groupdescription"];
|
||||
List<File?> filepath = Get.arguments['groupprofilephoto'];
|
||||
List<File?> bannerPath = Get.arguments['groupbannerimage'];
|
||||
|
||||
StreamController<GroupsAddfollowersModel> searchcontroller =
|
||||
StreamController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
var updata = "";
|
||||
Getgroups()
|
||||
.getGroupsAddfollowersearch(updata, streamController: searchcontroller);
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
searchcontroller.close();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
final List<int> _selectedIndices = [];
|
||||
|
||||
void _onContainerTap(int id) {
|
||||
setState(() {
|
||||
if (_selectedIndices.contains(id)) {
|
||||
_selectedIndices.remove(id);
|
||||
} else {
|
||||
_selectedIndices.add(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Uploadata() async {
|
||||
utils.loader();
|
||||
List<MultipartFile> bannermedialist = [];
|
||||
List<MultipartFile> profielpicturelist = [];
|
||||
|
||||
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 filepath.where((file) => file != null)) {
|
||||
profielpicturelist.add(
|
||||
await MultipartFile.fromFile(
|
||||
file!.path,
|
||||
filename: path.basename(file.path),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String selectedIndicesString = '[${_selectedIndices.join(',')}]';
|
||||
print('Selected Indices: $selectedIndicesString');
|
||||
|
||||
FormData formdata = FormData.fromMap({
|
||||
"manage_group_type_xid": grouptype,
|
||||
"background_image": bannermedialist[0],
|
||||
"group_image": profielpicturelist[0],
|
||||
"title": groupname,
|
||||
"description": groupdescription,
|
||||
'members': selectedIndicesString.isEmpty ? null : selectedIndicesString,
|
||||
});
|
||||
print('updata is ${formdata.toString()}');
|
||||
log('log is ${formdata.toString()}');
|
||||
final data = await PostMethodGroups().postCreategroups(formdata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
Get.back();
|
||||
print("groups created");
|
||||
// Get.toNamed(RouteName.mycommunity);
|
||||
Get.back();
|
||||
Get.back(result: true);
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
Get.back();
|
||||
print("groups not created");
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Get.back();
|
||||
return true;
|
||||
},
|
||||
child: GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: Scaffold(
|
||||
backgroundColor: Color(0xFF222935),
|
||||
extendBody: true,
|
||||
appBar: CommonAppbar(
|
||||
titleTxt: "Add followers",
|
||||
),
|
||||
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();
|
||||
},
|
||||
),
|
||||
),
|
||||
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 users",
|
||||
onInput: (value) {
|
||||
Getgroups().getGroupsAddfollowersearch(
|
||||
value,
|
||||
streamController: searchcontroller);
|
||||
},
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
Row(
|
||||
children: [
|
||||
text18w700_FCFCFC("Select followers"),
|
||||
Spacer(),
|
||||
commonGlassUI(
|
||||
opacity1: 0.24,
|
||||
opacity2: 0.24,
|
||||
width: 35.w,
|
||||
height: 35.h,
|
||||
borderRadius:
|
||||
BorderRadius.circular(100),
|
||||
customWidget: Center(
|
||||
child: Image.asset(
|
||||
"assets/images/png/basil_sort-outline.png",
|
||||
height: 20.h,
|
||||
width: 20.w,
|
||||
)),
|
||||
borderwidth: 0.5),
|
||||
sizedBoxWidth(18.w),
|
||||
commonGlassUI(
|
||||
opacity1: 0.24,
|
||||
opacity2: 0.24,
|
||||
width: 35.w,
|
||||
height: 35.h,
|
||||
borderRadius:
|
||||
BorderRadius.circular(100),
|
||||
customWidget: Center(
|
||||
child: Image.asset(
|
||||
"assets/images/png/bi_filter.png",
|
||||
height: 20.h,
|
||||
width: 20.w,
|
||||
)),
|
||||
borderwidth: 0.5),
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(25.h),
|
||||
// sizedBoxHeight(30.h),
|
||||
text20w700red("Available"),
|
||||
sizedBoxHeight(20.h),
|
||||
]),
|
||||
),
|
||||
StreamBuilder<GroupsAddfollowersModel>(
|
||||
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 groupsaddfollowersobj!.data.isEmpty
|
||||
? _buildNoDataBody(context)
|
||||
: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: ScrollPhysics(),
|
||||
itemCount:
|
||||
groupsaddfollowersobj!.data.length,
|
||||
itemBuilder: (context, index) {
|
||||
final isChecked = _selectedIndices
|
||||
.contains(groupsaddfollowersobj!
|
||||
.data[index].following!.id);
|
||||
return Column(
|
||||
children: [
|
||||
groupWidget(
|
||||
index: groupsaddfollowersobj!
|
||||
.data[index].id!,
|
||||
imagePath:
|
||||
groupsaddfollowersobj!
|
||||
.data[index]
|
||||
.following!
|
||||
.profilePhoto ??
|
||||
'',
|
||||
title: groupsaddfollowersobj!
|
||||
.data[index]
|
||||
.following!
|
||||
.fullName!,
|
||||
subtitle: groupsaddfollowersobj!
|
||||
.data[index]
|
||||
.following!
|
||||
.userName!,
|
||||
isChecked: isChecked,
|
||||
// isCheckedList[index],
|
||||
onCheckedChanged:
|
||||
(bool? value) {
|
||||
// isCheckedList[index] = value ?? false;
|
||||
_onContainerTap(
|
||||
groupsaddfollowersobj!
|
||||
.data[index]
|
||||
.following!
|
||||
.id!);
|
||||
},
|
||||
),
|
||||
commonDivider(),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}),
|
||||
sizedBoxHeight(50.h),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildNoDataBody(context) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"No followers found",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget groupWidget({
|
||||
required int index,
|
||||
required String? imagePath,
|
||||
required String? title,
|
||||
required String? subtitle,
|
||||
required bool isChecked,
|
||||
required ValueChanged<bool?> onCheckedChanged,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
imagePath == null || imagePath.isEmpty
|
||||
? CircleAvatar(
|
||||
backgroundImage: AssetImage('assets/images/png/img2.png'),
|
||||
radius: 20.r,
|
||||
)
|
||||
:
|
||||
// CircleAvatar(
|
||||
// backgroundImage: NetworkImage(imagePath),
|
||||
// radius: 20.r,
|
||||
// ),
|
||||
CircleAvatar(
|
||||
backgroundImage: CachedNetworkImageProvider(imagePath),
|
||||
radius: 20.r,
|
||||
child: CachedNetworkImage(
|
||||
cacheKey: index.toString(),
|
||||
maxHeightDiskCache: 100,
|
||||
maxWidthDiskCache: 100,
|
||||
imageUrl: imagePath,
|
||||
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: [
|
||||
title == null || title.isEmpty
|
||||
? text16w400_FCFCFC('ReGroup')
|
||||
: Text(
|
||||
title,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: const Color(0xFFFCFCFC),
|
||||
fontFamily: 'Helvetica',
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
sizedBoxHeight(4.h),
|
||||
subtitle == null || subtitle.isEmpty
|
||||
? text12w400_FCFCFC_blur('ReGroup')
|
||||
: Text(
|
||||
subtitle,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: const Color(0xFFFCFCFC).withOpacity(0.8),
|
||||
fontFamily: 'Helvetica',
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
commonGlassUI(
|
||||
borderwidth: isChecked ? 1.2 : 0.9,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
height: 23.h,
|
||||
width: 23.w,
|
||||
opacity1: 0.24,
|
||||
opacity2: 0.24,
|
||||
borderColor:
|
||||
// isChecked ? Color(0xFFD90B2E) :
|
||||
Color(0xFF434A53),
|
||||
customWidget: Transform.scale(
|
||||
scale: 1,
|
||||
child: Checkbox(
|
||||
side: BorderSide(color: Colors.transparent),
|
||||
value: isChecked,
|
||||
activeColor: Colors.transparent,
|
||||
checkColor:
|
||||
// Color(0xFFD90B2E),
|
||||
Color(0XFFFFFFFF),
|
||||
onChanged: onCheckedChanged,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,7 @@ class _GroupTabState extends State<GroupTab> {
|
||||
InkWell(
|
||||
onTap: () {
|
||||
// Get.toNamed(RouteName.addEvent);
|
||||
Get.toNamed(RouteName.creategroup);
|
||||
},
|
||||
child: Container(
|
||||
height: 35.h,
|
||||
|
||||
28
lib/Main_Screens/GroupTab/view_model/getmethod.dart
Normal file
28
lib/Main_Screens/GroupTab/view_model/getmethod.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'dart:async';
|
||||
|
||||
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/GroupTab/Model/groupsAddFollowersModel.dart';
|
||||
|
||||
|
||||
GroupsAddfollowersModel? groupsaddfollowersobj;
|
||||
|
||||
class Getgroups {
|
||||
|
||||
Future<ResponseData<dynamic>> getGroupsAddfollowersearch(updata,
|
||||
{required StreamController<GroupsAddfollowersModel> streamController}) async {
|
||||
final response =
|
||||
await NetworkApiServices().getApi(
|
||||
"${ApiUrls.getgroupsaddfollowers}?search=$updata",
|
||||
|
||||
);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
groupsaddfollowersobj = GroupsAddfollowersModel.fromJson(response.data);
|
||||
if (!streamController.isClosed) streamController.sink.add(groupsaddfollowersobj!);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
19
lib/Main_Screens/GroupTab/view_model/postmethod.dart
Normal file
19
lib/Main_Screens/GroupTab/view_model/postmethod.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:regroup/Common/api_urls.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Common/controller/data/network/network_api.dart';
|
||||
|
||||
class PostMethodGroups {
|
||||
PostMethodGroups();
|
||||
|
||||
Future<ResponseData<dynamic>> postCreategroups(updata) async {
|
||||
print("updata is $updata");
|
||||
final response = await NetworkApiServices().postApi(
|
||||
updata,
|
||||
ApiUrls.postcreategroups,
|
||||
);
|
||||
print("response is ${response.data}");
|
||||
print("response message is ${response.message}");
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -824,3 +824,16 @@ Widget text8w700_white(String text) {
|
||||
fontWeight: FontWeight.w700),
|
||||
);
|
||||
}
|
||||
|
||||
Widget text20w700red(String text, {TextAlign? textAlign}) {
|
||||
return Text(
|
||||
text,
|
||||
textAlign: textAlign,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp,
|
||||
fontFamily: 'Helvetica',
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Color(0XFFD90B2E),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -147,6 +147,10 @@ class RouteName {
|
||||
|
||||
static const String communitymembers = '/communitymembers';
|
||||
|
||||
static const String creategroup = '/creategroup';
|
||||
|
||||
static const String groupaddfollowers = '/groupaddfollowers';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,8 +19,10 @@ import 'package:regroup/Main_Screens/Community_HomePage/PostScreen.dart';
|
||||
import 'package:regroup/Main_Screens/ExploreDesign/DetailExplore.dart';
|
||||
import 'package:regroup/Main_Screens/ExploreDesign/ExploreScreen.dart';
|
||||
import 'package:regroup/Main_Screens/ExploreDesign/SearchGroup.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/View/CreateGroups.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/View/ConnectCommunity.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/View/GoupSettings.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/View/GroupAddfollowers.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/View/GroupDetail.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/View/GroupEvent.dart';
|
||||
import 'package:regroup/Main_Screens/GroupTab/View/GroupInfo.dart';
|
||||
@@ -550,6 +552,16 @@ class AppRoutes {
|
||||
page: () => const RequestsScreen(),
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: RouteName.creategroup,
|
||||
page: () => const Creategroup(),
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: RouteName.groupaddfollowers,
|
||||
page: () => const GroupAddFollowers(),
|
||||
),
|
||||
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user