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