Skip to content

Commit

Permalink
feat: clarify suggested version in app list (#934)
Browse files Browse the repository at this point in the history
Co-authored-by: Aunali321 <48486084+Aunali321@users.noreply.github.com>
  • Loading branch information
TheAabedKhan and Aunali321 authored Jun 12, 2023
1 parent a8e0194 commit 0079e74
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
2 changes: 2 additions & 0 deletions assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"updateButton": "Update",
"enabledLabel": "Enabled",
"disabledLabel": "Disabled",
"installed":"Installed: {version}",
"suggested":"Suggested: {version}",
"yesButton": "Yes",
"noButton": "No",
"warning": "Warning",
Expand Down
1 change: 1 addition & 0 deletions lib/ui/views/app_selector/app_selector_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
model.getSuggestedVersion(
app.packageName,
),
installedVersion: app.versionName!,
onTap: () => model.canSelectInstalled(context, app.packageName),
),
)
Expand Down
43 changes: 29 additions & 14 deletions lib/ui/widgets/appSelectorView/installed_app_item.dart
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -10,13 +11,15 @@ class InstalledAppItem extends StatefulWidget {
required this.icon,
required this.patchesCount,
required this.suggestedVersion,
required this.installedVersion,
this.onTap,
}) : super(key: key);
final String name;
final String pkgName;
final Uint8List icon;
final int patchesCount;
final String suggestedVersion;
final String installedVersion;
final Function()? onTap;

@override
Expand Down Expand Up @@ -48,25 +51,37 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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'
Expand Down
4 changes: 1 addition & 3 deletions lib/ui/widgets/appSelectorView/not_installed_app_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ class _NotInstalledAppItem extends State<NotInstalledAppItem> {
Row(
children: [
Text(
widget.suggestedVersion.isEmpty
? 'All versions'
: widget.suggestedVersion,
'Suggested: ${widget.suggestedVersion.isEmpty ? 'All versions' : 'v${widget.suggestedVersion}'}',
),
const SizedBox(width: 4),
Text(
Expand Down

0 comments on commit 0079e74

Please sign in to comment.