|
|
@ -42,42 +42,8 @@ class NewsFeedsView extends StatelessWidget { |
|
|
|
final BuildContext context, |
|
|
|
final BuildContext context, |
|
|
|
final news.Feed feed, |
|
|
|
final news.Feed feed, |
|
|
|
final List<news.Folder> folders, |
|
|
|
final List<news.Folder> folders, |
|
|
|
) => |
|
|
|
) { |
|
|
|
ListTile( |
|
|
|
Widget trailing = PopupMenuButton<NewsFeedAction>( |
|
|
|
title: Text( |
|
|
|
|
|
|
|
feed.title, |
|
|
|
|
|
|
|
style: feed.unreadCount! == 0 |
|
|
|
|
|
|
|
? Theme.of(context).textTheme.titleMedium!.copyWith(color: Theme.of(context).disabledColor) |
|
|
|
|
|
|
|
: null, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
subtitle: feed.unreadCount! > 0 |
|
|
|
|
|
|
|
? Text(NewsLocalizations.of(context).articlesUnread(feed.unreadCount!)) |
|
|
|
|
|
|
|
: const SizedBox(), |
|
|
|
|
|
|
|
leading: NewsFeedIcon(feed: feed), |
|
|
|
|
|
|
|
trailing: Row( |
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
if (feed.updateErrorCount > 0) ...[ |
|
|
|
|
|
|
|
IconButton( |
|
|
|
|
|
|
|
onPressed: () async { |
|
|
|
|
|
|
|
await showDialog<void>( |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
builder: (final context) => NewsFeedUpdateErrorDialog( |
|
|
|
|
|
|
|
feed: feed, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
tooltip: NewsLocalizations.of(context).feedShowErrorMessage, |
|
|
|
|
|
|
|
iconSize: 30, |
|
|
|
|
|
|
|
icon: Text( |
|
|
|
|
|
|
|
feed.updateErrorCount.toString(), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.error, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
PopupMenuButton<NewsFeedAction>( |
|
|
|
|
|
|
|
itemBuilder: (final context) => [ |
|
|
|
itemBuilder: (final context) => [ |
|
|
|
PopupMenuItem( |
|
|
|
PopupMenuItem( |
|
|
|
value: NewsFeedAction.showURL, |
|
|
|
value: NewsFeedAction.showURL, |
|
|
@ -145,9 +111,46 @@ class NewsFeedsView extends StatelessWidget { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (feed.updateErrorCount > 0) { |
|
|
|
|
|
|
|
trailing = Row( |
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
IconButton( |
|
|
|
|
|
|
|
onPressed: () async { |
|
|
|
|
|
|
|
await showDialog<void>( |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
builder: (final context) => NewsFeedUpdateErrorDialog( |
|
|
|
|
|
|
|
feed: feed, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
tooltip: NewsLocalizations.of(context).feedShowErrorMessage, |
|
|
|
|
|
|
|
iconSize: 30, |
|
|
|
|
|
|
|
icon: Text( |
|
|
|
|
|
|
|
feed.updateErrorCount.toString(), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.error, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
trailing, |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ListTile( |
|
|
|
|
|
|
|
title: Text( |
|
|
|
|
|
|
|
feed.title, |
|
|
|
|
|
|
|
style: feed.unreadCount! == 0 |
|
|
|
|
|
|
|
? Theme.of(context).textTheme.titleMedium!.copyWith(color: Theme.of(context).disabledColor) |
|
|
|
|
|
|
|
: null, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
subtitle: feed.unreadCount! > 0 |
|
|
|
|
|
|
|
? Text(NewsLocalizations.of(context).articlesUnread(feed.unreadCount!)) |
|
|
|
|
|
|
|
: const SizedBox(), |
|
|
|
|
|
|
|
leading: NewsFeedIcon(feed: feed), |
|
|
|
|
|
|
|
trailing: trailing, |
|
|
|
onLongPress: () { |
|
|
|
onLongPress: () { |
|
|
|
if (feed.unreadCount! > 0) { |
|
|
|
if (feed.unreadCount! > 0) { |
|
|
|
bloc.markFeedAsRead(feed.id); |
|
|
|
bloc.markFeedAsRead(feed.id); |
|
|
@ -165,6 +168,7 @@ class NewsFeedsView extends StatelessWidget { |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum NewsFeedAction { |
|
|
|
enum NewsFeedAction { |
|
|
|
showURL, |
|
|
|
showURL, |
|
|
|