improvements.

main_design2.0
Sikander Saleem 2 years ago
parent ee7665930e
commit 708e7c80d1

@ -12,7 +12,7 @@ class AllRequestsProvider extends ChangeNotifier {
bool isAllLoading = false; bool isAllLoading = false;
bool isOpenLoading = false; bool isOpenLoading = false;
bool isInProgressLoading = false; bool isInProgressLoading = false;
bool isCloseLoading = false; bool isCompleteLoading = false;
bool isOverdueLoading = false; bool isOverdueLoading = false;
bool isHighPriorityLoading = false; bool isHighPriorityLoading = false;
bool isCalendarLoading = false; bool isCalendarLoading = false;
@ -22,7 +22,7 @@ class AllRequestsProvider extends ChangeNotifier {
AllRequestsAndCount allRequestsAndCount; AllRequestsAndCount allRequestsAndCount;
AllRequestsAndCount openRequests; AllRequestsAndCount openRequests;
AllRequestsAndCount inProgressRequests; AllRequestsAndCount inProgressRequests;
AllRequestsAndCount closeRequests; AllRequestsAndCount completedRequests;
AllRequestsAndCount overdueRequests; AllRequestsAndCount overdueRequests;
AllRequestsAndCount highPriorityRequests; AllRequestsAndCount highPriorityRequests;
AllRequestsAndCount calendarRequests; AllRequestsAndCount calendarRequests;
@ -32,9 +32,8 @@ class AllRequestsProvider extends ChangeNotifier {
getOverdueRequests(); getOverdueRequests();
getOpenRequests(); getOpenRequests();
getInProgressRequests(); getInProgressRequests();
getCloseRequests(); getCompletedRequests();
} }
Future<int> getAllRequests(BuildContext context, {int typeTransaction, SearchAllRequestsModel search}) async { Future<int> getAllRequests(BuildContext context, {int typeTransaction, SearchAllRequestsModel search}) async {
if (isAllLoading == true) return -2; if (isAllLoading == true) return -2;
isAllLoading = true; isAllLoading = true;
@ -51,7 +50,7 @@ class AllRequestsProvider extends ChangeNotifier {
"typeTransaction": type, "typeTransaction": type,
"statusTransaction": status, "statusTransaction": status,
"priority": [0, 1], "priority": [0, 1],
"displayData": status, "displayData": [],
if (search?.requestNumber?.value?.isNotEmpty ?? false) "requestNumber": search.requestNumber.value, if (search?.requestNumber?.value?.isNotEmpty ?? false) "requestNumber": search.requestNumber.value,
if (search?.assetName?.value?.isNotEmpty ?? false) "assetName": search.assetName.value, if (search?.assetName?.value?.isNotEmpty ?? false) "assetName": search.assetName.value,
if (search?.assetNo?.value?.isNotEmpty ?? false) "assetNumber": search.assetNo.value, if (search?.assetNo?.value?.isNotEmpty ?? false) "assetNumber": search.assetNo.value,
@ -230,15 +229,15 @@ class AllRequestsProvider extends ChangeNotifier {
} }
} }
Future<int> getCloseRequests() async { Future<int> getCompletedRequests() async {
if (isCloseLoading == true) return -2; if (isCompleteLoading == true) return -2;
isCloseLoading = true; isCompleteLoading = true;
if (closeRequests == null) notifyListeners(); if (completedRequests == null) notifyListeners();
Response response; Response response;
try { try {
Map<String, dynamic> body = { Map<String, dynamic> body = {
"typeTransaction": [1, 2, 3, 4], "typeTransaction": [1, 2, 3, 4],
"statusTransaction": [3], "statusTransaction": [4],
"priority": [], "priority": [],
"displayData": [] "displayData": []
}; };
@ -246,17 +245,47 @@ class AllRequestsProvider extends ChangeNotifier {
stateCode = response.statusCode; stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) { if (response.statusCode >= 200 && response.statusCode < 300) {
closeRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]); completedRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
notifyListeners(); notifyListeners();
} }
isCloseLoading = false; isCompleteLoading = false;
notifyListeners(); notifyListeners();
return response.statusCode; return response.statusCode;
} catch (error) { } catch (error) {
isCloseLoading = false; isCompleteLoading = false;
stateCode = -1; stateCode = -1;
notifyListeners(); notifyListeners();
return -1; return -1;
} }
} }
// Future<int> getCloseRequests() async {
// if (isCloseLoading == true) return -2;
// isCloseLoading = true;
// if (closeRequests == null) notifyListeners();
// Response response;
// try {
// Map<String, dynamic> body = {
// "typeTransaction": [1, 2, 3, 4],
// "statusTransaction": [4],
// "priority": [],
// "displayData": []
// };
// response = await ApiManager.instance.post(URLs.getAllRequestsAndCount, body: body);
//
// stateCode = response.statusCode;
// if (response.statusCode >= 200 && response.statusCode < 300) {
// closeRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
// notifyListeners();
// }
// isCloseLoading = false;
// notifyListeners();
// return response.statusCode;
// } catch (error) {
// isCloseLoading = false;
// stateCode = -1;
// notifyListeners();
// return -1;
// }
// }
} }

