|
|
@ -2,34 +2,35 @@ part of '../neon_notifications.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class NotificationsMainPage extends StatefulWidget { |
|
|
|
class NotificationsMainPage extends StatefulWidget { |
|
|
|
const NotificationsMainPage({ |
|
|
|
const NotificationsMainPage({ |
|
|
|
required this.bloc, |
|
|
|
|
|
|
|
super.key, |
|
|
|
super.key, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
final NotificationsBloc bloc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
State<NotificationsMainPage> createState() => _NotificationsMainPageState(); |
|
|
|
State<NotificationsMainPage> createState() => _NotificationsMainPageState(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class _NotificationsMainPageState extends State<NotificationsMainPage> { |
|
|
|
class _NotificationsMainPageState extends State<NotificationsMainPage> { |
|
|
|
|
|
|
|
late NotificationsBloc bloc; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
|
|
widget.bloc.errors.listen((final error) { |
|
|
|
bloc = Provider.of<NotificationsBloc>(context, listen: false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bloc.errors.listen((final error) { |
|
|
|
NeonException.showSnackbar(context, error); |
|
|
|
NeonException.showSnackbar(context, error); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(final BuildContext context) => ResultBuilder<List<NextcloudNotificationsNotification>>( |
|
|
|
Widget build(final BuildContext context) => ResultBuilder<List<NextcloudNotificationsNotification>>( |
|
|
|
stream: widget.bloc.notifications, |
|
|
|
stream: bloc.notifications, |
|
|
|
builder: (final context, final notifications) => Scaffold( |
|
|
|
builder: (final context, final notifications) => Scaffold( |
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
floatingActionButton: FloatingActionButton( |
|
|
|
floatingActionButton: FloatingActionButton( |
|
|
|
onPressed: () async { |
|
|
|
onPressed: () async { |
|
|
|
widget.bloc.deleteAllNotifications(); |
|
|
|
bloc.deleteAllNotifications(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
tooltip: AppLocalizations.of(context).notificationsDismissAll, |
|
|
|
tooltip: AppLocalizations.of(context).notificationsDismissAll, |
|
|
|
child: const Icon(MdiIcons.checkAll), |
|
|
|
child: const Icon(MdiIcons.checkAll), |
|
|
@ -40,7 +41,7 @@ class _NotificationsMainPageState extends State<NotificationsMainPage> { |
|
|
|
items: notifications.data, |
|
|
|
items: notifications.data, |
|
|
|
isLoading: notifications.loading, |
|
|
|
isLoading: notifications.loading, |
|
|
|
error: notifications.error, |
|
|
|
error: notifications.error, |
|
|
|
onRefresh: widget.bloc.refresh, |
|
|
|
onRefresh: bloc.refresh, |
|
|
|
builder: _buildNotification, |
|
|
|
builder: _buildNotification, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -113,7 +114,7 @@ class _NotificationsMainPageState extends State<NotificationsMainPage> { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLongPress: () { |
|
|
|
onLongPress: () { |
|
|
|
widget.bloc.deleteNotification(notification.notificationId); |
|
|
|
bloc.deleteNotification(notification.notificationId); |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|