view.dart 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:vitalapp/components/button.dart';
  4. import 'package:vitalapp/components/side_nav/defines.dart';
  5. import 'package:vitalapp/components/side_nav/side_nav.dart';
  6. import 'package:vitalapp/pages/patient/create/controller.dart';
  7. import 'package:vitalapp/pages/patient/create/widgets/area.dart';
  8. import 'package:vitalapp/pages/patient/create/widgets/crowd_label.dart';
  9. import 'package:vitalapp/pages/patient/create/widgets/patient_info.dart';
  10. class CreatePatientPage extends GetView<CreatePatientController> {
  11. const CreatePatientPage({super.key});
  12. @override
  13. Widget build(BuildContext context) {
  14. return Stack(
  15. children: [
  16. VSideNavView(
  17. // navId: NavIds.CREATE,
  18. items: _buildItems(),
  19. ),
  20. Positioned(
  21. bottom: 8,
  22. left: 200,
  23. right: 200,
  24. child: Row(
  25. mainAxisAlignment: MainAxisAlignment.spaceAround,
  26. children: [
  27. VButton(
  28. label: "保存",
  29. onTap: () {
  30. controller.saveAndBack();
  31. },
  32. ),
  33. ],
  34. ),
  35. ),
  36. ],
  37. );
  38. }
  39. List<VSideNavMenuItem> _buildItems() {
  40. final items = <VSideNavMenuItem>[];
  41. items.add(_buildLogOutItem());
  42. items.add(_buildSignatureItem());
  43. items.add(_buildAboutItem());
  44. return items;
  45. }
  46. VSideNavMenuItem _buildSignatureItem() {
  47. return VSideNavMenuItem(
  48. title: "服务信息",
  49. icon: Icon(Icons.edit_document, color: Colors.grey.shade700),
  50. pageBuilder: (_) => _buildInterval(
  51. const Area(),
  52. ),
  53. );
  54. }
  55. VSideNavMenuItem _buildAboutItem() {
  56. return VSideNavMenuItem(
  57. title: "人群分类",
  58. isRequired: true,
  59. icon: Icon(Icons.info_outline, color: Colors.grey.shade700),
  60. pageBuilder: (_) => _buildInterval(
  61. const CrowdLabelView(),
  62. ),
  63. );
  64. }
  65. VSideNavMenuItem _buildLogOutItem() {
  66. return VSideNavMenuItem(
  67. title: "个人信息",
  68. icon:
  69. Icon(Icons.medical_information_outlined, color: Colors.grey.shade700),
  70. pageBuilder: (_) => _buildInterval(
  71. PatientInfo(),
  72. ),
  73. // route: VRouteSetting(
  74. // "/patient_info_panel",
  75. // () => const PatientInfo(),
  76. // binding: BindingsBuilder(
  77. // () {
  78. // Get.lazyPut(() => CreatePatientController());
  79. // },
  80. // ),
  81. // ),
  82. // shouldRearrage: true, // TODO: 调整样式后启用
  83. );
  84. }
  85. Widget _buildInterval(Widget child) {
  86. return Padding(
  87. padding: const EdgeInsets.symmetric(
  88. horizontal: 16,
  89. ),
  90. child: child,
  91. );
  92. }
  93. }