From e1726e077b63ed4634e5bb01bbeb3c06a2207cc2 Mon Sep 17 00:00:00 2001 From: Fabian Freund Date: Tue, 2 Dec 2025 10:17:22 +0100 Subject: [PATCH] add feed refresh action --- .../presentation/screens/feed_list.dart | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/app/lib/features/web_feed/presentation/screens/feed_list.dart b/app/lib/features/web_feed/presentation/screens/feed_list.dart index df476c70..18a70577 100644 --- a/app/lib/features/web_feed/presentation/screens/feed_list.dart +++ b/app/lib/features/web_feed/presentation/screens/feed_list.dart @@ -18,6 +18,8 @@ * along with this program. If not, see . */ import 'package:flutter/material.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:flutter_material_design_icons/flutter_material_design_icons.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:weblibre/core/routing/routes.dart'; import 'package:weblibre/features/web_feed/domain/providers.dart'; @@ -33,7 +35,37 @@ class FeedListScreen extends HookConsumerWidget { final feeds = ref.watch(feedListProvider); return Scaffold( - appBar: AppBar(title: const Text('Feeds')), + appBar: AppBar( + title: const Text('Feeds'), + actions: [ + HookBuilder( + builder: (context) { + final future = useState?>(null); + final state = useFuture(future.value); + + if (state.connectionState == ConnectionState.waiting) { + return const Padding( + padding: EdgeInsets.all(12.0), + child: SizedBox( + width: 24, + height: 24, + child: CircularProgressIndicator(strokeWidth: 2.0), + ), + ); + } + + return IconButton( + onPressed: () { + future.value = ref + .read(fetchArticlesControllerProvider.notifier) + .fetchAllArticles(); + }, + icon: const Icon(MdiIcons.cloudSync), + ); + }, + ), + ], + ), body: feeds.when( skipLoadingOnReload: true, data: (feeds) {