From 3951108bc92171ac3f434bfd77d834c424fe878e Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Sun, 4 Dec 2022 17:12:10 -0500 Subject: [PATCH] Refactor - removed duplicate code --- lib/pages/apps.dart | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/lib/pages/apps.dart b/lib/pages/apps.dart index 5e4f9a9..1a19455 100644 --- a/lib/pages/apps.dart +++ b/lib/pages/apps.dart @@ -219,6 +219,9 @@ class AppsPageState extends State { SliverList( delegate: SliverChildBuilderDelegate( (BuildContext context, int index) { + String? changesUrl = SourceProvider() + .getSource(sortedApps[index].app.url) + .changeLogPageFromStandardUrl(sortedApps[index].app.url); return ListTile( tileColor: sortedApps[index].app.pinned ? Colors.grey.withOpacity(0.1) @@ -274,22 +277,10 @@ class AppsPageState extends State { sortedApps[index].app.installedVersion != sortedApps[index].app.latestVersion ? GestureDetector( - onTap: SourceProvider() - .getSource( - sortedApps[index].app.url) - .changeLogPageFromStandardUrl( - sortedApps[index].app.url) == - null + onTap: changesUrl == null ? null : () { - launchUrlString( - SourceProvider() - .getSource( - sortedApps[index].app.url) - .changeLogPageFromStandardUrl( - sortedApps[index] - .app - .url)!, + launchUrlString(changesUrl, mode: LaunchMode .externalApplication); }, @@ -297,15 +288,7 @@ class AppsPageState extends State { '${tr('updateAvailable')}${sortedApps[index].app.trackOnly ? ' ${tr('estimateInBracketsShort')}' : ''}', style: TextStyle( fontStyle: FontStyle.italic, - decoration: SourceProvider() - .getSource(sortedApps[index] - .app - .url) - .changeLogPageFromStandardUrl( - sortedApps[index] - .app - .url) == - null + decoration: changesUrl == null ? TextDecoration.none : TextDecoration.underline), ))