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

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

@ -89,7 +89,8 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
],
).paddingOnly(start: 16, end: 16),
),
body: Column(
body: Consumer<AllRequestsProvider>(builder: (context, snapshot, _) {
return Column(
children: [
if (_filterIsEmpty())
SizedBox(
@ -110,7 +111,7 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
),
),
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(
side: selectedRequest == index ? BorderSide(width: 1, color: AppColor.blueStatus(context)) : BorderSide.none,
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))),
).onPress(() {
if (snapshot.isAllLoading) {
return;
}
if (selectedRequest != index) {
setState(() {
selectedRequest = index;
@ -130,17 +135,16 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
separatorBuilder: (cxt, index) => 8.width,
itemCount: requestsList.length),
),
Consumer<AllRequestsProvider>(builder: (context, snapshot, _) {
return LazyLoading(
LazyLoading(
child: RequestItemViewList(snapshot.allRequestsAndCount?.requestsDetails ?? [], snapshot.isAllLoading),
nextPage: snapshot.nextPage,
onLazyLoad: () {
print(selectedRequest);
snapshot.getAllRequests(context, typeTransaction: selectedRequest == 0 ? null : selectedRequest);},
);
}).expanded,
snapshot.getAllRequests(context, typeTransaction: selectedRequest == 0 ? null : selectedRequest);
},
).expanded,
],
));
);
}));
}
bool _filterIsEmpty() {

Loading…
Cancel
Save