fix:调整ios和android页面不一致的问题

This commit is contained in:
liyi 2025-08-04 15:54:19 +08:00
parent 79948ff405
commit 0ab9b5f03a

View File

@ -37,21 +37,32 @@ class _LockVoiceSettingState extends State<LockVoiceSetting> {
barTitle: '锁语音包设置'.tr, barTitle: '锁语音包设置'.tr,
haveBack: false, haveBack: false,
haveOtherLeftWidget: true, haveOtherLeftWidget: true,
leftWidget: TextButton( leftWidget: Container(
width: 60.w, // leading区域宽度
child: TextButton(
onPressed: () { onPressed: () {
eventBus eventBus
.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true)); .fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
Get.offAllNamed(Routers.starLockMain); Get.offAllNamed(Routers.starLockMain);
}, },
style: TextButton.styleFrom(
padding: EdgeInsets.symmetric(horizontal: 4), //
minimumSize: Size.zero, //
tapTargetSize: MaterialTapTargetSize.shrinkWrap, //
),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text( child: Text(
'跳过'.tr, '跳过'.tr,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 24.sp, fontSize: 24.sp, //
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
), ),
),
),
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: [
TextButton( TextButton(
@ -67,100 +78,72 @@ class _LockVoiceSettingState extends State<LockVoiceSetting> {
), ),
], ],
), ),
body: _buildBody(), body: Obx(
), () => ListView(
); padding: EdgeInsets.zero,
}
Widget _buildBody() {
return Obx(
() => SingleChildScrollView(
child: Column(
children: [ children: [
//
Container( Container(
width: 1.sw, width: 1.sw,
decoration: BoxDecoration(color: Colors.white), color: Colors.white,
child: ListView.builder( child: Column(
itemCount: state.soundTypeList.length, children: List.generate(
itemBuilder: (BuildContext context, int index) { state.soundTypeList.length,
// itemCount - 1 (index) {
final isLastItem = index == state.soundTypeList.length - 1; final isLastItem =
index == state.soundTypeList.length - 1;
// platFormSet RxList<Platform> final soundType = state.soundTypeList.value[index];
final platform = state.soundTypeList.value[index];
return CommonItem( return CommonItem(
leftTitel: state.soundTypeList.value[index], leftTitel: soundType,
rightTitle: '', rightTitle: '',
isHaveLine: !isLastItem, isHaveLine: !isLastItem,
// 线
isHaveDirection: false, isHaveDirection: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: Radio<String>( rightWidget: Radio<String>(
// Radio 使 id value: soundType,
value: platform,
// selectPlatFormIndex id
groupValue: state.soundTypeList groupValue: state.soundTypeList
.value[state.selectSoundTypeIndex.value], .value[state.selectSoundTypeIndex.value],
//
activeColor: AppColors.mainColor, activeColor: AppColors.mainColor,
// Radio
onChanged: (value) { onChanged: (value) {
if (value != null) { if (value != null) {
setState(() {
// id
final newIndex = state.soundTypeList.value final newIndex = state.soundTypeList.value
.indexWhere((p) => p == value); .indexWhere((p) => p == value);
if (newIndex != -1) { if (newIndex != -1) {
state.selectSoundTypeIndex.value = newIndex; state.selectSoundTypeIndex.value = newIndex;
} }
});
} }
}, },
), ),
action: () { action: () {
setState(() {
state.selectSoundTypeIndex.value = index; state.selectSoundTypeIndex.value = index;
});
}, },
); );
}, },
shrinkWrap: true, ),
physics: const AlwaysScrollableScrollPhysics(),
), ),
), ),
SizedBox( SizedBox(
height: 8.h, height: 8.h,
), ),
Column( //
children: _buildList(), Container(
), color: Colors.transparent,
], child: Column(
), children: List.generate(
), state.languages.length,
); (index) {
} final item = state.languages[index];
List<Widget> _buildList() {
final appLocalLanguages = state.languages;
return List.generate(
appLocalLanguages.length,
(index) => _buildItem(
appLocalLanguages[index],
index,
),
);
}
_buildItem(PassthroughItem passthroughItem, index) {
return CommonItem( return CommonItem(
leftTitel: passthroughItem.langText, leftTitel: item.langText,
rightTitle: '', rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: false, isHaveDirection: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: state.selectPassthroughListIndex.value == index rightWidget:
state.selectPassthroughListIndex.value == index
? Image( ? Image(
image: const AssetImage('images/icon_item_checked.png'), image: const AssetImage(
'images/icon_item_checked.png'),
width: 30.w, width: 30.w,
height: 30.w, height: 30.w,
fit: BoxFit.contain, fit: BoxFit.contain,
@ -170,6 +153,15 @@ class _LockVoiceSettingState extends State<LockVoiceSetting> {
state.selectPassthroughListIndex.value = index; state.selectPassthroughListIndex.value = index;
}, },
); );
},
),
),
),
],
),
),
),
);
} }
@override @override