mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
feat: add installer and enable app selection from storage (#2)
This commit is contained in:
@ -21,9 +21,19 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<AppSelectorViewModel>.reactive(
|
||||
disposeViewModel: false,
|
||||
onModelReady: (model) => model.initialise(),
|
||||
onModelReady: (model) => model.initialize(),
|
||||
viewModelBuilder: () => locator<AppSelectorViewModel>(),
|
||||
builder: (context, model, child) => Scaffold(
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
model.selectAppFromStorage(context);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
label: I18nText('appSelectorView.fabButton'),
|
||||
icon: const Icon(Icons.sd_storage),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding:
|
||||
@ -71,16 +81,16 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||
child: ListView.builder(
|
||||
itemCount: model.apps.length,
|
||||
itemBuilder: (context, index) {
|
||||
model.apps.sort((a, b) => a.name!.compareTo(b.name!));
|
||||
model.apps.sort((a, b) => a.appName.compareTo(b.appName));
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
model.selectApp(model.apps[index]);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: InstalledAppItem(
|
||||
name: model.apps[index].name!,
|
||||
pkgName: model.apps[index].packageName!,
|
||||
icon: model.apps[index].icon!,
|
||||
name: model.apps[index].appName,
|
||||
pkgName: model.apps[index].packageName,
|
||||
icon: model.apps[index].icon,
|
||||
),
|
||||
);
|
||||
},
|
||||
@ -93,8 +103,8 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||
child: ListView.builder(
|
||||
itemCount: model.apps.length,
|
||||
itemBuilder: (context, index) {
|
||||
model.apps.sort((a, b) => a.name!.compareTo(b.name!));
|
||||
if (model.apps[index].name!.toLowerCase().contains(
|
||||
model.apps.sort((a, b) => a.appName.compareTo(b.appName));
|
||||
if (model.apps[index].appName.toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
)) {
|
||||
return InkWell(
|
||||
@ -103,9 +113,9 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: InstalledAppItem(
|
||||
name: model.apps[index].name!,
|
||||
pkgName: model.apps[index].packageName!,
|
||||
icon: model.apps[index].icon!,
|
||||
name: model.apps[index].appName,
|
||||
pkgName: model.apps[index].packageName,
|
||||
icon: model.apps[index].icon,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
@ -1,15 +1,22 @@
|
||||
import 'package:installed_apps/app_info.dart';
|
||||
import 'dart:io';
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:package_archive_info/package_archive_info.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/application_info.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.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>();
|
||||
List<AppInfo> apps = [];
|
||||
AppInfo? selectedApp;
|
||||
List<ApplicationWithIcon> apps = [];
|
||||
ApplicationInfo? selectedApp;
|
||||
|
||||
Future<void> initialise() async {
|
||||
Future<void> initialize() async {
|
||||
await getApps();
|
||||
notifyListeners();
|
||||
}
|
||||
@ -19,9 +26,47 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
apps = await patcherAPI.getFilteredInstalledApps();
|
||||
}
|
||||
|
||||
void selectApp(AppInfo appInfo) {
|
||||
locator<AppSelectorViewModel>().selectedApp = appInfo;
|
||||
void selectApp(ApplicationWithIcon application) {
|
||||
ApplicationInfo app = ApplicationInfo(
|
||||
name: application.appName,
|
||||
packageName: application.packageName,
|
||||
version: application.versionName!,
|
||||
apkFilePath: application.apkFilePath,
|
||||
);
|
||||
locator<AppSelectorViewModel>().selectedApp = app;
|
||||
locator<PatcherViewModel>().dimPatchCard = false;
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> selectAppFromStorage(BuildContext context) async {
|
||||
try {
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['apk'],
|
||||
);
|
||||
if (result != null && result.files.single.path != null) {
|
||||
File apkFile = File(result.files.single.path!);
|
||||
PackageArchiveInfo? packageArchiveInfo =
|
||||
await PackageArchiveInfo.fromPath(apkFile.path);
|
||||
ApplicationInfo app = ApplicationInfo(
|
||||
name: packageArchiveInfo.appName,
|
||||
packageName: packageArchiveInfo.packageName,
|
||||
version: packageArchiveInfo.version,
|
||||
apkFilePath: result.files.single.path!,
|
||||
);
|
||||
locator<AppSelectorViewModel>().selectedApp = app;
|
||||
locator<PatcherViewModel>().dimPatchCard = false;
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
} on Exception {
|
||||
Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
context,
|
||||
'appSelectorView.errorMessage',
|
||||
),
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.CENTER,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class HomeView extends StatelessWidget {
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: IconButton(
|
||||
onPressed: () {},
|
||||
onPressed: () => {},
|
||||
icon: const Icon(
|
||||
Icons.more_vert,
|
||||
),
|
||||
|
144
lib/ui/views/installer/installer_view.dart
Normal file
144
lib/ui/views/installer/installer_view.dart
Normal file
@ -0,0 +1,144 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class InstallerView extends StatelessWidget {
|
||||
InstallerView({Key? key}) : super(key: key);
|
||||
final ScrollController _controller = ScrollController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => _controller.jumpTo(_controller.position.maxScrollExtent),
|
||||
);
|
||||
return ViewModelBuilder<InstallerViewModel>.reactive(
|
||||
disposeViewModel: false,
|
||||
onModelReady: (model) => model.initialize(),
|
||||
viewModelBuilder: () => locator<InstallerViewModel>(),
|
||||
builder: (context, model, child) => WillStartForegroundTask(
|
||||
onWillStart: () async => model.isPatching,
|
||||
androidNotificationOptions: AndroidNotificationOptions(
|
||||
channelId: 'revanced-patcher-patching',
|
||||
channelName: 'Patching',
|
||||
channelDescription: 'This notification appears when the patching '
|
||||
'foreground service is running.',
|
||||
channelImportance: NotificationChannelImportance.LOW,
|
||||
priority: NotificationPriority.LOW,
|
||||
),
|
||||
notificationTitle: 'Patching',
|
||||
notificationText: 'ReVanced Manager is patching',
|
||||
callback: () => {},
|
||||
child: WillPopScope(
|
||||
child: Scaffold(
|
||||
body: SafeArea(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
controller: _controller,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: constraints.maxWidth,
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
I18nText(
|
||||
'installerView.widgetTitle',
|
||||
child: Text(
|
||||
'',
|
||||
style: Theme.of(context).textTheme.headline5,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 16.0,
|
||||
horizontal: 4.0,
|
||||
),
|
||||
child: LinearProgressIndicator(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
backgroundColor: Colors.white,
|
||||
value: model.progress,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: SelectableText(
|
||||
model.logs,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'monospace', fontSize: 15),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Visibility(
|
||||
visible: model.showButtons,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: MaterialButton(
|
||||
textColor: Colors.white,
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12,
|
||||
horizontal: 8,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
onPressed: () => model.installResult(),
|
||||
child: I18nText(
|
||||
'installerView.installButton',
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: MaterialButton(
|
||||
textColor: Colors.white,
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12,
|
||||
horizontal: 8,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
onPressed: () => model.shareResult(),
|
||||
child: I18nText(
|
||||
'installerView.shareButton',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
onWillPop: () async {
|
||||
if (!model.isPatching) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
114
lib/ui/views/installer/installer_viewmodel.dart
Normal file
114
lib/ui/views/installer/installer_viewmodel.dart
Normal file
@ -0,0 +1,114 @@
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/application_info.dart';
|
||||
import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class InstallerViewModel extends BaseViewModel {
|
||||
double? progress = 0.2;
|
||||
String logs = '';
|
||||
bool isPatching = false;
|
||||
bool showButtons = false;
|
||||
|
||||
Future<void> initialize() async {
|
||||
await locator<PatcherAPI>().handlePlatformChannelMethods();
|
||||
runPatcher();
|
||||
}
|
||||
|
||||
void addLog(String message) {
|
||||
if (logs.isNotEmpty) {
|
||||
logs += '\n';
|
||||
}
|
||||
logs += message;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void updateProgress(double value) {
|
||||
progress = value;
|
||||
isPatching = progress == 1.0 ? false : true;
|
||||
showButtons = progress == 1.0 ? true : false;
|
||||
if (progress == 0.0) {
|
||||
logs = '';
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> runPatcher() async {
|
||||
updateProgress(0.0);
|
||||
ApplicationInfo? selectedApp = locator<AppSelectorViewModel>().selectedApp;
|
||||
if (selectedApp != null) {
|
||||
String apkFilePath = selectedApp.apkFilePath;
|
||||
List<Patch> selectedPatches =
|
||||
locator<PatchesSelectorViewModel>().selectedPatches;
|
||||
if (selectedPatches.isNotEmpty) {
|
||||
addLog('Initializing patcher...');
|
||||
bool? isSuccess = await locator<PatcherAPI>().initPatcher();
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
updateProgress(0.1);
|
||||
addLog('Copying original apk...');
|
||||
isSuccess = await locator<PatcherAPI>().copyInputFile(apkFilePath);
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
updateProgress(0.2);
|
||||
addLog('Creating patcher...');
|
||||
isSuccess = await locator<PatcherAPI>().createPatcher();
|
||||
if (isSuccess != null && isSuccess) {
|
||||
if (selectedApp.packageName == 'com.google.android.youtube') {
|
||||
addLog('Done');
|
||||
updateProgress(0.3);
|
||||
addLog('Merging integrations...');
|
||||
isSuccess = await locator<PatcherAPI>().mergeIntegrations();
|
||||
}
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
updateProgress(0.5);
|
||||
addLog('Applying patches...');
|
||||
isSuccess =
|
||||
await locator<PatcherAPI>().applyPatches(selectedPatches);
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
updateProgress(0.7);
|
||||
addLog('Repacking patched apk...');
|
||||
isSuccess = await locator<PatcherAPI>().repackPatchedFile();
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
updateProgress(0.9);
|
||||
addLog('Signing patched apk...');
|
||||
isSuccess = await locator<PatcherAPI>().signPatchedFile();
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
showButtons = true;
|
||||
updateProgress(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isSuccess == null || !isSuccess) {
|
||||
addLog('An error occurred! Aborting...');
|
||||
}
|
||||
} else {
|
||||
addLog('No patches selected! Aborting...');
|
||||
}
|
||||
} else {
|
||||
addLog('No app selected! Aborting...');
|
||||
}
|
||||
isPatching = false;
|
||||
}
|
||||
|
||||
void installResult() async {
|
||||
await locator<PatcherAPI>().installPatchedFile();
|
||||
}
|
||||
|
||||
void shareResult() {
|
||||
ApplicationInfo? selectedApp = locator<AppSelectorViewModel>().selectedApp;
|
||||
if (selectedApp != null) {
|
||||
locator<PatcherAPI>().sharePatchedFile(selectedApp.packageName);
|
||||
}
|
||||
}
|
||||
}
|
@ -3,12 +3,11 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/theme.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/app_selector_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/patch_selector_card.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import 'patcher_viewmodel.dart';
|
||||
|
||||
class PatcherView extends StatelessWidget {
|
||||
const PatcherView({Key? key}) : super(key: key);
|
||||
|
||||
@ -21,7 +20,7 @@ class PatcherView extends StatelessWidget {
|
||||
floatingActionButton: Visibility(
|
||||
visible: locator<PatcherViewModel>().showFabButton,
|
||||
child: FloatingActionButton.extended(
|
||||
onPressed: () => {},
|
||||
onPressed: () => model.navigateToInstaller(),
|
||||
label: I18nText('patcherView.fabButton'),
|
||||
icon: const Icon(Icons.build),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
|
@ -15,4 +15,8 @@ class PatcherViewModel extends BaseViewModel {
|
||||
void navigateToPatchesSelector() {
|
||||
_navigationService.navigateTo(Routes.patchesSelectorView);
|
||||
}
|
||||
|
||||
void navigateToInstaller() {
|
||||
_navigationService.navigateTo(Routes.installerView);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<PatchesSelectorViewModel>.reactive(
|
||||
disposeViewModel: false,
|
||||
onModelReady: (model) => model.initialise(),
|
||||
onModelReady: (model) => model.initialize(),
|
||||
viewModelBuilder: () => locator<PatchesSelectorViewModel>(),
|
||||
builder: (context, model, child) => Scaffold(
|
||||
body: SafeArea(
|
||||
@ -52,7 +52,7 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
: _getFilteredResults(model),
|
||||
MaterialButton(
|
||||
textColor: Colors.white,
|
||||
color: const Color(0x957792BA),
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
minWidth: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:installed_apps/app_info.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/application_info.dart';
|
||||
import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
|
||||
@ -12,14 +12,14 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
||||
List<Patch>? patches = [];
|
||||
List<Patch> selectedPatches = [];
|
||||
|
||||
Future<void> initialise() async {
|
||||
Future<void> initialize() async {
|
||||
await getPatches();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> getPatches() async {
|
||||
AppInfo? appInfo = locator<AppSelectorViewModel>().selectedApp;
|
||||
patches = await patcherAPI.getFilteredPatches(appInfo);
|
||||
ApplicationInfo? app = locator<AppSelectorViewModel>().selectedApp;
|
||||
patches = await patcherAPI.getFilteredPatches(app);
|
||||
}
|
||||
|
||||
void selectPatches(List<PatchItem> patchItems) {
|
||||
|
@ -45,7 +45,7 @@ class AppSelectorCard extends StatelessWidget {
|
||||
const SizedBox(height: 10),
|
||||
locator<AppSelectorViewModel>().selectedApp != null
|
||||
? Text(
|
||||
locator<AppSelectorViewModel>().selectedApp!.packageName!,
|
||||
locator<AppSelectorViewModel>().selectedApp!.packageName,
|
||||
style: robotoTextStyle,
|
||||
)
|
||||
: I18nText(
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/constants.dart';
|
||||
|
@ -33,59 +33,52 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
I18nText(
|
||||
'latestCommitCard.patcherLabel',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.roboto(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
I18nText(
|
||||
'latestCommitCard.patcherLabel',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.roboto(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
FutureBuilder<String>(
|
||||
future: githubAPI.latestCommitTime(
|
||||
'revanced',
|
||||
'revanced-patcher',
|
||||
),
|
||||
initialData: FlutterI18n.translate(
|
||||
context,
|
||||
'latestCommitCard.loadingLabel',
|
||||
),
|
||||
builder: (context, snapshot) => Text(
|
||||
snapshot.data!,
|
||||
style: robotoTextStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
I18nText(
|
||||
'latestCommitCard.managerLabel',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.roboto(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
FutureBuilder<String>(
|
||||
future: githubAPI.latestCommitTime(
|
||||
'revanced',
|
||||
'revanced-patcher',
|
||||
),
|
||||
initialData: FlutterI18n.translate(
|
||||
context,
|
||||
'latestCommitCard.loadingLabel',
|
||||
),
|
||||
builder: (context, snapshot) => Text(
|
||||
snapshot.data!,
|
||||
style: robotoTextStyle,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
I18nText(
|
||||
'latestCommitCard.managerLabel',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.roboto(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
FutureBuilder<String>(
|
||||
future: githubAPI.latestCommitTime(
|
||||
'revanced',
|
||||
'revanced-patcher',
|
||||
),
|
||||
initialData: FlutterI18n.translate(
|
||||
context,
|
||||
'latestCommitCard.loadingLabel',
|
||||
),
|
||||
builder: (context, snapshot) => Text(
|
||||
snapshot.data!,
|
||||
style: robotoTextStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
FutureBuilder<String>(
|
||||
future: githubAPI.latestCommitTime(
|
||||
'revanced',
|
||||
'revanced-patcher',
|
||||
),
|
||||
initialData: FlutterI18n.translate(
|
||||
context,
|
||||
'latestCommitCard.loadingLabel',
|
||||
),
|
||||
builder: (context, snapshot) => Text(
|
||||
snapshot.data!,
|
||||
style: robotoTextStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -25,64 +25,69 @@ class PatchItem extends StatefulWidget {
|
||||
class _PatchItemState extends State<PatchItem> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
widget.simpleName,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
return InkWell(
|
||||
onTap: () => setState(() {
|
||||
widget.isSelected = !widget.isSelected;
|
||||
}),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
widget.simpleName,
|
||||
style: GoogleFonts.inter(
|
||||
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: GoogleFonts.roboto(
|
||||
fontSize: 14,
|
||||
const SizedBox(width: 4),
|
||||
Text(widget.version)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.description,
|
||||
softWrap: true,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.visible,
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Transform.scale(
|
||||
scale: 1.2,
|
||||
child: Checkbox(
|
||||
value: widget.isSelected,
|
||||
activeColor: Colors.blueGrey[500],
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
widget.isSelected = newValue!;
|
||||
});
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
Transform.scale(
|
||||
scale: 1.2,
|
||||
child: Checkbox(
|
||||
value: widget.isSelected,
|
||||
activeColor: Colors.blueGrey[500],
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
widget.isSelected = newValue!;
|
||||
});
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user