all requests screen, wrong data show while switching tabs fixed.

main_design2.0
Sikander Saleem 2 years ago
parent 369ae3d949
commit 35b0a00ffd

@ -24,7 +24,7 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
SearchAllRequestsModel _search; SearchAllRequestsModel _search;
List<String> requestsList; List<String> requestsList;
int selectedRequest=0; int selectedRequest = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -89,7 +89,8 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
], ],
).paddingOnly(start: 16, end: 16), ).paddingOnly(start: 16, end: 16),
), ),
body: Column( body: Consumer<AllRequestsProvider>(builder: (context, snapshot, _) {
return Column(
children: [ children: [
if (_filterIsEmpty()) if (_filterIsEmpty())
SizedBox( SizedBox(
@ -110,7 +111,7 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
), ),
), ),
decoration: ShapeDecoration( decoration: ShapeDecoration(
color: selectedRequest == index ? AppColor.selectedButtonColor(context) : AppColor.unSelectedButtonColor(context), color: selectedRequest == index ? AppColor.selectedButtonColor(context) : AppColor.unSelectedButtonColor(context).withOpacity(snapshot.isAllLoading ? 0.7 : 1),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
side: selectedRequest == index ? BorderSide(width: 1, color: AppColor.blueStatus(context)) : BorderSide.none, side: selectedRequest == index ? BorderSide(width: 1, color: AppColor.blueStatus(context)) : BorderSide.none,
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
@ -119,6 +120,10 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
), ),
child: Text(requestsList[index], style: AppTextStyles.bodyText2.copyWith(height: 1, color: AppColor.filterButtonTextColor(context))), child: Text(requestsList[index], style: AppTextStyles.bodyText2.copyWith(height: 1, color: AppColor.filterButtonTextColor(context))),
).onPress(() { ).onPress(() {
if (snapshot.isAllLoading) {
return;
}
if (selectedRequest != index) { if (selectedRequest != index) {
setState(() { setState(() {
selectedRequest = index; selectedRequest = index;
@ -130,17 +135,16 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
separatorBuilder: (cxt, index) => 8.width, separatorBuilder: (cxt, index) => 8.width,
itemCount: requestsList.length), itemCount: requestsList.length),
), ),
Consumer<AllRequestsProvider>(builder: (context, snapshot, _) { LazyLoading(
return LazyLoading(
child: RequestItemViewList(snapshot.allRequestsAndCount?.requestsDetails ?? [], snapshot.isAllLoading), child: RequestItemViewList(snapshot.allRequestsAndCount?.requestsDetails ?? [], snapshot.isAllLoading),
nextPage: snapshot.nextPage, nextPage: snapshot.nextPage,
onLazyLoad: (){ onLazyLoad: () {
print(selectedRequest); snapshot.getAllRequests(context, typeTransaction: selectedRequest == 0 ? null : selectedRequest);
snapshot.getAllRequests(context, typeTransaction: selectedRequest == 0 ? null : selectedRequest);}, },
); ).expanded,
}).expanded,
], ],
)); );
}));
} }
bool _filterIsEmpty() { bool _filterIsEmpty() {

Loading…
Cancel
Save