diff --git a/lib/main/lockDetail/lockSet/speechLanguageSettings/speech_language_settings_page.dart b/lib/main/lockDetail/lockSet/speechLanguageSettings/speech_language_settings_page.dart index 94e602cd..ef590be8 100644 --- a/lib/main/lockDetail/lockSet/speechLanguageSettings/speech_language_settings_page.dart +++ b/lib/main/lockDetail/lockSet/speechLanguageSettings/speech_language_settings_page.dart @@ -48,7 +48,86 @@ class _SpeechLanguageSettingsPageState ), ], ), - body: _buildBody(), + body: Obx( + () => ListView( + padding: EdgeInsets.zero, + children: [ + // 语音类型选择区 + Container( + color: Colors.white, + child: Column( + children: List.generate( + state.soundTypeList.length, + (index) { + final isLastItem = index == state.soundTypeList.length - 1; + final soundType = state.soundTypeList.value[index]; + return CommonItem( + leftTitel: soundType, + rightTitle: '', + isHaveLine: !isLastItem, + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: Radio( + value: soundType, + groupValue: state.soundTypeList + .value[state.selectSoundTypeIndex.value], + activeColor: AppColors.mainColor, + onChanged: (value) { + if (value != null) { + final newIndex = state.soundTypeList.value + .indexWhere((p) => p == value); + if (newIndex != -1) { + state.selectSoundTypeIndex.value = newIndex; + } + } + }, + ), + action: () { + state.selectSoundTypeIndex.value = index; + }, + ); + }, + ), + ), + ), + SizedBox( + height: 8.h, + ), + // 语言包列表区 + Container( + color: Colors.transparent, + child: Column( + children: List.generate( + state.languages.length, + (index) { + final item = state.languages[index]; + return CommonItem( + leftTitel: item.langText, + rightTitle: '', + isHaveLine: true, + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: + state.selectPassthroughListIndex.value == index + ? Image( + image: const AssetImage( + 'images/icon_item_checked.png'), + width: 30.w, + height: 30.w, + fit: BoxFit.contain, + ) + : Container(), + action: () { + state.selectPassthroughListIndex.value = index; + }, + ); + }, + ), + ), + ), + ], + ), + ), ); } @@ -57,10 +136,7 @@ class _SpeechLanguageSettingsPageState () => SingleChildScrollView( child: Column( children: [ - Container( - width: 1.sw, - decoration: BoxDecoration(color: Colors.white), - child: ListView.builder( + ListView.builder( itemCount: state.soundTypeList.length, itemBuilder: (BuildContext context, int index) { // 判断是否是最后一个元素(索引等于 itemCount - 1) @@ -105,12 +181,8 @@ class _SpeechLanguageSettingsPageState ); }, shrinkWrap: true, - physics: const AlwaysScrollableScrollPhysics(), - ), - ), - SizedBox( - height: 8.h, - ), + physics: const NeverScrollableScrollPhysics() //add this line, + ), Column( children: _buildList(), ),