mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 12:47:37 +02:00
feat: Add custom patches sources
This commit is contained in:
@ -4,6 +4,7 @@ class CustomTextField extends StatelessWidget {
|
||||
final TextEditingController inputController;
|
||||
final Widget label;
|
||||
final String hint;
|
||||
final Widget? leadingIcon;
|
||||
final Function(String)? onChanged;
|
||||
|
||||
const CustomTextField({
|
||||
@ -11,60 +12,59 @@ class CustomTextField extends StatelessWidget {
|
||||
required this.inputController,
|
||||
required this.label,
|
||||
required this.hint,
|
||||
this.leadingIcon,
|
||||
required this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
controller: inputController,
|
||||
onChanged: onChanged,
|
||||
keyboardType: TextInputType.text,
|
||||
decoration: InputDecoration(
|
||||
label: label,
|
||||
filled: true,
|
||||
fillColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
hintText: hint,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
vertical: 0.0,
|
||||
horizontal: 20.0,
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 4.0),
|
||||
child: TextField(
|
||||
controller: inputController,
|
||||
onChanged: onChanged,
|
||||
keyboardType: TextInputType.text,
|
||||
decoration: InputDecoration(
|
||||
icon: leadingIcon,
|
||||
label: label,
|
||||
filled: true,
|
||||
fillColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
hintText: hint,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0,
|
||||
horizontal: 16.0,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 1.0,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
gapPadding: 4.0,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
gapPadding: 4.0,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 2.0,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
width: 1.0,
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.red,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,13 +4,13 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
class SettingsTileDialog extends StatelessWidget {
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final List<Widget> children;
|
||||
final Function()? onTap;
|
||||
|
||||
const SettingsTileDialog({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.children,
|
||||
required this.onTap,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -28,14 +28,7 @@ class SettingsTileDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
subtitle: I18nText(subtitle),
|
||||
onTap: () => showDialog(
|
||||
context: context,
|
||||
builder: (context) => SimpleDialog(
|
||||
title: I18nText(title),
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
children: children,
|
||||
),
|
||||
),
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:revanced_manager/constants.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
|
||||
class SourcesWidget extends StatelessWidget {
|
||||
final String title;
|
||||
final TextEditingController organizationController;
|
||||
final TextEditingController patchesSourceController;
|
||||
final TextEditingController integrationsSourceController;
|
||||
|
||||
const SourcesWidget({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.organizationController,
|
||||
required this.patchesSourceController,
|
||||
required this.integrationsSourceController,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ExpandablePanel(
|
||||
theme: ExpandableThemeData(
|
||||
hasIcon: true,
|
||||
iconColor: Theme.of(context).iconTheme.color,
|
||||
iconPadding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
animationDuration: const Duration(milliseconds: 400),
|
||||
),
|
||||
header: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: I18nText(
|
||||
'sourcesCard.widgetTitle',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
subtitle: I18nText('sourcesCard.widgetSubtitle'),
|
||||
),
|
||||
expanded: CustomCard(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
CustomTextField(
|
||||
inputController: organizationController,
|
||||
label: I18nText('sourcesCard.organizationLabel'),
|
||||
hint: ghOrg,
|
||||
onChanged: (value) => ghOrg = value,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
CustomTextField(
|
||||
inputController: patchesSourceController,
|
||||
label: I18nText('sourcesCard.patchesSourceLabel'),
|
||||
hint: patchesRepo,
|
||||
onChanged: (value) => patchesRepo = value,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
CustomTextField(
|
||||
inputController: integrationsSourceController,
|
||||
label: I18nText('sourcesCard.integrationsSourceLabel'),
|
||||
hint: integrationsRepo,
|
||||
onChanged: (value) => integrationsRepo = value,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
collapsed: Container(),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user