From 0c27ac73e351ada65a890dd111cebd1cd629bcf6 Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Wed, 19 Nov 2025 21:06:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widgets/select_equalizer_widget.dart | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/lib/modules/eq_settings/views/widgets/select_equalizer_widget.dart b/lib/modules/eq_settings/views/widgets/select_equalizer_widget.dart index a9cfc7431..1c62abde0 100644 --- a/lib/modules/eq_settings/views/widgets/select_equalizer_widget.dart +++ b/lib/modules/eq_settings/views/widgets/select_equalizer_widget.dart @@ -62,6 +62,8 @@ class _SelectEqualizerWidgetState extends State { // 构建主体内容 Widget _buildBody(bool isDarkMode) { + bool isAdd = true; + return ListView( padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 10.w), children: [ @@ -69,9 +71,41 @@ class _SelectEqualizerWidgetState extends State { Wrap( spacing: 10.w, runSpacing: 10.w, - children: _templateData['options'].map((Map option) { - return _item(isDarkMode, option); - }).toList(), + children: [ + ..._templateData['options'].map((Map option) { + bool isSelected = listEquals(_values, option['value']); + if (isSelected) { + isAdd = false; + } + return _item(isDarkMode, option, isSelected); + }).toList(), + if (isAdd) + Container( + width: 110.w, + height: 110.w, + alignment: Alignment.center, + decoration: BoxDecoration( + color: isDarkMode + ? Colors.white.withValues(alpha: 0.05) + : Colors.white, + borderRadius: BorderRadius.circular(8.w), + boxShadow: [ + BoxShadow( + color: isDarkMode + ? Colors.black.withValues(alpha: 0.2) + : Colors.black.withValues(alpha: 0.05), + blurRadius: 10, + offset: const Offset(0, 4), + ), + ], + ), + child: Icon( + Icons.add, + size: 40.sp, + color: Colors.green, + ), + ), + ], ), ], ); @@ -127,7 +161,7 @@ class _SelectEqualizerWidgetState extends State { ); } - Widget _item(bool isDarkMode, Map option) { + Widget _item(bool isDarkMode, Map option, bool isSelected) { return GestureDetector( onTap: () { Get.back(result: { @@ -140,7 +174,7 @@ class _SelectEqualizerWidgetState extends State { height: 110.w, alignment: Alignment.center, decoration: BoxDecoration( - color: listEquals(_values, option['value']) + color: isSelected ? Colors.green : isDarkMode ? Colors.white.withValues(alpha: 0.05) @@ -161,7 +195,7 @@ class _SelectEqualizerWidgetState extends State { style: TextStyle( fontSize: 16.sp, fontWeight: FontWeight.w600, - color: listEquals(_values, option['value']) + color: isSelected ? Colors.white : isDarkMode ? Colors.white