mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-17 22:46:27 +08:00
Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
d0293f5412 | |||
6f72c2ebec | |||
07407933d9 | |||
2f4726ea68 | |||
207e94de5a | |||
7231d44e02 | |||
bd5b38d88e | |||
530dd78752 | |||
efcf455b24 | |||
bed2cf76d5 | |||
5c8079ae95 | |||
2a2bb8212f | |||
3e6e94c098 | |||
ce100d97fd | |||
743a661c10 | |||
2b7287c04c | |||
9bdccb3c9d | |||
b8171253c7 | |||
d6dde3e23b | |||
fc5414c788 | |||
ed9038ffe8 | |||
269a71d336 | |||
9405334a7d | |||
2f14746124 | |||
6c2ceed91f | |||
c333fa3c33 | |||
79d0396630 | |||
110c3326bd | |||
9c5b0b9c14 | |||
c5ad337daa | |||
a9f64e449b | |||
48f0bc625d |
55
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
55
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
@ -20,10 +20,12 @@ body:
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Branch
|
||||
description: Which github branch did you use (Flutter or Compose)?
|
||||
label: Manager Branch
|
||||
options:
|
||||
- Flutter
|
||||
- Compose
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
@ -41,11 +43,56 @@ body:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
label: Android version
|
||||
description: Android version used.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Manager version
|
||||
description: Manager version used.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Target package name
|
||||
description: App you tried to patch.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Target package version.
|
||||
description: Version of the app you tried to patch.
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Installation type
|
||||
options:
|
||||
- Non-root
|
||||
- Root
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Patches selected.
|
||||
description: Patches you selected for the app.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Device logs (exported using Manager settings).
|
||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Installer logs (exported using Installer menu option) [unneeded if issue is not during patching].
|
||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
||||
render: shell
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Screenshots or videos
|
||||
|
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
8
.github/ISSUE_TEMPLATE/feature-issue.yml
vendored
8
.github/ISSUE_TEMPLATE/feature-issue.yml
vendored
@ -12,10 +12,12 @@ body:
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Branch
|
||||
description: Which github branch did you use (Flutter or Compose)?
|
||||
label: Manager Branch
|
||||
options:
|
||||
- Flutter
|
||||
- Compose
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
|
@ -12,4 +12,9 @@ For suggestions and bug reports, open an issue [here](https://github.com/revance
|
||||
If you wish to discuss the Manager, a thread has been made under the [#chat](https://discord.com/channels/952946952348270622/1002922226443632761) channel in the Discord server, please note that this thread may be temporary and may be removed in the future.
|
||||
|
||||
## ⚠️ Disclaimer
|
||||
*Please note that even though we're releasing the Manager, it is an ALPHA version. Meaning there's a big chance that the Manager might not work at all for you.*
|
||||
*Please note that even though we're releasing the Manager, it is an ALPHA version. Meaning there's a big chance that the Manager might not work at all for you.*
|
||||
|
||||
## Prerequisites
|
||||
1. Android 8 or higher.
|
||||
2. Does not work on armv7
|
||||
3. For YouTube and YouTube Music - Vanced MicroG(Only for non-root).
|
||||
|
@ -3,8 +3,8 @@
|
||||
"cancelButton": "Cancel",
|
||||
"enabledLabel": "Enabled",
|
||||
"disabledLabel": "Disabled",
|
||||
"yesLabel": "Yes",
|
||||
"noLabel": "No",
|
||||
"yesButton": "Yes",
|
||||
"noButton": "No",
|
||||
"navigationView": {
|
||||
"dashboardTab": "Dashboard",
|
||||
"patcherTab": "Patcher",
|
||||
@ -66,11 +66,13 @@
|
||||
"widgetSubtitle": "We are online!"
|
||||
},
|
||||
"appSelectorView": {
|
||||
"viewTitle": "Select application",
|
||||
"searchBarHint": "Search applications",
|
||||
"storageButton": "Storage",
|
||||
"errorMessage": "Unable to use selected application."
|
||||
},
|
||||
"patchesSelectorView": {
|
||||
"viewTitle": "Select patches",
|
||||
"searchBarHint": "Search patches",
|
||||
"doneButton": "Done",
|
||||
"noPatchesFound": "No patches found for the selected app."
|
||||
@ -89,14 +91,19 @@
|
||||
"notificationTitle": "ReVanced Manager is patching",
|
||||
"notificationText": "Tap to return to the installer",
|
||||
"shareApkMenuOption": "Share APK",
|
||||
"shareLogMenuOption": "Share log"
|
||||
"shareLogMenuOption": "Share log",
|
||||
"installErrorDialogTitle": "Error",
|
||||
"installErrorDialogText1": "Root install is not possible with the current patches selection.\nRepatch your app or choose non-root install.",
|
||||
"installErrorDialogText2": "Non-root install is not possible with the current patches selection.\nRepatch your app or choose root install if you have your device rooted.",
|
||||
"installErrorDialogText3": "Root install is not possible as the original APK was selected from storage.\nSelect an installed app or choose non-root install.",
|
||||
"noExit": "Installer is still running..."
|
||||
},
|
||||
"settingsView": {
|
||||
"widgetTitle": "Settings",
|
||||
"appearanceSectionTitle": "Appearance",
|
||||
"patcherSectionTitle": "Patcher",
|
||||
"teamSectionTitle": "Team",
|
||||
"infoSectionTitle": "Info",
|
||||
"advancedSectionTitle": "Advanced",
|
||||
"darkThemeLabel": "Dark Mode",
|
||||
"darkThemeHint": "Welcome to the Dark Side",
|
||||
"dynamicThemeLabel": "Material You",
|
||||
@ -112,10 +119,14 @@
|
||||
"sourcesIntegrationsLabel": "Integrations Source",
|
||||
"sourcesResetDialogTitle": "Reset",
|
||||
"sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?",
|
||||
"apiURLResetDialogText": "Are you sure you want to reset API URL to their default values?",
|
||||
"contributorsLabel": "Contributors",
|
||||
"contributorsHint": "A list of contributors of ReVanced",
|
||||
"logsLabel": "Logs",
|
||||
"logsHint": "Share device debug logs",
|
||||
"apiURLLabel": "API URL",
|
||||
"apiURLHint": "Configure your custom API URL",
|
||||
"selectApiURL": "Select URL",
|
||||
"aboutLabel": "About",
|
||||
"snackbarMessage": "Copied to clipboard"
|
||||
},
|
||||
@ -125,9 +136,6 @@
|
||||
"uninstallButton": "Uninstall",
|
||||
"patchButton": "Patch",
|
||||
"unpatchButton": "Unpatch",
|
||||
"uninstallDialogTitle": "Uninstall",
|
||||
"uninstallDialogText": "Are you sure you want to uninstall this app?",
|
||||
"unpatchDialogTitle": "Unpatch",
|
||||
"unpatchDialogText": "Are you sure you want to unpatch this app?",
|
||||
"rootDialogTitle": "Error",
|
||||
"rootDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
|
||||
|
@ -2,6 +2,7 @@ import 'package:revanced_manager/services/github_api.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/services/revanced_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/app_selector/app_selector_view.dart';
|
||||
import 'package:revanced_manager/ui/views/contributors/contributors_view.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
@ -36,6 +37,7 @@ import 'package:stacked_services/stacked_services.dart';
|
||||
LazySingleton(classType: PatcherAPI),
|
||||
LazySingleton(classType: RevancedAPI),
|
||||
LazySingleton(classType: GithubAPI),
|
||||
LazySingleton(classType: Toast),
|
||||
],
|
||||
)
|
||||
class AppSetup {}
|
||||
|
@ -9,15 +9,18 @@ import 'package:revanced_manager/services/revanced_api.dart';
|
||||
import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
|
||||
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
|
||||
import 'package:stacked_themes/stacked_themes.dart';
|
||||
import 'package:timezone/data/latest.dart' as tz;
|
||||
|
||||
Future main() async {
|
||||
await ThemeManager.initialise();
|
||||
await setupLocator();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await locator<ManagerAPI>().initialize();
|
||||
await locator<PatcherAPI>().initialize();
|
||||
locator<RevancedAPI>().initialize();
|
||||
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
||||
await locator<RevancedAPI>().initialize(apiUrl);
|
||||
locator<GithubAPI>().initialize();
|
||||
await locator<PatcherAPI>().initialize();
|
||||
tz.initializeTimeZones();
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ class PatchedApplication {
|
||||
Uint8List icon;
|
||||
DateTime patchDate;
|
||||
bool isRooted;
|
||||
bool isFromStorage;
|
||||
bool hasUpdates;
|
||||
List<String> appliedPatches;
|
||||
List<String> changelog;
|
||||
@ -29,6 +30,7 @@ class PatchedApplication {
|
||||
required this.icon,
|
||||
required this.patchDate,
|
||||
this.isRooted = false,
|
||||
this.isFromStorage = false,
|
||||
this.hasUpdates = false,
|
||||
this.appliedPatches = const [],
|
||||
this.changelog = const [],
|
||||
|
@ -9,8 +9,7 @@ import 'package:revanced_manager/models/patch.dart';
|
||||
|
||||
@lazySingleton
|
||||
class GithubAPI {
|
||||
final String apiUrl = 'https://api.github.com';
|
||||
final Dio _dio = Dio();
|
||||
final Dio _dio = Dio(BaseOptions(baseUrl: 'https://api.github.com'));
|
||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||
final Options _cacheOptions = buildCacheOptions(
|
||||
const Duration(days: 1),
|
||||
@ -37,7 +36,7 @@ class GithubAPI {
|
||||
Future<Map<String, dynamic>?> _getLatestRelease(String repoName) async {
|
||||
try {
|
||||
var response = await _dio.get(
|
||||
'$apiUrl/repos/$repoName/releases/latest',
|
||||
'/repos/$repoName/releases/latest',
|
||||
options: _cacheOptions,
|
||||
);
|
||||
return response.data;
|
||||
@ -55,7 +54,7 @@ class GithubAPI {
|
||||
'src/main/kotlin/app/revanced/patches/${repoAppPath[packageName]}';
|
||||
try {
|
||||
var response = await _dio.get(
|
||||
'$apiUrl/repos/$repoName/commits',
|
||||
'/repos/$repoName/commits',
|
||||
queryParameters: {
|
||||
'path': path,
|
||||
'per_page': 3,
|
||||
|
@ -19,6 +19,7 @@ class ManagerAPI {
|
||||
final String patcherRepo = 'revanced-patcher';
|
||||
final String cliRepo = 'revanced-cli';
|
||||
late SharedPreferences _prefs;
|
||||
String defaultApiUrl = 'https://revanced-releases-api.afterst0rm.xyz';
|
||||
String defaultPatcherRepo = 'revanced/revanced-patcher';
|
||||
String defaultPatchesRepo = 'revanced/revanced-patches';
|
||||
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
|
||||
@ -29,6 +30,19 @@ class ManagerAPI {
|
||||
_prefs = await SharedPreferences.getInstance();
|
||||
}
|
||||
|
||||
String getApiUrl() {
|
||||
return _prefs.getString('apiUrl') ?? defaultApiUrl;
|
||||
}
|
||||
|
||||
Future<void> setApiUrl(String url) async {
|
||||
if (url.isEmpty || url == ' ') {
|
||||
url = defaultApiUrl;
|
||||
}
|
||||
await _revancedAPI.initialize(url);
|
||||
await _revancedAPI.clearAllCache();
|
||||
await _prefs.setString('apiUrl', url);
|
||||
}
|
||||
|
||||
String getPatchesRepo() {
|
||||
return _prefs.getString('patchesRepo') ?? defaultPatchesRepo;
|
||||
}
|
||||
@ -83,8 +97,10 @@ class ManagerAPI {
|
||||
Future<void> savePatchedApp(PatchedApplication app) async {
|
||||
List<PatchedApplication> patchedApps = getPatchedApps();
|
||||
patchedApps.removeWhere((a) => a.packageName == app.packageName);
|
||||
ApplicationWithIcon? installed =
|
||||
await DeviceApps.getApp(app.packageName, true) as ApplicationWithIcon?;
|
||||
ApplicationWithIcon? installed = await DeviceApps.getApp(
|
||||
app.packageName,
|
||||
true,
|
||||
) as ApplicationWithIcon?;
|
||||
if (installed != null) {
|
||||
app.name = installed.appName;
|
||||
app.version = installed.versionName!;
|
||||
@ -110,10 +126,11 @@ class ManagerAPI {
|
||||
}
|
||||
|
||||
Future<List<Patch>> getPatches() async {
|
||||
if (getPatchesRepo() == defaultPatchesRepo) {
|
||||
String repoName = getPatchesRepo();
|
||||
if (repoName == defaultPatchesRepo) {
|
||||
return await _revancedAPI.getPatches();
|
||||
} else {
|
||||
return await _githubAPI.getPatches(getPatchesRepo());
|
||||
return await _githubAPI.getPatches(repoName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,9 +204,10 @@ class ManagerAPI {
|
||||
List<String> installedApps = await _rootAPI.getInstalledApps();
|
||||
for (String packageName in installedApps) {
|
||||
if (!patchedApps.any((app) => app.packageName == packageName)) {
|
||||
ApplicationWithIcon? application =
|
||||
await DeviceApps.getApp(packageName, true)
|
||||
as ApplicationWithIcon?;
|
||||
ApplicationWithIcon? application = await DeviceApps.getApp(
|
||||
packageName,
|
||||
true,
|
||||
) as ApplicationWithIcon?;
|
||||
if (application != null) {
|
||||
unsavedApps.add(
|
||||
PatchedApplication(
|
||||
@ -214,9 +232,10 @@ class ManagerAPI {
|
||||
if (app.packageName.startsWith('app.revanced') &&
|
||||
!app.packageName.startsWith('app.revanced.manager.') &&
|
||||
!patchedApps.any((uapp) => uapp.packageName == app.packageName)) {
|
||||
ApplicationWithIcon? application =
|
||||
await DeviceApps.getApp(app.packageName, true)
|
||||
as ApplicationWithIcon?;
|
||||
ApplicationWithIcon? application = await DeviceApps.getApp(
|
||||
app.packageName,
|
||||
true,
|
||||
) as ApplicationWithIcon?;
|
||||
if (application != null) {
|
||||
unsavedApps.add(
|
||||
PatchedApplication(
|
||||
|
@ -53,9 +53,10 @@ class PatcherAPI {
|
||||
for (Package package in patch.compatiblePackages) {
|
||||
try {
|
||||
if (!filteredApps.any((app) => app.packageName == package.name)) {
|
||||
ApplicationWithIcon? app =
|
||||
await DeviceApps.getApp(package.name, true)
|
||||
as ApplicationWithIcon?;
|
||||
ApplicationWithIcon? app = await DeviceApps.getApp(
|
||||
package.name,
|
||||
true,
|
||||
) as ApplicationWithIcon?;
|
||||
if (app != null) {
|
||||
filteredApps.add(app);
|
||||
}
|
||||
@ -199,10 +200,9 @@ class PatcherAPI {
|
||||
String prefix = appName.toLowerCase().replaceAll(' ', '-');
|
||||
String newName = '$prefix-revanced_v$version.apk';
|
||||
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
||||
File share = _outFile!.renameSync(
|
||||
_outFile!.path.substring(0, lastSeparator + 1) + newName,
|
||||
);
|
||||
ShareExtend.share(share.path, 'file');
|
||||
String newPath = _outFile!.path.substring(0, lastSeparator + 1) + newName;
|
||||
File shareFile = _outFile!.copySync(newPath);
|
||||
ShareExtend.share(shareFile.path, 'file');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,15 +9,15 @@ import 'package:timeago/timeago.dart';
|
||||
|
||||
@lazySingleton
|
||||
class RevancedAPI {
|
||||
final String apiUrl = 'https://revanced-releases-api.afterst0rm.xyz';
|
||||
final Dio _dio = Dio();
|
||||
late Dio _dio = Dio();
|
||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||
final Options _cacheOptions = buildCacheOptions(
|
||||
const Duration(days: 1),
|
||||
maxStale: const Duration(days: 7),
|
||||
);
|
||||
|
||||
void initialize() {
|
||||
Future<void> initialize(String apiUrl) async {
|
||||
_dio = Dio(BaseOptions(baseUrl: apiUrl));
|
||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||
}
|
||||
|
||||
@ -28,10 +28,7 @@ class RevancedAPI {
|
||||
Future<Map<String, List<dynamic>>> getContributors() async {
|
||||
Map<String, List<dynamic>> contributors = {};
|
||||
try {
|
||||
var response = await _dio.get(
|
||||
'$apiUrl/contributors',
|
||||
options: _cacheOptions,
|
||||
);
|
||||
var response = await _dio.get('/contributors', options: _cacheOptions);
|
||||
List<dynamic> repositories = response.data['repositories'];
|
||||
for (Map<String, dynamic> repo in repositories) {
|
||||
String name = repo['name'];
|
||||
@ -45,7 +42,7 @@ class RevancedAPI {
|
||||
|
||||
Future<List<Patch>> getPatches() async {
|
||||
try {
|
||||
var response = await _dio.get('$apiUrl/patches', options: _cacheOptions);
|
||||
var response = await _dio.get('/patches', options: _cacheOptions);
|
||||
List<dynamic> patches = response.data;
|
||||
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
||||
} on Exception {
|
||||
@ -58,7 +55,7 @@ class RevancedAPI {
|
||||
String repoName,
|
||||
) async {
|
||||
try {
|
||||
var response = await _dio.get('$apiUrl/tools', options: _cacheOptions);
|
||||
var response = await _dio.get('/tools', options: _cacheOptions);
|
||||
List<dynamic> tools = response.data['tools'];
|
||||
return tools.firstWhereOrNull(
|
||||
(t) =>
|
||||
@ -71,10 +68,14 @@ class RevancedAPI {
|
||||
}
|
||||
|
||||
Future<String?> getLatestReleaseVersion(
|
||||
String extension, String repoName) async {
|
||||
String extension,
|
||||
String repoName,
|
||||
) async {
|
||||
try {
|
||||
Map<String, dynamic>? release =
|
||||
await _getLatestRelease(extension, repoName);
|
||||
Map<String, dynamic>? release = await _getLatestRelease(
|
||||
extension,
|
||||
repoName,
|
||||
);
|
||||
if (release != null) {
|
||||
return release['version'];
|
||||
}
|
||||
|
23
lib/services/toast.dart
Normal file
23
lib/services/toast.dart
Normal file
@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart' as t;
|
||||
|
||||
class Toast {
|
||||
final t.FToast _fToast = t.FToast();
|
||||
late BuildContext buildContext;
|
||||
|
||||
void initialize(BuildContext context) {
|
||||
_fToast.init(context);
|
||||
}
|
||||
|
||||
void show(String text) {
|
||||
t.Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
_fToast.context!,
|
||||
text,
|
||||
),
|
||||
toastLength: t.Toast.LENGTH_LONG,
|
||||
gravity: t.ToastGravity.CENTER,
|
||||
);
|
||||
}
|
||||
}
|
@ -31,53 +31,77 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 12.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SearchBar(
|
||||
showSelectIcon: false,
|
||||
hintText: FlutterI18n.translate(
|
||||
context,
|
||||
'appSelectorView.searchBarHint',
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
floating: true,
|
||||
snap: false,
|
||||
title: I18nText(
|
||||
'appSelectorView.viewTitle',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).textTheme.headline6!.color,
|
||||
),
|
||||
onQueryChanged: (searchQuery) {
|
||||
setState(() {
|
||||
_query = searchQuery;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: model.noApps
|
||||
? Center(
|
||||
child: I18nText('appSelectorCard.noAppsLabel'),
|
||||
)
|
||||
: model.apps.isEmpty
|
||||
? const AppSkeletonLoader()
|
||||
: ListView(
|
||||
padding: const EdgeInsets.only(bottom: 80),
|
||||
children: model
|
||||
.getFilteredApps(_query)
|
||||
.map((app) => InkWell(
|
||||
onTap: () {
|
||||
model.selectApp(app);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: InstalledAppItem(
|
||||
name: app.appName,
|
||||
pkgName: app.packageName,
|
||||
icon: app.icon,
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color: Theme.of(context).textTheme.headline6!.color,
|
||||
),
|
||||
],
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(64.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0,
|
||||
horizontal: 12.0,
|
||||
),
|
||||
child: SearchBar(
|
||||
showSelectIcon: false,
|
||||
hintText: FlutterI18n.translate(
|
||||
context,
|
||||
'appSelectorView.searchBarHint',
|
||||
),
|
||||
onQueryChanged: (searchQuery) {
|
||||
setState(() {
|
||||
_query = searchQuery;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: model.noApps
|
||||
? Center(
|
||||
child: I18nText('appSelectorCard.noAppsLabel'),
|
||||
)
|
||||
: model.apps.isEmpty
|
||||
? const AppSkeletonLoader()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0)
|
||||
.copyWith(bottom: 80),
|
||||
child: Column(
|
||||
children: model
|
||||
.getFilteredApps(_query)
|
||||
.map((app) => InstalledAppItem(
|
||||
name: app.appName,
|
||||
pkgName: app.packageName,
|
||||
icon: app.icon,
|
||||
onTap: () {
|
||||
model.selectApp(app);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -2,16 +2,16 @@ import 'dart:io';
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class AppSelectorViewModel extends BaseViewModel {
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final Toast _toast = locator<Toast>();
|
||||
final List<ApplicationWithIcon> apps = [];
|
||||
bool noApps = false;
|
||||
|
||||
@ -43,9 +43,10 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
);
|
||||
if (result != null && result.files.single.path != null) {
|
||||
File apkFile = File(result.files.single.path!);
|
||||
ApplicationWithIcon? application =
|
||||
await DeviceApps.getAppFromStorage(apkFile.path, true)
|
||||
as ApplicationWithIcon?;
|
||||
ApplicationWithIcon? application = await DeviceApps.getAppFromStorage(
|
||||
apkFile.path,
|
||||
true,
|
||||
) as ApplicationWithIcon?;
|
||||
if (application != null) {
|
||||
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
||||
name: application.appName,
|
||||
@ -54,20 +55,14 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
apkFilePath: result.files.single.path!,
|
||||
icon: application.icon,
|
||||
patchDate: DateTime.now(),
|
||||
isFromStorage: true,
|
||||
);
|
||||
locator<PatcherViewModel>().selectedPatches.clear();
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
}
|
||||
} on Exception {
|
||||
Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
context,
|
||||
'appSelectorView.errorMessage',
|
||||
),
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.CENTER,
|
||||
);
|
||||
_toast.show('appSelectorView.errorMessage');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:animations/animations.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/homeView/available_updates_card.dart';
|
||||
@ -27,6 +28,7 @@ class HomeView extends StatelessWidget {
|
||||
child: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
CustomSliverAppBar(
|
||||
isMainView: true,
|
||||
title: I18nText(
|
||||
'homeView.widgetTitle',
|
||||
child: Text(
|
||||
@ -83,9 +85,26 @@ class HomeView extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
model.showUpdatableApps
|
||||
? AvailableUpdatesCard()
|
||||
: InstalledAppsCard(),
|
||||
PageTransitionSwitcher(
|
||||
transitionBuilder:
|
||||
(child, primaryAnimation, secondaryAnimation) {
|
||||
return FadeThroughTransition(
|
||||
animation: primaryAnimation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
fillColor: Colors.transparent,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
layoutBuilder: (entries) {
|
||||
return Stack(
|
||||
alignment: Alignment.topCenter,
|
||||
children: entries,
|
||||
);
|
||||
},
|
||||
child: model.showUpdatableApps
|
||||
? AvailableUpdatesCard()
|
||||
: InstalledAppsCard(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -6,24 +6,26 @@ import 'package:device_apps/device_apps.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/app/app.router.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';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
import 'package:timezone/timezone.dart' as tz;
|
||||
|
||||
@lazySingleton
|
||||
class HomeViewModel extends BaseViewModel {
|
||||
final NavigationService _navigationService = locator<NavigationService>();
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final Toast _toast = locator<Toast>();
|
||||
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
||||
DateTime? _lastUpdate;
|
||||
bool showUpdatableApps = true;
|
||||
@ -38,16 +40,13 @@ class HomeViewModel extends BaseViewModel {
|
||||
onSelectNotification: (p) =>
|
||||
DeviceApps.openApp('app.revanced.manager.flutter'),
|
||||
);
|
||||
flutterLocalNotificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.requestPermission();
|
||||
bool isConnected = await Connectivity().checkConnection();
|
||||
if (!isConnected) {
|
||||
Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
context,
|
||||
'homeView.noConnection',
|
||||
),
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.CENTER,
|
||||
);
|
||||
_toast.show('homeView.noConnection');
|
||||
}
|
||||
_getPatchedApps();
|
||||
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
|
||||
@ -102,69 +101,48 @@ class HomeViewModel extends BaseViewModel {
|
||||
return false;
|
||||
}
|
||||
|
||||
void updateManager(BuildContext context) async {
|
||||
Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
context,
|
||||
'homeView.downloadingMessage',
|
||||
),
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.CENTER,
|
||||
);
|
||||
File? managerApk = await _managerAPI.downloadManager();
|
||||
if (managerApk != null) {
|
||||
flutterLocalNotificationsPlugin.show(
|
||||
0,
|
||||
FlutterI18n.translate(
|
||||
context,
|
||||
'homeView.notificationTitle',
|
||||
),
|
||||
FlutterI18n.translate(
|
||||
context,
|
||||
'homeView.notificationText',
|
||||
),
|
||||
const NotificationDetails(
|
||||
android: AndroidNotificationDetails(
|
||||
'revanced_manager_channel',
|
||||
'ReVanced Manager Channel',
|
||||
),
|
||||
),
|
||||
);
|
||||
try {
|
||||
Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
Future<void> updateManager(BuildContext context) async {
|
||||
try {
|
||||
_toast.show('homeView.downloadingMessage');
|
||||
File? managerApk = await _managerAPI.downloadManager();
|
||||
if (managerApk != null) {
|
||||
await flutterLocalNotificationsPlugin.zonedSchedule(
|
||||
0,
|
||||
FlutterI18n.translate(
|
||||
context,
|
||||
'homeView.installingMessage',
|
||||
'homeView.notificationTitle',
|
||||
),
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.CENTER,
|
||||
FlutterI18n.translate(
|
||||
context,
|
||||
'homeView.notificationText',
|
||||
),
|
||||
tz.TZDateTime.now(tz.local).add(const Duration(seconds: 5)),
|
||||
const NotificationDetails(
|
||||
android: AndroidNotificationDetails(
|
||||
'revanced_manager_channel',
|
||||
'ReVanced Manager Channel',
|
||||
importance: Importance.max,
|
||||
priority: Priority.high,
|
||||
ticker: 'ticker',
|
||||
),
|
||||
),
|
||||
androidAllowWhileIdle: true,
|
||||
uiLocalNotificationDateInterpretation:
|
||||
UILocalNotificationDateInterpretation.absoluteTime,
|
||||
);
|
||||
_toast.show('homeView.installingMessage');
|
||||
await AppInstaller.installApk(managerApk.path);
|
||||
} on Exception {
|
||||
Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
context,
|
||||
'homeView.errorInstallMessage',
|
||||
),
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.CENTER,
|
||||
);
|
||||
} else {
|
||||
_toast.show('homeView.errorDownloadMessage');
|
||||
}
|
||||
} else {
|
||||
Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
context,
|
||||
'homeView.errorDownloadMessage',
|
||||
),
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.CENTER,
|
||||
);
|
||||
} on Exception {
|
||||
_toast.show('homeView.errorInstallMessage');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> showUpdateConfirmationDialog(BuildContext context) async {
|
||||
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
context: parentContext,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('homeView.updateDialogTitle'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
@ -172,14 +150,14 @@ class HomeViewModel extends BaseViewModel {
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
label: I18nText('noButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
label: I18nText('yesButton'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
updateManager(context);
|
||||
updateManager(parentContext);
|
||||
},
|
||||
)
|
||||
],
|
||||
|
@ -29,6 +29,7 @@ class InstallerView extends StatelessWidget {
|
||||
color: Theme.of(context).textTheme.headline6!.color,
|
||||
),
|
||||
),
|
||||
onBackButtonPressed: () => model.onWillPop(context),
|
||||
actions: <Widget>[
|
||||
Visibility(
|
||||
visible: !model.isPatching && !model.hasErrors,
|
||||
@ -111,7 +112,10 @@ class InstallerView extends StatelessWidget {
|
||||
label:
|
||||
I18nText('installerView.installRootButton'),
|
||||
isExpanded: true,
|
||||
onPressed: () => model.installResult(true),
|
||||
onPressed: () => model.installResult(
|
||||
context,
|
||||
true,
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
@ -125,7 +129,10 @@ class InstallerView extends StatelessWidget {
|
||||
child: CustomMaterialButton(
|
||||
label: I18nText('installerView.installButton'),
|
||||
isExpanded: true,
|
||||
onPressed: () => model.installResult(false),
|
||||
onPressed: () => model.installResult(
|
||||
context,
|
||||
false,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -137,13 +144,7 @@ class InstallerView extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
onWillPop: () async {
|
||||
if (!model.isPatching) {
|
||||
model.cleanPatcher();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
onWillPop: () => model.onWillPop(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -3,19 +3,22 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_background/flutter_background.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
//import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/patch.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';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:wakelock/wakelock.dart';
|
||||
|
||||
class InstallerViewModel extends BaseViewModel {
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final Toast _toast = locator<Toast>();
|
||||
final PatchedApplication _app = locator<PatcherViewModel>().selectedApp!;
|
||||
final List<Patch> _patches = locator<PatcherViewModel>().selectedPatches;
|
||||
static const _installerChannel = MethodChannel(
|
||||
@ -30,9 +33,9 @@ class InstallerViewModel extends BaseViewModel {
|
||||
bool hasErrors = false;
|
||||
|
||||
Future<void> initialize(BuildContext context) async {
|
||||
if (true /*await Permission.ignoreBatteryOptimizations.isGranted*/) {
|
||||
if (await Permission.ignoreBatteryOptimizations.isGranted) {
|
||||
try {
|
||||
await FlutterBackground.initialize(
|
||||
FlutterBackground.initialize(
|
||||
androidConfig: FlutterBackgroundAndroidConfig(
|
||||
notificationTitle: FlutterI18n.translate(
|
||||
context,
|
||||
@ -48,8 +51,7 @@ class InstallerViewModel extends BaseViewModel {
|
||||
defType: 'drawable',
|
||||
),
|
||||
),
|
||||
);
|
||||
await FlutterBackground.enableBackgroundExecution();
|
||||
).then((value) => FlutterBackground.enableBackgroundExecution());
|
||||
} on Exception {
|
||||
// ignore
|
||||
}
|
||||
@ -122,9 +124,9 @@ class InstallerViewModel extends BaseViewModel {
|
||||
hasErrors = true;
|
||||
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||
}
|
||||
if (true /*await Permission.ignoreBatteryOptimizations.isGranted*/) {
|
||||
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||
try {
|
||||
await FlutterBackground.disableBackgroundExecution();
|
||||
FlutterBackground.disableBackgroundExecution();
|
||||
} on Exception {
|
||||
// ignore
|
||||
}
|
||||
@ -133,28 +135,56 @@ class InstallerViewModel extends BaseViewModel {
|
||||
isPatching = false;
|
||||
}
|
||||
|
||||
void installResult(bool installAsRoot) async {
|
||||
void installResult(BuildContext context, bool installAsRoot) async {
|
||||
_app.isRooted = installAsRoot;
|
||||
update(
|
||||
1.0,
|
||||
'Installing...',
|
||||
_app.isRooted
|
||||
? 'Installing patched file using root method'
|
||||
: 'Installing patched file using nonroot method',
|
||||
);
|
||||
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
||||
if (isInstalled) {
|
||||
update(1.0, 'Installed!', 'Installed!');
|
||||
_app.patchDate = DateTime.now();
|
||||
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
||||
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
||||
if (hasMicroG) {
|
||||
_app.packageName = _app.packageName.replaceFirst(
|
||||
'com.google.',
|
||||
'app.revanced.',
|
||||
);
|
||||
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
||||
bool rootMicroG = installAsRoot && hasMicroG;
|
||||
bool rootFromStorage = installAsRoot && _app.isFromStorage;
|
||||
bool ytWithoutRootMicroG =
|
||||
!installAsRoot && !hasMicroG && _app.packageName.contains('youtube');
|
||||
if (rootMicroG || rootFromStorage || ytWithoutRootMicroG) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('installerView.installErrorDialogTitle'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(
|
||||
rootMicroG
|
||||
? 'installerView.installErrorDialogText1'
|
||||
: rootFromStorage
|
||||
? 'installerView.installErrorDialogText3'
|
||||
: 'installerView.installErrorDialogText2',
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
update(
|
||||
1.0,
|
||||
'Installing...',
|
||||
_app.isRooted
|
||||
? 'Installing patched file using root method'
|
||||
: 'Installing patched file using nonroot method',
|
||||
);
|
||||
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
||||
if (isInstalled) {
|
||||
update(1.0, 'Installed!', 'Installed!');
|
||||
_app.isFromStorage = false;
|
||||
_app.patchDate = DateTime.now();
|
||||
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
||||
if (hasMicroG) {
|
||||
_app.packageName = _app.packageName.replaceFirst(
|
||||
'com.google.',
|
||||
'app.revanced.',
|
||||
);
|
||||
}
|
||||
await _managerAPI.savePatchedApp(_app);
|
||||
}
|
||||
await _managerAPI.savePatchedApp(_app);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,4 +217,14 @@ class InstallerViewModel extends BaseViewModel {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> onWillPop(BuildContext context) async {
|
||||
if (isPatching) {
|
||||
_toast.show('installerView.noExit');
|
||||
return false;
|
||||
}
|
||||
cleanPatcher();
|
||||
Navigator.of(context).pop();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,10 @@ import 'package:dynamic_themes/dynamic_themes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
//import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/services/root_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_view.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_view.dart';
|
||||
import 'package:revanced_manager/ui/views/settings/settings_view.dart';
|
||||
@ -14,29 +16,32 @@ import 'package:stacked/stacked.dart';
|
||||
@lazySingleton
|
||||
class NavigationViewModel extends IndexTrackingViewModel {
|
||||
void initialize(BuildContext context) async {
|
||||
locator<Toast>().initialize(context);
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
if (prefs.getBool('permissionsRequested') == null) {
|
||||
await prefs.setBool('permissionsRequested', true);
|
||||
RootAPI().hasRootPermissions().then(
|
||||
(value) => Permission.requestInstallPackages.request().then(
|
||||
(value) => Permission.ignoreBatteryOptimizations.request(),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (prefs.getBool('useDarkTheme') == null) {
|
||||
bool isDark =
|
||||
MediaQuery.of(context).platformBrightness != Brightness.light;
|
||||
await prefs.setBool('useDarkTheme', isDark);
|
||||
await DynamicTheme.of(context)!.setTheme(isDark ? 1 : 0);
|
||||
}
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(
|
||||
systemNavigationBarColor:
|
||||
DynamicTheme.of(context)!.theme.colorScheme.surface,
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
systemNavigationBarIconBrightness:
|
||||
DynamicTheme.of(context)!.theme.brightness == Brightness.light
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
),
|
||||
);
|
||||
//if (prefs.getBool('permissionsRequested') == null) {
|
||||
//await prefs.setBool('permissionsRequested', true);
|
||||
RootAPI().hasRootPermissions();
|
||||
//Permission.requestInstallPackages.request();
|
||||
//Permission.ignoreBatteryOptimizations.request();
|
||||
//}
|
||||
}
|
||||
|
||||
Widget getViewForIndex(int index) {
|
||||
|
@ -28,6 +28,7 @@ class PatcherView extends StatelessWidget {
|
||||
body: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
CustomSliverAppBar(
|
||||
isMainView: true,
|
||||
title: I18nText(
|
||||
'patcherView.widgetTitle',
|
||||
child: Text(
|
||||
|
@ -64,11 +64,11 @@ class PatcherViewModel extends BaseViewModel {
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
label: I18nText('noButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
label: I18nText('yesButton'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
navigateToInstaller();
|
||||
|
@ -33,144 +33,170 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
},
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 12.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SearchBar(
|
||||
showSelectIcon: true,
|
||||
hintText: FlutterI18n.translate(
|
||||
context,
|
||||
'patchesSelectorView.searchBarHint',
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
floating: true,
|
||||
snap: false,
|
||||
title: I18nText(
|
||||
'patchesSelectorView.viewTitle',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).textTheme.headline6!.color,
|
||||
),
|
||||
onQueryChanged: (searchQuery) {
|
||||
setState(() {
|
||||
_query = searchQuery;
|
||||
});
|
||||
},
|
||||
onSelectAll: (value) => model.selectAllPatches(value),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: model.patches.isEmpty
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: I18nText(
|
||||
'patchesSelectorView.noPatchesFound',
|
||||
child: Text(
|
||||
'',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color: Theme.of(context).textTheme.headline6!.color,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(64.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0,
|
||||
horizontal: 12.0,
|
||||
),
|
||||
child: SearchBar(
|
||||
showSelectIcon: true,
|
||||
hintText: FlutterI18n.translate(
|
||||
context,
|
||||
'patchesSelectorView.searchBarHint',
|
||||
),
|
||||
onQueryChanged: (searchQuery) {
|
||||
setState(() {
|
||||
_query = searchQuery;
|
||||
});
|
||||
},
|
||||
onSelectAll: (value) => model.selectAllPatches(value),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: model.patches.isEmpty
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: I18nText(
|
||||
'patchesSelectorView.noPatchesFound',
|
||||
child: Text(
|
||||
'',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
)
|
||||
: ListView(
|
||||
padding: const EdgeInsets.only(bottom: 80),
|
||||
children: model
|
||||
.getQueriedPatches(_query)
|
||||
.map(
|
||||
(patch) => PatchItem(
|
||||
name: patch.name,
|
||||
simpleName: patch.getSimpleName(),
|
||||
version: patch.version,
|
||||
description: patch.description,
|
||||
packageVersion: model.getAppVersion(),
|
||||
supportedPackageVersions:
|
||||
model.getSupportedVersions(patch),
|
||||
isUnsupported: !model.isPatchSupported(patch),
|
||||
isSelected: model.isSelected(patch),
|
||||
onChanged: (value) =>
|
||||
model.selectPatch(patch, value),
|
||||
),
|
||||
/* TODO: Enable this and make use of new Patch Options implementation
|
||||
patch.hasOptions ? ExpandablePanel(
|
||||
controller: expController,
|
||||
theme: const ExpandableThemeData(
|
||||
hasIcon: false,
|
||||
tapBodyToExpand: true,
|
||||
tapBodyToCollapse: true,
|
||||
tapHeaderToExpand: true,
|
||||
),
|
||||
header: Column(
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onLongPress: () =>
|
||||
expController.toggle(),
|
||||
child: PatchItem(
|
||||
name: patch.name,
|
||||
simpleName: patch.getSimpleName(),
|
||||
description: patch.description,
|
||||
version: patch.version,
|
||||
packageVersion:
|
||||
model.getAppVersion(),
|
||||
supportedPackageVersions: model
|
||||
.getSupportedVersions(patch),
|
||||
isUnsupported: !model
|
||||
.isPatchSupported(patch),
|
||||
isSelected:
|
||||
model.isSelected(patch),
|
||||
onChanged: (value) => model
|
||||
.selectPatch(patch, value),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8.0,
|
||||
),
|
||||
child: Text(
|
||||
'Long press for additional options.',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0)
|
||||
.copyWith(bottom: 80),
|
||||
child: Column(
|
||||
children: model
|
||||
.getQueriedPatches(_query)
|
||||
.map(
|
||||
(patch) => PatchItem(
|
||||
name: patch.name,
|
||||
simpleName: patch.getSimpleName(),
|
||||
version: patch.version,
|
||||
description: patch.description,
|
||||
packageVersion: model.getAppVersion(),
|
||||
supportedPackageVersions:
|
||||
model.getSupportedVersions(patch),
|
||||
isUnsupported: !model.isPatchSupported(patch),
|
||||
isSelected: model.isSelected(patch),
|
||||
onChanged: (value) =>
|
||||
model.selectPatch(patch, value),
|
||||
),
|
||||
/* TODO: Enable this and make use of new Patch Options implementation
|
||||
patch.hasOptions ? ExpandablePanel(
|
||||
controller: expController,
|
||||
theme: const ExpandableThemeData(
|
||||
hasIcon: false,
|
||||
tapBodyToExpand: true,
|
||||
tapBodyToCollapse: true,
|
||||
tapHeaderToExpand: true,
|
||||
),
|
||||
header: Column(
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onLongPress: () =>
|
||||
expController.toggle(),
|
||||
child: PatchItem(
|
||||
name: patch.name,
|
||||
simpleName: patch.getSimpleName(),
|
||||
description: patch.description,
|
||||
version: patch.version,
|
||||
packageVersion:
|
||||
model.getAppVersion(),
|
||||
supportedPackageVersions: model
|
||||
.getSupportedVersions(patch),
|
||||
isUnsupported: !model
|
||||
.isPatchSupported(patch),
|
||||
isSelected:
|
||||
model.isSelected(patch),
|
||||
onChanged: (value) => model
|
||||
.selectPatch(patch, value),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8.0,
|
||||
),
|
||||
child: Text(
|
||||
'Long press for additional options.',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
expanded: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10.0,
|
||||
horizontal: 10,
|
||||
),
|
||||
expanded: Padding(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10.0,
|
||||
horizontal: 10,
|
||||
vertical: 8,
|
||||
horizontal: 8,
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.tertiary
|
||||
.withOpacity(0.1),
|
||||
borderRadius:
|
||||
BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Patch options',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.tertiary
|
||||
.withOpacity(0.1),
|
||||
borderRadius:
|
||||
BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Patch options',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
const OptionsTextField(
|
||||
hint: 'App name'),
|
||||
const OptionsFilePicker(
|
||||
optionName: 'Choose a logo',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const OptionsTextField(
|
||||
hint: 'App name'),
|
||||
const OptionsFilePicker(
|
||||
optionName: 'Choose a logo',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
collapsed: Container(),
|
||||
) */
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
collapsed: Container(),
|
||||
) */
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -17,13 +17,6 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
||||
locator<PatcherViewModel>().selectedApp!.packageName,
|
||||
));
|
||||
patches.sort((a, b) => a.name.compareTo(b.name));
|
||||
if (selectedPatches.isEmpty) {
|
||||
for (Patch patch in patches) {
|
||||
if (!patch.excluded && isPatchSupported(patch)) {
|
||||
selectedPatches.add(patch);
|
||||
}
|
||||
}
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,9 @@ import 'package:stacked/stacked.dart';
|
||||
class SettingsView extends StatelessWidget {
|
||||
const SettingsView({Key? key}) : super(key: key);
|
||||
|
||||
static const _settingsDivider =
|
||||
Divider(thickness: 1.0, indent: 20.0, endIndent: 20.0);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<SettingsViewModel>.reactive(
|
||||
@ -21,6 +24,7 @@ class SettingsView extends StatelessWidget {
|
||||
body: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
CustomSliverAppBar(
|
||||
isMainView: true,
|
||||
title: I18nText(
|
||||
'settingsView.widgetTitle',
|
||||
child: Text(
|
||||
@ -31,122 +35,135 @@ class SettingsView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildListDelegate.fixed(
|
||||
<Widget>[
|
||||
SettingsSection(
|
||||
title: 'settingsView.appearanceSectionTitle',
|
||||
children: <Widget>[
|
||||
CustomSwitchTile(
|
||||
title: I18nText(
|
||||
'settingsView.darkThemeLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate.fixed(
|
||||
<Widget>[
|
||||
SettingsSection(
|
||||
title: 'settingsView.appearanceSectionTitle',
|
||||
children: <Widget>[
|
||||
CustomSwitchTile(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'settingsView.darkThemeLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
subtitle: I18nText('settingsView.darkThemeHint'),
|
||||
value: model.getDarkThemeStatus(),
|
||||
onTap: (value) => model.setUseDarkTheme(
|
||||
context,
|
||||
value,
|
||||
),
|
||||
),
|
||||
FutureBuilder<int>(
|
||||
future: model.getSdkVersion(),
|
||||
builder: (context, snapshot) => Visibility(
|
||||
visible: snapshot.hasData &&
|
||||
snapshot.data! >= ANDROID_12_SDK_VERSION,
|
||||
child: CustomSwitchTile(
|
||||
title: I18nText(
|
||||
'settingsView.dynamicThemeLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
subtitle: I18nText('settingsView.darkThemeHint'),
|
||||
value: model.getDarkThemeStatus(),
|
||||
onTap: (value) => model.setUseDarkTheme(
|
||||
context,
|
||||
value,
|
||||
),
|
||||
),
|
||||
FutureBuilder<int>(
|
||||
future: model.getSdkVersion(),
|
||||
builder: (context, snapshot) => Visibility(
|
||||
visible: snapshot.hasData &&
|
||||
snapshot.data! >= ANDROID_12_SDK_VERSION,
|
||||
child: CustomSwitchTile(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'settingsView.dynamicThemeLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
subtitle:
|
||||
I18nText('settingsView.dynamicThemeHint'),
|
||||
value: model.getDynamicThemeStatus(),
|
||||
onTap: (value) => model.setUseDynamicTheme(
|
||||
context,
|
||||
value,
|
||||
),
|
||||
),
|
||||
subtitle: I18nText('settingsView.dynamicThemeHint'),
|
||||
value: model.getDynamicThemeStatus(),
|
||||
onTap: (value) => model.setUseDynamicTheme(
|
||||
context,
|
||||
value,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SettingsTileDialog(
|
||||
title: 'settingsView.languageLabel',
|
||||
subtitle: 'English',
|
||||
onTap: () => model.showLanguagesDialog(context),
|
||||
),
|
||||
const Divider(thickness: 1.0),
|
||||
SettingsSection(
|
||||
title: 'settingsView.patcherSectionTitle',
|
||||
children: <Widget>[
|
||||
SettingsTileDialog(
|
||||
title: 'settingsView.sourcesLabel',
|
||||
subtitle: 'settingsView.sourcesLabelHint',
|
||||
onTap: () => model.showSourcesDialog(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(thickness: 1.0),
|
||||
SettingsSection(
|
||||
title: 'settingsView.teamSectionTitle',
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: I18nText(
|
||||
'settingsView.contributorsLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SettingsTileDialog(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: 'settingsView.languageLabel',
|
||||
subtitle: 'English',
|
||||
onTap: () => model.showLanguagesDialog(context),
|
||||
),
|
||||
_settingsDivider,
|
||||
SettingsSection(
|
||||
title: 'settingsView.teamSectionTitle',
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'settingsView.contributorsLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
subtitle: I18nText('settingsView.contributorsHint'),
|
||||
onTap: () => model.navigateToContributors(),
|
||||
),
|
||||
const SocialMediaWidget(),
|
||||
],
|
||||
),
|
||||
const Divider(thickness: 1.0),
|
||||
SettingsSection(
|
||||
title: 'settingsView.infoSectionTitle',
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: I18nText(
|
||||
'settingsView.logsLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
subtitle: I18nText('settingsView.contributorsHint'),
|
||||
onTap: () => model.navigateToContributors(),
|
||||
),
|
||||
const SocialMediaWidget(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
_settingsDivider,
|
||||
SettingsSection(
|
||||
title: 'settingsView.advancedSectionTitle',
|
||||
children: <Widget>[
|
||||
SettingsTileDialog(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: 'settingsView.apiURLLabel',
|
||||
subtitle: 'settingsView.apiURLHint',
|
||||
onTap: () => model.showApiUrlDialog(context),
|
||||
),
|
||||
SettingsTileDialog(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: 'settingsView.sourcesLabel',
|
||||
subtitle: 'settingsView.sourcesLabelHint',
|
||||
onTap: () => model.showSourcesDialog(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
_settingsDivider,
|
||||
SettingsSection(
|
||||
title: 'settingsView.infoSectionTitle',
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'settingsView.logsLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
subtitle: I18nText('settingsView.logsHint'),
|
||||
onTap: () => model.exportLogcatLogs(),
|
||||
),
|
||||
const AboutWidget(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: I18nText('settingsView.logsHint'),
|
||||
onTap: () => model.exportLogcatLogs(),
|
||||
),
|
||||
const AboutWidget(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -27,6 +27,7 @@ class SettingsViewModel extends BaseViewModel {
|
||||
final TextEditingController _patSourceController = TextEditingController();
|
||||
final TextEditingController _orgIntSourceController = TextEditingController();
|
||||
final TextEditingController _intSourceController = TextEditingController();
|
||||
final TextEditingController _apiUrlController = TextEditingController();
|
||||
|
||||
void setLanguage(String language) {
|
||||
notifyListeners();
|
||||
@ -55,12 +56,6 @@ class SettingsViewModel extends BaseViewModel {
|
||||
} else {
|
||||
await DynamicTheme.of(context)!.setTheme(value ? 3 : 1);
|
||||
}
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(
|
||||
systemNavigationBarColor:
|
||||
DynamicTheme.of(context)!.theme.colorScheme.surface,
|
||||
),
|
||||
);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@ -78,8 +73,6 @@ class SettingsViewModel extends BaseViewModel {
|
||||
}
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(
|
||||
systemNavigationBarColor:
|
||||
DynamicTheme.of(context)!.theme.colorScheme.surface,
|
||||
systemNavigationBarIconBrightness:
|
||||
value ? Brightness.light : Brightness.dark,
|
||||
),
|
||||
@ -208,6 +201,65 @@ class SettingsViewModel extends BaseViewModel {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showApiUrlDialog(BuildContext context) async {
|
||||
String apiUrl = _managerAPI.getApiUrl();
|
||||
_apiUrlController.text = apiUrl.replaceAll('https://', '');
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Row(
|
||||
children: <Widget>[
|
||||
I18nText('settingsView.apiURLLabel'),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.manage_history_outlined),
|
||||
onPressed: () => showApiUrlResetDialog(context),
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
)
|
||||
],
|
||||
),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
CustomTextField(
|
||||
leadingIcon: Icon(
|
||||
Icons.api_outlined,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
inputController: _apiUrlController,
|
||||
label: I18nText('settingsView.selectApiURL'),
|
||||
hint: apiUrl.split('/')[0],
|
||||
onChanged: (value) => notifyListeners(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
onPressed: () {
|
||||
_apiUrlController.clear();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
onPressed: () {
|
||||
String apiUrl = _apiUrlController.text;
|
||||
if (!apiUrl.startsWith('https')) {
|
||||
apiUrl = 'https://$apiUrl';
|
||||
}
|
||||
_managerAPI.setApiUrl(apiUrl);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showResetConfirmationDialog(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
@ -218,11 +270,11 @@ class SettingsViewModel extends BaseViewModel {
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
label: I18nText('noButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
label: I18nText('yesButton'),
|
||||
onPressed: () {
|
||||
_managerAPI.setPatchesRepo('');
|
||||
_managerAPI.setIntegrationsRepo('');
|
||||
@ -235,6 +287,32 @@ class SettingsViewModel extends BaseViewModel {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showApiUrlResetDialog(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('settingsView.sourcesResetDialogTitle'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText('settingsView.apiURLResetDialogText'),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
onPressed: () {
|
||||
_managerAPI.setApiUrl('');
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<int> getSdkVersion() async {
|
||||
AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
|
||||
return info.version.sdkInt ?? -1;
|
||||
|
@ -34,7 +34,7 @@ class AppInfoView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildListDelegate.fixed(
|
||||
<Widget>[
|
||||
@ -61,135 +61,34 @@ class AppInfoView extends StatelessWidget {
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
CustomCard(
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
!app.isRooted ? const Spacer() : Container(),
|
||||
InkWell(
|
||||
onTap: () => model.openApp(app),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.open_in_new_outlined,
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.openButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
VerticalDivider(
|
||||
color: Theme.of(context).canvasColor,
|
||||
),
|
||||
const Spacer(),
|
||||
InkWell(
|
||||
onTap: () => model.showUninstallAlertDialog(
|
||||
context,
|
||||
app,
|
||||
false,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.delete_outline,
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.uninstallButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
VerticalDivider(
|
||||
color: Theme.of(context).canvasColor,
|
||||
),
|
||||
const Spacer(),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
model.navigateToPatcher(app);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.build_outlined,
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.patchButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
app.isRooted ? const Spacer() : Container(),
|
||||
app.isRooted
|
||||
? VerticalDivider(
|
||||
color: Theme.of(context).canvasColor,
|
||||
)
|
||||
: Container(),
|
||||
app.isRooted ? const Spacer() : Container(),
|
||||
app.isRooted
|
||||
? InkWell(
|
||||
onTap: () => model.showUninstallAlertDialog(
|
||||
context,
|
||||
app,
|
||||
true,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
child: CustomCard(
|
||||
padding: EdgeInsets.zero,
|
||||
child: SizedBox(
|
||||
height: 94.0,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
onTap: () => model.openApp(app),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons
|
||||
.settings_backup_restore_outlined,
|
||||
Icons.open_in_new_outlined,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.unpatchButton',
|
||||
'appInfoView.openButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
@ -202,16 +101,154 @@ class AppInfoView extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
!app.isRooted ? const Spacer() : Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (app.isRooted)
|
||||
VerticalDivider(
|
||||
color: Theme.of(context).canvasColor,
|
||||
indent: 12.0,
|
||||
endIndent: 12.0,
|
||||
width: 1.0,
|
||||
),
|
||||
if (app.isRooted)
|
||||
Expanded(
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
onTap: () => model.showUninstallDialog(
|
||||
context,
|
||||
app,
|
||||
false,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.uninstallButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
VerticalDivider(
|
||||
color: Theme.of(context).canvasColor,
|
||||
indent: 12.0,
|
||||
endIndent: 12.0,
|
||||
width: 1.0,
|
||||
),
|
||||
Expanded(
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
onTap: () {
|
||||
model.navigateToPatcher(app);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.build_outlined,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.patchButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (app.isRooted)
|
||||
VerticalDivider(
|
||||
color: Theme.of(context).canvasColor,
|
||||
indent: 12.0,
|
||||
endIndent: 12.0,
|
||||
width: 1.0,
|
||||
),
|
||||
if (app.isRooted)
|
||||
Expanded(
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
onTap: () => model.showUninstallDialog(
|
||||
context,
|
||||
app,
|
||||
true,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons
|
||||
.settings_backup_restore_outlined,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
I18nText(
|
||||
'appInfoView.unpatchButton',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'appInfoView.packageNameLabel',
|
||||
child: const Text(
|
||||
@ -226,7 +263,8 @@ class AppInfoView extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'appInfoView.installTypeLabel',
|
||||
child: const Text(
|
||||
@ -243,7 +281,8 @@ class AppInfoView extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'appInfoView.patchedDateLabel',
|
||||
child: const Text(
|
||||
@ -264,7 +303,8 @@ class AppInfoView extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'appInfoView.appliedPatchesLabel',
|
||||
child: const Text(
|
||||
|
@ -1,3 +1,4 @@
|
||||
// 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';
|
||||
@ -44,7 +45,7 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
locator<NavigationViewModel>().setIndex(1);
|
||||
}
|
||||
|
||||
Future<void> showUninstallAlertDialog(
|
||||
Future<void> showUninstallDialog(
|
||||
BuildContext context,
|
||||
PatchedApplication app,
|
||||
bool onlyUnpatch,
|
||||
@ -66,38 +67,40 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText(
|
||||
onlyUnpatch
|
||||
? 'appInfoView.unpatchDialogTitle'
|
||||
: 'appInfoView.uninstallDialogTitle',
|
||||
),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(
|
||||
onlyUnpatch
|
||||
? 'appInfoView.unpatchDialogText'
|
||||
: 'appInfoView.uninstallDialogText',
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
if (onlyUnpatch) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText(
|
||||
'appInfoView.unpatchButton',
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
onPressed: () {
|
||||
uninstallApp(app, onlyUnpatch);
|
||||
locator<HomeViewModel>().initialize(context);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(
|
||||
'appInfoView.unpatchDialogText',
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
onPressed: () {
|
||||
uninstallApp(app, onlyUnpatch);
|
||||
locator<HomeViewModel>().initialize(context);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
uninstallApp(app, onlyUnpatch);
|
||||
locator<HomeViewModel>().initialize(context);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ class AppSkeletonLoader extends StatelessWidget {
|
||||
return Skeleton(
|
||||
isLoading: true,
|
||||
skeleton: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: 7,
|
||||
itemBuilder: (context, index) => Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8.0),
|
||||
|
@ -6,12 +6,14 @@ class InstalledAppItem extends StatefulWidget {
|
||||
final String name;
|
||||
final String pkgName;
|
||||
final Uint8List icon;
|
||||
final Function()? onTap;
|
||||
|
||||
const InstalledAppItem({
|
||||
Key? key,
|
||||
required this.name,
|
||||
required this.pkgName,
|
||||
required this.icon,
|
||||
this.onTap,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -24,6 +26,7 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: CustomCard(
|
||||
onTap: widget.onTap,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
|
@ -15,61 +15,59 @@ class AppSelectorCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
return CustomCard(
|
||||
onTap: onPressed,
|
||||
child: CustomCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
I18nText(
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? 'appSelectorCard.widgetTitle'
|
||||
: 'appSelectorCard.widgetTitleSelected',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
I18nText(
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? 'appSelectorCard.widgetTitle'
|
||||
: 'appSelectorCard.widgetTitleSelected',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? I18nText('appSelectorCard.widgetSubtitle')
|
||||
: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 18.0,
|
||||
child: ClipOval(
|
||||
child: Image.memory(
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? Uint8List(0)
|
||||
: locator<PatcherViewModel>().selectedApp!.icon,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? I18nText('appSelectorCard.widgetSubtitle')
|
||||
: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 18.0,
|
||||
child: ClipOval(
|
||||
child: Image.memory(
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? Uint8List(0)
|
||||
: locator<PatcherViewModel>().selectedApp!.icon,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(locator<PatcherViewModel>().getAppSelectionString()),
|
||||
],
|
||||
),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? Container()
|
||||
: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20),
|
||||
child: Text(
|
||||
locator<PatcherViewModel>()
|
||||
.getRecommendedVersionString(context),
|
||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(locator<PatcherViewModel>().getAppSelectionString()),
|
||||
],
|
||||
),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? Container()
|
||||
: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20),
|
||||
child: Text(
|
||||
locator<PatcherViewModel>()
|
||||
.getRecommendedVersionString(context),
|
||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -15,32 +15,30 @@ class PatchSelectorCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
return CustomCard(
|
||||
onTap: onPressed,
|
||||
child: CustomCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
I18nText(
|
||||
locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||
? 'patchSelectorCard.widgetTitle'
|
||||
: 'patchSelectorCard.widgetTitleSelected',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
I18nText(
|
||||
locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||
? 'patchSelectorCard.widgetTitle'
|
||||
: 'patchSelectorCard.widgetTitleSelected',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? I18nText('patchSelectorCard.widgetSubtitle')
|
||||
: locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||
? I18nText('patchSelectorCard.widgetEmptySubtitle')
|
||||
: Text(_getPatchesSelection()),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? I18nText('patchSelectorCard.widgetSubtitle')
|
||||
: locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||
? I18nText('patchSelectorCard.widgetEmptySubtitle')
|
||||
: Text(_getPatchesSelection()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -39,102 +39,98 @@ class _PatchItemState extends State<PatchItem> {
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: CustomCard(
|
||||
onTap: () {
|
||||
setState(() => widget.isSelected = !widget.isSelected);
|
||||
widget.onChanged(widget.isSelected);
|
||||
},
|
||||
child: CustomCard(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.simpleName,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.simpleName,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(widget.version)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.description,
|
||||
softWrap: true,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.visible,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Transform.scale(
|
||||
scale: 1.2,
|
||||
child: Checkbox(
|
||||
value: widget.isSelected,
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
checkColor:
|
||||
Theme.of(context).colorScheme.secondaryContainer,
|
||||
side: BorderSide(
|
||||
width: 2.0,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(widget.version)
|
||||
],
|
||||
),
|
||||
onChanged: (newValue) {
|
||||
setState(() => widget.isSelected = newValue!);
|
||||
widget.onChanged(widget.isSelected);
|
||||
},
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.description,
|
||||
softWrap: true,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.visible,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Transform.scale(
|
||||
scale: 1.2,
|
||||
child: Checkbox(
|
||||
value: widget.isSelected,
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
checkColor:
|
||||
Theme.of(context).colorScheme.secondaryContainer,
|
||||
side: BorderSide(
|
||||
width: 2.0,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
widget.isUnsupported
|
||||
? Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: TextButton.icon(
|
||||
label:
|
||||
I18nText('patchItem.unsupportedWarningButton'),
|
||||
icon: const Icon(Icons.warning),
|
||||
onPressed: () => _showUnsupportedWarningDialog(),
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: BorderSide(
|
||||
width: 1,
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
onChanged: (newValue) {
|
||||
setState(() => widget.isSelected = newValue!);
|
||||
widget.onChanged(widget.isSelected);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
widget.isUnsupported
|
||||
? Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: TextButton.icon(
|
||||
label: I18nText('patchItem.unsupportedWarningButton'),
|
||||
icon: const Icon(Icons.warning),
|
||||
onPressed: () => _showUnsupportedWarningDialog(),
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: BorderSide(
|
||||
width: 1,
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
widget.child ?? const SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
widget.child ?? const SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -4,7 +4,9 @@ import 'package:revanced_manager/utils/about_info.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class AboutWidget extends StatefulWidget {
|
||||
const AboutWidget({Key? key}) : super(key: key);
|
||||
const AboutWidget({Key? key, this.padding}) : super(key: key);
|
||||
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
@override
|
||||
State<AboutWidget> createState() => _AboutWidgetState();
|
||||
@ -13,28 +15,15 @@ class AboutWidget extends StatefulWidget {
|
||||
class _AboutWidgetState extends State<AboutWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
I18nText(
|
||||
'settingsView.aboutLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
FutureBuilder<Map<String, dynamic>>(
|
||||
future: AboutInfo.getInfo(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return GestureDetector(
|
||||
onLongPress: () {
|
||||
return FutureBuilder<Map<String, dynamic>>(
|
||||
future: AboutInfo.getInfo(),
|
||||
builder: (context, snapshot) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: ListTile(
|
||||
contentPadding: widget.padding ?? EdgeInsets.zero,
|
||||
onLongPress: snapshot.hasData
|
||||
? () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(
|
||||
text: 'Version: ${snapshot.data!['version']}\n'
|
||||
@ -50,8 +39,20 @@ class _AboutWidgetState extends State<AboutWidget> {
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
}
|
||||
: null,
|
||||
title: I18nText(
|
||||
'settingsView.aboutLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
subtitle: snapshot.hasData
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
@ -90,15 +91,11 @@ class _AboutWidgetState extends State<AboutWidget> {
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
},
|
||||
)
|
||||
: const SizedBox(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ class CustomSwitchTile extends StatelessWidget {
|
||||
final Widget subtitle;
|
||||
final bool value;
|
||||
final Function(bool) onTap;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
const CustomSwitchTile({
|
||||
Key? key,
|
||||
@ -13,14 +14,16 @@ class CustomSwitchTile extends StatelessWidget {
|
||||
required this.subtitle,
|
||||
required this.value,
|
||||
required this.onTap,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding: padding ?? EdgeInsets.zero,
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
onTap: () => onTap(!value),
|
||||
trailing: CustomSwitch(
|
||||
value: value,
|
||||
onChanged: onTap,
|
||||
|
@ -17,7 +17,7 @@ class SettingsSection extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 16.0, bottom: 10.0),
|
||||
padding: const EdgeInsets.only(top: 16.0, bottom: 10.0, left: 20.0),
|
||||
child: I18nText(
|
||||
title,
|
||||
child: Text(
|
||||
|
@ -5,18 +5,20 @@ class SettingsTileDialog extends StatelessWidget {
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final Function()? onTap;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
const SettingsTileDialog({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.onTap,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding: padding ?? EdgeInsets.zero,
|
||||
title: I18nText(
|
||||
title,
|
||||
child: const Text(
|
||||
|
52
lib/ui/widgets/settingsView/social_media_item.dart
Normal file
52
lib/ui/widgets/settingsView/social_media_item.dart
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class SocialMediaItem extends StatelessWidget {
|
||||
final Widget? icon;
|
||||
final Widget title;
|
||||
final Widget? subtitle;
|
||||
final String? url;
|
||||
|
||||
const SocialMediaItem({
|
||||
Key? key,
|
||||
this.icon,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
this.url,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: SizedBox(
|
||||
width: 48.0,
|
||||
child: Center(
|
||||
child: icon,
|
||||
),
|
||||
),
|
||||
title: DefaultTextStyle(
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
child: title,
|
||||
),
|
||||
subtitle: subtitle != null
|
||||
? DefaultTextStyle(
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
child: subtitle!,
|
||||
)
|
||||
: null,
|
||||
onTap: () => url != null
|
||||
? launchUrl(
|
||||
Uri.parse(url!),
|
||||
mode: LaunchMode.externalApplication,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
}
|
@ -2,11 +2,16 @@ import 'package:expandable/expandable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/social_media_item.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class SocialMediaWidget extends StatelessWidget {
|
||||
const SocialMediaWidget({Key? key}) : super(key: key);
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
const SocialMediaWidget({
|
||||
Key? key,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -14,11 +19,13 @@ class SocialMediaWidget extends StatelessWidget {
|
||||
theme: ExpandableThemeData(
|
||||
hasIcon: true,
|
||||
iconColor: Theme.of(context).iconTheme.color,
|
||||
iconPadding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
iconPadding: const EdgeInsets.symmetric(vertical: 16.0)
|
||||
.add(padding ?? EdgeInsets.zero)
|
||||
.resolve(Directionality.of(context)),
|
||||
animationDuration: const Duration(milliseconds: 400),
|
||||
),
|
||||
header: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
contentPadding: padding ?? EdgeInsets.zero,
|
||||
title: I18nText(
|
||||
'socialMediaCard.widgetTitle',
|
||||
child: const Text(
|
||||
@ -31,169 +38,52 @@ class SocialMediaWidget extends StatelessWidget {
|
||||
),
|
||||
subtitle: I18nText('socialMediaCard.widgetSubtitle'),
|
||||
),
|
||||
expanded: CustomCard(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.github,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
expanded: Padding(
|
||||
padding: padding ?? EdgeInsets.zero,
|
||||
child: CustomCard(
|
||||
child: Column(
|
||||
children: const <Widget>[
|
||||
SocialMediaItem(
|
||||
icon: FaIcon(FontAwesomeIcons.github),
|
||||
title: Text('GitHub'),
|
||||
subtitle: Text('github.com/revanced'),
|
||||
url: 'https://github.com/revanced',
|
||||
),
|
||||
title: Text(
|
||||
'GitHub',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
SocialMediaItem(
|
||||
icon: FaIcon(FontAwesomeIcons.discord),
|
||||
title: Text('Discord'),
|
||||
subtitle: Text('discord.gg/revanced'),
|
||||
url: 'https://discord.gg/rF2YcEjcrT',
|
||||
),
|
||||
subtitle: Text(
|
||||
'github.com/revanced',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
SocialMediaItem(
|
||||
icon: FaIcon(FontAwesomeIcons.telegram),
|
||||
title: Text('Telegram'),
|
||||
subtitle: Text('t.me/app_revanced'),
|
||||
url: 'https://t.me/app_revanced',
|
||||
),
|
||||
onTap: () => launchUrl(
|
||||
Uri.parse('https://github.com/revanced'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
SocialMediaItem(
|
||||
icon: FaIcon(FontAwesomeIcons.reddit),
|
||||
title: Text('Reddit'),
|
||||
subtitle: Text('r/revancedapp'),
|
||||
url: 'https://reddit.com/r/revancedapp',
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(8.0).copyWith(left: 5),
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.discord,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
SocialMediaItem(
|
||||
icon: FaIcon(FontAwesomeIcons.twitter),
|
||||
title: Text('Twitter'),
|
||||
subtitle: Text('@revancedapp'),
|
||||
url: 'https://twitter.com/revancedapp',
|
||||
),
|
||||
title: Text(
|
||||
'Discord',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
SocialMediaItem(
|
||||
icon: FaIcon(FontAwesomeIcons.youtube),
|
||||
title: Text('YouTube'),
|
||||
subtitle: Text('youtube.com/revanced'),
|
||||
url: 'https://youtube.com/revanced',
|
||||
),
|
||||
subtitle: Text(
|
||||
'discord.gg/revanced',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
onTap: () => launchUrl(
|
||||
Uri.parse('https://discord.gg/rF2YcEjcrT'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.telegram,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
'Telegram',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
't.me/app_revanced',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
onTap: () => launchUrl(
|
||||
Uri.parse('https://t.me/app_revanced'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.reddit,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
'Reddit',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'r/revancedapp',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
onTap: () => launchUrl(
|
||||
Uri.parse('https://reddit.com/r/revancedapp'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.twitter,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
'Twitter',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'@revancedapp',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
onTap: () => launchUrl(
|
||||
Uri.parse('https://twitter.com/revancedapp'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.youtube,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
'YouTube',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'youtube.com/revanced',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
onTap: () => launchUrl(
|
||||
Uri.parse('https://youtube.com/revanced'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
collapsed: Container(),
|
||||
collapsed: const SizedBox(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,12 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
animationDuration: Duration(milliseconds: 450),
|
||||
),
|
||||
header: CustomCard(
|
||||
onTap: () {
|
||||
expController.toggle();
|
||||
_animationController.isCompleted
|
||||
? _animationController.reverse()
|
||||
: _animationController.forward();
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
@ -87,20 +93,11 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 5.0),
|
||||
child: RotationTransition(
|
||||
turns:
|
||||
Tween(begin: 0.0, end: 0.50).animate(_animationController),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
expController.toggle();
|
||||
_animationController.isCompleted
|
||||
? _animationController.reverse()
|
||||
: _animationController.forward();
|
||||
},
|
||||
icon: const Icon(Icons.arrow_drop_down),
|
||||
),
|
||||
RotationTransition(
|
||||
turns: Tween(begin: 0.0, end: 0.50).animate(_animationController),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Icon(Icons.arrow_drop_down),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
@ -118,7 +115,7 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
],
|
||||
),
|
||||
),
|
||||
collapsed: const Text(''),
|
||||
collapsed: const SizedBox(),
|
||||
expanded: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
|
||||
child: Column(
|
||||
|
@ -3,30 +3,33 @@ import 'package:flutter/material.dart';
|
||||
class CustomCard extends StatelessWidget {
|
||||
final bool isFilled;
|
||||
final Widget child;
|
||||
final Function()? onTap;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
const CustomCard({
|
||||
Key? key,
|
||||
this.isFilled = true,
|
||||
required this.child,
|
||||
this.onTap,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
return Material(
|
||||
type: isFilled ? MaterialType.card : MaterialType.transparency,
|
||||
color: isFilled
|
||||
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
color: isFilled
|
||||
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.40)
|
||||
: Colors.transparent,
|
||||
border: isFilled
|
||||
? null
|
||||
: Border.all(
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
child: Padding(
|
||||
padding: padding ?? const EdgeInsets.all(20.0),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,16 @@ class CustomSliverAppBar extends StatelessWidget {
|
||||
final Widget title;
|
||||
final List<Widget>? actions;
|
||||
final PreferredSizeWidget? bottom;
|
||||
final bool isMainView;
|
||||
final Function()? onBackButtonPressed;
|
||||
|
||||
const CustomSliverAppBar({
|
||||
Key? key,
|
||||
required this.title,
|
||||
this.actions,
|
||||
this.bottom,
|
||||
this.isMainView = false,
|
||||
this.onBackButtonPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -19,16 +23,29 @@ class CustomSliverAppBar extends StatelessWidget {
|
||||
snap: false,
|
||||
floating: false,
|
||||
expandedHeight: 100.0,
|
||||
automaticallyImplyLeading: false,
|
||||
automaticallyImplyLeading: !isMainView,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
titlePadding: EdgeInsets.only(
|
||||
bottom: bottom != null ? 16.0 : 14.0,
|
||||
left: isMainView ? 20.0 : 55.0,
|
||||
),
|
||||
title: title,
|
||||
),
|
||||
leading: isMainView
|
||||
? null
|
||||
: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color: Theme.of(context).textTheme.headline6!.color,
|
||||
),
|
||||
onPressed:
|
||||
onBackButtonPressed ?? () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(states) => states.contains(MaterialState.scrolledUnder)
|
||||
? Theme.of(context).colorScheme.surface
|
||||
: Theme.of(context).canvasColor,
|
||||
),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
titlePadding: const EdgeInsets.only(bottom: 16.0, left: 20.0),
|
||||
title: title,
|
||||
),
|
||||
actions: actions,
|
||||
bottom: bottom,
|
||||
);
|
||||
|
@ -21,7 +21,7 @@ class SearchBar extends StatefulWidget {
|
||||
|
||||
class _SearchBarState extends State<SearchBar> {
|
||||
final TextEditingController _textController = TextEditingController();
|
||||
bool _toggleSelectAll = true;
|
||||
bool _toggleSelectAll = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
|
||||
|
||||
publish_to: 'none'
|
||||
|
||||
version: 0.0.13+13
|
||||
version: 0.0.15+15
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.5 <3.0.0"
|
||||
@ -52,7 +52,7 @@ dependencies:
|
||||
ref: feature/nullSafe
|
||||
package_info_plus: ^1.4.3+1
|
||||
path_provider: ^2.0.11
|
||||
#permission_handler: ^10.0.0
|
||||
permission_handler: ^10.0.0
|
||||
pull_to_refresh: ^2.0.0
|
||||
root: ^2.0.2
|
||||
share_extend: ^2.0.0
|
||||
@ -63,6 +63,7 @@ dependencies:
|
||||
stacked_services: ^0.9.3
|
||||
stacked_themes: ^0.3.9
|
||||
timeago: ^3.2.2
|
||||
timezone: ^0.8.0
|
||||
url_launcher: ^6.1.5
|
||||
wakelock: ^0.6.2
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:revanced_manager/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user