@ -47,7 +47,7 @@ class ProgressFragment extends StatelessWidget {
chartValueStyle: AppTextStyles.heading6.copyWith(color: AppColor.neutral20), chartValueStyle: AppTextStyles.heading6.copyWith(color: AppColor.neutral20),
showChartValuesOutside: true, showChartValuesOutside: true,
), ),
).toShimmer(isShow: snapshot.isOpenLoading || snapshot.isInProgressLoading || snapshot.isCloseLoading, radius: 300).paddingAll(12).toShadowContainer(context), ).toShimmer(isShow: snapshot.isOpenLoading || snapshot.isInProgressLoading || snapshot.isCompleteLoading, radius: 300).paddingAll(12).toShadowContainer(context),
).paddingOnly(start: 16, end: 16, bottom: 16), ).paddingOnly(start: 16, end: 16, bottom: 16),
DefaultTabController( DefaultTabController(
length: 3, length: 3,
@ -80,7 +80,7 @@ class ProgressFragment extends StatelessWidget {
children: [ children: [
RequestItemViewList(snapshot.openRequests?.requestsDetails ?? [], snapshot.isOpenLoading), RequestItemViewList(snapshot.openRequests?.requestsDetails ?? [], snapshot.isOpenLoading),
RequestItemViewList(snapshot.inProgressRequests?.requestsDetails ?? [], snapshot.isInProgressLoading), RequestItemViewList(snapshot.inProgressRequests?.requestsDetails ?? [], snapshot.isInProgressLoading),
RequestItemViewList(snapshot.closeRequests?.requestsDetails ?? [], snapshot.isCloseLoading), RequestItemViewList(snapshot.completedRequests?.requestsDetails ?? [], snapshot.isCompleteLoading),
], ],
).expanded, ).expanded,
], ],

@ -26,7 +26,7 @@ class RequestsFragment extends StatelessWidget {
gridItem(snapshot.highPriorityRequests?.total?.count?.toString() ?? "-", "high_priority", context.translation.highPriority, context, snapshot.isHighPriorityLoading, 0), gridItem(snapshot.highPriorityRequests?.total?.count?.toString() ?? "-", "high_priority", context.translation.highPriority, context, snapshot.isHighPriorityLoading, 0),
gridItem(snapshot.overdueRequests?.total?.count?.toString() ?? "-", "overdue", context.translation.overdue, context, snapshot.isOverdueLoading, 1), gridItem(snapshot.overdueRequests?.total?.count?.toString() ?? "-", "overdue", context.translation.overdue, context, snapshot.isOverdueLoading, 1),
gridItem(snapshot.openRequests?.total?.count?.toString() ?? "-", "new_request", context.translation.newR, context, snapshot.isOpenLoading, 2), gridItem(snapshot.openRequests?.total?.count?.toString() ?? "-", "new_request", context.translation.newR, context, snapshot.isOpenLoading, 2),
gridItem(snapshot.closeRequests?.total?.count?.toString() ?? "-", "complete_request", context.translation.completed, context, snapshot.isCloseLoading, 3), gridItem(snapshot.completedRequests?.total?.count?.toString() ?? "-", "complete_request", context.translation.completed, context, snapshot.isCompleteLoading, 3),
], ],
), ),
), ),

@ -34,7 +34,7 @@ class RequestsListPage extends StatelessWidget {
: index == 2 : index == 2
? snapshot.isOpenLoading ? snapshot.isOpenLoading
: index == 3 : index == 3
? snapshot.isCloseLoading ? snapshot.isCompleteLoading
: false; : false;
List<RequestsDetails> list = index == 0 List<RequestsDetails> list = index == 0
@ -44,7 +44,7 @@ class RequestsListPage extends StatelessWidget {
: index == 2 : index == 2
? snapshot.openRequests.requestsDetails ? snapshot.openRequests.requestsDetails
: index == 3 : index == 3
? snapshot.closeRequests.requestsDetails ? snapshot.completedRequests.requestsDetails
: []; : [];
return RequestItemViewList(list, isLoading); return RequestItemViewList(list, isLoading);
})); }));

@ -58,7 +58,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
builder: (context, snap) { builder: (context, snap) {
if (snap.connectionState == ConnectionState.waiting) { if (snap.connectionState == ConnectionState.waiting) {
return const ALoading(); return const ALoading();
} else if (!snap.hasData) { } else if (snap.hasData) {
_model = snap.data; _model = snap.data;
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

Loading…
Cancel
Save