refactor(ui): improve ComboBox layout in settings views #4222

* Wrapped `ComboBox` in a `SizedBox` to set a fixed width for better UI consistency.
* Enhanced readability and maintainability of the code structure.
This commit is contained in:
qianlifeng 2025-07-13 20:43:31 +08:00
parent 4a87001625
commit 282745707c
2 changed files with 44 additions and 38 deletions

View File

@ -118,23 +118,26 @@ class WoxSettingGeneralView extends WoxSettingBaseView {
label: controller.tr("ui_last_query_mode"),
tips: controller.tr("ui_last_query_mode_tips"),
child: Obx(() {
return ComboBox<String>(
items: [
ComboBoxItem(
value: WoxLastQueryModeEnum.WOX_LAST_QUERY_MODE_PRESERVE.code,
child: Text(controller.tr("ui_last_query_mode_preserve")),
),
ComboBoxItem(
value: WoxLastQueryModeEnum.WOX_LAST_QUERY_MODE_EMPTY.code,
child: Text(controller.tr("ui_last_query_mode_empty")),
),
],
value: controller.woxSetting.value.lastQueryMode,
onChanged: (v) {
if (v != null) {
controller.updateConfig("LastQueryMode", v);
}
},
return SizedBox(
width: 250,
child: ComboBox<String>(
items: [
ComboBoxItem(
value: WoxLastQueryModeEnum.WOX_LAST_QUERY_MODE_PRESERVE.code,
child: Text(controller.tr("ui_last_query_mode_preserve")),
),
ComboBoxItem(
value: WoxLastQueryModeEnum.WOX_LAST_QUERY_MODE_EMPTY.code,
child: Text(controller.tr("ui_last_query_mode_empty")),
),
],
value: controller.woxSetting.value.lastQueryMode,
onChanged: (v) {
if (v != null) {
controller.updateConfig("LastQueryMode", v);
}
},
),
);
}),
),

View File

@ -13,27 +13,30 @@ class WoxSettingUIView extends WoxSettingBaseView {
label: controller.tr("ui_show_position"),
tips: controller.tr("ui_show_position_tips"),
child: Obx(() {
return ComboBox<String>(
items: [
ComboBoxItem(
value: "mouse_screen",
child: Text(controller.tr("ui_show_position_mouse_screen")),
),
ComboBoxItem(
value: "active_screen",
child: Text(controller.tr("ui_show_position_active_screen")),
),
ComboBoxItem(
value: "last_location",
child: Text(controller.tr("ui_show_position_last_location")),
),
],
value: controller.woxSetting.value.showPosition,
onChanged: (v) {
if (v != null) {
controller.updateConfig("ShowPosition", v);
}
},
return SizedBox(
width: 200,
child: ComboBox<String>(
items: [
ComboBoxItem(
value: "mouse_screen",
child: Text(controller.tr("ui_show_position_mouse_screen")),
),
ComboBoxItem(
value: "active_screen",
child: Text(controller.tr("ui_show_position_active_screen")),
),
ComboBoxItem(
value: "last_location",
child: Text(controller.tr("ui_show_position_last_location")),
),
],
value: controller.woxSetting.value.showPosition,
onChanged: (v) {
if (v != null) {
controller.updateConfig("ShowPosition", v);
}
},
),
);
}),
),