view.dart 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * @Descripttion:
  3. * @version:
  4. * @Author: guanxiaoxin
  5. * @Date: 2023-09-20 13:29:42
  6. * @LastEditors: guanxiaoxin
  7. * @LastEditTime: 2023-10-08 17:14:17
  8. * @FilePath: \VNoteApp\lib\pages\check\examination\view.dart
  9. */
  10. import 'package:flutter/material.dart';
  11. import 'package:get/get.dart';
  12. import 'package:vnoteapp/components/appbar.dart';
  13. import 'package:vnoteapp/pages/check/examination/controller.dart';
  14. import 'package:vnoteapp/pages/check/widgets/check_category_widget.dart';
  15. import 'package:vnoteapp/pages/check/widgets/configurable_card.dart';
  16. class ExaminationPage extends GetView<ExaminationController> {
  17. const ExaminationPage({Key? key}) : super(key: key);
  18. @override
  19. Widget build(BuildContext context) {
  20. return GetBuilder<ExaminationController>(
  21. init: ExaminationController(),
  22. id: "examination",
  23. builder: (_) {
  24. return Scaffold(
  25. backgroundColor: const Color.fromRGBO(238, 238, 238, 1),
  26. appBar: VAppBar(
  27. titleWidget: const Text('健康体检'),
  28. ),
  29. body: Scrollbar(
  30. thumbVisibility: true,
  31. child: SingleChildScrollView(
  32. child: Center(
  33. child: Container(
  34. padding: const EdgeInsets.symmetric(vertical: 20),
  35. child: buildExaminationList(),
  36. ),
  37. ),
  38. ),
  39. ),
  40. );
  41. },
  42. );
  43. }
  44. Widget buildExaminationList() {
  45. return Wrap(
  46. spacing: 40,
  47. runSpacing: 40,
  48. children: controller.menuList
  49. .map((e) => CheckCategoryWidget(
  50. label: e.label,
  51. assetName: "${e.label}.png",
  52. onTap: () {
  53. changePage(e.value);
  54. },
  55. ))
  56. .toList(),
  57. );
  58. }
  59. void changePage(String key) {
  60. Get.to(
  61. ConfigurableCard(
  62. cardKey: key,
  63. callBack: (key, templateCode, data) async {
  64. await controller.createExam(key, templateCode, data);
  65. Get.back();
  66. },
  67. patientCode: controller.patientCode,
  68. ),
  69. transition: Transition.rightToLeft,
  70. );
  71. }
  72. }