merge-requests/126/head
Aamir Muhammad 3 years ago
parent 3871d3f1e3
commit d096559a2f

@ -92,8 +92,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
} }
void fetchChatUser({bool isNeedLoading = true}) async { void fetchChatUser({bool isNeedLoading = true}) async {
if (pageNo == 1) if (pageNo == 1) chatUsersList!.clear();
chatUsersList = [];
try { try {
Utils.showLoading(context); Utils.showLoading(context);
await ChatApiClient().getChatMemberFromSearch(searchText, AppState().chatDetails!.response!.id!, pageNo).then((ChatUserModel value) { await ChatApiClient().getChatMemberFromSearch(searchText, AppState().chatDetails!.response!.id!, pageNo).then((ChatUserModel value) {
@ -130,11 +129,11 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
} }
void scrollListener() async { void scrollListener() async {
if (sc.position.pixels == if (sc.position.pixels == sc.position.maxScrollExtent) {
sc.position.maxScrollExtent) {
pageNo++; pageNo++;
setState(() {}); setState(() {});
} }
}
@override @override
void initState() { void initState() {
@ -146,10 +145,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return SizedBox(
width: double.infinity, width: double.infinity,
height: MediaQuery height: MediaQuery.of(context).size.height - 100,
.of(context)
.size
.height - 100,
child: Column( child: Column(
children: [ children: [
Column( Column(
@ -191,9 +187,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
), ),
if (replacementList != null) if (replacementList != null)
replacementList!.isEmpty replacementList!.isEmpty
? Utils ? Utils.getNoDataWidget(context).expanded
.getNoDataWidget(context)
.expanded
: ListView( : ListView(
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
padding: EdgeInsets.only(top: 21, bottom: 8), padding: EdgeInsets.only(top: 21, bottom: 8),
@ -205,8 +199,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (cxt, index) => employeeItemView(favouriteUserList![index]), itemBuilder: (cxt, index) => employeeItemView(favouriteUserList![index]),
separatorBuilder: (cxt, index) => separatorBuilder: (cxt, index) => Container(
Container(
height: 1, height: 1,
color: MyColors.borderE3Color, color: MyColors.borderE3Color,
), ),
@ -220,8 +213,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (cxt, index) => employeeItemView(nonFavouriteUserList![index]), itemBuilder: (cxt, index) => employeeItemView(nonFavouriteUserList![index]),
separatorBuilder: (cxt, index) => separatorBuilder: (cxt, index) => Container(
Container(
height: 1, height: 1,
color: MyColors.borderE3Color, color: MyColors.borderE3Color,
), ),
@ -238,8 +230,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
Utils.getNoDataWidget(context), Utils.getNoDataWidget(context),
], ],
) )
: ListView : ListView.separated(
.separated(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
controller: sc, controller: sc,
shrinkWrap: true, shrinkWrap: true,
@ -283,20 +274,16 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
), ),
); );
}, },
separatorBuilder: (BuildContext context, int index) => separatorBuilder: (BuildContext context, int index) => const Padding(
const Padding(
padding: EdgeInsets.only(right: 10, left: 70, bottom: 0, top: 0), padding: EdgeInsets.only(right: 10, left: 70, bottom: 0, top: 0),
child: Divider( child: Divider(
color: Color(0xFFE5E5E5), color: Color(0xFFE5E5E5),
), ),
), ),
itemCount: chatUsersList?.length ?? 0, itemCount: chatUsersList?.length ?? 0,
) ).expanded,
.expanded,
], ],
) ).paddingOnly(left: 21, right: 21, bottom: 0, top: 21).expanded,
.paddingOnly(left: 21, right: 21, bottom: 0, top: 21)
.expanded,
Container(width: double.infinity, height: 1, color: MyColors.lightGreyEFColor), Container(width: double.infinity, height: 1, color: MyColors.lightGreyEFColor),
DefaultButton( DefaultButton(
LocaleKeys.cancel.tr(), LocaleKeys.cancel.tr(),
@ -374,4 +361,4 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
setState(() {}); setState(() {});
}).expanded; }).expanded;
} }
} }

Loading…
Cancel
Save