view.dart 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:vitalapp/architecture/utils/prompt_box.dart';
  4. import 'package:vitalapp/components/alert_dialog.dart';
  5. import 'package:vitalapp/components/button.dart';
  6. import 'package:vitalapp/pages/check/examination/controller.dart';
  7. import 'package:vitalapp/pages/check/widgets/check_category_widget.dart';
  8. import 'package:vitalapp/pages/check/widgets/configurable_card.dart';
  9. class ExaminationPage extends GetView<ExaminationController> {
  10. const ExaminationPage({Key? key}) : super(key: key);
  11. @override
  12. Widget build(BuildContext context) {
  13. return Scaffold(
  14. backgroundColor: const Color.fromRGBO(238, 238, 238, 1),
  15. // appBar: VAppBar(
  16. // titleWidget: const Text('健康体检'),
  17. // ),
  18. body: Stack(
  19. children: [
  20. Scrollbar(
  21. thumbVisibility: true,
  22. child: SingleChildScrollView(
  23. child: Center(
  24. child: Container(
  25. padding: const EdgeInsets.symmetric(vertical: 20),
  26. child: buildExaminationList(),
  27. ),
  28. ),
  29. ),
  30. ),
  31. Positioned(
  32. right: 20,
  33. bottom: 50,
  34. child: SizedBox(
  35. width: 200,
  36. height: 70,
  37. child: VButton(
  38. label: '结束本轮体检',
  39. onTap: () async {
  40. final isExamEmpty = await controller.checkExamEmpty();
  41. if (isExamEmpty) {
  42. PromptBox.toast("不能提交空数据");
  43. } else {
  44. Get.dialog(VAlertDialog(
  45. title: '提示',
  46. content: Container(
  47. margin: const EdgeInsets.only(bottom: 20),
  48. child: const Text(
  49. '确定结束本次体检?',
  50. style: TextStyle(fontSize: 20),
  51. textAlign: TextAlign.center,
  52. ),
  53. ),
  54. showCancel: true,
  55. onConfirm: () {
  56. controller.deleteCached();
  57. },
  58. ));
  59. }
  60. },
  61. ),
  62. ),
  63. ),
  64. ],
  65. ),
  66. );
  67. }
  68. Widget buildExaminationList() {
  69. return Wrap(
  70. spacing: 26,
  71. runSpacing: 26,
  72. children: controller.menuList
  73. .map((e) => CheckCategoryWidget(
  74. label: e.label,
  75. assetName: "${e.label}.png",
  76. onTap: () {
  77. changePage(e.value);
  78. },
  79. ))
  80. .toList(),
  81. );
  82. }
  83. void changePage(String key) {
  84. Get.to(
  85. ConfigurableCard(
  86. cardKey: key,
  87. callBack: (key, templateCode, data) async {
  88. await controller.createOrUpdateExam(key, templateCode, data);
  89. return true;
  90. },
  91. patientCode: controller.patientCode,
  92. ),
  93. transition: Transition.rightToLeft,
  94. );
  95. }
  96. }