From 282745707c64a0d6dc606c0ce197d52273fd55c2 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Sun, 13 Jul 2025 20:43:31 +0800 Subject: [PATCH] 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. --- .../views/wox_setting_general_view.dart | 37 ++++++++------- .../setting/views/wox_setting_ui_view.dart | 45 ++++++++++--------- 2 files changed, 44 insertions(+), 38 deletions(-) diff --git a/wox.ui.flutter/wox/lib/modules/setting/views/wox_setting_general_view.dart b/wox.ui.flutter/wox/lib/modules/setting/views/wox_setting_general_view.dart index 14e56f01..c5446c52 100644 --- a/wox.ui.flutter/wox/lib/modules/setting/views/wox_setting_general_view.dart +++ b/wox.ui.flutter/wox/lib/modules/setting/views/wox_setting_general_view.dart @@ -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( - 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( + 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); + } + }, + ), ); }), ), diff --git a/wox.ui.flutter/wox/lib/modules/setting/views/wox_setting_ui_view.dart b/wox.ui.flutter/wox/lib/modules/setting/views/wox_setting_ui_view.dart index 370c48b6..b381ccc6 100644 --- a/wox.ui.flutter/wox/lib/modules/setting/views/wox_setting_ui_view.dart +++ b/wox.ui.flutter/wox/lib/modules/setting/views/wox_setting_ui_view.dart @@ -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( - 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( + 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); + } + }, + ), ); }), ),