Pārlūkot izejas kodu

1、优化页面UI

guanxinyi 1 gadu atpakaļ
vecāks
revīzija
528ae36245

+ 55 - 93
lib/pages/medical_checkup_station/appointment/widgets/form.dart

@@ -5,7 +5,6 @@ import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';
 import 'package:vitalapp/components/alert_dialog.dart';
-import 'package:vitalapp/components/button.dart';
 import 'package:vitalapp/components/dialog_input.dart';
 import 'package:vitalapp/components/dialog_time.dart';
 import 'package:vitalapp/components/input.dart';
@@ -25,60 +24,62 @@ class AppointmentFormDialog extends GetView<AppointmentController> {
   Widget _buildView() {
     return Container(
       height: 500,
-      child: Column(
+      child: ListView(
+        shrinkWrap: true,
         children: [
-          _buildInputItem(
-            "体检名称",
-            value: appointment?.appointmentName ?? '',
-            maxLines: 1,
-            onChanged: (v) {
-              appointment?.appointmentName = v;
-            },
-          ),
-          _buildInputItem(
-            "体检地点",
-            value: appointment?.appointmentAddress ?? '',
-            maxLines: 1,
-            onChanged: (v) {
-              appointment?.appointmentAddress = v;
-            },
-          ),
-          _buildInputItem(
-            "体检开始时间",
-            value: _getTime(appointment?.appointmentStartTime),
-            onTap: _onChangeStartTime,
-            suffixIcon: Icon(
-              Icons.chevron_right_rounded,
-              size: 30,
-            ),
-          ),
-          _buildInputItem(
-            "体检结束时间",
-            value: _getTime(appointment?.appointmentEndTime),
-            onTap: _onChangeEndTime,
-            suffixIcon: Icon(
-              Icons.chevron_right_rounded,
-              size: 30,
-            ),
-          ),
-          _buildInputItem(
-            "体检对象",
-            maxLines: 1,
-            value: appointment?.appointmentObject,
-            onChanged: (v) {
-              appointment?.appointmentObject = v;
-            },
-          ),
-          _buildInputItem(
-            "体检说明",
-            maxLines: 5,
-            value: appointment?.appointmentDescription,
-            onChanged: (v) {
-              appointment?.appointmentDescription = v;
-            },
-          ),
-          SizedBox(
-            height: 10,
+          Column(
+            children: [
+              _buildInputItem(
+                "体检名称",
+                value: appointment?.appointmentName ?? '',
+                maxLines: 1,
+                onChanged: (v) {
+                  appointment?.appointmentName = v;
+                },
+              ),
+              _buildInputItem(
+                "体检地点",
+                value: appointment?.appointmentAddress ?? '',
+                maxLines: 1,
+                onChanged: (v) {
+                  appointment?.appointmentAddress = v;
+                },
+              ),
+              _buildInputItem(
+                "体检开始时间",
+                value: _getTime(appointment?.appointmentStartTime),
+                onTap: _onChangeStartTime,
+                suffixIcon: Icon(
+                  Icons.chevron_right_rounded,
+                  size: 30,
+                ),
+              ),
+              _buildInputItem(
+                "体检结束时间",
+                value: _getTime(appointment?.appointmentEndTime),
+                onTap: _onChangeEndTime,
+                suffixIcon: Icon(
+                  Icons.chevron_right_rounded,
+                  size: 30,
+                ),
+              ),
+              _buildInputItem(
+                "体检对象",
+                maxLines: 1,
+                value: appointment?.appointmentObject,
+                onChanged: (v) {
+                  appointment?.appointmentObject = v;
+                },
+              ),
+              _buildInputItem(
+                "体检说明",
+                maxLines: 5,
+                value: appointment?.appointmentDescription,
+                onChanged: (v) {
+                  appointment?.appointmentDescription = v;
+                },
+              ),
+            ],
           ),
         ],
       ),
@@ -103,45 +104,6 @@ class AppointmentFormDialog extends GetView<AppointmentController> {
     );
   }
 
-  /// 构建创建按钮
-  Widget _buildCreate() {
-    return VButton(
-      child: isEdit! ? Text("更新") : Text("创建"),
-      onTap: () {
-        controller.formController.saveHealthExamBooking(
-          appointment!,
-          isEdit: isEdit!,
-        );
-      },
-    );
-  }
-
-  /// 构建弹窗顶部,右侧显示关闭按钮
-  Widget _buildHead() {
-    return SizedBox(
-      height: 60,
-      child: Row(
-        mainAxisAlignment: MainAxisAlignment.spaceBetween,
-        children: [
-          Container(
-            padding: const EdgeInsets.only(left: 16),
-            child: Text(
-              isEdit! ? "编辑预约模板" : "新建预约模板",
-              style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
-            ),
-          ),
-          IconButton(
-            onPressed: () => Get.back(),
-            icon: const Icon(
-              Icons.close,
-              size: 30,
-            ),
-          ),
-        ],
-      ),
-    );
-  }
-
   /// 构建表格输入框
   Widget _buildInputItem(
     String title, {

+ 146 - 137
lib/pages/medical_checkup_station/registration/widgets/form/index.dart

@@ -48,148 +48,157 @@ class _RegistrationFormDialogState extends State<RegistrationFormDialog> {
 
   Widget _buildView() {
     return Container(
-      height: 450,
-      child: Column(
+      child: ListView(
+        shrinkWrap: true,
         children: [
-          _buildInputItem(
-            "身份证号",
-            value: widget.patient?.cardNo ?? '',
-            onTap: () async {
-              var result = await VDialogInput(
-                initialValue: widget.patient?.cardNo ?? '',
-                title: "身份证号",
-                onConfirmVerification: (v) {
-                  bool isValid = IdCardHelper.validateIDCard(v);
-                  if (!isValid) {
-                    PromptBox.showToast("请填写正确的证件号");
+          Column(
+            children: [
+              _buildInputItem(
+                "身份证号",
+                value: widget.patient?.cardNo ?? '',
+                onTap: () async {
+                  var result = await VDialogInput(
+                    initialValue: widget.patient?.cardNo ?? '',
+                    title: "身份证号",
+                    onConfirmVerification: (v) {
+                      bool isValid = IdCardHelper.validateIDCard(v);
+                      if (!isValid) {
+                        PromptBox.showToast("请填写正确的证件号");
+                      }
+                      return isValid;
+                    },
+                    showCancel: true,
+                  ).show();
+                  if (result == null) {
+                    return;
                   }
-                  return isValid;
+                  if (widget.patient == null) {
+                    return;
+                  }
+                  final patient = widget.patient!;
+                  patient.cardNo = result;
+                  patient.birthday = _getBirthDayofIdNumber(result);
+                  patient.patientGender = _checkGenderFromID(result);
+                  final patientDto = await controller.getPatientByID(result);
+                  if (patientDto != null) {
+                    patient.patientName = patientDto.patientName;
+                    patient.phone = patientDto.phone;
+                    patient.patientAddress = patientDto.patientAddress;
+                  }
+                  controller.update(["registration_Form"]);
                 },
-                showCancel: true,
-              ).show();
-              if (result == null) {
-                return;
-              }
-              if (widget.patient == null) {
-                return;
-              }
-              final patient = widget.patient!;
-              patient.cardNo = result;
-              patient.birthday = _getBirthDayofIdNumber(result);
-              patient.patientGender = _checkGenderFromID(result);
-              final patientDto = await controller.getPatientByID(result);
-              if (patientDto != null) {
-                patient.patientName = patientDto.patientName;
-                patient.phone = patientDto.phone;
-                patient.patientAddress = patientDto.patientAddress;
-              }
-              controller.update(["registration_Form"]);
-            },
-          ),
-          _buildInputItem(
-            "姓名",
-            value: widget.patient?.patientName ?? '',
-            onTap: () async {
-              var result = await VDialogInput(
-                initialValue: widget.patient?.patientName ?? '',
-                title: "姓名",
-              ).show();
-              if (result != null) {
-                widget.patient?.patientName = result;
-                controller.update(["registration_Form"]);
-              }
-            },
-          ),
-          _buildInputItem(
-            "性别",
-            value: controller.formController.selectGenderList
-                .firstWhereOrNull(
-                    (element) => element.code == widget.patient?.patientGender)
-                ?.name,
-            onTap: () async {
-              String? result =
-                  await VDialogSelect<VSelectGenderEnumModel, String>(
-                source: controller.formController.selectGenderList,
-                labelGetter: (data) => data.name,
-                valueGetter: (data) => data.code.index.toString(),
-                initialValue: widget.patient?.patientGender?.index.toString(),
-                title: "性别",
-              ).show();
-              if (result != null) {
-                widget.patient?.patientGender =
-                    GenderEnum.values[int.parse(result)];
-                controller.update(["registration_Form"]);
-              }
-            },
-            suffixIcon: Icon(
-              Icons.chevron_right_rounded,
-              size: 30,
-            ),
-          ),
-          _buildInputItem(
-            "生日",
-            value: getBirthDay(widget.patient?.birthday),
-            onTap: () async {
-              DateTime? result;
-              bool _isLocalStation = AppParameters.data.isLocalStation;
-              if (kIsWeb || _isLocalStation) {
-                result = await showDatePicker(
-                  context: Get.context!,
-                  initialDate: widget.patient?.birthday ?? DateTime.now(),
-                  firstDate: DateTime(1900),
-                  lastDate: DateTime(2100),
-                );
-              } else {
-                result = await VDialogDate(
-                  initialValue: widget.patient?.birthday,
-                  title: "生日",
-                ).show();
-              }
-              if (result != null) {
-                widget.patient?.birthday = result;
-                controller.update(["registration_Form"]);
-              }
-            },
-            suffixIcon: Icon(
-              Icons.chevron_right_rounded,
-              size: 30,
-            ),
-          ),
-          _buildInputItem(
-            "手机号",
-            value: widget.patient?.phone,
-            onTap: () async {
-              var result = await VDialogInput(
-                initialValue: widget.patient?.phone ?? '',
-                title: "手机号",
-                showCancel: true,
-                onConfirmVerification: (v) {
-                  var isValid = (v.length == 11 && IdCardHelper.isNumeric(v));
-                  if (!isValid) {
-                    PromptBox.showToast("请填写正确的手机号");
+              ),
+              _buildInputItem(
+                "姓名",
+                value: widget.patient?.patientName ?? '',
+                onTap: () async {
+                  var result = await VDialogInput(
+                    initialValue: widget.patient?.patientName ?? '',
+                    title: "姓名",
+                  ).show();
+                  if (result != null) {
+                    widget.patient?.patientName = result;
+                    controller.update(["registration_Form"]);
                   }
-                  return isValid;
                 },
-              ).show();
-              if (result != null) {
-                widget.patient?.phone = result;
-                controller.update(["registration_Form"]);
-              }
-            },
-          ),
-          _buildInputItem(
-            "家庭住址",
-            value: widget.patient?.patientAddress ?? '',
-            onTap: () async {
-              var result = await VDialogInput(
-                initialValue: widget.patient?.patientAddress ?? '',
-                title: "家庭住址",
-              ).show();
-              if (result != null) {
-                widget.patient?.patientAddress = result;
-                controller.update(["registration_Form"]);
-              }
-            },
+              ),
+              _buildInputItem(
+                "性别",
+                value: controller.formController.selectGenderList
+                    .firstWhereOrNull((element) =>
+                        element.code == widget.patient?.patientGender)
+                    ?.name,
+                onTap: () async {
+                  String? result =
+                      await VDialogSelect<VSelectGenderEnumModel, String>(
+                    source: controller.formController.selectGenderList,
+                    labelGetter: (data) => data.name,
+                    valueGetter: (data) => data.code.index.toString(),
+                    initialValue:
+                        widget.patient?.patientGender?.index.toString(),
+                    title: "性别",
+                  ).show();
+                  if (result != null) {
+                    widget.patient?.patientGender =
+                        GenderEnum.values[int.parse(result)];
+                    controller.update(["registration_Form"]);
+                  }
+                },
+                suffixIcon: Icon(
+                  Icons.chevron_right_rounded,
+                  size: 30,
+                ),
+              ),
+              _buildInputItem(
+                "生日",
+                value: getBirthDay(widget.patient?.birthday),
+                onTap: () async {
+                  DateTime? result;
+                  bool _isLocalStation = AppParameters.data.isLocalStation;
+                  if (kIsWeb || _isLocalStation) {
+                    result = await showDatePicker(
+                      context: Get.context!,
+                      initialDate: widget.patient?.birthday ?? DateTime.now(),
+                      firstDate: DateTime(1900),
+                      lastDate: DateTime(2100),
+                    );
+                  } else {
+                    result = await VDialogDate(
+                      initialValue: widget.patient?.birthday,
+                      title: "生日",
+                    ).show();
+                  }
+                  if (result != null) {
+                    widget.patient?.birthday = result;
+                    controller.update(["registration_Form"]);
+                  }
+                },
+                suffixIcon: Icon(
+                  Icons.chevron_right_rounded,
+                  size: 30,
+                ),
+              ),
+              _buildInputItem(
+                "手机号",
+                value: widget.patient?.phone,
+                onTap: () async {
+                  var result = await VDialogInput(
+                    initialValue: widget.patient?.phone ?? '',
+                    title: "手机号",
+                    showCancel: true,
+                    onConfirmVerification: (v) {
+                      var isValid =
+                          (v.length == 11 && IdCardHelper.isNumeric(v));
+                      if (!isValid) {
+                        PromptBox.showToast("请填写正确的手机号");
+                      }
+                      return isValid;
+                    },
+                  ).show();
+                  if (result != null) {
+                    widget.patient?.phone = result;
+                    controller.update(["registration_Form"]);
+                  }
+                },
+              ),
+              _buildInputItem(
+                "家庭住址",
+                value: widget.patient?.patientAddress ?? '',
+                onTap: () async {
+                  var result = await VDialogInput(
+                    initialValue: widget.patient?.patientAddress ?? '',
+                    title: "家庭住址",
+                  ).show();
+                  if (result != null) {
+                    widget.patient?.patientAddress = result;
+                    controller.update(["registration_Form"]);
+                  }
+                },
+              ),
+              SizedBox(
+                height: 40,
+              )
+            ],
           ),
         ],
       ),