更新城市选择语言
This commit is contained in:
@@ -2,8 +2,10 @@ import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/EventBus.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/eventType.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/mh_language_controller.dart';
|
||||
import 'package:vbvs_app/controller/weather/weather_controller.dart';
|
||||
@@ -122,7 +124,9 @@ class _LanguagePageState extends State<LanguagePage> {
|
||||
lang.selected = (lang ==
|
||||
language); // 根据选择更新状态
|
||||
}
|
||||
|
||||
EventBus().emit(
|
||||
SwitchLanguageEvent(language
|
||||
.language_code));
|
||||
await AppLanguage()
|
||||
.loadLanguage(
|
||||
language.language_code,
|
||||
|
||||
@@ -253,7 +253,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
Text('SWES2025.10.31',
|
||||
Text('SWES2025.12.17',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/pojo/city.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
@@ -15,6 +16,7 @@ import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart';
|
||||
import 'package:vbvs_app/pages/person/select_city.dart';
|
||||
import 'package:vbvs_app/pages/person/select_disease.dart';
|
||||
|
||||
//更新人员信息
|
||||
class PeopleInfoPage extends GetView<PeopleInfoController> {
|
||||
@@ -31,9 +33,26 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
|
||||
|
||||
PeopleInfoController controller = Get.put(PeopleInfoController());
|
||||
|
||||
final CityModelController cityController = Get.find<CityModelController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
getPersonData();
|
||||
controller.getDiseaseData().then((apiResponse) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (apiResponse.code != HttpStatusCodes.ok) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg ?? '',
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
getPersonData();
|
||||
|
||||
controller.cityDataFuture = cityController.loadAndSetCityData().then((success) {
|
||||
return cityController.cityList;
|
||||
});
|
||||
return LayoutBuilder(
|
||||
builder: (context, boxConstraints) => GestureDetector(
|
||||
onTap: () {
|
||||
@@ -931,6 +950,242 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
|
||||
),
|
||||
),
|
||||
getLine(),
|
||||
// Container(
|
||||
// height: 90.rpx,
|
||||
// margin: EdgeInsets.only(
|
||||
// left: 40.rpx, right: 35.rpx),
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
// // if (widget.status ==
|
||||
// // BindType.share.code) {
|
||||
// // TopSlideNotification.show(
|
||||
// // context,
|
||||
// // text: "被分享用户只能修改用户名称",
|
||||
// // textColor:
|
||||
// // themeController
|
||||
// // .currentColor
|
||||
// // .sc9);
|
||||
// // return;
|
||||
// // }
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(
|
||||
// FocusNode());
|
||||
// Future.delayed(
|
||||
// Duration(
|
||||
// milliseconds: 250),
|
||||
// () {
|
||||
// // 使用当前选中的城市数据,如果没有则创建默认
|
||||
// CityModel? currentCity;
|
||||
// if (controller
|
||||
// .model
|
||||
// .cityModels
|
||||
// .isNotEmpty &&
|
||||
// index <
|
||||
// controller
|
||||
// .model
|
||||
// .cityModels
|
||||
// .length) {
|
||||
// currentCity = controller
|
||||
// .model
|
||||
// .cityModels[index];
|
||||
// } else {
|
||||
// currentCity = CityModel();
|
||||
// }
|
||||
|
||||
// showCitySelectionDialog(
|
||||
// context,
|
||||
// selectedCity: currentCity,
|
||||
// onCityChanged:
|
||||
// (CityModel newCity) {
|
||||
// final list = controller
|
||||
// .model.cityModels;
|
||||
// if (index <
|
||||
// list.length) {
|
||||
// // 替换
|
||||
// list[index] = newCity;
|
||||
// } else {
|
||||
// // 补齐并追加
|
||||
// list.add(newCity);
|
||||
// }
|
||||
// controller.model
|
||||
// .peopleList[
|
||||
// index]['UTC'] =
|
||||
// list[index].UTC;
|
||||
// controller.model
|
||||
// .peopleList[
|
||||
// index]
|
||||
// ['city_id'] = list[
|
||||
// index]
|
||||
// .id;
|
||||
// controller.updateAll();
|
||||
// },
|
||||
|
||||
// title: "选择城市".tr,
|
||||
// cityDataFuture: controller
|
||||
// .cityDataFuture, // 传入预加载的数据
|
||||
// colors:
|
||||
// CitySelectionColors(
|
||||
// pickerBackgroundColor:
|
||||
// stringToColor(
|
||||
// "#003058"),
|
||||
// confirmTextColor:
|
||||
// stringToColor(
|
||||
// "#84F5FF"),
|
||||
// selectedCityColor:
|
||||
// stringToColor(
|
||||
// "#84F5FF"),
|
||||
// ),
|
||||
// );
|
||||
// });
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment
|
||||
// .spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// '慢病管理'.tr,
|
||||
// style: TextStyle(
|
||||
// fontFamily:
|
||||
// 'Readex Pro',
|
||||
// color:
|
||||
// Color(0xFF9EA4B7),
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// getCityModel(index) !=
|
||||
// null
|
||||
// ? MyUtils
|
||||
// .getDetailedCityDisplayText(
|
||||
// getCityModel(
|
||||
// index))
|
||||
// : "请选择城市".tr,
|
||||
// style: TextStyle(
|
||||
// color: getCityModel(
|
||||
// index) !=
|
||||
// null
|
||||
// ? themeController
|
||||
// .currentColor
|
||||
// .sc3
|
||||
// : themeController
|
||||
// .currentColor
|
||||
// .sc4,
|
||||
// fontSize: AppConstants()
|
||||
// .title_text_fontSize,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
Container(
|
||||
height: 90.rpx,
|
||||
margin: EdgeInsets.only(
|
||||
left: 40.rpx, right: 35.rpx),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(
|
||||
FocusNode());
|
||||
Future.delayed(
|
||||
Duration(
|
||||
milliseconds: 250),
|
||||
() {
|
||||
// 获取当前已选择的慢病ID列表
|
||||
final currentDiseaseIds = List<
|
||||
String>.from(controller
|
||||
.model
|
||||
.peopleList[
|
||||
index]
|
||||
['disease_ids'] ??
|
||||
[]);
|
||||
|
||||
showDiseaseSelectionDialog(
|
||||
context,
|
||||
selectedIds:
|
||||
currentDiseaseIds,
|
||||
onDiseasesChanged:
|
||||
(List<String>
|
||||
newDiseaseIds) {
|
||||
// 更新模型数据
|
||||
controller.model.peopleList[
|
||||
index][
|
||||
'disease_ids'] =
|
||||
newDiseaseIds;
|
||||
controller.updateAll();
|
||||
},
|
||||
title: "选择慢病".tr,
|
||||
colors:
|
||||
DiseaseSelectionColors(
|
||||
pickerBackgroundColor:
|
||||
stringToColor(
|
||||
"#003058"),
|
||||
confirmTextColor:
|
||||
stringToColor(
|
||||
"#84F5FF"),
|
||||
selectedDiseaseColor:
|
||||
stringToColor(
|
||||
"#84F5FF"),
|
||||
),
|
||||
diseaseList: controller
|
||||
.diseaseList,
|
||||
);
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'慢病管理'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color:
|
||||
Color(0xFF9EA4B7),
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
Obx(() {
|
||||
final selectedIds = controller
|
||||
.model
|
||||
.peopleList[
|
||||
index]
|
||||
['disease_ids'] ??
|
||||
[];
|
||||
final diseases =
|
||||
controller
|
||||
.diseaseList;
|
||||
|
||||
return Text(
|
||||
getSelectedDiseaseNames(
|
||||
diseases,
|
||||
List<String>.from(
|
||||
selectedIds)),
|
||||
style: TextStyle(
|
||||
color: selectedIds
|
||||
.isNotEmpty
|
||||
? themeController
|
||||
.currentColor
|
||||
.sc3
|
||||
: themeController
|
||||
.currentColor
|
||||
.sc4,
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
getLine(),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
@@ -40,9 +40,9 @@ Future<List<CityModel>> loadCityData() async {
|
||||
// 定义城市选择器颜色配置
|
||||
class CitySelectionColors {
|
||||
final Color? pickerBackgroundColor; // 选择器整体背景色
|
||||
final Color? confirmTextColor; // 确定按钮文字颜色
|
||||
final Color? selectedCityColor; // 选中的城市背景色
|
||||
|
||||
final Color? confirmTextColor; // 确定按钮文字颜色
|
||||
final Color? selectedCityColor; // 选中的城市背景色
|
||||
|
||||
const CitySelectionColors({
|
||||
this.pickerBackgroundColor,
|
||||
this.confirmTextColor,
|
||||
@@ -59,12 +59,15 @@ Future showCitySelectionDialog(
|
||||
CitySelectionColors? colors, // 新增:颜色配置参数
|
||||
}) {
|
||||
ThemeController themeController = Get.find();
|
||||
final bool isChinese = Get.locale?.languageCode == 'zh' ?? true;
|
||||
final bool isChinese = Get.locale?.languageCode == 'zh_CN' ?? true;
|
||||
|
||||
// 使用传入的颜色,如果没传则使用主题颜色
|
||||
final Color pickerBackgroundColor = colors?.pickerBackgroundColor ?? themeController.currentColor.sc17;
|
||||
final Color confirmTextColor = colors?.confirmTextColor ?? themeController.currentColor.sc2;
|
||||
final Color selectedCityColor = colors?.selectedCityColor ?? themeController.currentColor.sc2;
|
||||
final Color pickerBackgroundColor =
|
||||
colors?.pickerBackgroundColor ?? themeController.currentColor.sc17;
|
||||
final Color confirmTextColor =
|
||||
colors?.confirmTextColor ?? themeController.currentColor.sc2;
|
||||
final Color selectedCityColor =
|
||||
colors?.selectedCityColor ?? themeController.currentColor.sc2;
|
||||
|
||||
final RxList<String> countries = <String>[].obs;
|
||||
final RxList<String> provinces = <String>[].obs;
|
||||
@@ -263,7 +266,7 @@ Future showCitySelectionDialog(
|
||||
// 数据加载中
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return _buildLoadingBottomSheet(
|
||||
themeController,
|
||||
themeController,
|
||||
pickerBackgroundColor,
|
||||
confirmTextColor,
|
||||
);
|
||||
@@ -272,8 +275,8 @@ Future showCitySelectionDialog(
|
||||
// 数据加载错误
|
||||
if (snapshot.hasError || !snapshot.hasData) {
|
||||
return _buildErrorBottomSheet(
|
||||
themeController,
|
||||
context,
|
||||
themeController,
|
||||
context,
|
||||
pickerBackgroundColor,
|
||||
confirmTextColor,
|
||||
);
|
||||
@@ -282,9 +285,10 @@ Future showCitySelectionDialog(
|
||||
final cityData = snapshot.data!;
|
||||
|
||||
// 只在第一次初始化数据
|
||||
if (countries.isEmpty) {
|
||||
initializePickerData(cityData);
|
||||
}
|
||||
// if (countries.isEmpty) {
|
||||
|
||||
// }
|
||||
initializePickerData(cityData);
|
||||
|
||||
return _buildCityPickerContent(
|
||||
context,
|
||||
@@ -796,4 +800,4 @@ Widget _buildErrorBottomSheet(
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user