mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-04-30 22:14:25 +02:00
feat: display app's patch count in appcard
This commit is contained in:
parent
d78868b462
commit
8d4e4ba6c9
@ -92,6 +92,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
|||||||
name: app.appName,
|
name: app.appName,
|
||||||
pkgName: app.packageName,
|
pkgName: app.packageName,
|
||||||
icon: app.icon,
|
icon: app.icon,
|
||||||
|
patchesCount: model.patchesCount(app.packageName),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
model.selectApp(app);
|
model.selectApp(app);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
@ -15,6 +15,9 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
final Toast _toast = locator<Toast>();
|
final Toast _toast = locator<Toast>();
|
||||||
final List<ApplicationWithIcon> apps = [];
|
final List<ApplicationWithIcon> apps = [];
|
||||||
bool noApps = false;
|
bool noApps = false;
|
||||||
|
int patchesCount(String packageName) {
|
||||||
|
return _patcherAPI.getFilteredPatches(packageName).length;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
apps.addAll(await _patcherAPI.getFilteredInstalledApps());
|
apps.addAll(await _patcherAPI.getFilteredInstalledApps());
|
||||||
|
@ -6,6 +6,7 @@ class InstalledAppItem extends StatefulWidget {
|
|||||||
final String name;
|
final String name;
|
||||||
final String pkgName;
|
final String pkgName;
|
||||||
final Uint8List icon;
|
final Uint8List icon;
|
||||||
|
final int patchesCount;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
|
|
||||||
const InstalledAppItem({
|
const InstalledAppItem({
|
||||||
@ -13,6 +14,7 @@ class InstalledAppItem extends StatefulWidget {
|
|||||||
required this.name,
|
required this.name,
|
||||||
required this.pkgName,
|
required this.pkgName,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
|
required this.patchesCount,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@ -45,14 +47,29 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Row(
|
||||||
widget.name,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
maxLines: 2,
|
children: <Widget>[
|
||||||
overflow: TextOverflow.visible,
|
Text(
|
||||||
style: const TextStyle(
|
widget.name,
|
||||||
fontSize: 16,
|
maxLines: 2,
|
||||||
fontWeight: FontWeight.w500,
|
overflow: TextOverflow.visible,
|
||||||
),
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(
|
||||||
|
widget.patchesCount == 1
|
||||||
|
? "${widget.patchesCount} patch"
|
||||||
|
: "${widget.patchesCount} patches",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 8,
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(widget.pkgName),
|
Text(widget.pkgName),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user