1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +00:00

Automatically refresh the list of notifications when required

This commit is contained in:
Pierre HUBERT 2020-04-18 14:17:14 +02:00
parent 1b13a90615
commit 0700014b3a

View File

@ -1,3 +1,4 @@
import 'package:comunic/helpers/events_helper.dart';
import 'package:comunic/helpers/groups_helper.dart'; import 'package:comunic/helpers/groups_helper.dart';
import 'package:comunic/helpers/notifications_helper.dart'; import 'package:comunic/helpers/notifications_helper.dart';
import 'package:comunic/helpers/users_helper.dart'; import 'package:comunic/helpers/users_helper.dart';
@ -7,6 +8,7 @@ import 'package:comunic/lists/users_list.dart';
import 'package:comunic/models/notification.dart' as n; import 'package:comunic/models/notification.dart' as n;
import 'package:comunic/ui/routes/main_route.dart'; import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/widgets/account_image_widget.dart'; import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/ui/widgets/safe_state.dart';
import 'package:comunic/utils/date_utils.dart'; import 'package:comunic/utils/date_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/navigation_utils.dart'; import 'package:comunic/utils/navigation_utils.dart';
@ -26,7 +28,7 @@ class NotificationsScreen extends StatefulWidget {
_NotificationsScreenState createState() => _NotificationsScreenState(); _NotificationsScreenState createState() => _NotificationsScreenState();
} }
class _NotificationsScreenState extends State<NotificationsScreen> { class _NotificationsScreenState extends SafeState<NotificationsScreen> {
NotificationsList _list; NotificationsList _list;
UsersList _users; UsersList _users;
GroupsList _groups; GroupsList _groups;
@ -62,6 +64,14 @@ class _NotificationsScreenState extends State<NotificationsScreen> {
} }
} }
@override
void initState() {
super.initState();
this.listenChangeState<NewNumberNotifsEvent>(
(d) => _refreshKey.currentState.show());
}
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();