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();
return GeneratedFormModal(
title: tr('additionalOptions'),
items: items,
);
title: tr('additionalOptions'), 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(
onPressed: (app?.app.installedVersion == null ||
app?.app.installedVersion != app?.app.latestVersion) &&
@@ -402,7 +409,13 @@ class _AppPageState extends State<AppPage> {
icon: const Icon(Icons.more_horiz),
tooltip: tr('more')),
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),
Expanded(
child: TextButton(