mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-04-30 05:54:26 +02:00
feat: partial implementation of patches sources.
This commit is contained in:
parent
89ca3f0040
commit
8a12278b47
@ -71,7 +71,10 @@
|
|||||||
"aboutLabel": "About",
|
"aboutLabel": "About",
|
||||||
"contributorsLabel": "Contributors",
|
"contributorsLabel": "Contributors",
|
||||||
"rootModeLabel": "Root Mode",
|
"rootModeLabel": "Root Mode",
|
||||||
"rootModeHint": "Enable this if you want to patch applications as rooted."
|
"rootModeHint": "Enable this if you want to patch applications as rooted.",
|
||||||
|
"organizationLabel": "Organization",
|
||||||
|
"patchesSourceLabel" : "Patches Source",
|
||||||
|
"integrationsSourceLabel": "Integrations Source"
|
||||||
},
|
},
|
||||||
"rootCheckerView": {
|
"rootCheckerView": {
|
||||||
"widgetTitle": "Is your device rooted?",
|
"widgetTitle": "Is your device rooted?",
|
||||||
|
@ -19,9 +19,9 @@ final kSettingItemSubtitleTextStyle = GoogleFonts.roboto(
|
|||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
);
|
);
|
||||||
|
|
||||||
const ghOrg = 'revanced';
|
String ghOrg = 'revanced';
|
||||||
const patchesRepo = 'revanced-patches';
|
String patchesRepo = 'revanced-patches';
|
||||||
const integrationsRepo = 'revanced-integrations';
|
String integrationsRepo = 'revanced-integrations';
|
||||||
const patcherRepo = 'revanced-patcher';
|
const patcherRepo = 'revanced-patcher';
|
||||||
const cliRepo = 'revanced-cli';
|
const cliRepo = 'revanced-cli';
|
||||||
const managerRepo = 'revanced-manager';
|
const managerRepo = 'revanced-manager';
|
||||||
|
@ -128,7 +128,7 @@ class Navigation extends StatelessWidget {
|
|||||||
case 1:
|
case 1:
|
||||||
return const PatcherView();
|
return const PatcherView();
|
||||||
case 2:
|
case 2:
|
||||||
return const SettingsView();
|
return SettingsView();
|
||||||
default:
|
default:
|
||||||
return const HomeView();
|
return const HomeView();
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,18 @@ import 'package:revanced_manager/constants.dart';
|
|||||||
import 'package:revanced_manager/theme.dart';
|
import 'package:revanced_manager/theme.dart';
|
||||||
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/settingsView/about_info_widget.dart';
|
import 'package:revanced_manager/ui/widgets/settingsView/about_info_widget.dart';
|
||||||
|
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_switch_item.dart';
|
import 'package:revanced_manager/ui/widgets/settingsView/settings_switch_item.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_themes/stacked_themes.dart';
|
import 'package:stacked_themes/stacked_themes.dart';
|
||||||
|
|
||||||
class SettingsView extends StatelessWidget {
|
class SettingsView extends StatelessWidget {
|
||||||
const SettingsView({Key? key}) : super(key: key);
|
final TextEditingController organizationController = TextEditingController();
|
||||||
|
final TextEditingController patchesSourceController = TextEditingController();
|
||||||
|
final TextEditingController integrationsSourceController =
|
||||||
|
TextEditingController();
|
||||||
|
|
||||||
|
SettingsView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -19,102 +25,128 @@ class SettingsView extends StatelessWidget {
|
|||||||
viewModelBuilder: () => SettingsViewModel(),
|
viewModelBuilder: () => SettingsViewModel(),
|
||||||
onModelReady: (model) => model.initialize(),
|
onModelReady: (model) => model.initialize(),
|
||||||
builder: (context, SettingsViewModel model, child) => Scaffold(
|
builder: (context, SettingsViewModel model, child) => Scaffold(
|
||||||
body: SafeArea(
|
body: SingleChildScrollView(
|
||||||
child: Padding(
|
child: SafeArea(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
child: Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
children: <Widget>[
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
const SizedBox(height: 60),
|
children: <Widget>[
|
||||||
I18nText(
|
const SizedBox(height: 60),
|
||||||
'settingsView.widgetTitle',
|
I18nText(
|
||||||
child: Text(
|
'settingsView.widgetTitle',
|
||||||
'',
|
|
||||||
style: GoogleFonts.inter(
|
|
||||||
fontSize: 28,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
SettingsSwitchItem(
|
|
||||||
title: 'settingsView.themeLabel',
|
|
||||||
subtitle: 'settingsView.themeHint',
|
|
||||||
value: isDark,
|
|
||||||
onTap: (value) {
|
|
||||||
isDark = value;
|
|
||||||
getThemeManager(context).toggleDarkLightTheme();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
title: I18nText(
|
|
||||||
'settingsView.rootModeLabel',
|
|
||||||
child: Text(
|
child: Text(
|
||||||
'',
|
'',
|
||||||
style: kSettingItemTextStyle,
|
style: GoogleFonts.inter(
|
||||||
|
fontSize: 28,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
subtitle: I18nText('settingsView.rootModeHint'),
|
const SizedBox(height: 12),
|
||||||
trailing: GestureDetector(
|
SettingsSwitchItem(
|
||||||
onTap: () {
|
title: 'settingsView.themeLabel',
|
||||||
model.navigateToRootChecker();
|
subtitle: 'settingsView.themeHint',
|
||||||
|
value: isDark,
|
||||||
|
onTap: (value) {
|
||||||
|
isDark = value;
|
||||||
|
getThemeManager(context).toggleDarkLightTheme();
|
||||||
},
|
},
|
||||||
child: Container(
|
),
|
||||||
padding: const EdgeInsets.symmetric(
|
ListTile(
|
||||||
horizontal: 16, vertical: 8),
|
title: I18nText(
|
||||||
decoration: BoxDecoration(
|
'settingsView.rootModeLabel',
|
||||||
borderRadius: BorderRadius.circular(20),
|
child: Text(
|
||||||
border: Border.all(
|
'',
|
||||||
width: 1,
|
style: kSettingItemTextStyle,
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.rootModeHint'),
|
||||||
|
trailing: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
model.navigateToRootChecker();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16, vertical: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1,
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
model.isRooted ? 'Rooted' : 'Not rooted',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
|
||||||
model.isRooted ? 'Rooted' : 'Not rooted',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
CustomTextField(
|
||||||
Container(
|
inputController: organizationController,
|
||||||
padding: const EdgeInsets.symmetric(
|
label: 'settingsView.organizationLabel',
|
||||||
horizontal: 16.0,
|
hint: ghOrg,
|
||||||
vertical: 8.0,
|
onChanged: (value) {
|
||||||
|
ghOrg = value;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
child: Row(
|
CustomTextField(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
inputController: patchesSourceController,
|
||||||
children: [
|
label: 'settingsView.patchesSourceLabel',
|
||||||
I18nText(
|
hint: patchesRepo,
|
||||||
'settingsView.languageLabel',
|
onChanged: (value) {
|
||||||
child: Text('', style: kSettingItemTextStyle),
|
patchesRepo = value;
|
||||||
),
|
},
|
||||||
DropdownButton(
|
|
||||||
value: 'en',
|
|
||||||
items: const [
|
|
||||||
DropdownMenuItem(
|
|
||||||
value: 'en',
|
|
||||||
child: Text('English'),
|
|
||||||
),
|
|
||||||
DropdownMenuItem(
|
|
||||||
value: 'fr',
|
|
||||||
child: Text('French'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onChanged: (value) {
|
|
||||||
value = value;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
CustomTextField(
|
||||||
ListTile(
|
inputController: integrationsSourceController,
|
||||||
title: I18nText(
|
label: 'settingsView.integrationsSourceLabel',
|
||||||
'settingsView.contributorsLabel',
|
hint: integrationsRepo,
|
||||||
child: Text('', style: kSettingItemTextStyle),
|
onChanged: (value) {
|
||||||
|
integrationsRepo = value;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
onTap: model.navigateToContributors,
|
Container(
|
||||||
),
|
padding: const EdgeInsets.symmetric(
|
||||||
const AboutWidget(),
|
horizontal: 16.0,
|
||||||
],
|
vertical: 8.0,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
I18nText(
|
||||||
|
'settingsView.languageLabel',
|
||||||
|
child: Text('', style: kSettingItemTextStyle),
|
||||||
|
),
|
||||||
|
DropdownButton(
|
||||||
|
value: 'en',
|
||||||
|
items: const [
|
||||||
|
DropdownMenuItem(
|
||||||
|
value: 'en',
|
||||||
|
child: Text('English'),
|
||||||
|
),
|
||||||
|
DropdownMenuItem(
|
||||||
|
value: 'fr',
|
||||||
|
child: Text('French'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onChanged: (value) {
|
||||||
|
value = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.contributorsLabel',
|
||||||
|
child: Text('', style: kSettingItemTextStyle),
|
||||||
|
),
|
||||||
|
onTap: model.navigateToContributors,
|
||||||
|
),
|
||||||
|
const AboutWidget(),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
|
||||||
|
|
||||||
class CustomSwitch extends StatelessWidget {
|
class CustomSwitch extends StatelessWidget {
|
||||||
final ValueChanged<bool> onChanged;
|
final ValueChanged<bool> onChanged;
|
||||||
|
81
lib/ui/widgets/settingsView/custom_text_field.dart
Normal file
81
lib/ui/widgets/settingsView/custom_text_field.dart
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
|
import 'package:revanced_manager/theme.dart';
|
||||||
|
|
||||||
|
class CustomTextField extends StatelessWidget {
|
||||||
|
final TextEditingController inputController;
|
||||||
|
final String label;
|
||||||
|
final String hint;
|
||||||
|
final Function(String)? onChanged;
|
||||||
|
|
||||||
|
const CustomTextField({
|
||||||
|
Key? key,
|
||||||
|
required this.inputController,
|
||||||
|
required this.label,
|
||||||
|
required this.hint,
|
||||||
|
required this.onChanged,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
const errorColor = Color(0xffEF4444);
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: inputController,
|
||||||
|
onChanged: onChanged,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: isDark ? Colors.grey[300] : Colors.black,
|
||||||
|
),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
label: I18nText(label),
|
||||||
|
labelStyle:
|
||||||
|
TextStyle(color: isDark ? Colors.grey[300] : Colors.black),
|
||||||
|
filled: true,
|
||||||
|
fillColor: Theme.of(context).colorScheme.primary,
|
||||||
|
hintText: hint,
|
||||||
|
hintStyle: TextStyle(color: Colors.grey.withOpacity(.75)),
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 0.0, horizontal: 20.0),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Theme.of(context).colorScheme.tertiary,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(10.0)),
|
||||||
|
gapPadding: 4.0,
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
width: 2.0,
|
||||||
|
),
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(10.0)),
|
||||||
|
),
|
||||||
|
errorBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: errorColor, width: 1.0),
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Theme.of(context).colorScheme.tertiary,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(10.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user