From d2f61e77b119ac68f055951b40e591d0a23be48b Mon Sep 17 00:00:00 2001 From: Lea Date: Sun, 1 Jan 2023 02:05:19 +0100 Subject: [PATCH] mark posts as read when opening --- lib/widgets/homepage_post.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/widgets/homepage_post.dart b/lib/widgets/homepage_post.dart index 92eb4c4..4b798a1 100644 --- a/lib/widgets/homepage_post.dart +++ b/lib/widgets/homepage_post.dart @@ -32,11 +32,18 @@ class _HomepagePostState extends State { : Theme.of(context).colorScheme.secondaryContainer.withAlpha(150), ), child: InkWell( - onTap: () { + onTap: () async { Navigator.of(context).push( MaterialPageRoute( builder: (context) => ArticlePage(article: post)), ); + if (!post.isRead) { + await post.api + .request() + .markItem(post, ItemMarkType.read) + .execute(); + setState(() {}); + } }, onLongPress: () async { var theme = Theme.of(context);