|
|
|
|
@ -73,6 +73,7 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
|
|
|
|
|
final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => AllRequestsSearchPage(data: _search)));
|
|
|
|
|
if (result != null) {
|
|
|
|
|
_search = result;
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
}).expanded,
|
|
|
|
|
16.width,
|
|
|
|
|
@ -83,6 +84,7 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
|
|
|
|
|
final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => AllRequestsFilterPage(data: _search)));
|
|
|
|
|
if (result != null) {
|
|
|
|
|
_search = result;
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
@ -90,45 +92,61 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
|
|
|
|
|
),
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 34 + 16.0,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
padding: const EdgeInsets.only(top: 16, right: 16, left: 16),
|
|
|
|
|
itemBuilder: (cxt, index) => Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
|
color: selectedRequest == index ? Color(0xFFEAF1F4) : Colors.white,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
side: BorderSide(width: 1, color: selectedRequest == index ? Color(0xFF4A8DB7) : Colors.white),
|
|
|
|
|
borderRadius: BorderRadius.circular(7),
|
|
|
|
|
if (_filterIsEmpty())
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 34 + 16.0,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
padding: const EdgeInsets.only(top: 16, right: 16, left: 16),
|
|
|
|
|
itemBuilder: (cxt, index) => Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
|
color: selectedRequest == index ? Color(0xFFEAF1F4) : Colors.white,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
side: BorderSide(width: 1, color: selectedRequest == index ? Color(0xFF4A8DB7) : Colors.white),
|
|
|
|
|
borderRadius: BorderRadius.circular(7),
|
|
|
|
|
),
|
|
|
|
|
shadows: const [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Color(0x07000000),
|
|
|
|
|
blurRadius: 14,
|
|
|
|
|
offset: Offset(0, 0),
|
|
|
|
|
spreadRadius: 0,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
shadows: const [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Color(0x07000000),
|
|
|
|
|
blurRadius: 14,
|
|
|
|
|
offset: Offset(0, 0),
|
|
|
|
|
spreadRadius: 0,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
child: Text(requestsList[index], style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral20 : AppColor.neutral50, height: 1)),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (selectedRequest != index) {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedRequest = index;
|
|
|
|
|
});
|
|
|
|
|
_provider.getAllRequests(context, typeTransaction: selectedRequest == 0 ? null : selectedRequest);
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
separatorBuilder: (cxt, index) => 8.width,
|
|
|
|
|
itemCount: requestsList.length),
|
|
|
|
|
),
|
|
|
|
|
child: Text(requestsList[index], style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral20 : AppColor.neutral50, height: 1)),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (selectedRequest != index) {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedRequest = index;
|
|
|
|
|
});
|
|
|
|
|
_provider.getAllRequests(context, typeTransaction: selectedRequest == 0 ? null : selectedRequest);
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
separatorBuilder: (cxt, index) => 8.width,
|
|
|
|
|
itemCount: requestsList.length),
|
|
|
|
|
),
|
|
|
|
|
Consumer<AllRequestsProvider>(builder: (context, snapshot, _) {
|
|
|
|
|
return RequestItemViewList(snapshot.allRequestsAndCount?.requestsDetails ?? [], snapshot.isAllLoading);
|
|
|
|
|
}).expanded,
|
|
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool _filterIsEmpty() {
|
|
|
|
|
if (_search == null) return true;
|
|
|
|
|
if ((_search.requestNumber?.value?.isNotEmpty ?? false) ||
|
|
|
|
|
(_search.assetNo?.value?.isNotEmpty ?? false) ||
|
|
|
|
|
(_search.assetName?.value?.isNotEmpty ?? false) ||
|
|
|
|
|
(_search.manufacture?.value?.isNotEmpty ?? false) ||
|
|
|
|
|
(_search.sn?.value?.isNotEmpty ?? false) ||
|
|
|
|
|
(_search.statuses?.isNotEmpty ?? false) ||
|
|
|
|
|
(_search.startDate != null) ||
|
|
|
|
|
(_search.endDate != null)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|