values are not shown in overview screen. also on my request screens.

main_design2.0
nextwo 2 years ago
parent 08ada0c275
commit 8295fd2b1d

@ -66,7 +66,7 @@ class AllRequestsProvider extends ChangeNotifier {
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
allRequestsAndCount = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
allRequestsAndCount = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
notifyListeners();
} else {
allRequestsAndCount = null;
@ -101,7 +101,7 @@ class AllRequestsProvider extends ChangeNotifier {
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
calendarRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
calendarRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
notifyListeners();
}
isCalendarLoading = false;
@ -130,7 +130,7 @@ class AllRequestsProvider extends ChangeNotifier {
response = await ApiManager.instance.post(URLs.getAllRequestsAndCount, body: body);
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
highPriorityRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
highPriorityRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
notifyListeners();
}
isHighPriorityLoading = false;
@ -160,7 +160,7 @@ class AllRequestsProvider extends ChangeNotifier {
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
overdueRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
overdueRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
notifyListeners();
}
isOverdueLoading = false;
@ -191,7 +191,7 @@ class AllRequestsProvider extends ChangeNotifier {
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
openRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
openRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
notifyListeners();
}
isOpenLoading = false;
@ -221,7 +221,7 @@ class AllRequestsProvider extends ChangeNotifier {
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
inProgressRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
inProgressRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
notifyListeners();
}
isInProgressLoading = false;
@ -251,7 +251,7 @@ class AllRequestsProvider extends ChangeNotifier {
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
completedRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
completedRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
notifyListeners();
}
isCompleteLoading = false;

@ -28,8 +28,10 @@ class _DashboardPageState extends State<DashboardPage> {
@override
void initState() {
super.initState();
Provider.of<AllRequestsProvider>(context, listen: false).getRequests();
Provider.of<NotificationsProvider>(context, listen: false).getSystemNotifications();
WidgetsBinding.instance.addPostFrameCallback((_){
Provider.of<AllRequestsProvider>(context, listen: false).getRequests();
Provider.of<NotificationsProvider>(context, listen: false).getSystemNotifications();
});
}
@override

Loading…
Cancel
Save