refact: custom client proxy (#8093)

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2024-05-19 16:40:49 +08:00
committed by GitHub
parent 986b9fb0e0
commit d8c9250aab
2 changed files with 61 additions and 5 deletions

View File

@@ -2170,6 +2170,11 @@ void changeSocks5Proxy() async {
var pwdController = TextEditingController(text: password);
RxBool obscure = true.obs;
// proxy settings
// The following option is a not real key, it is just used for custom client advanced settings.
const String optionProxyUrl = "proxy-url";
final isOptFixed = isOptionFixed(optionProxyUrl);
var isInProgress = false;
gFFI.dialogManager.show((setState, close, context) {
submit() async {
@@ -2247,6 +2252,7 @@ void changeSocks5Proxy() async {
),
controller: proxyController,
autofocus: true,
enabled: !isOptFixed,
),
),
],
@@ -2262,6 +2268,7 @@ void changeSocks5Proxy() async {
Expanded(
child: TextField(
controller: userController,
enabled: isInProgress,
),
),
],
@@ -2284,6 +2291,7 @@ void changeSocks5Proxy() async {
? Icons.visibility_off
: Icons.visibility))),
controller: pwdController,
enabled: !isOptFixed,
)),
),
],
@@ -2296,7 +2304,7 @@ void changeSocks5Proxy() async {
),
actions: [
dialogButton('Cancel', onPressed: close, isOutline: true),
dialogButton('OK', onPressed: submit),
if (!isOptFixed) dialogButton('OK', onPressed: submit),
],
onSubmit: submit,
onCancel: close,