import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; import 'package:vitalapp/architecture/app_parameters.dart'; import 'package:vitalapp/components/cell.dart'; import 'package:vitalapp/components/dialog_check.dart'; import 'package:vitalapp/components/dialog_date.dart'; import 'package:vitalapp/components/dialog_input.dart'; import 'package:vitalapp/components/dialog_profile_time_input.dart'; import 'package:vitalapp/components/dialog_select.dart'; import 'package:fis_common/index.dart'; import 'package:vitalapp/pages/patient_info/controller.dart'; import 'package:vitalapp/pages/patient_info/entitys/patientInfo_record.dart'; class HealthInfomations extends GetView { @override Widget build(BuildContext context) { return Obx(() { final data = controller.state.healthInfo; final state = controller.state; return VListFormCellGroup( formTitle: "健康信息", children: [ Row( children: [ Text( "过敏史", style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), ), Expanded(child: SizedBox()), Text( "全选", style: TextStyle( fontSize: 20, fontWeight: FontWeight.w700, ), ), Switch( value: controller.state.selectedAllergyHistory, onChanged: (v) { controller.state.selectedAllergyHistory = v; if (v) { data.historyDrugAllergies = ["1"]; data.historyExposure = ["1"]; } else { data.historyDrugAllergies = []; data.historyExposure = []; } }, ), ], ), VListFormCell( label: "药物过敏史", content: data.historyDrugAllergies?.map( (index) { return PatientInfoRecord.historyDrugAllergiesList .firstWhere((element) => element.key == index) .value; }, ).join(',') ?? "", onTap: () async { final result = await VDialogCheck, String>( title: "药物过敏史", source: PatientInfoRecord.historyDrugAllergiesList, initialValue: data.historyDrugAllergies ?? [], valueGetter: (data) => data.key, labelGetter: (data) => data.value, MutexValue: '1', ).show(); if (result != null) { data.historyDrugAllergies = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.historyDrugAllergies?.contains("5") ?? false) VListFormCell( label: "药物过敏史-其他", content: data.historyDrugAllergiesOther, onTap: () async { final result = await VDialogInput( title: "药物过敏史-其他", initialValue: data.historyDrugAllergiesOther, placeholder: '请输入') .show(); if (result != null) { data.historyDrugAllergiesOther = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "暴露史", content: data.historyExposure?.map((index) { return PatientInfoRecord.historyExposureList .firstWhere((element) => element.key == index) .value; }).join(',') ?? '', onTap: () async { final result = await VDialogCheck, String>( title: "暴露史", source: PatientInfoRecord.historyExposureList, initialValue: data.historyExposure ?? [], valueGetter: (data) => data.key, labelGetter: (data) => data.value, MutexValue: '1', ).show(); if (result != null) { data.historyExposure = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), Row( children: [ Text( "既往史", style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), ), Expanded(child: SizedBox()), Text( "全选", style: TextStyle( fontSize: 20, fontWeight: FontWeight.w700, ), ), Switch( value: controller.state.selectedAllMedicalHistory, onChanged: (v) { controller.state.selectedAllMedicalHistory = v; if (v) { data.operation = "1"; data.trauma = "1"; data.transfusion = "1"; data.historyPreviousDisease = ["1"]; } else { data.operation = null; data.trauma = null; data.transfusion = null; data.historyPreviousDisease = null; } }, ), ], ), Column( children: [ VListFormCell( label: "疾病", content: data.historyPreviousDisease?.map((index) { return PatientInfoRecord.historyPreviousDiseaseList .firstWhere((element) => element.key == index) .value; }).join(','), onTap: () async { final result = await VDialogCheck, String>( title: "疾病", source: PatientInfoRecord.historyPreviousDiseaseList, initialValue: data.historyPreviousDisease ?? [], valueGetter: (data) => data.key, labelGetter: (data) => data.value, MutexValue: '1', ).show(); if (result != null) { data.historyPreviousDisease = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.historyPreviousDisease?.contains("6") ?? false) VListFormCell( label: " 疾病-恶性肿瘤", content: data.historyPreviousDiseaseMalignancy, onTap: () async { final result = await VDialogInput( title: "疾病-恶性肿瘤", initialValue: data.historyPreviousDiseaseMalignancy, placeholder: '请输入恶性肿瘤详情') .show(); if (result != null) { data.historyPreviousDiseaseMalignancy = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.historyPreviousDisease?.contains("12") ?? false) VListFormCell( label: " 疾病-职业病", content: data.historyPreviousDiseaseOccupationalDisease, onTap: () async { final result = await VDialogInput( title: "疾病-职业病", initialValue: data.historyPreviousDiseaseOccupationalDisease, placeholder: '请输入职业病详情') .show(); if (result != null) { data.historyPreviousDiseaseOccupationalDisease = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.historyPreviousDisease?.contains("13") ?? false) VListFormCell( label: " 疾病-其他", content: data.historyPreviousDiseaseOther, onTap: () async { final result = await VDialogInput( title: "疾病-其他", initialValue: data.historyPreviousDiseaseOther, placeholder: '请输入其他疾病详情') .show(); if (result != null) { data.historyPreviousDiseaseOther = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if ((data.historyPreviousDisease?.isNotEmpty ?? false) && !(data.historyPreviousDisease?.contains("1") ?? false)) ...data.historyPreviousDisease! .map( (e) => VListFormCell( label: ' ${PatientInfoRecord.historyPreviousDiseaseList.firstWhere((element) => element.key == e).value} 确诊时间', content: data.diseaseDiagnosisTime[e] != null ? DateFormat('yyyy-MM-dd') .format(data.diseaseDiagnosisTime[e]!) : '', onTap: () async { bool _isLocalStation = AppParameters.data.isLocalStation; DateTime? result; if (kIsWeb || _isLocalStation) { result = await showDatePicker( context: Get.context!, initialDate: controller.state.birthday ?? DateTime.now(), firstDate: DateTime(1900), lastDate: DateTime(2100), ); } else { result = await VDialogDate( maxValue: DateTime.now(), ).show(); } if (result != null) { data.diseaseDiagnosisTime[e] = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), ) .toList(), ], ), ///手术 Column( children: [ VListFormCell( label: "手术", content: data.operation.isNotNullOrEmpty ? PatientInfoRecord.historyPreviousOtherList .firstWhere((element) => element.key == data.operation) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "既往史-手术", source: PatientInfoRecord.historyPreviousOtherList, initialValue: data.operation, valueGetter: (data) => data.key, labelGetter: (data) => data.value, ).show(); if (result != null) { data.operation = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.operation?.contains("2") ?? false) Row( children: [ const SizedBox( width: 16, ), Expanded( child: InkWell( onTap: () async { final result = await VDialogProfileTimeInput( title: "手术1", initialValue: data.operationOne, ).show(); if (result != null) { data.operationOne = result; state.refreshHealthInfo(); } }, child: Card( elevation: 0, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.grey.shade300, ), borderRadius: BorderRadius.circular(8)), padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( '手术1', style: TextStyle( fontSize: 24, ), ), Text( '名称:${data.operationOne?.name ?? ''}', style: const TextStyle( fontSize: 20, ), ), Text( '时间:${data.operationOne?.time != null ? DateFormat('yyyy-MM-dd').format(data.operationOne!.time!) : ''}', style: const TextStyle( fontSize: 20, ), ), const SizedBox( height: 4, ) ], ), ), ), ), ), Expanded( child: InkWell( onTap: () async { final result = await VDialogProfileTimeInput( title: "手术2", initialValue: data.operationTwo, ).show(); if (result != null) { data.operationTwo = result; state.refreshHealthInfo(); } }, child: Card( elevation: 0, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.grey.shade300, ), borderRadius: BorderRadius.circular(8)), padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( '手术2', style: TextStyle( fontSize: 24, ), ), Text( '名称:${data.operationTwo?.name ?? ''}', style: const TextStyle( fontSize: 20, ), ), Text( '时间:${data.operationTwo?.time != null ? DateFormat('yyyy-MM-dd').format(data.operationTwo!.time!) : ''}', style: const TextStyle( fontSize: 20, ), ), const SizedBox( height: 4, ) ], ), ), ), ), ), const SizedBox( width: 16, ), ], ), ], ), ///外伤 Column( children: [ VListFormCell( label: "外伤", content: data.trauma.isNotNullOrEmpty ? PatientInfoRecord.historyPreviousOtherList .firstWhere((element) => element.key == data.trauma) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "既往史-外伤", source: PatientInfoRecord.historyPreviousOtherList, initialValue: data.trauma, valueGetter: (data) => data.key, labelGetter: (data) => data.value, ).show(); if (result != null) { data.trauma = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.trauma?.contains('2') ?? false) Row( children: [ const SizedBox( width: 16, ), Expanded( child: InkWell( onTap: () async { final result = await VDialogProfileTimeInput( title: "外伤1", initialValue: data.traumaOne, ).show(); if (result != null) { data.traumaOne = result; state.refreshHealthInfo(); } }, child: Card( elevation: 0, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.grey.shade300, ), borderRadius: BorderRadius.circular(8)), padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( '外伤1', style: TextStyle( fontSize: 24, ), ), Text( '名称:${data.traumaOne?.name ?? ''}', style: const TextStyle( fontSize: 20, ), ), Text( '时间:${data.traumaOne?.time != null ? DateFormat('yyyy-MM-dd').format(data.traumaOne!.time!) : ''}', style: const TextStyle( fontSize: 20, ), ), const SizedBox( height: 4, ) ], ), ), ), ), ), Expanded( child: InkWell( onTap: () async { final result = await VDialogProfileTimeInput( title: "外伤2", initialValue: data.traumaTwo, ).show(); if (result != null) { data.traumaTwo = result; state.refreshHealthInfo(); } }, child: Card( elevation: 0, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.grey.shade300, ), borderRadius: BorderRadius.circular(8)), padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( '外伤2', style: TextStyle( fontSize: 24, ), ), Text( '名称:${data.traumaTwo?.name ?? ''}', style: const TextStyle( fontSize: 20, ), ), Text( '时间:${data.traumaTwo?.time != null ? DateFormat('yyyy-MM-dd').format(data.traumaTwo!.time!) : ''}', style: const TextStyle( fontSize: 20, ), ), const SizedBox( height: 4, ) ], ), ), ), ), ), const SizedBox( width: 16, ), ], ), ], ), ///输血项目 Column( children: [ VListFormCell( label: "输血", content: data.transfusion.isNotNullOrEmpty ? PatientInfoRecord.historyPreviousOtherList .firstWhere( (element) => element.key == data.transfusion) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "既往史-输血", source: PatientInfoRecord.historyPreviousOtherList, initialValue: data.transfusion, valueGetter: (data) => data.key, labelGetter: (data) => data.value, ).show(); if (result != null) { data.transfusion = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.transfusion?.contains('2') ?? false) Row( children: [ const SizedBox( width: 16, ), Expanded( child: InkWell( onTap: () async { final result = await VDialogProfileTimeInput( title: "输血1", initialValue: data.transfusionOne, ).show(); if (result != null) { data.transfusionOne = result; state.refreshHealthInfo(); } }, child: Card( elevation: 0, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.grey.shade300, ), borderRadius: BorderRadius.circular(8)), padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( '输血1', style: TextStyle( fontSize: 24, ), ), Text( '名称:${data.transfusionOne?.name ?? ''}', style: const TextStyle( fontSize: 20, ), ), Text( '时间:${data.transfusionOne?.time != null ? DateFormat('yyyy-MM-dd').format(data.transfusionOne!.time!) : ''}', style: const TextStyle( fontSize: 20, ), ), const SizedBox( height: 4, ) ], ), ), ), ), ), Expanded( child: InkWell( onTap: () async { final result = await VDialogProfileTimeInput( title: "输血2", initialValue: data.transfusionTwo, ).show(); if (result != null) { data.transfusionTwo = result; state.refreshHealthInfo(); } }, child: Card( elevation: 0, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.grey.shade300, ), borderRadius: BorderRadius.circular(8)), padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( '输血2', style: TextStyle( fontSize: 24, ), ), Text( '名称:${data.transfusionTwo?.name ?? ''}', style: const TextStyle( fontSize: 20, ), ), Text( '时间:${data.transfusionTwo?.time != null ? DateFormat('yyyy-MM-dd').format(data.transfusionTwo!.time!) : ''}', style: const TextStyle( fontSize: 20, ), ), const SizedBox( height: 4, ) ], ), ), ), ), ), const SizedBox( width: 16, ), ], ), ], ), Row( children: [ Text( "家族病史", style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), ), Expanded(child: SizedBox()), Text( "全选", style: TextStyle( fontSize: 20, fontWeight: FontWeight.w700, ), ), Switch( value: controller.state.selectedAllFamilyMedicalHistory, onChanged: (v) { controller.state.selectedAllFamilyMedicalHistory = v; if (v) { data.father = ["1"]; data.mother = ["1"]; data.sibling = ["1"]; data.children = ["1"]; } else { data.father = []; data.mother = []; data.sibling = []; data.children = []; } }, ), ], ), VListFormCell( label: "父亲", content: data.father?.map((index) { return PatientInfoRecord.historyFamilyList .firstWhere((element) => element.key == index) .value; }).join(','), onTap: () async { final result = await VDialogCheck, String>( title: "父亲", source: PatientInfoRecord.historyFamilyList, initialValue: data.father ?? [], valueGetter: (data) => data.key, labelGetter: (data) => data.value, MutexValue: '1', ).show(); if (result != null) { data.father = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.father?.contains("12") ?? false) VListFormCell( label: "父亲-其他", content: data.fatherOther, onTap: () async { final result = await VDialogInput( title: "父亲-其他", initialValue: data.fatherOther, placeholder: '请输入') .show(); if (result != null) { data.fatherOther = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "母亲", content: data.mother?.map((index) { return PatientInfoRecord.historyFamilyList .firstWhere((element) => element.key == index) .value; }).join(','), onTap: () async { final result = await VDialogCheck, String>( title: "母亲", source: PatientInfoRecord.historyFamilyList, initialValue: data.mother ?? [], valueGetter: (data) => data.key, labelGetter: (data) => data.value, MutexValue: '1', ).show(); if (result != null) { data.mother = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.mother?.contains("12") ?? false) VListFormCell( label: "母亲-其他", content: data.motherOther, onTap: () async { final result = await VDialogInput( title: "母亲-其他", initialValue: data.motherOther, placeholder: '请输入') .show(); if (result != null) { data.motherOther = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "兄弟姐妹", content: data.sibling?.map((index) { return PatientInfoRecord.historyFamilyList .firstWhere((element) => element.key == index) .value; }).join(','), onTap: () async { final result = await VDialogCheck, String>( title: "兄弟姐妹", source: PatientInfoRecord.historyFamilyList, initialValue: data.sibling ?? [], valueGetter: (data) => data.key, labelGetter: (data) => data.value, MutexValue: '1', ).show(); if (result != null) { data.sibling = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.sibling?.contains("12") ?? false) VListFormCell( label: "兄弟姐妹-其他", content: data.siblingOther, onTap: () async { final result = await VDialogInput( title: "兄弟姐妹-其他", initialValue: data.siblingOther, placeholder: '请输入') .show(); if (result != null) { data.siblingOther = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "子女", content: data.children?.map((index) { return PatientInfoRecord.historyFamilyList .firstWhere((element) => element.key == index) .value; }).join(','), onTap: () async { final result = await VDialogCheck, String>( title: "子女", source: PatientInfoRecord.historyFamilyList, initialValue: data.children ?? [], valueGetter: (data) => data.key, labelGetter: (data) => data.value, MutexValue: '1', ).show(); if (result != null) { data.children = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.children?.contains("12") ?? false) VListFormCell( label: "子女-其他", content: data.childrenOther, onTap: () async { final result = await VDialogInput( title: "子女-其他", initialValue: data.childrenOther, placeholder: '请输入') .show(); if (result != null) { data.childrenOther = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), Row( children: [ Text( "遗传病史", style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), ), Expanded(child: SizedBox()), Text( "全选", style: TextStyle( fontSize: 20, fontWeight: FontWeight.w700, ), ), Switch( value: controller.state.selectAllGeneticHistory, onChanged: (v) { controller.state.selectAllGeneticHistory = v; if (v) { data.historyGenetic = "1"; data.disabilitySituation = ["1"]; } else { data.historyGenetic = null; data.disabilitySituation = []; } }, ), ], ), VListFormCell( label: "遗传病史", content: data.historyGenetic.isNotNullOrEmpty ? PatientInfoRecord.historyPreviousOtherList .firstWhere((element) => element.key == data.historyGenetic) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "遗传病史", source: PatientInfoRecord.historyPreviousOtherList, initialValue: data.historyGenetic, valueGetter: (data) => data.key, labelGetter: (data) => data.value, ).show(); if (result != null) { data.historyGenetic = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.historyGenetic?.contains("2") ?? false) VListFormCell( label: "疾病名称", content: data.historyGeneticName, onTap: () async { final result = await VDialogInput( title: "疾病名称", initialValue: data.historyGeneticName, placeholder: '请输入') .show(); if (result != null) { data.historyGeneticName = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), Column( children: [ VListFormCell( label: "残疾情况", content: data.disabilitySituation?.map((index) { return PatientInfoRecord.disabilitySituationList .firstWhere((element) => element.key == index) .value; }).join(','), onTap: () async { final result = await VDialogCheck, String>( title: "残疾情况", source: PatientInfoRecord.disabilitySituationList, initialValue: data.disabilitySituation ?? [], valueGetter: (data) => data.key, labelGetter: (data) => data.value, MutexValue: '1', ).show(); if (result != null) { data.disabilitySituation = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.disabilitySituation?.contains("8") ?? false) VListFormCell( label: "其他残疾-疾病名称", content: data.disabilitySituationOther, onTap: () async { final result = await VDialogInput( title: "其他残疾-疾病名称", initialValue: data.disabilitySituationOther, placeholder: '请输入') .show(); if (result != null) { data.disabilitySituationOther = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), ], ), Row( children: [ Text( "生活环境", style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), ), Expanded(child: SizedBox()), Text( "全选", style: TextStyle( fontSize: 20, fontWeight: FontWeight.w700, ), ), Switch( value: controller.state.livingEnvironment, onChanged: (v) { controller.state.livingEnvironment = v; if (v) { data.fuel = "1"; data.drinkingWater = "1"; data.toilet = "1"; data.animalPen = "1"; data.kitchenExhaustFacilities = "1"; } else { data.fuel = null; data.toilet = null; data.animalPen = null; data.kitchenExhaustFacilities = null; data.drinkingWater = null; } }, ), ], ), VListFormCell( label: "厨房排风设施", content: data.kitchenExhaustFacilities.isNotNullOrEmpty ? PatientInfoRecord.kitchenExhaustFacilitiesList .firstWhere((element) => element.key == data.kitchenExhaustFacilities) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "厨房排风设施", source: PatientInfoRecord.kitchenExhaustFacilitiesList, initialValue: data.kitchenExhaustFacilities, valueGetter: (data) => data.key, labelGetter: (data) => data.value, ).show(); if (result != null) { data.kitchenExhaustFacilities = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "燃气类型", content: data.fuel.isNotNullOrEmpty ? PatientInfoRecord.fuelList .firstWhere((element) => element.key == data.fuel) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "燃气类型", source: PatientInfoRecord.fuelList, initialValue: data.fuel, valueGetter: (data) => data.key, labelGetter: (data) => data.value, ).show(); if (result != null) { data.fuel = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.fuel?.contains("6") ?? false) VListFormCell( label: "燃气类型-其他", content: data.fuelOther, onTap: () async { final result = await VDialogInput( title: "燃气类型-其他", initialValue: data.fuelOther, placeholder: '请输入') .show(); if (result != null) { data.fuelOther = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "饮水", content: data.drinkingWater.isNotNullOrEmpty ? PatientInfoRecord.drinkingWaterList .firstWhere((element) => element.key == data.drinkingWater) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "饮水", source: PatientInfoRecord.drinkingWaterList, initialValue: data.drinkingWater, valueGetter: (data) => data.key, labelGetter: (data) => data.value, ).show(); if (result != null) { data.drinkingWater = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), if (data.drinkingWater?.contains("6") ?? false) VListFormCell( label: "饮水-其他", content: data.drinkingWaterOther, onTap: () async { final result = await VDialogInput( title: "饮水-其他", initialValue: data.drinkingWaterOther, placeholder: '请输入') .show(); if (result != null) { data.drinkingWaterOther = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "厕所", content: data.toilet.isNotNullOrEmpty ? PatientInfoRecord.toiletList .firstWhere((element) => element.key == data.toilet) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "厕所", source: PatientInfoRecord.toiletList, initialValue: data.toilet, valueGetter: (data) => data.key, labelGetter: (data) => data.value, ).show(); if (result != null) { data.toilet = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "禽兽栏", content: data.animalPen.isNotNullOrEmpty ? PatientInfoRecord.animalPenList .firstWhere((element) => element.key == data.animalPen) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "禽兽栏", source: PatientInfoRecord.animalPenList, initialValue: data.animalPen, valueGetter: (data) => data.key, labelGetter: (data) => data.value, ).show(); if (result != null) { data.animalPen = result; state.refreshHealthInfo(); } }, endIcon: _buildEndIcon(), ), ], ); }); } Widget _buildEndIcon({bool isEdit = true}) { return Container( margin: EdgeInsets.only(left: isEdit ? 15 : 35), child: isEdit ? Icon(Icons.edit_outlined) : SizedBox(), ); } }