import 'base_form_value.dart'; import 'form_info.dart'; class PrenatalFollowupForm extends BaseFormValueChange { static PrenatalFollowupForm? _prenatalFollowupForm; PrenatalFollowupForm._internal(); ///第 1 次产前检查服务记录表的值 static PrenatalFollowupForm get instance { _prenatalFollowupForm ??= PrenatalFollowupForm._internal(); return _prenatalFollowupForm!; } void initListener(int times) { FormInfo.instance.onValueChange.addListener(_onValueChange); Future.delayed(Duration(milliseconds: 300), () { if (times <= 3) { //第2、3次随访,不需要显示分娩准备、 FormInfo.instance.onChangeTargetValue.emit( this, TargetFormArgs( "Guidance_Delivery_Preparation", isHidden: true, ), ); } if (times == 2) { //第2次随访,不需要显示自我监测\母乳喂养 FormInfo.instance.onChangeTargetValue.emit( this, TargetFormArgs( "Guidance_5", isHidden: true, ), ); FormInfo.instance.onChangeTargetValue.emit( this, TargetFormArgs( "Guidance_Breast_Feeding", isHidden: true, ), ); } }); } void dispose() { FormInfo.instance.onValueChange.removeListener(_onValueChange); } void _onValueChange(Object sender, UpdateFormArgs e) { String sourceKey = e.sourceKey; switch (sourceKey) { case "Referral": onReferralChange(e); } } }