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 isOpenLoading = false;
bool isInProgressLoading = false;
bool isCloseLoading = false;
bool isCompleteLoading = false;
bool isOverdueLoading = false;
bool isHighPriorityLoading = false;
bool isCalendarLoading = false;
@ -22,7 +22,7 @@ class AllRequestsProvider extends ChangeNotifier {
AllRequestsAndCount allRequestsAndCount;
AllRequestsAndCount openRequests;
AllRequestsAndCount inProgressRequests;
AllRequestsAndCount closeRequests;
AllRequestsAndCount completedRequests;
AllRequestsAndCount overdueRequests;
AllRequestsAndCount highPriorityRequests;
AllRequestsAndCount calendarRequests;
@ -32,9 +32,8 @@ class AllRequestsProvider extends ChangeNotifier {
getOverdueRequests();
getOpenRequests();
getInProgressRequests();
getCloseRequests();
getCompletedRequests();
}
Future<int> getAllRequests(BuildContext context, {int typeTransaction, SearchAllRequestsModel search}) async {
if (isAllLoading == true) return -2;
isAllLoading = true;
@ -51,7 +50,7 @@ class AllRequestsProvider extends ChangeNotifier {
"typeTransaction": type,
"statusTransaction": status,
"priority": [0, 1],
"displayData": status,
"displayData": [],
if (search?.requestNumber?.value?.isNotEmpty ?? false) "requestNumber": search.requestNumber.value,
if (search?.assetName?.value?.isNotEmpty ?? false) "assetName": search.assetName.value,
if (search?.assetNo?.value?.isNotEmpty ?? false) "assetNumber": search.assetNo.value,
@ -230,15 +229,15 @@ class AllRequestsProvider extends ChangeNotifier {
}
}
Future<int> getCloseRequests() async {
if (isCloseLoading == true) return -2;
isCloseLoading = true;
if (closeRequests == null) notifyListeners();
Future<int> getCompletedRequests() async {
if (isCompleteLoading == true) return -2;
isCompleteLoading = true;
if (completedRequests == null) notifyListeners();
Response response;
try {
Map<String, dynamic> body = {
"typeTransaction": [1, 2, 3, 4],
"statusTransaction": [3],
"statusTransaction": [4],
"priority": [],
"displayData": []
};
@ -246,17 +245,47 @@ class AllRequestsProvider extends ChangeNotifier {
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
closeRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
completedRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
notifyListeners();
}
isCloseLoading = false;
isCompleteLoading = false;
notifyListeners();
return response.statusCode;
} catch (error) {
isCloseLoading = false;
isCompleteLoading = false;
stateCode = -1;
notifyListeners();
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),
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),
DefaultTabController(
length: 3,
@ -80,7 +80,7 @@ class ProgressFragment extends StatelessWidget {
children: [
RequestItemViewList(snapshot.openRequests?.requestsDetails ?? [], snapshot.isOpenLoading),
RequestItemViewList(snapshot.inProgressRequests?.requestsDetails ?? [], snapshot.isInProgressLoading),
RequestItemViewList(snapshot.closeRequests?.requestsDetails ?? [], snapshot.isCloseLoading),
RequestItemViewList(snapshot.completedRequests?.requestsDetails ?? [], snapshot.isCompleteLoading),
],
).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.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.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
? snapshot.isOpenLoading
: index == 3
? snapshot.isCloseLoading
? snapshot.isCompleteLoading
: false;
List<RequestsDetails> list = index == 0
@ -44,7 +44,7 @@ class RequestsListPage extends StatelessWidget {
: index == 2
? snapshot.openRequests.requestsDetails
: index == 3
? snapshot.closeRequests.requestsDetails
? snapshot.completedRequests.requestsDetails
: [];
return RequestItemViewList(list, isLoading);
}));

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

Loading…
Cancel
Save