|
|
|
|
@ -6,6 +6,7 @@ import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/search_all_requests_model.dart';
|
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
import 'package:test_sa/new_views/pages/land_page/my_request/all_requests_filter_page.dart';
|
|
|
|
|
import 'package:test_sa/new_views/pages/land_page/my_request/all_requests_search_page.dart';
|
|
|
|
|
import 'package:test_sa/new_views/pages/land_page/widgets/request_item_view_list.dart';
|
|
|
|
|
@ -21,9 +22,20 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
|
|
|
|
|
AllRequestsProvider _provider;
|
|
|
|
|
SearchAllRequestsModel _search;
|
|
|
|
|
|
|
|
|
|
List<String> requestsList;
|
|
|
|
|
int selectedRequest;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
if (_provider == null) {
|
|
|
|
|
requestsList = [
|
|
|
|
|
context.translation.allRequests,
|
|
|
|
|
context.translation.serviceRequest,
|
|
|
|
|
context.translation.gasRefillRequest,
|
|
|
|
|
context.translation.deviceTransferRequest,
|
|
|
|
|
context.translation.preventiveMaintenance,
|
|
|
|
|
];
|
|
|
|
|
selectedRequest = 0;
|
|
|
|
|
_provider = Provider.of<AllRequestsProvider>(context, listen: false);
|
|
|
|
|
_provider.getAllRequests();
|
|
|
|
|
}
|
|
|
|
|
@ -78,8 +90,47 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(start: 16, end: 16),
|
|
|
|
|
),
|
|
|
|
|
body: Consumer<AllRequestsProvider>(builder: (context, snapshot, _) {
|
|
|
|
|
return RequestItemViewList(snapshot.allRequestsAndCount?.requestsDetails ?? [], snapshot.isAllLoading);
|
|
|
|
|
}));
|
|
|
|
|
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 ? const 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,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
child: Text(requestsList[index], style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, height: 1)),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (selectedRequest != index) {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedRequest = index;
|
|
|
|
|
});
|
|
|
|
|
_provider.getAllRequests(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,
|
|
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|