Merge remote-tracking branch 'origin/main_design2.0' into main_design2.0

main_design2.0
zaid_daoud 2 years ago
commit f07a70462a

@ -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),
],
),
),

@ -99,7 +99,7 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: selectedRequest == index ? const Color(0xFFEAF1F4) : Colors.white,
color: selectedRequest == index ? Color(0xFFEAF1F4):Colors.white,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: selectedRequest == index ? Color(0xFF4A8DB7) : Colors.white),
borderRadius: BorderRadius.circular(7),
@ -113,7 +113,7 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
)
],
),
child: Text(requestsList[index], style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, height: 1)),
child: Text(requestsList[index], style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral20 : AppColor.neutral50, height: 1)),
).onPress(() {
if (selectedRequest != index) {
setState(() {

@ -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,

@ -32,11 +32,11 @@ class ADatePicker extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
label.tinyFont(context),
((date?.toIso8601String()?.split("T")?.first) ?? context.translation.pickADate).bodyText(context).custom(color: AppColor.neutral50),
((date?.toIso8601String()?.split("T")?.first) ?? context.translation.pickADate).bodyText(context).custom(color: context.isDark?AppColor.neutral10: AppColor.neutral50),
],
).expanded,
16.width,
"calender".toSvgAsset(width: 20),
"calender".toSvgAsset(width: 20, color: context.isDark? AppColor.neutral10:null),
],
),
).onPress(enable

Loading…
Cancel
Save