|
|
|
@ -23,17 +23,6 @@ class NotificationsPage extends StatefulWidget {
|
|
|
|
class _NotificationsPageState extends State<NotificationsPage> {
|
|
|
|
class _NotificationsPageState extends State<NotificationsPage> {
|
|
|
|
int currentIndex = 0;
|
|
|
|
int currentIndex = 0;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void didChangeDependencies() {
|
|
|
|
|
|
|
|
super.didChangeDependencies();
|
|
|
|
|
|
|
|
// This will be called when navigating back to this page
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
|
|
|
final model = Provider.of<NotificationViewModel>(context, listen: false);
|
|
|
|
|
|
|
|
currentIndex = 0; // Reset to first page
|
|
|
|
|
|
|
|
_loadNotifications(model, context);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
@ -42,6 +31,7 @@ class _NotificationsPageState extends State<NotificationsPage> {
|
|
|
|
onModelReady: (model) {
|
|
|
|
onModelReady: (model) {
|
|
|
|
// GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: currentIndex, pagingSize: 14, notificationStatusID: 2);
|
|
|
|
// GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: currentIndex, pagingSize: 14, notificationStatusID: 2);
|
|
|
|
// model.getNotifications(getNotificationsRequestModel, context);
|
|
|
|
// model.getNotifications(getNotificationsRequestModel, context);
|
|
|
|
|
|
|
|
|
|
|
|
_loadNotifications(model, context);
|
|
|
|
_loadNotifications(model, context);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
builder: (_, model, widget) => AppScaffold(
|
|
|
|
builder: (_, model, widget) => AppScaffold(
|
|
|
|
@ -93,7 +83,9 @@ class _NotificationsPageState extends State<NotificationsPage> {
|
|
|
|
notification: model.notifications[index],
|
|
|
|
notification: model.notifications[index],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
).then((value) {
|
|
|
|
|
|
|
|
_loadNotifications(model, context);
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
@ -171,13 +163,11 @@ class _NotificationsPageState extends State<NotificationsPage> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _loadNotifications(NotificationViewModel model, BuildContext context) {
|
|
|
|
void _loadNotifications(NotificationViewModel model, BuildContext context) {
|
|
|
|
GetNotificationsRequestModel getNotificationsRequestModel =
|
|
|
|
GetNotificationsRequestModel getNotificationsRequestModel = GetNotificationsRequestModel(
|
|
|
|
GetNotificationsRequestModel(
|
|
|
|
|
|
|
|
currentPage: currentIndex,
|
|
|
|
currentPage: currentIndex,
|
|
|
|
pagingSize: 14,
|
|
|
|
pagingSize: 14,
|
|
|
|
notificationStatusID: 2,
|
|
|
|
notificationStatusID: 2,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
model.getNotifications(getNotificationsRequestModel, context);
|
|
|
|
model.getNotifications(getNotificationsRequestModel, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|