From 953b878a8947af058a6cba4590be25aec3286862 Mon Sep 17 00:00:00 2001 From: Levi Date: Fri, 15 Dec 2023 19:09:48 +0800 Subject: [PATCH] fix: adapt mobile proxy settings ui (#301) --- .../modules/setting/views/setting_view.dart | 82 +++++++++---------- 1 file changed, 37 insertions(+), 45 deletions(-) diff --git a/ui/flutter/lib/app/modules/setting/views/setting_view.dart b/ui/flutter/lib/app/modules/setting/views/setting_view.dart index 495259ef6..f42c30617 100644 --- a/ui/flutter/lib/app/modules/setting/views/setting_view.dart +++ b/ui/flutter/lib/app/modules/setting/views/setting_view.dart @@ -387,35 +387,33 @@ class SettingView extends GetView { }, ); - final items = [ - SizedBox( - width: 150, - child: DropdownButtonFormField( - value: proxy.scheme, - onChanged: (value) async { - if (value != null && value != proxy.scheme) { - proxy.scheme = value; + final scheme = SizedBox( + width: 100, + child: DropdownButtonFormField( + value: proxy.scheme, + onChanged: (value) async { + if (value != null && value != proxy.scheme) { + proxy.scheme = value; - await debounceSave(); - } - }, - items: const [ - DropdownMenuItem( - value: 'http', - child: Text('HTTP'), - ), - DropdownMenuItem( - value: 'https', - child: Text('HTTPS'), - ), - DropdownMenuItem( - value: 'socks5', - child: Text('SOCKS5'), - ), - ], - ), - ) - ]; + await debounceSave(); + } + }, + items: const [ + DropdownMenuItem( + value: 'http', + child: Text('HTTP'), + ), + DropdownMenuItem( + value: 'https', + child: Text('HTTPS'), + ), + DropdownMenuItem( + value: 'socks5', + child: Text('SOCKS5'), + ), + ], + ), + ); final arr = proxy.host.split(':'); var ip = ''; @@ -438,10 +436,8 @@ class SettingView extends GetView { ipController.addListener(updateAddress); portController.addListener(updateAddress); - items.addAll([ - const Padding(padding: EdgeInsets.only(left: 20)), - SizedBox( - width: 150, + final host = [ + Flexible( child: TextFormField( controller: ipController, decoration: const InputDecoration( @@ -455,8 +451,7 @@ class SettingView extends GetView { ), ), const Padding(padding: EdgeInsets.only(left: 10)), - SizedBox( - width: 150, + Flexible( child: TextFormField( controller: portController, decoration: InputDecoration( @@ -470,14 +465,13 @@ class SettingView extends GetView { ], ), ), - ]); + ]; final usrController = TextEditingController(text: proxy.usr); final pwdController = TextEditingController(text: proxy.pwd); final auth = [ - SizedBox( - width: 150, + Flexible( child: TextFormField( controller: usrController, decoration: InputDecoration( @@ -491,8 +485,7 @@ class SettingView extends GetView { ), ), const Padding(padding: EdgeInsets.only(left: 10)), - SizedBox( - width: 150, + Flexible( child: TextFormField( controller: pwdController, decoration: InputDecoration( @@ -513,8 +506,9 @@ class SettingView extends GetView { crossAxisAlignment: CrossAxisAlignment.start, children: _addPadding([ switcher, + scheme, Row( - children: items, + children: host, ), Row( children: auth, @@ -534,7 +528,7 @@ class SettingView extends GetView { (Key key) { final items = [ SizedBox( - width: 150, + width: 80, child: DropdownButtonFormField( value: startCfg.value.network, onChanged: Util.isDesktop() @@ -585,8 +579,7 @@ class SettingView extends GetView { portController.addListener(updateAddress); items.addAll([ const Padding(padding: EdgeInsets.only(left: 20)), - SizedBox( - width: 150, + Flexible( child: TextFormField( controller: ipController, decoration: const InputDecoration( @@ -600,8 +593,7 @@ class SettingView extends GetView { ), ), const Padding(padding: EdgeInsets.only(left: 10)), - SizedBox( - width: 150, + Flexible( child: TextFormField( controller: portController, decoration: InputDecoration(