mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 12:47:37 +02:00
feat: update rules of analysis_options.yaml. and solved all problems (#665)
* update rules of analysis_options.yaml. and solved all problems * refactor: fix remaining problems --------- Co-authored-by: Ushie <ushiekane@gmail.com>
This commit is contained in:
@ -8,12 +8,11 @@ import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class AppInfoView extends StatelessWidget {
|
||||
final PatchedApplication app;
|
||||
|
||||
const AppInfoView({
|
||||
Key? key,
|
||||
required this.app,
|
||||
}) : super(key: key);
|
||||
final PatchedApplication app;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -29,7 +29,7 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
) async {
|
||||
bool isUninstalled = true;
|
||||
if (app.isRooted) {
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
final bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (hasRootPermissions) {
|
||||
await _rootAPI.deleteApp(app.packageName, app.apkFilePath);
|
||||
if (!onlyUnpatch) {
|
||||
@ -45,7 +45,7 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
void navigateToPatcher(PatchedApplication app) async {
|
||||
Future<void> navigateToPatcher(PatchedApplication app) async {
|
||||
locator<PatcherViewModel>().selectedApp = app;
|
||||
locator<PatcherViewModel>().selectedPatches =
|
||||
await _patcherAPI.getAppliedPatches(app.appliedPatches);
|
||||
@ -62,7 +62,7 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
PatchedApplication app,
|
||||
bool onlyUnpatch,
|
||||
) async {
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
final bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (app.isRooted && !hasRootPermissions) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
@ -134,7 +134,8 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
title: I18nText('appInfoView.appliedPatchesLabel'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: SingleChildScrollView(
|
||||
child: Text(getAppliedPatchesString(app.appliedPatches))),
|
||||
child: Text(getAppliedPatchesString(app.appliedPatches)),
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
@ -146,13 +147,15 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
String getAppliedPatchesString(List<String> appliedPatches) {
|
||||
List<String> names = appliedPatches
|
||||
.map((p) => p
|
||||
.replaceAll('-', ' ')
|
||||
.split('-')
|
||||
.join(' ')
|
||||
.toTitleCase()
|
||||
.replaceFirst('Microg', 'MicroG'))
|
||||
final List<String> names = appliedPatches
|
||||
.map(
|
||||
(p) => p
|
||||
.replaceAll('-', ' ')
|
||||
.split('-')
|
||||
.join(' ')
|
||||
.toTitleCase()
|
||||
.replaceFirst('Microg', 'MicroG'),
|
||||
)
|
||||
.toList();
|
||||
return '\u2022 ${names.join('\n\u2022 ')}';
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ class AppSkeletonLoader extends StatelessWidget {
|
||||
style: SkeletonAvatarStyle(
|
||||
width: screenWidth * 0.15,
|
||||
height: screenWidth * 0.15,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
),
|
||||
|
@ -3,12 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
|
||||
class InstalledAppItem extends StatefulWidget {
|
||||
final String name;
|
||||
final String pkgName;
|
||||
final Uint8List icon;
|
||||
final int patchesCount;
|
||||
final Function()? onTap;
|
||||
|
||||
const InstalledAppItem({
|
||||
Key? key,
|
||||
required this.name,
|
||||
@ -17,6 +11,11 @@ class InstalledAppItem extends StatefulWidget {
|
||||
required this.patchesCount,
|
||||
this.onTap,
|
||||
}) : super(key: key);
|
||||
final String name;
|
||||
final String pkgName;
|
||||
final Uint8List icon;
|
||||
final int patchesCount;
|
||||
final Function()? onTap;
|
||||
|
||||
@override
|
||||
State<InstalledAppItem> createState() => _InstalledAppItemState();
|
||||
@ -48,7 +47,6 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.name,
|
||||
@ -62,8 +60,8 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
widget.patchesCount == 1
|
||||
? "${widget.patchesCount} patch"
|
||||
: "${widget.patchesCount} patches",
|
||||
? '${widget.patchesCount} patch'
|
||||
: '${widget.patchesCount} patches',
|
||||
style: TextStyle(
|
||||
fontSize: 8,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
|
@ -6,14 +6,13 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ContributorsCard extends StatefulWidget {
|
||||
final String title;
|
||||
final List<dynamic> contributors;
|
||||
|
||||
const ContributorsCard({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.contributors,
|
||||
}) : super(key: key);
|
||||
final String title;
|
||||
final List<dynamic> contributors;
|
||||
|
||||
@override
|
||||
State<ContributorsCard> createState() => _ContributorsCardState();
|
||||
|
@ -3,7 +3,6 @@ import 'package:flutter_i18n/flutter_i18n.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/shared/application_item.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
|
||||
class AvailableUpdatesCard extends StatelessWidget {
|
||||
|
@ -2,16 +2,15 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.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/shared/custom_material_button.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
|
||||
class LatestCommitCard extends StatefulWidget {
|
||||
final Function() onPressed;
|
||||
|
||||
const LatestCommitCard({
|
||||
Key? key,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
final Function() onPressed;
|
||||
|
||||
@override
|
||||
State<LatestCommitCard> createState() => _LatestCommitCardState();
|
||||
@ -73,7 +72,6 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
builder: (context, snapshot) => Opacity(
|
||||
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
|
||||
child: CustomMaterialButton(
|
||||
isExpanded: false,
|
||||
label: I18nText('latestCommitCard.updateButton'),
|
||||
onPressed: snapshot.hasData && snapshot.data!
|
||||
? widget.onPressed
|
||||
|
@ -14,7 +14,6 @@ class UpdateConfirmationDialog extends StatelessWidget {
|
||||
|
||||
return DraggableScrollableSheet(
|
||||
expand: false,
|
||||
initialChildSize: 0.5,
|
||||
snap: true,
|
||||
snapSizes: const [0.5],
|
||||
builder: (context, scrollController) => SingleChildScrollView(
|
||||
@ -37,7 +36,11 @@ class UpdateConfirmationDialog extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 40.0, left: 24.0, right: 24.0, bottom: 32.0),
|
||||
top: 40.0,
|
||||
left: 24.0,
|
||||
right: 24.0,
|
||||
bottom: 32.0,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -47,10 +50,11 @@ class UpdateConfirmationDialog extends StatelessWidget {
|
||||
I18nText(
|
||||
'homeView.updateDialogTitle',
|
||||
child: const Text(
|
||||
"",
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold),
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4.0),
|
||||
@ -63,7 +67,7 @@ class UpdateConfirmationDialog extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 8.0),
|
||||
Text(
|
||||
snapshot.data!["tag_name"] ?? "Unknown",
|
||||
snapshot.data!['tag_name'] ?? 'Unknown',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
@ -93,13 +97,14 @@ class UpdateConfirmationDialog extends StatelessWidget {
|
||||
child: I18nText(
|
||||
'homeView.updateChangelogTitle',
|
||||
child: Text(
|
||||
"",
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -113,7 +118,7 @@ class UpdateConfirmationDialog extends StatelessWidget {
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
data: snapshot.data!["body"] ?? "",
|
||||
data: snapshot.data!['body'] ?? '',
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class GradientProgressIndicator extends StatefulWidget {
|
||||
final double? progress;
|
||||
const GradientProgressIndicator({required this.progress, super.key});
|
||||
final double? progress;
|
||||
|
||||
@override
|
||||
State<GradientProgressIndicator> createState() =>
|
||||
|
@ -6,12 +6,11 @@ import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
|
||||
class AppSelectorCard extends StatelessWidget {
|
||||
final Function() onPressed;
|
||||
|
||||
const AppSelectorCard({
|
||||
Key? key,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
final Function() onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -33,40 +32,41 @@ class AppSelectorCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
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,
|
||||
),
|
||||
),
|
||||
if (locator<PatcherViewModel>().selectedApp == null)
|
||||
I18nText('appSelectorCard.widgetSubtitle')
|
||||
else
|
||||
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(),
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? Container()
|
||||
: Column(
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
locator<PatcherViewModel>()
|
||||
.getRecommendedVersionString(context),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
locator<PatcherViewModel>().getAppSelectionString(),
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (locator<PatcherViewModel>().selectedApp == null)
|
||||
Container()
|
||||
else
|
||||
Column(
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
locator<PatcherViewModel>()
|
||||
.getRecommendedVersionString(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -6,12 +6,11 @@ import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
|
||||
class PatchSelectorCard extends StatelessWidget {
|
||||
final Function() onPressed;
|
||||
|
||||
const PatchSelectorCard({
|
||||
Key? key,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
final Function() onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -46,11 +45,12 @@ class PatchSelectorCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? I18nText('patchSelectorCard.widgetSubtitle')
|
||||
: locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||
? I18nText('patchSelectorCard.widgetEmptySubtitle')
|
||||
: Text(_getPatchesSelection()),
|
||||
if (locator<PatcherViewModel>().selectedApp == null)
|
||||
I18nText('patchSelectorCard.widgetSubtitle')
|
||||
else
|
||||
locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||
? I18nText('patchSelectorCard.widgetEmptySubtitle')
|
||||
: Text(_getPatchesSelection()),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -58,7 +58,7 @@ class PatchSelectorCard extends StatelessWidget {
|
||||
|
||||
String _getPatchesSelection() {
|
||||
String text = '';
|
||||
for (Patch p in locator<PatcherViewModel>().selectedPatches) {
|
||||
for (final Patch p in locator<PatcherViewModel>().selectedPatches) {
|
||||
text += '\u2022 ${p.getSimpleName()} (v${p.version})\n';
|
||||
}
|
||||
return text.substring(0, text.length - 1);
|
||||
|
@ -3,11 +3,24 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class PatchItem extends StatefulWidget {
|
||||
PatchItem({
|
||||
Key? key,
|
||||
required this.name,
|
||||
required this.simpleName,
|
||||
required this.description,
|
||||
required this.version,
|
||||
required this.packageVersion,
|
||||
required this.supportedPackageVersions,
|
||||
required this.isUnsupported,
|
||||
required this.isSelected,
|
||||
required this.onChanged,
|
||||
this.child,
|
||||
}) : super(key: key);
|
||||
final String name;
|
||||
final String simpleName;
|
||||
final String description;
|
||||
@ -21,20 +34,6 @@ class PatchItem extends StatefulWidget {
|
||||
final toast = locator<Toast>();
|
||||
final _managerAPI = locator<ManagerAPI>();
|
||||
|
||||
PatchItem(
|
||||
{Key? key,
|
||||
required this.name,
|
||||
required this.simpleName,
|
||||
required this.description,
|
||||
required this.version,
|
||||
required this.packageVersion,
|
||||
required this.supportedPackageVersions,
|
||||
required this.isUnsupported,
|
||||
required this.isSelected,
|
||||
required this.onChanged,
|
||||
this.child})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<PatchItem> createState() => _PatchItemState();
|
||||
}
|
||||
@ -141,38 +140,37 @@ class _PatchItemState extends State<PatchItem> {
|
||||
)
|
||||
],
|
||||
),
|
||||
widget.isUnsupported
|
||||
? Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: TextButton.icon(
|
||||
label: I18nText('warning'),
|
||||
icon: const Icon(Icons.warning, size: 20.0),
|
||||
onPressed: () => _showUnsupportedWarningDialog(),
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
width: 1,
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
if (widget.isUnsupported)
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: TextButton.icon(
|
||||
label: I18nText('warning'),
|
||||
icon: const Icon(Icons.warning, size: 20.0),
|
||||
onPressed: () => _showUnsupportedWarningDialog(),
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
else
|
||||
Container(),
|
||||
widget.child ?? const SizedBox(),
|
||||
],
|
||||
),
|
||||
|
@ -3,8 +3,8 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class OptionsTextField extends StatelessWidget {
|
||||
final String hint;
|
||||
const OptionsTextField({Key? key, required this.hint}) : super(key: key);
|
||||
final String hint;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -12,7 +12,7 @@ class OptionsTextField extends StatelessWidget {
|
||||
final sWidth = MediaQuery.of(context).size.width;
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 12, bottom: 6),
|
||||
padding: const EdgeInsets.all(0),
|
||||
padding: EdgeInsets.zero,
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
constraints: BoxConstraints(
|
||||
@ -28,9 +28,9 @@ class OptionsTextField extends StatelessWidget {
|
||||
}
|
||||
|
||||
class OptionsFilePicker extends StatelessWidget {
|
||||
final String optionName;
|
||||
const OptionsFilePicker({Key? key, required this.optionName})
|
||||
: super(key: key);
|
||||
final String optionName;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:revanced_manager/utils/about_info.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class AboutWidget extends StatefulWidget {
|
||||
const AboutWidget({Key? key, this.padding}) : super(key: key);
|
||||
|
@ -1,14 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomSwitch extends StatelessWidget {
|
||||
final ValueChanged<bool> onChanged;
|
||||
final bool value;
|
||||
|
||||
const CustomSwitch({
|
||||
Key? key,
|
||||
required this.onChanged,
|
||||
required this.value,
|
||||
}) : super(key: key);
|
||||
final ValueChanged<bool> onChanged;
|
||||
final bool value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -2,12 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/custom_switch.dart';
|
||||
|
||||
class CustomSwitchTile extends StatelessWidget {
|
||||
final Widget title;
|
||||
final Widget subtitle;
|
||||
final bool value;
|
||||
final Function(bool) onTap;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
const CustomSwitchTile({
|
||||
Key? key,
|
||||
required this.title,
|
||||
@ -16,6 +10,11 @@ class CustomSwitchTile extends StatelessWidget {
|
||||
required this.onTap,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
final Widget title;
|
||||
final Widget subtitle;
|
||||
final bool value;
|
||||
final Function(bool) onTap;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -1,12 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomTextField extends StatelessWidget {
|
||||
final TextEditingController inputController;
|
||||
final Widget label;
|
||||
final String hint;
|
||||
final Widget? leadingIcon;
|
||||
final Function(String)? onChanged;
|
||||
|
||||
const CustomTextField({
|
||||
Key? key,
|
||||
required this.inputController,
|
||||
@ -15,6 +9,11 @@ class CustomTextField extends StatelessWidget {
|
||||
this.leadingIcon,
|
||||
required this.onChanged,
|
||||
}) : super(key: key);
|
||||
final TextEditingController inputController;
|
||||
final Widget label;
|
||||
final String hint;
|
||||
final Widget? leadingIcon;
|
||||
final Function(String)? onChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -45,10 +44,8 @@ class CustomTextField extends StatelessWidget {
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
gapPadding: 4.0,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
@ -60,14 +57,12 @@ class CustomTextField extends StatelessWidget {
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
|
@ -7,12 +7,14 @@ class SExperimentalUniversalPatches extends StatefulWidget {
|
||||
const SExperimentalUniversalPatches({super.key});
|
||||
|
||||
@override
|
||||
State<SExperimentalUniversalPatches> createState() => _SExperimentalUniversalPatchesState();
|
||||
State<SExperimentalUniversalPatches> createState() =>
|
||||
_SExperimentalUniversalPatchesState();
|
||||
}
|
||||
|
||||
final _settingsViewModel = SettingsViewModel();
|
||||
|
||||
class _SExperimentalUniversalPatchesState extends State<SExperimentalUniversalPatches> {
|
||||
class _SExperimentalUniversalPatchesState
|
||||
extends State<SExperimentalUniversalPatches> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomSwitchTile(
|
||||
|
@ -2,14 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
|
||||
class SettingsSection extends StatelessWidget {
|
||||
final String title;
|
||||
final List<Widget> children;
|
||||
|
||||
const SettingsSection({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.children,
|
||||
}) : super(key: key);
|
||||
final String title;
|
||||
final List<Widget> children;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -2,11 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
|
||||
class SettingsTileDialog extends StatelessWidget {
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final Function()? onTap;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
const SettingsTileDialog({
|
||||
Key? key,
|
||||
required this.title,
|
||||
@ -14,6 +9,10 @@ class SettingsTileDialog extends StatelessWidget {
|
||||
required this.onTap,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final Function()? onTap;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -1,13 +1,7 @@
|
||||
|
||||
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,
|
||||
@ -15,6 +9,10 @@ class SocialMediaItem extends StatelessWidget {
|
||||
this.subtitle,
|
||||
this.url,
|
||||
}) : super(key: key);
|
||||
final Widget? icon;
|
||||
final Widget title;
|
||||
final Widget? subtitle;
|
||||
final String? url;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -6,12 +6,11 @@ import 'package:revanced_manager/ui/widgets/settingsView/social_media_item.dart'
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
|
||||
class SocialMediaWidget extends StatelessWidget {
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
const SocialMediaWidget({
|
||||
Key? key,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -1,19 +1,13 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
|
||||
class ApplicationItem extends StatefulWidget {
|
||||
final Uint8List icon;
|
||||
final String name;
|
||||
final DateTime patchDate;
|
||||
final List<String> changelog;
|
||||
final bool isUpdatableApp;
|
||||
final Function() onPressed;
|
||||
|
||||
const ApplicationItem({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
@ -23,6 +17,12 @@ class ApplicationItem extends StatefulWidget {
|
||||
required this.isUpdatableApp,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
final Uint8List icon;
|
||||
final String name;
|
||||
final DateTime patchDate;
|
||||
final List<String> changelog;
|
||||
final bool isUpdatableApp;
|
||||
final Function() onPressed;
|
||||
|
||||
@override
|
||||
State<ApplicationItem> createState() => _ApplicationItemState();
|
||||
@ -33,7 +33,7 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
late AnimationController _animationController;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_animationController = AnimationController(
|
||||
vsync: this,
|
||||
@ -49,95 +49,100 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ExpandableController expController = ExpandableController();
|
||||
final ExpandableController expController = ExpandableController();
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 16.0),
|
||||
child: CustomCard(
|
||||
onTap: () {
|
||||
expController.toggle();
|
||||
_animationController.isCompleted
|
||||
? _animationController.reverse()
|
||||
: _animationController.forward();
|
||||
},
|
||||
child: ExpandablePanel(
|
||||
controller: expController,
|
||||
theme: const ExpandableThemeData(
|
||||
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
|
||||
tapBodyToCollapse: false,
|
||||
tapBodyToExpand: false,
|
||||
tapHeaderToExpand: false,
|
||||
hasIcon: false,
|
||||
animationDuration: Duration(milliseconds: 450),
|
||||
),
|
||||
header: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 40,
|
||||
child: Image.memory(widget.icon, height: 40, width: 40),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 15.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.name.length > 12
|
||||
? '${widget.name.substring(0, 12)}...'
|
||||
: widget.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(format(widget.patchDate)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
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),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
margin: const EdgeInsets.only(bottom: 16.0),
|
||||
child: CustomCard(
|
||||
onTap: () {
|
||||
expController.toggle();
|
||||
_animationController.isCompleted
|
||||
? _animationController.reverse()
|
||||
: _animationController.forward();
|
||||
},
|
||||
child: ExpandablePanel(
|
||||
controller: expController,
|
||||
theme: const ExpandableThemeData(
|
||||
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
|
||||
tapBodyToCollapse: false,
|
||||
tapBodyToExpand: false,
|
||||
tapHeaderToExpand: false,
|
||||
hasIcon: false,
|
||||
animationDuration: Duration(milliseconds: 450),
|
||||
),
|
||||
header: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 40,
|
||||
child: Image.memory(widget.icon, height: 40, width: 40),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 15.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: widget.isUpdatableApp
|
||||
? I18nText('applicationItem.patchButton')
|
||||
: I18nText('applicationItem.infoButton'),
|
||||
onPressed: widget.onPressed,
|
||||
Text(
|
||||
widget.name.length > 12
|
||||
? '${widget.name.substring(0, 12)}...'
|
||||
: widget.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(format(widget.patchDate)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
collapsed: const SizedBox(),
|
||||
expanded: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 16.0, left: 4.0, right: 4.0, bottom: 4.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
),
|
||||
const Spacer(),
|
||||
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),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
I18nText(
|
||||
'applicationItem.changelogLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: widget.isUpdatableApp
|
||||
? I18nText('applicationItem.patchButton')
|
||||
: I18nText('applicationItem.infoButton'),
|
||||
onPressed: widget.onPressed,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
collapsed: const SizedBox(),
|
||||
expanded: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 16.0,
|
||||
left: 4.0,
|
||||
right: 4.0,
|
||||
bottom: 4.0,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
I18nText(
|
||||
'applicationItem.changelogLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomCard extends StatelessWidget {
|
||||
const CustomCard({
|
||||
Key? key,
|
||||
this.isFilled = true,
|
||||
required this.child,
|
||||
this.onTap,
|
||||
this.padding,
|
||||
this.backgroundColor,
|
||||
}) : super(key: key);
|
||||
final bool isFilled;
|
||||
final Widget child;
|
||||
final Function()? onTap;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
final Color? backgroundColor;
|
||||
|
||||
const CustomCard(
|
||||
{Key? key,
|
||||
this.isFilled = true,
|
||||
required this.child,
|
||||
this.onTap,
|
||||
this.padding,
|
||||
this.backgroundColor})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
|
@ -1,16 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomChip extends StatelessWidget {
|
||||
final Widget label;
|
||||
final bool isSelected;
|
||||
final Function(bool)? onSelected;
|
||||
|
||||
const CustomChip({
|
||||
Key? key,
|
||||
required this.label,
|
||||
this.isSelected = false,
|
||||
this.onSelected,
|
||||
}) : super(key: key);
|
||||
final Widget label;
|
||||
final bool isSelected;
|
||||
final Function(bool)? onSelected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -1,11 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomMaterialButton extends StatelessWidget {
|
||||
final Widget label;
|
||||
final bool isFilled;
|
||||
final bool isExpanded;
|
||||
final Function()? onPressed;
|
||||
|
||||
const CustomMaterialButton({
|
||||
Key? key,
|
||||
required this.label,
|
||||
@ -13,6 +8,10 @@ class CustomMaterialButton extends StatelessWidget {
|
||||
this.isExpanded = false,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
final Widget label;
|
||||
final bool isFilled;
|
||||
final bool isExpanded;
|
||||
final Function()? onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -28,7 +27,6 @@ class CustomMaterialButton extends StatelessWidget {
|
||||
side: isFilled
|
||||
? BorderSide.none
|
||||
: BorderSide(
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
@ -50,12 +48,6 @@ class CustomMaterialButton extends StatelessWidget {
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class TimerButton extends StatefulWidget {
|
||||
Widget label;
|
||||
bool isFilled;
|
||||
int seconds;
|
||||
final bool isRunning;
|
||||
final Function()? onTimerEnd;
|
||||
|
||||
TimerButton({
|
||||
Key? key,
|
||||
required this.seconds,
|
||||
@ -64,6 +56,11 @@ class TimerButton extends StatefulWidget {
|
||||
this.label = const Text(''),
|
||||
this.isFilled = true,
|
||||
}) : super(key: key);
|
||||
Widget label;
|
||||
bool isFilled;
|
||||
int seconds;
|
||||
final bool isRunning;
|
||||
final Function()? onTimerEnd;
|
||||
|
||||
@override
|
||||
State<TimerButton> createState() => _TimerButtonState();
|
||||
@ -101,7 +98,6 @@ class _TimerButtonState extends State<TimerButton> {
|
||||
side: widget.isFilled
|
||||
? BorderSide.none
|
||||
: BorderSide(
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
|
@ -1,14 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomPopupMenu extends StatelessWidget {
|
||||
final Function(dynamic) onSelected;
|
||||
final Map<int, Widget> children;
|
||||
|
||||
const CustomPopupMenu({
|
||||
Key? key,
|
||||
required this.onSelected,
|
||||
required this.children,
|
||||
}) : super(key: key);
|
||||
final Function(dynamic) onSelected;
|
||||
final Map<int, Widget> children;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -1,12 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
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,
|
||||
@ -15,13 +9,16 @@ class CustomSliverAppBar extends StatelessWidget {
|
||||
this.isMainView = false,
|
||||
this.onBackButtonPressed,
|
||||
}) : super(key: key);
|
||||
final Widget title;
|
||||
final List<Widget>? actions;
|
||||
final PreferredSizeWidget? bottom;
|
||||
final bool isMainView;
|
||||
final Function()? onBackButtonPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SliverAppBar(
|
||||
pinned: true,
|
||||
snap: false,
|
||||
floating: false,
|
||||
expandedHeight: 100.0,
|
||||
automaticallyImplyLeading: !isMainView,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
|
@ -2,21 +2,19 @@ import 'package:animations/animations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OpenContainerWrapper extends StatelessWidget {
|
||||
final OpenContainerBuilder openBuilder;
|
||||
final CloseContainerBuilder closedBuilder;
|
||||
|
||||
const OpenContainerWrapper({
|
||||
Key? key,
|
||||
required this.openBuilder,
|
||||
required this.closedBuilder,
|
||||
}) : super(key: key);
|
||||
final OpenContainerBuilder openBuilder;
|
||||
final CloseContainerBuilder closedBuilder;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return OpenContainer(
|
||||
openBuilder: openBuilder,
|
||||
closedBuilder: closedBuilder,
|
||||
transitionType: ContainerTransitionType.fade,
|
||||
transitionDuration: const Duration(milliseconds: 400),
|
||||
openColor: Theme.of(context).colorScheme.primary,
|
||||
closedColor: Colors.transparent,
|
||||
|
@ -1,10 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SearchBar extends StatefulWidget {
|
||||
final String? hintText;
|
||||
final bool showSelectIcon;
|
||||
final Function(bool)? onSelectAll;
|
||||
|
||||
const SearchBar({
|
||||
Key? key,
|
||||
required this.hintText,
|
||||
@ -12,6 +8,9 @@ class SearchBar extends StatefulWidget {
|
||||
this.onSelectAll,
|
||||
required this.onQueryChanged,
|
||||
}) : super(key: key);
|
||||
final String? hintText;
|
||||
final bool showSelectIcon;
|
||||
final Function(bool)? onSelectAll;
|
||||
|
||||
final Function(String) onQueryChanged;
|
||||
|
||||
|
Reference in New Issue
Block a user