feat: improve explanation of update being unusable

This commit is contained in:
Ushie 2022-10-20 00:15:48 +03:00
parent ac79765372
commit caa9694543
No known key found for this signature in database
GPG Key ID: 0EF73F1CA38B2D5F
5 changed files with 79 additions and 51 deletions

View File

@ -16,6 +16,7 @@
"patchedSubtitle": "Patched Applications", "patchedSubtitle": "Patched Applications",
"updatesAvailable": "Updates available", "updatesAvailable": "Updates available",
"noUpdates": "No updates available", "noUpdates": "No updates available",
"WIP": "Work In Progress",
"noInstallations": "No patched applications installed", "noInstallations": "No patched applications installed",
"installed": "Installed", "installed": "Installed",
"updateDialogTitle": "Update Manager", "updateDialogTitle": "Update Manager",

View File

@ -67,20 +67,20 @@ class HomeView extends StatelessWidget {
const SizedBox(height: 8), const SizedBox(height: 8),
Row( Row(
children: <Widget>[ children: <Widget>[
DashboardChip(
label: I18nText('homeView.updatesAvailable'),
isSelected: model.showUpdatableApps,
onSelected: (value) {
model.toggleUpdatableApps(true);
},
),
const SizedBox(width: 10),
DashboardChip( DashboardChip(
label: I18nText('homeView.installed'), label: I18nText('homeView.installed'),
isSelected: !model.showUpdatableApps, isSelected: !model.showUpdatableApps,
onSelected: (value) { onSelected: (value) {
model.toggleUpdatableApps(false); model.toggleUpdatableApps(false);
}, },
),
const SizedBox(width: 10),
DashboardChip(
label: I18nText('homeView.updatesAvailable'),
isSelected: model.showUpdatableApps,
onSelected: (value) {
model.toggleUpdatableApps(true);
},
) )
], ],
), ),

View File

@ -29,7 +29,7 @@ class HomeViewModel extends BaseViewModel {
final Toast _toast = locator<Toast>(); final Toast _toast = locator<Toast>();
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
DateTime? _lastUpdate; DateTime? _lastUpdate;
bool showUpdatableApps = true; bool showUpdatableApps = false;
List<PatchedApplication> patchedInstalledApps = []; List<PatchedApplication> patchedInstalledApps = [];
List<PatchedApplication> patchedUpdatableApps = []; List<PatchedApplication> patchedUpdatableApps = [];

View File

@ -14,47 +14,74 @@ class AvailableUpdatesCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return apps.isEmpty return CustomCard(
? CustomCard( child: Center(
child: Center( child: Column(
child: Column( children: <Widget>[
children: <Widget>[ Icon(
Icon( size: 40,
size: 40, Icons.update_disabled,
Icons.update_disabled, color: Theme.of(context).colorScheme.secondary,
color: Theme.of(context).colorScheme.secondary,
),
const SizedBox(height: 16),
I18nText(
'homeView.noUpdates',
child: Text(
'',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1!.copyWith(
color: Theme.of(context).colorScheme.secondary,
),
),
)
],
),
), ),
) const SizedBox(height: 16),
: ListView( I18nText(
shrinkWrap: true, 'homeView.WIP',
padding: EdgeInsets.zero, child: Text(
physics: const NeverScrollableScrollPhysics(), '',
children: apps textAlign: TextAlign.center,
.map((app) => ApplicationItem( style: Theme.of(context).textTheme.subtitle1!.copyWith(
icon: app.icon, color: Theme.of(context).colorScheme.secondary,
name: app.name, ),
patchDate: app.patchDate, ),
changelog: app.changelog, )
isUpdatableApp: true, ],
//TODO: Find a better way to do update functionality ),
onPressed: () => ),
locator<HomeViewModel>().updatesAreDisabled(), );
)) // return apps.isEmpty
.toList(), // ? CustomCard(
); // child: Center(
// child: Column(
// children: <Widget>[
// Icon(
// size: 40,
// Icons.update_disabled,
// color: Theme.of(context).colorScheme.secondary,
// ),
// const SizedBox(height: 16),
// I18nText(
// 'homeView.noUpdates',
// child: Text(
// '',
// textAlign: TextAlign.center,
// style: Theme.of(context).textTheme.subtitle1!.copyWith(
// color: Theme.of(context).colorScheme.secondary,
// ),
// ),
// )
// ],
// ),
// ),
// )
// : ListView(
// shrinkWrap: true,
// padding: EdgeInsets.zero,
// physics: const NeverScrollableScrollPhysics(),
// children: apps
// .map((app) => ApplicationItem(
// icon: app.icon,
// name: app.name,
// patchDate: app.patchDate,
// changelog: app.changelog,
// isUpdatableApp: true,
// //TODO: Find a better way to do update functionality
// onPressed: () {}
// // () =>
// // locator<HomeViewModel>().navigateToPatcher(
// // app,
// // ),
// ))
// .toList(),
// );
} }
} }

View File

@ -110,7 +110,7 @@ class _ApplicationItemState extends State<ApplicationItem>
children: <Widget>[ children: <Widget>[
CustomMaterialButton( CustomMaterialButton(
label: widget.isUpdatableApp label: widget.isUpdatableApp
? I18nText('applicationItem.infoButton') ? I18nText('applicationItem.patchButton')
: I18nText('applicationItem.infoButton'), : I18nText('applicationItem.infoButton'),
onPressed: widget.onPressed, onPressed: widget.onPressed,
), ),