|
|
@ -20,10 +20,11 @@ class NewsFoldersView extends StatelessWidget { |
|
|
|
input: feeds.data == null |
|
|
|
input: feeds.data == null |
|
|
|
? null |
|
|
|
? null |
|
|
|
: folders.data?.map((final folder) { |
|
|
|
: folders.data?.map((final folder) { |
|
|
|
final feedsInFolder = feeds.data!.where((final feed) => feed.folderId == folder.id).toList(); |
|
|
|
final feedsInFolder = feeds.data!.where((final feed) => feed.folderId == folder.id); |
|
|
|
|
|
|
|
final feedCount = feedsInFolder.length; |
|
|
|
final unreadCount = feedsInFolder.fold(0, (final a, final b) => a + b.unreadCount!); |
|
|
|
final unreadCount = feedsInFolder.fold(0, (final a, final b) => a + b.unreadCount!); |
|
|
|
|
|
|
|
|
|
|
|
return (folder, feedsInFolder, unreadCount); |
|
|
|
return (folder, feedCount, unreadCount); |
|
|
|
}).toList(), |
|
|
|
}).toList(), |
|
|
|
builder: (final context, final sorted) => NeonListView<FolderFeedsWrapper>( |
|
|
|
builder: (final context, final sorted) => NeonListView<FolderFeedsWrapper>( |
|
|
|
scrollKey: 'news-folders', |
|
|
|
scrollKey: 'news-folders', |
|
|
@ -42,7 +43,7 @@ class NewsFoldersView extends StatelessWidget { |
|
|
|
final BuildContext context, |
|
|
|
final BuildContext context, |
|
|
|
final FolderFeedsWrapper folderFeedsWrapper, |
|
|
|
final FolderFeedsWrapper folderFeedsWrapper, |
|
|
|
) { |
|
|
|
) { |
|
|
|
final (folder, feeds, unreadCount) = folderFeedsWrapper; |
|
|
|
final (folder, feedCount, unreadCount) = folderFeedsWrapper; |
|
|
|
return ListTile( |
|
|
|
return ListTile( |
|
|
|
title: Text( |
|
|
|
title: Text( |
|
|
|
folder.name, |
|
|
|
folder.name, |
|
|
@ -66,7 +67,7 @@ class NewsFoldersView extends StatelessWidget { |
|
|
|
), |
|
|
|
), |
|
|
|
Center( |
|
|
|
Center( |
|
|
|
child: Text( |
|
|
|
child: Text( |
|
|
|
feeds.length.toString(), |
|
|
|
feedCount.toString(), |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Theme.of(context).colorScheme.onPrimary, |
|
|
|
color: Theme.of(context).colorScheme.onPrimary, |
|
|
|
), |
|
|
|
), |
|
|
|