fix: proxy setting only numeric input (#328)

This commit is contained in:
Levi authored and GitHub committed 2024-01-18 09:17:06 +08:00
1 parent 8425a96ac9
commit f7dc60ad50
4 files changed
+11 -21

No files matched your search

@@ -428,14 +428,14 @@ class SettingView extends GetView<SettingController> {
);
final arr = proxy.host.split(':');
var ip = '';
var host = '';
var port = '';
if (arr.length > 1) {
ip = arr[0];
host = arr[0];
port = arr[1];
}
final ipController = TextEditingController(text: ip);
final ipController = TextEditingController(text: host);
final portController = TextEditingController(text: port);
updateAddress() async {
final newAddress = '${ipController.text}:${portController.text}';
@@ -448,18 +448,14 @@ class SettingView extends GetView<SettingController> {
ipController.addListener(updateAddress);
portController.addListener(updateAddress);
final host = [
final server = [
Flexible(
child: TextFormField(
controller: ipController,
decoration: const InputDecoration(
labelText: 'IP',
contentPadding: EdgeInsets.all(0.0),
decoration: InputDecoration(
labelText: 'server'.tr,
contentPadding: const EdgeInsets.all(0.0),
),
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp('[0-9.]')),
],
),
),
const Padding(padding: EdgeInsets.only(left: 10)),
@@ -490,10 +486,6 @@ class SettingView extends GetView<SettingController> {
labelText: 'username'.tr,
contentPadding: const EdgeInsets.all(0.0),
),
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp('[0-9.]')),
],
),
),
const Padding(padding: EdgeInsets.only(left: 10)),
@@ -504,11 +496,6 @@ class SettingView extends GetView<SettingController> {
labelText: 'password'.tr,
contentPadding: const EdgeInsets.all(0.0),
),
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
NumericalRangeFormatter(min: 0, max: 65535),
],
),
),
];
@@ -520,7 +507,7 @@ class SettingView extends GetView<SettingController> {
switcher,
scheme,
Row(
children: host,
children: server,
),
Row(
children: auth,
+1
View File
@@ -79,6 +79,7 @@ const enUS = {
'serviceText': 'Running',
'network': 'Network',
'proxy': 'Proxy',
'server': 'Server',
'username': 'Username',
'password': 'Password',
'thanks': 'Thanks',
+1
View File
@@ -77,6 +77,7 @@ const zhCN = {
'serviceText': '运行中',
'network': '网络',
'proxy': '代理',
'server': '服务器',
'username': '用户名',
'password': '密码',
'thanks': '鸣谢',
+1
View File
@@ -77,6 +77,7 @@ const zhTW = {
'serviceText': '執行中',
'network': '網路',
'proxy': '代理',
'server': '伺服器',
'username': '名稱',
'password': '密碼',
'thanks': '鳴謝',