Skip to content

Commit

Permalink
fix: adapt mobile proxy settings ui (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie authored Dec 15, 2023
1 parent ae4ca3d commit 953b878
Showing 1 changed file with 37 additions and 45 deletions.
82 changes: 37 additions & 45 deletions ui/flutter/lib/app/modules/setting/views/setting_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -387,35 +387,33 @@ class SettingView extends GetView<SettingController> {
},
);

final items = <Widget>[
SizedBox(
width: 150,
child: DropdownButtonFormField<String>(
value: proxy.scheme,
onChanged: (value) async {
if (value != null && value != proxy.scheme) {
proxy.scheme = value;
final scheme = SizedBox(
width: 100,
child: DropdownButtonFormField<String>(
value: proxy.scheme,
onChanged: (value) async {
if (value != null && value != proxy.scheme) {
proxy.scheme = value;

await debounceSave();
}
},
items: const [
DropdownMenuItem<String>(
value: 'http',
child: Text('HTTP'),
),
DropdownMenuItem<String>(
value: 'https',
child: Text('HTTPS'),
),
DropdownMenuItem<String>(
value: 'socks5',
child: Text('SOCKS5'),
),
],
),
)
];
await debounceSave();
}
},
items: const [
DropdownMenuItem<String>(
value: 'http',
child: Text('HTTP'),
),
DropdownMenuItem<String>(
value: 'https',
child: Text('HTTPS'),
),
DropdownMenuItem<String>(
value: 'socks5',
child: Text('SOCKS5'),
),
],
),
);

final arr = proxy.host.split(':');
var ip = '';
Expand All @@ -438,10 +436,8 @@ class SettingView extends GetView<SettingController> {

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(
Expand All @@ -455,8 +451,7 @@ class SettingView extends GetView<SettingController> {
),
),
const Padding(padding: EdgeInsets.only(left: 10)),
SizedBox(
width: 150,
Flexible(
child: TextFormField(
controller: portController,
decoration: InputDecoration(
Expand All @@ -470,14 +465,13 @@ class SettingView extends GetView<SettingController> {
],
),
),
]);
];

final usrController = TextEditingController(text: proxy.usr);
final pwdController = TextEditingController(text: proxy.pwd);

final auth = [
SizedBox(
width: 150,
Flexible(
child: TextFormField(
controller: usrController,
decoration: InputDecoration(
Expand All @@ -491,8 +485,7 @@ class SettingView extends GetView<SettingController> {
),
),
const Padding(padding: EdgeInsets.only(left: 10)),
SizedBox(
width: 150,
Flexible(
child: TextFormField(
controller: pwdController,
decoration: InputDecoration(
Expand All @@ -513,8 +506,9 @@ class SettingView extends GetView<SettingController> {
crossAxisAlignment: CrossAxisAlignment.start,
children: _addPadding([
switcher,
scheme,
Row(
children: items,
children: host,
),
Row(
children: auth,
Expand All @@ -534,7 +528,7 @@ class SettingView extends GetView<SettingController> {
(Key key) {
final items = <Widget>[
SizedBox(
width: 150,
width: 80,
child: DropdownButtonFormField<String>(
value: startCfg.value.network,
onChanged: Util.isDesktop()
Expand Down Expand Up @@ -585,8 +579,7 @@ class SettingView extends GetView<SettingController> {
portController.addListener(updateAddress);
items.addAll([
const Padding(padding: EdgeInsets.only(left: 20)),
SizedBox(
width: 150,
Flexible(
child: TextFormField(
controller: ipController,
decoration: const InputDecoration(
Expand All @@ -600,8 +593,7 @@ class SettingView extends GetView<SettingController> {
),
),
const Padding(padding: EdgeInsets.only(left: 10)),
SizedBox(
width: 150,
Flexible(
child: TextFormField(
controller: portController,
decoration: InputDecoration(
Expand Down

0 comments on commit 953b878

Please sign in to comment.