From 0079e74d77b9334b2dee4573712d7049524523c7 Mon Sep 17 00:00:00 2001 From: Aabed Khan <39409020+TheAabedKhan@users.noreply.github.com> Date: Mon, 12 Jun 2023 05:50:02 +0545 Subject: [PATCH] feat: clarify suggested version in app list (#934) Co-authored-by: Aunali321 <48486084+Aunali321@users.noreply.github.com> --- assets/i18n/en_US.json | 2 + .../views/app_selector/app_selector_view.dart | 1 + .../appSelectorView/installed_app_item.dart | 43 +++++++++++++------ .../not_installed_app_item.dart | 4 +- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/assets/i18n/en_US.json b/assets/i18n/en_US.json index 03b28c54..ae4e5360 100644 --- a/assets/i18n/en_US.json +++ b/assets/i18n/en_US.json @@ -4,6 +4,8 @@ "updateButton": "Update", "enabledLabel": "Enabled", "disabledLabel": "Disabled", + "installed":"Installed: {version}", + "suggested":"Suggested: {version}", "yesButton": "Yes", "noButton": "No", "warning": "Warning", diff --git a/lib/ui/views/app_selector/app_selector_view.dart b/lib/ui/views/app_selector/app_selector_view.dart index 3404b08e..2f6ddda2 100644 --- a/lib/ui/views/app_selector/app_selector_view.dart +++ b/lib/ui/views/app_selector/app_selector_view.dart @@ -111,6 +111,7 @@ class _AppSelectorViewState extends State { model.getSuggestedVersion( app.packageName, ), + installedVersion: app.versionName!, onTap: () => model.canSelectInstalled(context, app.packageName), ), ) diff --git a/lib/ui/widgets/appSelectorView/installed_app_item.dart b/lib/ui/widgets/appSelectorView/installed_app_item.dart index 27bed6cd..80266e3f 100644 --- a/lib/ui/widgets/appSelectorView/installed_app_item.dart +++ b/lib/ui/widgets/appSelectorView/installed_app_item.dart @@ -1,6 +1,7 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; +import 'package:flutter_i18n/flutter_i18n.dart'; class InstalledAppItem extends StatefulWidget { const InstalledAppItem({ @@ -10,6 +11,7 @@ class InstalledAppItem extends StatefulWidget { required this.icon, required this.patchesCount, required this.suggestedVersion, + required this.installedVersion, this.onTap, }) : super(key: key); final String name; @@ -17,6 +19,7 @@ class InstalledAppItem extends StatefulWidget { final Uint8List icon; final int patchesCount; final String suggestedVersion; + final String installedVersion; final Function()? onTap; @override @@ -48,25 +51,37 @@ class _InstalledAppItemState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - widget.name, - maxLines: 2, - overflow: TextOverflow.visible, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - const SizedBox(height: 4), - Text(widget.pkgName), Row( children: [ Text( - widget.suggestedVersion.isEmpty - ? 'All versions' - : widget.suggestedVersion, + widget.name, + maxLines: 2, + overflow: TextOverflow.visible, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + ), ), const SizedBox(width: 4), + I18nText(widget.installedVersion.isEmpty + ? 'All versions' + : 'v${widget.installedVersion}'), + ], + ), + Text(widget.pkgName), + Row( + children: [ + I18nText( + FlutterI18n.translate( + context, + 'suggested', + translationParams: { + 'version': widget.suggestedVersion.isEmpty + ? 'All versions' + : 'v${widget.suggestedVersion}' + }, + ), + const SizedBox(width: 4), Text( widget.patchesCount == 1 ? '• ${widget.patchesCount} patch' diff --git a/lib/ui/widgets/appSelectorView/not_installed_app_item.dart b/lib/ui/widgets/appSelectorView/not_installed_app_item.dart index f6062af9..8c1ae1fc 100644 --- a/lib/ui/widgets/appSelectorView/not_installed_app_item.dart +++ b/lib/ui/widgets/appSelectorView/not_installed_app_item.dart @@ -59,9 +59,7 @@ class _NotInstalledAppItem extends State { Row( children: [ Text( - widget.suggestedVersion.isEmpty - ? 'All versions' - : widget.suggestedVersion, + 'Suggested: ${widget.suggestedVersion.isEmpty ? 'All versions' : 'v${widget.suggestedVersion}'}', ), const SizedBox(width: 4), Text(