mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-21 10:13:56 +00:00
feat: Allow changing languages (#1488)
Co-authored-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/gen/strings.g.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/ui/widgets/appInfoView/app_info_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
@@ -22,13 +22,10 @@ class AppInfoView extends StatelessWidget {
|
||||
body: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
CustomSliverAppBar(
|
||||
title: I18nText(
|
||||
'appInfoView.widgetTitle',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.inter(
|
||||
color: Theme.of(context).textTheme.titleLarge!.color,
|
||||
),
|
||||
title: Text(
|
||||
t.appInfoView.widgetTitle,
|
||||
style: GoogleFonts.inter(
|
||||
color: Theme.of(context).textTheme.titleLarge!.color,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -86,16 +83,13 @@ class AppInfoView extends StatelessWidget {
|
||||
.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.openButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Text(
|
||||
t.appInfoView.openButton,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -130,16 +124,13 @@ class AppInfoView extends StatelessWidget {
|
||||
.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.uninstallButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Text(
|
||||
t.appInfoView.uninstallButton,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -183,16 +174,13 @@ class AppInfoView extends StatelessWidget {
|
||||
.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.unmountButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Text(
|
||||
t.appInfoView.unmountButton,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -209,14 +197,11 @@ class AppInfoView extends StatelessWidget {
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'appInfoView.packageNameLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
title: Text(
|
||||
t.appInfoView.packageNameLabel,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
subtitle: Text(app.packageName),
|
||||
@@ -225,61 +210,50 @@ class AppInfoView extends StatelessWidget {
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'appInfoView.installTypeLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
title: Text(
|
||||
t.appInfoView.installTypeLabel,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
subtitle: app.isRooted
|
||||
? I18nText('appInfoView.mountTypeLabel')
|
||||
: I18nText('appInfoView.regularTypeLabel'),
|
||||
? Text(t.appInfoView.mountTypeLabel)
|
||||
: Text(t.appInfoView.regularTypeLabel),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'appInfoView.patchedDateLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
title: Text(
|
||||
t.appInfoView.patchedDateLabel,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
subtitle: I18nText(
|
||||
'appInfoView.patchedDateHint',
|
||||
translationParams: {
|
||||
'date': model.getPrettyDate(context, app.patchDate),
|
||||
'time': model.getPrettyTime(context, app.patchDate),
|
||||
},
|
||||
subtitle: Text(
|
||||
t.appInfoView.patchedDateHint(
|
||||
date: model.getPrettyDate(context, app.patchDate),
|
||||
time: model.getPrettyTime(context, app.patchDate),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'appInfoView.appliedPatchesLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
title: Text(
|
||||
t.appInfoView.appliedPatchesLabel,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
subtitle: I18nText(
|
||||
'appInfoView.appliedPatchesHint',
|
||||
translationParams: {
|
||||
'quantity': app.appliedPatches.length.toString(),
|
||||
},
|
||||
subtitle: Text(
|
||||
t.appInfoView.appliedPatchesHint(
|
||||
quantity: app.appliedPatches.length.toString(),
|
||||
),
|
||||
),
|
||||
onTap: () => model.showAppliedPatchesDialog(context, app),
|
||||
),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// ignore_for_file: use_build_context_synchronously
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/gen/strings.g.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
@@ -32,7 +32,7 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
isUninstalled = await DeviceApps.uninstallApp(app.packageName);
|
||||
}
|
||||
|
||||
if (isUninstalled && app.isRooted && await _rootAPI.hasRootPermissions()) {
|
||||
if (isUninstalled && app.isRooted && await _rootAPI.hasRootPermissions()) {
|
||||
await _rootAPI.uninstall(app.packageName);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
void updateNotImplemented(BuildContext context) {
|
||||
_toast.showBottom('appInfoView.updateNotImplemented');
|
||||
_toast.showBottom(t.appInfoView.updateNotImplemented);
|
||||
}
|
||||
|
||||
Future<void> showUninstallDialog(
|
||||
@@ -64,12 +64,12 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('appInfoView.rootDialogTitle'),
|
||||
content: I18nText('appInfoView.rootDialogText'),
|
||||
title: Text(t.appInfoView.rootDialogTitle),
|
||||
content: Text(t.appInfoView.rootDialogText),
|
||||
actions: <Widget>[
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
child: Text(t.okButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -79,16 +79,12 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText(
|
||||
'appInfoView.unmountButton',
|
||||
),
|
||||
content: I18nText(
|
||||
'appInfoView.unmountDialogText',
|
||||
),
|
||||
title: Text(t.appInfoView.unmountButton),
|
||||
content: Text(t.appInfoView.unmountDialogText),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('noButton'),
|
||||
child: Text(t.noButton),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
@@ -96,7 +92,7 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
child: Text(t.yesButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -105,16 +101,12 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText(
|
||||
'appInfoView.uninstallButton',
|
||||
),
|
||||
content: I18nText(
|
||||
'appInfoView.uninstallDialogText',
|
||||
),
|
||||
title: Text(t.appInfoView.uninstallButton),
|
||||
content: Text(t.appInfoView.uninstallDialogText),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('noButton'),
|
||||
child: Text(t.noButton),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
@@ -122,7 +114,7 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
child: Text(t.yesButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -148,14 +140,14 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('appInfoView.appliedPatchesLabel'),
|
||||
title: Text(t.appInfoView.appliedPatchesLabel),
|
||||
content: SingleChildScrollView(
|
||||
child: Text(getAppliedPatchesString(app.appliedPatches)),
|
||||
),
|
||||
actions: <Widget>[
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
child: Text(t.okButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user