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

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

View File

@ -37,18 +37,29 @@ class _LockVoiceSettingState extends State<LockVoiceSetting> {
barTitle: '锁语音包设置'.tr,
haveBack: false,
haveOtherLeftWidget: true,
leftWidget: TextButton(
onPressed: () {
eventBus
.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
Get.offAllNamed(Routers.starLockMain);
},
child: Text(
'跳过'.tr,
style: TextStyle(
color: Colors.white,
fontSize: 24.sp,
fontWeight: FontWeight.w500,
leftWidget: Container(
width: 60.w, // leading区域宽度
child: TextButton(
onPressed: () {
eventBus
.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
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(
'跳过'.tr,
style: TextStyle(
color: Colors.white,
fontSize: 24.sp, //
fontWeight: FontWeight.w500,
),
),
),
),
),
@ -67,111 +78,92 @@ class _LockVoiceSettingState extends State<LockVoiceSetting> {
),
],
),
body: _buildBody(),
),
);
}
Widget _buildBody() {
return Obx(
() => SingleChildScrollView(
child: Column(
children: [
Container(
width: 1.sw,
decoration: BoxDecoration(color: Colors.white),
child: ListView.builder(
itemCount: state.soundTypeList.length,
itemBuilder: (BuildContext context, int index) {
// itemCount - 1
final isLastItem = index == state.soundTypeList.length - 1;
// platFormSet RxList<Platform>
final platform = state.soundTypeList.value[index];
return CommonItem(
leftTitel: state.soundTypeList.value[index],
rightTitle: '',
isHaveLine: !isLastItem,
// 线
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: Radio<String>(
// Radio 使 id
value: platform,
// selectPlatFormIndex id
groupValue: state.soundTypeList
.value[state.selectSoundTypeIndex.value],
//
activeColor: AppColors.mainColor,
// Radio
onChanged: (value) {
if (value != null) {
setState(() {
// id
final newIndex = state.soundTypeList.value
.indexWhere((p) => p == value);
if (newIndex != -1) {
state.selectSoundTypeIndex.value = newIndex;
body: Obx(
() => ListView(
padding: EdgeInsets.zero,
children: [
//
Container(
width: 1.sw,
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<String>(
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: () {
setState(() {
state.selectSoundTypeIndex.value = index;
});
},
),
action: () {
state.selectSoundTypeIndex.value = index;
},
);
},
);
},
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(),
),
),
),
),
SizedBox(
height: 8.h,
),
Column(
children: _buildList(),
),
],
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;
},
);
},
),
),
),
],
),
),
),
);
}
List<Widget> _buildList() {
final appLocalLanguages = state.languages;
return List.generate(
appLocalLanguages.length,
(index) => _buildItem(
appLocalLanguages[index],
index,
),
);
}
_buildItem(PassthroughItem passthroughItem, index) {
return CommonItem(
leftTitel: passthroughItem.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;
},
);
}
@override
void dispose() {
// TODO: implement dispose