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",
"updatesAvailable": "Updates available",
"noUpdates": "No updates available",
"WIP": "Work In Progress",
"noInstallations": "No patched applications installed",
"installed": "Installed",
"updateDialogTitle": "Update Manager",

View File

@ -67,20 +67,20 @@ class HomeView extends StatelessWidget {
const SizedBox(height: 8),
Row(
children: <Widget>[
DashboardChip(
label: I18nText('homeView.updatesAvailable'),
isSelected: model.showUpdatableApps,
onSelected: (value) {
model.toggleUpdatableApps(true);
},
),
const SizedBox(width: 10),
DashboardChip(
label: I18nText('homeView.installed'),
isSelected: !model.showUpdatableApps,
onSelected: (value) {
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 flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
DateTime? _lastUpdate;
bool showUpdatableApps = true;
bool showUpdatableApps = false;
List<PatchedApplication> patchedInstalledApps = [];
List<PatchedApplication> patchedUpdatableApps = [];

View File

@ -14,47 +14,74 @@ class AvailableUpdatesCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return apps.isEmpty
? 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,
),
),
)
],
),
return CustomCard(
child: Center(
child: Column(
children: <Widget>[
Icon(
size: 40,
Icons.update_disabled,
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>().updatesAreDisabled(),
))
.toList(),
);
const SizedBox(height: 16),
I18nText(
'homeView.WIP',
child: Text(
'',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1!.copyWith(
color: Theme.of(context).colorScheme.secondary,
),
),
)
],
),
),
);
// return apps.isEmpty
// ? 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>[
CustomMaterialButton(
label: widget.isUpdatableApp
? I18nText('applicationItem.infoButton')
? I18nText('applicationItem.patchButton')
: I18nText('applicationItem.infoButton'),
onPressed: widget.onPressed,
),