更新眠花糖选择城市
This commit is contained in:
@@ -632,7 +632,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
},
|
||||
child: Center(
|
||||
child: Text(
|
||||
_getDetailedCityDisplayText(
|
||||
MyUtils.getDetailedCityDisplayText(
|
||||
personController.cityModel),
|
||||
textAlign: TextAlign.right,
|
||||
style: TextStyle(
|
||||
@@ -650,6 +650,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 117.rpx, 0, 0),
|
||||
@@ -858,28 +859,4 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 获取城市显示文本
|
||||
// 更详细的显示逻辑(可选)
|
||||
String _getDetailedCityDisplayText(CityModel? cityModel) {
|
||||
if (cityModel == null) {
|
||||
return '选择城市'.tr;
|
||||
}
|
||||
|
||||
// 根据数据层级显示不同的格式
|
||||
if (cityModel.city != null && cityModel.city!.isNotEmpty) {
|
||||
// 三级数据:国家-省份-城市
|
||||
return '${cityModel.country ?? ''}-${cityModel.province ?? ''}-${cityModel.city ?? cityModel.value ?? ''}';
|
||||
} else if (cityModel.province != null && cityModel.province!.isNotEmpty) {
|
||||
// 二级数据:国家-省份
|
||||
return '${cityModel.country ?? ''}-${cityModel.province ?? cityModel.value ?? ''}';
|
||||
} else if (cityModel.country != null && cityModel.country!.isNotEmpty) {
|
||||
// 一级数据:国家
|
||||
return cityModel.country!;
|
||||
} else if (cityModel.value != null && cityModel.value!.isNotEmpty) {
|
||||
// 只有 value 字段
|
||||
return cityModel.value!;
|
||||
} else {
|
||||
return '选择城市'.tr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user