diff --git a/lib/riverpod_controllers/notification_services.g.dart b/lib/riverpod_controllers/notification_services.g.dart index 6dfa4f9..f337631 100644 --- a/lib/riverpod_controllers/notification_services.g.dart +++ b/lib/riverpod_controllers/notification_services.g.dart @@ -7,7 +7,7 @@ part of 'notification_services.dart'; // ************************************************************************** String _$userNotificationsByTypeHash() => - r'11ea5e83e8035073414f5159b2d0db62998882c7'; + r'fe1e04eab091d6e92de866a9888c389024ca3da3'; /// Copied from Dart SDK class _SystemHash { @@ -768,7 +768,7 @@ class _LowHighIdProviderElement } String _$notificationsStoreHash() => - r'390707e411acdeb617105e1baf551e14a1842a39'; + r'b503c0459703f8a1e7f6b4f9697056f22abbda4d'; abstract class _$NotificationsStore extends BuildlessNotifier> { diff --git a/lib/screens/notifications_screen.dart b/lib/screens/notifications_screen.dart index 124582c..3a4cda2 100644 --- a/lib/screens/notifications_screen.dart +++ b/lib/screens/notifications_screen.dart @@ -87,29 +87,33 @@ class NotificationsScreen extends ConsumerWidget { profile: profile, isRead: true), ]; + final allEntries = [ + TextButton( + onPressed: () async { + await ref + .read(notificationsManagerProvider(profile).notifier) + .loadNewerNotifications(); + }, + child: const Text('Load newer notifications')), + ...notificationEntries, + TextButton( + onPressed: () async { + await ref + .read(notificationsManagerProvider(profile).notifier) + .loadOlderNotifications(); + }, + child: const Text('Load older notifications')) + ]; + body = RefreshIndicator( onRefresh: () async => ref .read(notificationsManagerProvider(profile).notifier) .refreshNotifications(), child: ResponsiveMaxWidth( - child: ListView( - children: [ - TextButton( - onPressed: () async { - await ref - .read(notificationsManagerProvider(profile).notifier) - .loadNewerNotifications(); - }, - child: const Text('Load newer notifications')), - ...notificationEntries, - TextButton( - onPressed: () async { - await ref - .read(notificationsManagerProvider(profile).notifier) - .loadOlderNotifications(); - }, - child: const Text('Load older notifications')) - ], + child: ListView.separated( + itemBuilder: (_, index) => allEntries[index], + separatorBuilder: (_, __) => _standardDivider, + itemCount: allEntries.length, ), )); } @@ -174,10 +178,7 @@ class _NotificationsByTypeListElement extends ConsumerWidget { shrinkWrap: true, itemBuilder: (_, index) => NotificationControl(notification: notifications[index]), - separatorBuilder: (_, __) => const Divider( - color: Colors.black54, - height: 0.0, - ), + separatorBuilder: (_, __) => _standardDivider, itemCount: notifications.length, ); } @@ -198,10 +199,7 @@ class _NotificationsByReadStatusListElement extends ConsumerWidget { shrinkWrap: true, itemBuilder: (_, index) => NotificationControl(notification: notifications[index]), - separatorBuilder: (_, __) => const Divider( - color: Colors.black54, - height: 0.0, - ), + separatorBuilder: (_, __) => _standardDivider, itemCount: notifications.length, ); } @@ -218,3 +216,8 @@ final orderedNotificationTypes = [ NotificationType.favourite, NotificationType.unknown, ]; + +const _standardDivider = Divider( + color: Colors.black54, + height: 0.0, +);