|
@@ -0,0 +1,199 @@
|
|
|
+// ignore_for_file: must_be_immutable
|
|
|
+
|
|
|
+import 'package:flutter/material.dart';
|
|
|
+import 'package:vitalapp/components/dialog_number.dart';
|
|
|
+import 'package:vitalapp/pages/check/models/form.dart';
|
|
|
+import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_radio_and_select.dart';
|
|
|
+import 'package:vitalapp/pages/check/widgets/exam_title.dart';
|
|
|
+
|
|
|
+/// 前囟特殊组件
|
|
|
+class FollowUpChildAnteriorFontanelleOther extends StatelessWidget {
|
|
|
+ FollowUpChildAnteriorFontanelleOther({
|
|
|
+ super.key,
|
|
|
+ required this.currentFormObject,
|
|
|
+ required this.options,
|
|
|
+ required this.selectRaidoChange,
|
|
|
+ required this.selectInputChange,
|
|
|
+ required this.currentSelected,
|
|
|
+ required this.formValue,
|
|
|
+ required this.selectOtherValue,
|
|
|
+ });
|
|
|
+ final FormObject currentFormObject;
|
|
|
+ final List<Option> options;
|
|
|
+ final Function selectRaidoChange;
|
|
|
+ final Function selectOtherValue;
|
|
|
+ final Function(String, String?) selectInputChange;
|
|
|
+ final String currentSelected;
|
|
|
+ final Map<String, dynamic> formValue;
|
|
|
+
|
|
|
+ Future<void> commonInput(String inputKey) async {
|
|
|
+ String mapKey = "Fontanel_Length";
|
|
|
+ if (inputKey == "width") {
|
|
|
+ mapKey = "Fontanel_Width";
|
|
|
+ }
|
|
|
+ if (formValue[mapKey] == null) {
|
|
|
+ formValue[mapKey] = "";
|
|
|
+ }
|
|
|
+ String? result = await VDialogNumber(
|
|
|
+ title: currentFormObject.label,
|
|
|
+ initialValue: formValue[mapKey],
|
|
|
+ ).show();
|
|
|
+ if (result?.isNotEmpty ?? false) {
|
|
|
+ selectInputChange.call(inputKey, result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Future<void> commonValue() async {
|
|
|
+ String mapKey = "Fontanel_Other";
|
|
|
+
|
|
|
+ String? result = await VDialogNumber(
|
|
|
+ title: currentFormObject.label,
|
|
|
+ initialValue: formValue[mapKey],
|
|
|
+ ).show();
|
|
|
+ if (result?.isNotEmpty ?? false) {
|
|
|
+ selectOtherValue.call(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ TextStyle testStyle = const TextStyle(
|
|
|
+ fontSize: 30,
|
|
|
+ color: Colors.black,
|
|
|
+ );
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ if (currentFormObject.showLimit ?? true) {
|
|
|
+ return ExamCardRadioSelect(
|
|
|
+ titleText: ExamTitle(
|
|
|
+ label: currentFormObject.label,
|
|
|
+ titleType: '(单选)',
|
|
|
+ ),
|
|
|
+ title: currentFormObject.label ?? '',
|
|
|
+ content: Container(
|
|
|
+ padding: const EdgeInsets.symmetric(
|
|
|
+ horizontal: 5,
|
|
|
+ vertical: 16,
|
|
|
+ ).copyWith(top: 0),
|
|
|
+ alignment: currentFormObject.span == 24
|
|
|
+ ? Alignment.centerLeft
|
|
|
+ : Alignment.center,
|
|
|
+ width: double.infinity,
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ Wrap(
|
|
|
+ children: options
|
|
|
+ .map(
|
|
|
+ (e) => Container(
|
|
|
+ padding: const EdgeInsets.all(7),
|
|
|
+ child: InkWell(
|
|
|
+ onTap: () {
|
|
|
+ selectRaidoChange.call(e);
|
|
|
+ },
|
|
|
+ borderRadius: BorderRadius.circular(50),
|
|
|
+ child: Ink(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ border: Border.all(
|
|
|
+ color: currentSelected == e.value
|
|
|
+ ? Colors.blue
|
|
|
+ : Colors.black26,
|
|
|
+ ),
|
|
|
+ borderRadius: const BorderRadius.all(
|
|
|
+ Radius.circular(50),
|
|
|
+ ),
|
|
|
+ color: currentSelected == e.value
|
|
|
+ ? Colors.blue
|
|
|
+ : Colors.transparent,
|
|
|
+ ),
|
|
|
+ child: Container(
|
|
|
+ padding: const EdgeInsets.all(15),
|
|
|
+ alignment: Alignment.center,
|
|
|
+ width: 250,
|
|
|
+ child: FittedBox(
|
|
|
+ child: Text(
|
|
|
+ e.label ?? '',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 20,
|
|
|
+ color: currentSelected == e.value
|
|
|
+ ? Colors.white
|
|
|
+ : Colors.black54,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ .toList(),
|
|
|
+ ),
|
|
|
+ if (currentSelected == '4')
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.only(bottom: 16),
|
|
|
+ child: Center(
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: TextField(
|
|
|
+ readOnly: true,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ controller: TextEditingController(
|
|
|
+ text: formValue['Fontanel_Other'],
|
|
|
+ ),
|
|
|
+ style: const TextStyle(fontSize: 30),
|
|
|
+ onTap: () => commonValue(),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ )),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.only(bottom: 16),
|
|
|
+ child: Center(
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: TextField(
|
|
|
+ readOnly: true,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ controller: TextEditingController(
|
|
|
+ text: formValue['Fontanel_Length'],
|
|
|
+ ),
|
|
|
+ style: const TextStyle(fontSize: 30),
|
|
|
+ onTap: () => commonInput("length"),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ "cm",
|
|
|
+ style: testStyle,
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ "×",
|
|
|
+ style: testStyle,
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: TextField(
|
|
|
+ readOnly: true,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ controller: TextEditingController(
|
|
|
+ text: formValue['Fontanel_Width'],
|
|
|
+ ),
|
|
|
+ style: const TextStyle(fontSize: 30),
|
|
|
+ onTap: () => commonInput("width"),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ "cm",
|
|
|
+ style: testStyle,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ )),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return Container();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|