mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
feat: add empty cards in app listings of the home view
This commit is contained in:
parent
6487284dd2
commit
7723bb717c
3 changed files with 95 additions and 32 deletions
|
@ -10,6 +10,8 @@
|
||||||
"updatesSubtitle": "Updates",
|
"updatesSubtitle": "Updates",
|
||||||
"patchedSubtitle": "Patched Applications",
|
"patchedSubtitle": "Patched Applications",
|
||||||
"updatesAvailable": "Updates Available",
|
"updatesAvailable": "Updates Available",
|
||||||
|
"noUpdates": "No updates available",
|
||||||
|
"noInstallations": "No patched apps installed",
|
||||||
"installed": "Installed",
|
"installed": "Installed",
|
||||||
"notificationTitle": "ReVanced Manager was updated!",
|
"notificationTitle": "ReVanced Manager was updated!",
|
||||||
"notificationText": "Tap to open the app",
|
"notificationText": "Tap to open the app",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_i18n/widgets/I18nText.dart';
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||||
|
@ -12,22 +13,52 @@ class AvailableUpdatesCard extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListView(
|
return apps.isEmpty
|
||||||
shrinkWrap: true,
|
? Container(
|
||||||
padding: EdgeInsets.zero,
|
decoration: BoxDecoration(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
borderRadius: BorderRadius.circular(12),
|
||||||
children: apps
|
color: Theme.of(context).colorScheme.primary,
|
||||||
.map((app) => ApplicationItem(
|
),
|
||||||
icon: app.icon,
|
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
|
||||||
name: app.name,
|
child: Center(
|
||||||
patchDate: app.patchDate,
|
child: Column(
|
||||||
changelog: app.changelog,
|
children: [
|
||||||
isUpdatableApp: true,
|
Icon(
|
||||||
onPressed: () => locator<HomeViewModel>().navigateToPatcher(
|
Icons.update_disabled,
|
||||||
app,
|
size: 40,
|
||||||
),
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
))
|
),
|
||||||
.toList(),
|
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,
|
||||||
|
onPressed: () =>
|
||||||
|
locator<HomeViewModel>().navigateToPatcher(
|
||||||
|
app,
|
||||||
|
),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:device_apps/device_apps.dart';
|
import 'package:device_apps/device_apps.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||||
|
@ -13,20 +14,49 @@ class InstalledAppsCard extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListView(
|
return apps.isEmpty
|
||||||
shrinkWrap: true,
|
? Container(
|
||||||
padding: EdgeInsets.zero,
|
decoration: BoxDecoration(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
borderRadius: BorderRadius.circular(12),
|
||||||
children: apps
|
color: Theme.of(context).colorScheme.primary,
|
||||||
.map((app) => ApplicationItem(
|
),
|
||||||
icon: app.icon,
|
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
|
||||||
name: app.name,
|
child: Center(
|
||||||
patchDate: app.patchDate,
|
child: Column(
|
||||||
changelog: app.changelog,
|
children: [
|
||||||
isUpdatableApp: false,
|
Icon(
|
||||||
onPressed: () => DeviceApps.openApp(app.packageName),
|
Icons.file_download_off,
|
||||||
))
|
size: 40,
|
||||||
.toList(),
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
);
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
I18nText(
|
||||||
|
'homeView.noInstallations',
|
||||||
|
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: false,
|
||||||
|
onPressed: () => DeviceApps.openApp(app.packageName),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue