diff --git a/packages/neon/neon_news/lib/sort/folders.dart b/packages/neon/neon_news/lib/sort/folders.dart index b769ad8b..05cf9813 100644 --- a/packages/neon/neon_news/lib/sort/folders.dart +++ b/packages/neon/neon_news/lib/sort/folders.dart @@ -3,7 +3,7 @@ part of '../neon_news.dart'; final foldersSortBox = SortBox( { FoldersSortProperty.alphabetical: (final folderFeedsWrapper) => folderFeedsWrapper.folder.name.toLowerCase(), - FoldersSortProperty.unreadCount: (final folderFeedsWrapper) => feedsUnreadCountSum(folderFeedsWrapper.feeds), + FoldersSortProperty.unreadCount: (final folderFeedsWrapper) => folderFeedsWrapper.feedsUnreadCountSum, }, { FoldersSortProperty.alphabetical: Box(FoldersSortProperty.unreadCount, SortBoxOrder.descending), @@ -19,6 +19,5 @@ class FolderFeedsWrapper { final NextcloudNewsFolder folder; final List feeds; + int get feedsUnreadCountSum => feeds.fold(0, (final a, final b) => a + b.unreadCount!); } - -int feedsUnreadCountSum(final List feeds) => feeds.fold(0, (final a, final b) => a + b.unreadCount!); diff --git a/packages/neon/neon_news/lib/widgets/folders_view.dart b/packages/neon/neon_news/lib/widgets/folders_view.dart index df8e457d..6b351aee 100644 --- a/packages/neon/neon_news/lib/widgets/folders_view.dart +++ b/packages/neon/neon_news/lib/widgets/folders_view.dart @@ -44,7 +44,7 @@ class NewsFoldersView extends StatelessWidget { final BuildContext context, final FolderFeedsWrapper folderFeedsWrapper, ) { - final unreadCount = feedsUnreadCountSum(folderFeedsWrapper.feeds); + final unreadCount = folderFeedsWrapper.feedsUnreadCountSum; return ListTile( title: Text( folderFeedsWrapper.folder.name,