From c2ef1245ac09e5baae77c4b0bc3ee34bf2ed5fe9 Mon Sep 17 00:00:00 2001 From: franzap <_@franzap.com> Date: Tue, 18 Feb 2025 13:25:56 -0300 Subject: [PATCH] Add a warning for old latest release, closes #100 --- lib/widgets/release_card.dart | 38 ++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/lib/widgets/release_card.dart b/lib/widgets/release_card.dart index d1c2350..04fd5d7 100644 --- a/lib/widgets/release_card.dart +++ b/lib/widgets/release_card.dart @@ -32,6 +32,24 @@ class ReleaseCard extends StatelessWidget { Text(release.version, style: TextStyle(fontSize: 26, fontWeight: FontWeight.bold)), Gap(10), + if (DateTime.now().difference(release.event.createdAt) > + Duration(days: 365)) + Padding( + padding: const EdgeInsets.all(8), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.warning_rounded, size: 18), + Gap(10), + Text('This release is over a year old', + style: TextStyle( + color: Colors.red[100], + fontWeight: FontWeight.bold, + )), + ], + ), + ), + Gap(10), release.releaseNotes.length < 3000 ? MarkdownBody( data: release.releaseNotes, @@ -56,16 +74,6 @@ class ReleaseCard extends StatelessWidget { children: [Text('Version'), Text(metadata.version!)], ), ), - Padding( - padding: const EdgeInsets.all(8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text('Date'), - Text(formatter.format(release.event.createdAt)), - ], - ), - ), if (metadata != null) Padding( padding: const EdgeInsets.all(8), @@ -77,6 +85,16 @@ class ReleaseCard extends StatelessWidget { ], ), ), + Padding( + padding: const EdgeInsets.all(8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text('Date'), + Text(formatter.format(release.event.createdAt)), + ], + ), + ), ], ), ),