@@ -24,47 +24,47 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
2424import 'package:nullability/nullability.dart' ;
2525import 'package:skeletonizer/skeletonizer.dart' ;
2626import 'package:weblibre/core/routing/routes.dart' ;
27- import 'package:weblibre/features/geckoview/domain/entities/states/tab.dart' ;
2827import 'package:weblibre/presentation/controllers/website_title.dart' ;
2928import 'package:weblibre/presentation/widgets/rounded_text.dart' ;
3029
31- class WebsiteFeedTile extends HookConsumerWidget {
32- final TabState initialTabState ;
30+ class WebsiteFeedMenuButton extends HookConsumerWidget {
31+ final String tabId ;
3332
34- const WebsiteFeedTile (this .initialTabState , {super .key});
33+ const WebsiteFeedMenuButton (this .tabId , {super .key});
3534
3635 @override
3736 Widget build (BuildContext context, WidgetRef ref) {
38- final pageInfoAsync = ref.watch (completePageInfoProvider (initialTabState ));
37+ final feedsAsync = ref.watch (websiteFeedProviderProvider (tabId ));
3938
4039 return Skeletonizer (
41- enabled: pageInfoAsync .isLoading && initialTabState.feeds == null ,
42- child: pageInfoAsync .when (
40+ enabled: feedsAsync .isLoading && feedsAsync.value ? .value == null ,
41+ child: feedsAsync .when (
4342 skipLoadingOnReload: true ,
44- data: (info ) {
45- if (info. feeds.isEmpty) {
43+ data: (feeds ) {
44+ if (feeds.value .isEmpty) {
4645 return const SizedBox .shrink ();
4746 }
4847
49- return ListTile (
50- leading : const Icon (Icons .rss_feed),
51- title : const Text ( 'Available Web Feeds' ) ,
52- trailing : RoundedBackground (
48+ return MenuItemButton (
49+ leadingIcon : const Icon (Icons .rss_feed),
50+ closeOnActivate : false ,
51+ trailingIcon : RoundedBackground (
5352 child: Text (
54- info. feeds! .length.toString (),
53+ feeds.value ! .length.toString (),
5554 textAlign: TextAlign .center,
5655 style: TextStyle (
5756 color: Theme .of (context).colorScheme.onPrimary,
5857 ),
5958 ),
6059 ),
61- onTap : () async {
60+ onPressed : () async {
6261 await SelectFeedDialogRoute (
6362 feedsJson: jsonEncode (
64- info. feeds! .map ((feed) => feed.toString ()).toList (),
63+ feeds.value ! .map ((feed) => feed.toString ()).toList (),
6564 ),
6665 ).push (context);
6766 },
67+ child: const Text ('Available Web Feeds' ),
6868 );
6969 },
7070 error: (error, stackTrace) {
@@ -77,11 +77,10 @@ class WebsiteFeedTile extends HookConsumerWidget {
7777 // onRetry: () => ref.refresh(pageInfoProvider(url)),
7878 // );
7979 },
80- loading: () => const ListTile (
81- leading: Icon (Icons .rss_feed),
82- contentPadding: EdgeInsets .zero,
83- title: Text ('Available Web Feeds' ),
84- trailing: Bone .icon (),
80+ loading: () => const MenuItemButton (
81+ leadingIcon: Icon (Icons .rss_feed),
82+ trailingIcon: Bone .icon (),
83+ child: Text ('Available Web Feeds' ),
8584 ),
8685 ),
8786 );
0 commit comments