view.dart 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:vnoteapp/components/button.dart';
  4. import 'package:vnoteapp/pages/medical/controller.dart';
  5. import 'package:vnoteapp/pages/medical/widgets/blood_pressure.dart';
  6. import 'package:vnoteapp/pages/medical/widgets/blood_sugar.dart';
  7. import 'package:vnoteapp/pages/medical/widgets/body_temperature.dart';
  8. import 'package:vnoteapp/pages/medical/widgets/body_bmi.dart';
  9. import 'package:vnoteapp/pages/medical/widgets/bool_oxygen.dart';
  10. import 'package:vnoteapp/store/store.dart';
  11. class MedicalPage extends GetView<MedicalController> {
  12. const MedicalPage({super.key});
  13. @override
  14. Widget build(BuildContext context) {
  15. return Scaffold(
  16. backgroundColor: Colors.white,
  17. // appBar: VAppBar(
  18. // titleWidget: const Text(
  19. // "健康检测",
  20. // style: TextStyle(fontSize: 24),
  21. // ),
  22. // ),
  23. body: Stack(
  24. children: [
  25. Row(
  26. children: [
  27. Column(
  28. mainAxisAlignment: MainAxisAlignment.center,
  29. children: controller.state.medicalMenuList
  30. .map(
  31. (e) => Material(
  32. borderRadius: const BorderRadius.only(
  33. topRight: Radius.circular(30),
  34. bottomRight: Radius.circular(30),
  35. ),
  36. child: Ink(
  37. decoration: const BoxDecoration(
  38. borderRadius: BorderRadius.only(
  39. topRight: Radius.circular(30),
  40. bottomRight: Radius.circular(30),
  41. ),
  42. ),
  43. child: InkWell(
  44. borderRadius: const BorderRadius.only(
  45. topRight: Radius.circular(30),
  46. bottomRight: Radius.circular(30),
  47. ),
  48. onTap: () {
  49. controller.state.currentTab = e.key;
  50. },
  51. child: Obx(
  52. () => _SideBar(
  53. title: e.diagnosticItem,
  54. isActive:
  55. controller.state.currentTab == e.key,
  56. ),
  57. )),
  58. ),
  59. ),
  60. )
  61. .toList(),
  62. ),
  63. Container(
  64. alignment: Alignment.topCenter,
  65. margin: const EdgeInsets.all(16).copyWith(top: 0),
  66. child: Image.asset(
  67. 'assets/images/exam/normalMeasurementChart.png',
  68. height: double.infinity,
  69. fit: BoxFit.fitWidth, // 设置图像的适应方式
  70. ),
  71. ),
  72. Expanded(
  73. child: Stack(
  74. children: [
  75. Container(
  76. padding: const EdgeInsets.all(16),
  77. child: Column(
  78. children: [
  79. _buildContent(),
  80. ],
  81. ),
  82. ),
  83. _buildSaveButton(),
  84. ],
  85. ),
  86. )
  87. ],
  88. ),
  89. _buildGenerateReport(),
  90. ],
  91. ),
  92. );
  93. }
  94. Widget _buildGenerateReport() {
  95. return Positioned(
  96. bottom: 100,
  97. left: 16,
  98. child: VButton(
  99. onTap: controller.saveCachedAppDataId,
  100. child: const Text(
  101. '生成报告',
  102. style: TextStyle(fontSize: 26),
  103. ),
  104. ),
  105. );
  106. }
  107. Widget _buildSaveButton() {
  108. return Obx(() {
  109. if (Store.user.currentSelectPatientInfo == null) {
  110. return const SizedBox();
  111. }
  112. return Positioned(
  113. bottom: 100,
  114. right: 16,
  115. child: VButton(
  116. onTap: controller.createDiagnosis,
  117. child: const Text(
  118. '保存',
  119. style: TextStyle(fontSize: 26),
  120. ),
  121. ),
  122. );
  123. });
  124. }
  125. Widget _buildContent() {
  126. return Obx(() {
  127. switch (controller.state.currentTab) {
  128. case 'Temp':
  129. return const BodyTemperature();
  130. case 'GLU':
  131. return const BloodSugar();
  132. case 'NIBP':
  133. return const BloodPressure();
  134. case 'SpO2':
  135. return const BloodOxygen();
  136. case 'BMI':
  137. return const BodyWeight();
  138. default:
  139. return const SizedBox();
  140. }
  141. });
  142. }
  143. }
  144. class _SideBar extends StatelessWidget {
  145. const _SideBar({
  146. required this.title,
  147. this.isActive,
  148. });
  149. final String title;
  150. final bool? isActive;
  151. @override
  152. Widget build(BuildContext context) {
  153. return Container(
  154. alignment: Alignment.centerLeft,
  155. width: 100,
  156. child: Container(
  157. margin: const EdgeInsets.only(bottom: 2),
  158. decoration: BoxDecoration(
  159. color: isActive!
  160. ? Theme.of(context).primaryColor
  161. : Theme.of(context).primaryColor.withOpacity(.2),
  162. borderRadius: const BorderRadius.only(
  163. topRight: Radius.circular(30),
  164. bottomRight: Radius.circular(30),
  165. ),
  166. ),
  167. alignment: Alignment.center,
  168. width: isActive! ? 100 : 90,
  169. height: 60,
  170. child: Text(
  171. title,
  172. style: TextStyle(
  173. fontSize: 26,
  174. color: isActive! ? Colors.white : Colors.black,
  175. ),
  176. ),
  177. ),
  178. );
  179. }
  180. }