App page 'reset install status' button shows if appropriate

This commit is contained in:
Imran Remtulla
2023-04-22 21:40:15 -04:00
parent 78141998f4
commit 9f2db4e4e7

View File

@@ -268,9 +268,7 @@ class _AppPageState extends State<AppPage> {
}).toList(); }).toList();
return GeneratedFormModal( return GeneratedFormModal(
title: tr('additionalOptions'), title: tr('additionalOptions'), items: items);
items: items,
);
}); });
} }
@@ -307,6 +305,15 @@ class _AppPageState extends State<AppPage> {
} }
} }
getResetInstallStatusButton() => TextButton(
onPressed: app?.app == null
? null
: () {
app!.app.installedVersion = null;
appsProvider.saveApps([app.app]);
},
child: Text(tr('resetInstallStatus')));
getInstallOrUpdateButton() => TextButton( getInstallOrUpdateButton() => TextButton(
onPressed: (app?.app.installedVersion == null || onPressed: (app?.app.installedVersion == null ||
app?.app.installedVersion != app?.app.latestVersion) && app?.app.installedVersion != app?.app.latestVersion) &&
@@ -402,7 +409,13 @@ class _AppPageState extends State<AppPage> {
icon: const Icon(Icons.more_horiz), icon: const Icon(Icons.more_horiz),
tooltip: tr('more')), tooltip: tr('more')),
const SizedBox(width: 16.0), const SizedBox(width: 16.0),
Expanded(child: getInstallOrUpdateButton()), Expanded(
child: !isVersionDetectionStandard &&
app?.app.installedVersion != null &&
app?.app.installedVersion ==
app?.app.latestVersion
? getResetInstallStatusButton()
: getInstallOrUpdateButton()),
const SizedBox(width: 16.0), const SizedBox(width: 16.0),
Expanded( Expanded(
child: TextButton( child: TextButton(