feat: partial implementation of patches sources.

This commit is contained in:
Aunali321 2022-08-21 21:16:42 +05:30 committed by Ushie
parent 013329fea9
commit 95739244fa
No known key found for this signature in database
GPG Key ID: 0EF73F1CA38B2D5F
6 changed files with 206 additions and 91 deletions

View File

@ -71,7 +71,10 @@
"aboutLabel": "About",
"contributorsLabel": "Contributors",
"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": {
"widgetTitle": "Is your device rooted?",

View File

@ -19,9 +19,9 @@ final kSettingItemSubtitleTextStyle = GoogleFonts.roboto(
fontWeight: FontWeight.w300,
);
const ghOrg = 'revanced';
const patchesRepo = 'revanced-patches';
const integrationsRepo = 'revanced-integrations';
String ghOrg = 'revanced';
String patchesRepo = 'revanced-patches';
String integrationsRepo = 'revanced-integrations';
const patcherRepo = 'revanced-patcher';
const cliRepo = 'revanced-cli';
const managerRepo = 'revanced-manager';

View File

@ -128,7 +128,7 @@ class Navigation extends StatelessWidget {
case 1:
return const PatcherView();
case 2:
return const SettingsView();
return SettingsView();
default:
return const HomeView();
}

View File

@ -5,12 +5,18 @@ import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/theme.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/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_switch_item.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_themes/stacked_themes.dart';
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
Widget build(BuildContext context) {
@ -19,7 +25,8 @@ class SettingsView extends StatelessWidget {
viewModelBuilder: () => SettingsViewModel(),
onModelReady: (model) => model.initialize(),
builder: (context, SettingsViewModel model, child) => Scaffold(
body: SafeArea(
body: SingleChildScrollView(
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Column(
@ -75,6 +82,30 @@ class SettingsView extends StatelessWidget {
),
),
),
CustomTextField(
inputController: organizationController,
label: 'settingsView.organizationLabel',
hint: ghOrg,
onChanged: (value) {
ghOrg = value;
},
),
CustomTextField(
inputController: patchesSourceController,
label: 'settingsView.patchesSourceLabel',
hint: patchesRepo,
onChanged: (value) {
patchesRepo = value;
},
),
CustomTextField(
inputController: integrationsSourceController,
label: 'settingsView.integrationsSourceLabel',
hint: integrationsRepo,
onChanged: (value) {
integrationsRepo = value;
},
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
@ -119,6 +150,7 @@ class SettingsView extends StatelessWidget {
),
),
),
),
);
}
}

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
class CustomSwitch extends StatelessWidget {
final ValueChanged<bool> onChanged;

View 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)),
),
),
),
],
),
);
}
}