mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
feat: "New dashboard UI". (#3)
* feat: "New dashboard UI". * fix: some improvenents * fix: fix inconsistencies and light theme. * fix: save patched and installed apps on prefs, improve installer log, improve dashboard with real data (wip) Co-authored-by: Aunali321 <aunvakil.aa@gmail.com> * feat: move chips to a separate widget. Co-authored-by: Alberto Ponces <ponces26@gmail.com>
This commit is contained in:
@ -4,7 +4,6 @@ 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/patched_application.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
@ -39,6 +38,8 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
packageName: application.packageName,
|
||||
version: application.versionName!,
|
||||
apkFilePath: application.apkFilePath,
|
||||
icon: application.icon,
|
||||
patchDate: DateTime.now(),
|
||||
isRooted: isRooted,
|
||||
isFromStorage: isFromStorage,
|
||||
);
|
||||
@ -57,20 +58,25 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
);
|
||||
if (result != null && result.files.single.path != null) {
|
||||
File apkFile = File(result.files.single.path!);
|
||||
PackageArchiveInfo? packageArchiveInfo =
|
||||
await PackageArchiveInfo.fromPath(apkFile.path);
|
||||
PatchedApplication app = PatchedApplication(
|
||||
name: packageArchiveInfo.appName,
|
||||
packageName: packageArchiveInfo.packageName,
|
||||
version: packageArchiveInfo.version,
|
||||
apkFilePath: result.files.single.path!,
|
||||
isRooted: isRooted,
|
||||
isFromStorage: isFromStorage,
|
||||
);
|
||||
locator<AppSelectorViewModel>().selectedApp = app;
|
||||
locator<PatchesSelectorViewModel>().selectedPatches.clear();
|
||||
locator<PatcherViewModel>().dimPatchCard = false;
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
ApplicationWithIcon? application =
|
||||
await DeviceApps.getAppFromStorage(apkFile.path, true)
|
||||
as ApplicationWithIcon?;
|
||||
if (application != null) {
|
||||
PatchedApplication app = PatchedApplication(
|
||||
name: application.appName,
|
||||
packageName: application.packageName,
|
||||
version: application.versionName!,
|
||||
apkFilePath: result.files.single.path!,
|
||||
icon: application.icon,
|
||||
patchDate: DateTime.now(),
|
||||
isRooted: isRooted,
|
||||
isFromStorage: isFromStorage,
|
||||
);
|
||||
locator<AppSelectorViewModel>().selectedApp = app;
|
||||
locator<PatchesSelectorViewModel>().selectedPatches.clear();
|
||||
locator<PatcherViewModel>().dimPatchCard = false;
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
}
|
||||
} on Exception {
|
||||
Fluttertoast.showToast(
|
||||
|
@ -1,9 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
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/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/available_updates_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/dashboard_raw_chip.dart';
|
||||
import 'package:revanced_manager/ui/widgets/installed_apps_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/latest_commit_card.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
@ -13,8 +15,9 @@ class HomeView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder.reactive(
|
||||
viewModelBuilder: () => HomeViewModel(),
|
||||
return ViewModelBuilder<HomeViewModel>.reactive(
|
||||
disposeViewModel: false,
|
||||
viewModelBuilder: () => locator<HomeViewModel>(),
|
||||
builder: (context, model, child) => Scaffold(
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
@ -30,6 +33,7 @@ class HomeView extends StatelessWidget {
|
||||
'',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -40,6 +44,7 @@ class HomeView extends StatelessWidget {
|
||||
'',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark
|
||||
? const Color(0xffD1E1FA)
|
||||
: const Color(0xff384E6E),
|
||||
@ -48,7 +53,8 @@ class HomeView extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
LatestCommitCard(
|
||||
color: Theme.of(context).colorScheme.primary),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
I18nText(
|
||||
'homeView.patchedSubtitle',
|
||||
@ -62,14 +68,30 @@ class HomeView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
DashboardChip(
|
||||
label: "homeView.updatesAvailable",
|
||||
isSelected: model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
model.toggleUpdatableApps(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
DashboardChip(
|
||||
label: "homeView.installed",
|
||||
isSelected: !model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
model.toggleUpdatableApps(false);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
AvailableUpdatesCard(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
InstalledAppsCard(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
model.showUpdatableApps
|
||||
? const AvailableUpdatesCard()
|
||||
: const InstalledAppsCard()
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -1,8 +1,28 @@
|
||||
import 'dart:convert';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
@lazySingleton
|
||||
class HomeViewModel extends BaseViewModel {
|
||||
bool showUpdatableApps = true;
|
||||
|
||||
void toggleUpdatableApps(bool value) {
|
||||
showUpdatableApps = value;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future downloadPatches() => locator<ManagerAPI>().downloadPatches();
|
||||
Future downloadIntegrations() => locator<ManagerAPI>().downloadIntegrations();
|
||||
|
||||
Future<List<PatchedApplication>> getPatchedApps(bool isUpdatable) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
List<String> patchedApps = prefs.getStringList('patchedApps') ?? [];
|
||||
return patchedApps
|
||||
.map((app) => PatchedApplication.fromJson(json.decode(app)))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
@ -81,9 +82,8 @@ class InstallerView extends StatelessWidget {
|
||||
),
|
||||
child: SelectableText(
|
||||
model.logs,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 15,
|
||||
style: GoogleFonts.jetBrainsMono(
|
||||
fontSize: 12,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
|
@ -7,6 +7,7 @@ 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/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class InstallerViewModel extends BaseViewModel {
|
||||
@ -23,7 +24,7 @@ class InstallerViewModel extends BaseViewModel {
|
||||
notificationText: 'ReVanced Manager is patching',
|
||||
notificationImportance: AndroidNotificationImportance.Default,
|
||||
notificationIcon: AndroidResource(
|
||||
name: 'ic_launcher_foreground',
|
||||
name: 'ic_notification',
|
||||
defType: 'drawable',
|
||||
),
|
||||
),
|
||||
@ -34,11 +35,13 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
void addLog(String message) {
|
||||
if (logs.isNotEmpty) {
|
||||
logs += '\n';
|
||||
if (message.isNotEmpty && !message.startsWith('Merging L')) {
|
||||
if (logs.isNotEmpty) {
|
||||
logs += '\n';
|
||||
}
|
||||
logs += message;
|
||||
notifyListeners();
|
||||
}
|
||||
logs += message;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void updateProgress(double value) {
|
||||
@ -61,29 +64,25 @@ class InstallerViewModel extends BaseViewModel {
|
||||
List<Patch> selectedPatches =
|
||||
locator<PatchesSelectorViewModel>().selectedPatches;
|
||||
if (selectedPatches.isNotEmpty) {
|
||||
addLog('Initializing installer...');
|
||||
addLog('Initializing installer');
|
||||
if (selectedApp.isRooted && !selectedApp.isFromStorage) {
|
||||
addLog('Checking if an old patched version exists...');
|
||||
addLog('Checking if an old patched version exists');
|
||||
bool oldExists =
|
||||
await locator<PatcherAPI>().checkOldPatch(selectedApp);
|
||||
addLog('Done');
|
||||
if (oldExists) {
|
||||
addLog('Deleting old patched version...');
|
||||
addLog('Deleting old patched version');
|
||||
await locator<PatcherAPI>().deleteOldPatch(selectedApp);
|
||||
addLog('Done');
|
||||
}
|
||||
}
|
||||
addLog('Creating working directory...');
|
||||
addLog('Creating working directory');
|
||||
bool? isSuccess = await locator<PatcherAPI>().initPatcher();
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
updateProgress(0.1);
|
||||
addLog('Copying original apk...');
|
||||
addLog('Copying original apk');
|
||||
isSuccess = await locator<PatcherAPI>().copyInputFile(apkFilePath);
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
updateProgress(0.2);
|
||||
addLog('Creating patcher...');
|
||||
addLog('Creating patcher');
|
||||
bool resourcePatching = false;
|
||||
if (selectedApp.packageName == 'com.google.android.youtube' ||
|
||||
selectedApp.packageName ==
|
||||
@ -95,31 +94,26 @@ class InstallerViewModel extends BaseViewModel {
|
||||
);
|
||||
if (isSuccess != null && isSuccess) {
|
||||
if (selectedApp.packageName == 'com.google.android.youtube') {
|
||||
addLog('Done');
|
||||
updateProgress(0.3);
|
||||
addLog('Merging integrations...');
|
||||
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...');
|
||||
addLog('Repacking patched apk');
|
||||
isSuccess = await locator<PatcherAPI>().repackPatchedFile();
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
updateProgress(0.9);
|
||||
addLog('Signing patched apk...');
|
||||
addLog('Signing patched apk');
|
||||
isSuccess = await locator<PatcherAPI>().signPatchedFile();
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
showButtons = true;
|
||||
updateProgress(1.0);
|
||||
addLog('Finished');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,13 +122,13 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
}
|
||||
if (isSuccess == null || !isSuccess) {
|
||||
addLog('An error occurred! Aborting...');
|
||||
addLog('An error occurred! Aborting');
|
||||
}
|
||||
} else {
|
||||
addLog('No patches selected! Aborting...');
|
||||
addLog('No patches selected! Aborting');
|
||||
}
|
||||
} else {
|
||||
addLog('No app selected! Aborting...');
|
||||
addLog('No app selected! Aborting');
|
||||
}
|
||||
await FlutterBackground.disableBackgroundExecution();
|
||||
isPatching = false;
|
||||
@ -145,13 +139,14 @@ class InstallerViewModel extends BaseViewModel {
|
||||
locator<AppSelectorViewModel>().selectedApp;
|
||||
if (selectedApp != null) {
|
||||
addLog(selectedApp.isRooted
|
||||
? 'Installing patched file using root method...'
|
||||
: 'Installing patched file using nonroot method...');
|
||||
? 'Installing patched file using root method'
|
||||
: 'Installing patched file using nonroot method');
|
||||
isInstalled = await locator<PatcherAPI>().installPatchedFile(selectedApp);
|
||||
if (isInstalled) {
|
||||
addLog('Done');
|
||||
await saveApp(selectedApp);
|
||||
} else {
|
||||
addLog('An error occurred! Aborting...');
|
||||
addLog('An error occurred! Aborting');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -181,4 +176,14 @@ class InstallerViewModel extends BaseViewModel {
|
||||
DeviceApps.openApp(selectedApp.packageName);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> saveApp(PatchedApplication selectedApp) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
List<String> patchedApps = prefs.getStringList('patchedApps') ?? [];
|
||||
String app = selectedApp.toJson().toString();
|
||||
if (!patchedApps.contains(app)) {
|
||||
patchedApps.add(app);
|
||||
prefs.setStringList('patchedApps', patchedApps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,57 +1,114 @@
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/constants.dart';
|
||||
import 'package:revanced_manager/theme.dart';
|
||||
import 'package:revanced_manager/ui/widgets/patch_text_button.dart';
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
|
||||
class ApplicationItem extends StatelessWidget {
|
||||
final String asset;
|
||||
final Uint8List icon;
|
||||
final String name;
|
||||
final String releaseDate;
|
||||
final DateTime patchDate;
|
||||
final String? changelog;
|
||||
final bool isUpdatableApp;
|
||||
final Function()? onPressed;
|
||||
|
||||
const ApplicationItem({
|
||||
Key? key,
|
||||
required this.asset,
|
||||
required this.icon,
|
||||
required this.name,
|
||||
required this.releaseDate,
|
||||
required this.patchDate,
|
||||
this.changelog = '',
|
||||
required this.isUpdatableApp,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isSVG = asset.endsWith('.svg');
|
||||
return ListTile(
|
||||
horizontalTitleGap: 12.0,
|
||||
leading: isSVG
|
||||
? SvgPicture.asset(
|
||||
asset,
|
||||
height: 26,
|
||||
width: 26,
|
||||
)
|
||||
: Image.asset(
|
||||
asset,
|
||||
height: 39,
|
||||
width: 39,
|
||||
return ExpandablePanel(
|
||||
theme: const ExpandableThemeData(
|
||||
hasIcon: false,
|
||||
animationDuration: Duration(milliseconds: 450),
|
||||
),
|
||||
header: Container(
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(16),
|
||||
),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 60,
|
||||
child: Image.memory(
|
||||
icon,
|
||||
height: 39,
|
||||
width: 39,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
name,
|
||||
style: GoogleFonts.roboto(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
const SizedBox(width: 4),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width - 250,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
name,
|
||||
style: GoogleFonts.roboto(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
format(patchDate),
|
||||
style: robotoTextStyle.copyWith(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
isUpdatableApp
|
||||
? Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: PatchTextButton(
|
||||
text: 'applicationItem.patchButton',
|
||||
onPressed: onPressed,
|
||||
borderColor: isDark
|
||||
? const Color(0xff4D5054)
|
||||
: const Color.fromRGBO(119, 146, 168, 1),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
releaseDate,
|
||||
style: robotoTextStyle,
|
||||
),
|
||||
trailing: PatchTextButton(
|
||||
text: FlutterI18n.translate(
|
||||
context,
|
||||
'applicationItem.patchButton',
|
||||
collapsed: const Text(""),
|
||||
expanded: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
I18nText(
|
||||
'applicationItem.changelogLabel',
|
||||
child: Text(
|
||||
'',
|
||||
style: robotoTextStyle.copyWith(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
changelog!,
|
||||
style: robotoTextStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
onPressed: onPressed,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -1,94 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
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/models/patched_application.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/application_item.dart';
|
||||
import 'package:revanced_manager/ui/widgets/patch_text_button.dart';
|
||||
|
||||
class AvailableUpdatesCard extends StatelessWidget {
|
||||
final Color? color;
|
||||
const AvailableUpdatesCard({
|
||||
Key? key,
|
||||
this.color = const Color(0xff1B222B),
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: color,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
I18nText(
|
||||
'availableUpdatesCard.widgetTitle',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
PatchTextButton(
|
||||
text: FlutterI18n.translate(
|
||||
context,
|
||||
'availableUpdatesCard.patchButton',
|
||||
),
|
||||
onPressed: () => {},
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
ApplicationItem(
|
||||
asset: 'assets/images/revanced.svg',
|
||||
name: 'ReVanced',
|
||||
releaseDate: '2 days ago',
|
||||
onPressed: () => {},
|
||||
),
|
||||
ApplicationItem(
|
||||
asset: 'assets/images/reddit.png',
|
||||
name: 'ReReddit',
|
||||
releaseDate: 'Released 1 month ago',
|
||||
onPressed: () => {},
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
I18nText(
|
||||
'availableUpdatesCard.changelogLabel',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.roboto(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'fix: we made the player even worse (you love)',
|
||||
style: GoogleFonts.roboto(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'chore: guhhughghu',
|
||||
style: GoogleFonts.roboto(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
FutureBuilder<List<PatchedApplication>>(
|
||||
future: locator<HomeViewModel>().getPatchedApps(true),
|
||||
builder: (context, snapshot) =>
|
||||
snapshot.hasData && snapshot.data!.length > 1
|
||||
? ListView.builder(
|
||||
itemBuilder: (context, index) => ApplicationItem(
|
||||
icon: snapshot.data![index].icon,
|
||||
name: snapshot.data![index].name,
|
||||
patchDate: snapshot.data![index].patchDate,
|
||||
isUpdatableApp: true,
|
||||
onPressed: () => {},
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
51
lib/ui/widgets/dashboard_raw_chip.dart
Normal file
51
lib/ui/widgets/dashboard_raw_chip.dart
Normal file
@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/theme.dart';
|
||||
|
||||
class DashboardChip extends StatelessWidget {
|
||||
final String label;
|
||||
final bool isSelected;
|
||||
final Function(bool)? onSelected;
|
||||
const DashboardChip({
|
||||
Key? key,
|
||||
required this.label,
|
||||
required this.isSelected,
|
||||
this.onSelected,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RawChip(
|
||||
showCheckmark: false,
|
||||
label: I18nText(label),
|
||||
selected: isSelected,
|
||||
labelStyle: GoogleFonts.inter(
|
||||
color: isSelected
|
||||
? isDark
|
||||
? const Color(0xff95C0FE)
|
||||
: Theme.of(context).colorScheme.secondary
|
||||
: isDark
|
||||
? Colors.grey
|
||||
: Colors.grey[700],
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
selectedColor: const Color.fromRGBO(118, 155, 209, 0.42),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
side: BorderSide(
|
||||
width: 1,
|
||||
color: isDark
|
||||
? isSelected
|
||||
? const Color.fromRGBO(118, 155, 209, 0.42)
|
||||
: Colors.grey
|
||||
: isSelected
|
||||
? const Color.fromRGBO(118, 155, 209, 0.42)
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
onSelected: onSelected,
|
||||
);
|
||||
}
|
||||
}
|
@ -1,70 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
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/models/patched_application.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/application_item.dart';
|
||||
|
||||
class InstalledAppsCard extends StatelessWidget {
|
||||
final Color? color;
|
||||
const InstalledAppsCard({
|
||||
Key? key,
|
||||
this.color = const Color(0xff1B222B),
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: color,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
I18nText(
|
||||
'installedAppsCard.widgetTitle',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
ApplicationItem(
|
||||
asset: 'assets/images/revanced.svg',
|
||||
name: 'ReVanced',
|
||||
releaseDate: '2 days ago',
|
||||
onPressed: () => {},
|
||||
),
|
||||
I18nText(
|
||||
'installedAppsCard.changelogLabel',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.roboto(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'fix: we made the player even worse (you love)',
|
||||
style: GoogleFonts.roboto(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'chore: guhhughghu',
|
||||
style: GoogleFonts.roboto(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
FutureBuilder<List<PatchedApplication>>(
|
||||
future: locator<HomeViewModel>().getPatchedApps(false),
|
||||
builder: (context, snapshot) =>
|
||||
snapshot.hasData && snapshot.data!.length > 1
|
||||
? ListView.builder(
|
||||
itemBuilder: (context, index) => ApplicationItem(
|
||||
icon: snapshot.data![index].icon,
|
||||
name: snapshot.data![index].name,
|
||||
patchDate: snapshot.data![index].patchDate,
|
||||
isUpdatableApp: false,
|
||||
onPressed: () => {},
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
),
|
||||
onPressed: () => {},
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
borderColor: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:revanced_manager/constants.dart';
|
||||
import 'package:revanced_manager/theme.dart';
|
||||
|
||||
class PatchTextButton extends StatelessWidget {
|
||||
final String text;
|
||||
@ -19,21 +21,30 @@ class PatchTextButton extends StatelessWidget {
|
||||
return TextButton(
|
||||
onPressed: onPressed,
|
||||
style: Theme.of(context).textButtonTheme.style?.copyWith(
|
||||
backgroundColor: MaterialStateProperty.all<Color?>(backgroundColor),
|
||||
side: MaterialStateProperty.all<BorderSide>(
|
||||
BorderSide(
|
||||
color: borderColor,
|
||||
width: 1,
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all<Color?>(backgroundColor),
|
||||
side: MaterialStateProperty.all<BorderSide>(
|
||||
BorderSide(
|
||||
color: borderColor,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
text,
|
||||
style: interTextStyle.copyWith(
|
||||
color: backgroundColor == Colors.transparent
|
||||
? const Color.fromRGBO(119, 146, 186, 1)
|
||||
: Colors.white),
|
||||
),
|
||||
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 4,
|
||||
),
|
||||
)),
|
||||
child: I18nText(text,
|
||||
child: Text(
|
||||
'',
|
||||
style: interTextStyle.copyWith(
|
||||
color: backgroundColor == Colors.transparent
|
||||
? const Color.fromRGBO(119, 146, 186, 1)
|
||||
: isDark
|
||||
? Colors.black
|
||||
: Colors.white,
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user