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"), label: controller.tr("ui_last_query_mode"),
tips: controller.tr("ui_last_query_mode_tips"), tips: controller.tr("ui_last_query_mode_tips"),
child: Obx(() { child: Obx(() {
return ComboBox<String>( return SizedBox(
items: [ width: 250,
ComboBoxItem( child: ComboBox<String>(
value: WoxLastQueryModeEnum.WOX_LAST_QUERY_MODE_PRESERVE.code, items: [
child: Text(controller.tr("ui_last_query_mode_preserve")), ComboBoxItem(
), value: WoxLastQueryModeEnum.WOX_LAST_QUERY_MODE_PRESERVE.code,
ComboBoxItem( child: Text(controller.tr("ui_last_query_mode_preserve")),
value: WoxLastQueryModeEnum.WOX_LAST_QUERY_MODE_EMPTY.code, ),
child: Text(controller.tr("ui_last_query_mode_empty")), 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) { value: controller.woxSetting.value.lastQueryMode,
controller.updateConfig("LastQueryMode", v); 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"), label: controller.tr("ui_show_position"),
tips: controller.tr("ui_show_position_tips"), tips: controller.tr("ui_show_position_tips"),
child: Obx(() { child: Obx(() {
return ComboBox<String>( return SizedBox(
items: [ width: 200,
ComboBoxItem( child: ComboBox<String>(
value: "mouse_screen", items: [
child: Text(controller.tr("ui_show_position_mouse_screen")), ComboBoxItem(
), value: "mouse_screen",
ComboBoxItem( child: Text(controller.tr("ui_show_position_mouse_screen")),
value: "active_screen", ),
child: Text(controller.tr("ui_show_position_active_screen")), ComboBoxItem(
), value: "active_screen",
ComboBoxItem( child: Text(controller.tr("ui_show_position_active_screen")),
value: "last_location", ),
child: Text(controller.tr("ui_show_position_last_location")), ComboBoxItem(
), value: "last_location",
], child: Text(controller.tr("ui_show_position_last_location")),
value: controller.woxSetting.value.showPosition, ),
onChanged: (v) { ],
if (v != null) { value: controller.woxSetting.value.showPosition,
controller.updateConfig("ShowPosition", v); onChanged: (v) {
} if (v != null) {
}, controller.updateConfig("ShowPosition", v);
}
},
),
); );
}), }),
), ),