Add pull-to-refresh to the notifications list

The devices list already supported pull-to-refresh; mirror that on the
notifications list by wrapping its CustomScrollView in a RefreshIndicator
with AlwaysScrollableScrollPhysics. Keep the existing list visible during
a refresh (_isLoading = _items.isEmpty) instead of flashing the skeleton,
matching the devices list behaviour.

Add widget tests covering pull-to-refresh for both lists.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-06-04 18:02:07 -04:00
co-authored by Claude Opus 4.8
parent 7b8a33606c
commit 8b8fa5ce89
4 changed files with 80 additions and 8 deletions
+11 -7
View File
@@ -126,7 +126,7 @@ class _NotificationsListState extends State<NotificationsList>
final token = CancelToken();
_fetchToken = token;
setState(() {
_isLoading = true;
_isLoading = _items.isEmpty;
_error = null;
});
try {
@@ -217,12 +217,16 @@ class _NotificationsListState extends State<NotificationsList>
children: [
_buildNotificationsHeader(context),
Expanded(
child: CustomScrollView(
controller: _scrollController,
slivers: [
..._buildNotificationSlivers(context),
...widget.trailingSlivers,
],
child: RefreshIndicator(
onRefresh: () => _fetchPage(_currentPage),
child: CustomScrollView(
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
..._buildNotificationSlivers(context),
...widget.trailingSlivers,
],
),
),
),
],