functions_panel.dart 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:vitalapp/architecture/values/features.dart';
  4. import 'package:vitalapp/consts/styles.dart';
  5. import 'package:vitalapp/pages/widgets/function_button.dart';
  6. import 'package:vitalapp/store/store.dart';
  7. import '../controller.dart';
  8. /// 功能入口面板
  9. class FunctionsPanel extends GetView<PatientDetailController> {
  10. const FunctionsPanel({super.key});
  11. @override
  12. Widget build(BuildContext context) {
  13. return Container(
  14. alignment: Alignment.topLeft,
  15. margin: const EdgeInsets.all(8).copyWith(left: 0, right: 12),
  16. decoration: BoxDecoration(
  17. color: Colors.white,
  18. borderRadius: GlobalStyles.borderRadius,
  19. ),
  20. padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 10)
  21. .copyWith(right: 0),
  22. child: GridView(
  23. padding: const EdgeInsets.symmetric(horizontal: 32).copyWith(top: 12),
  24. // shrinkWrap: true,
  25. // controller: scrollController,
  26. gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
  27. crossAxisCount: 3,
  28. mainAxisSpacing: 24,
  29. crossAxisSpacing: 24,
  30. childAspectRatio: 15 / 14,
  31. ),
  32. children: [
  33. if (Store.user.hasFeature(FeatureKeys.HealthRecordHandling))
  34. FunctionButton(
  35. label: "个人基本信息",
  36. icon: _buildImgIcon("档案.png"),
  37. onTap: controller.gotoInfo,
  38. ),
  39. if (Store.user.hasFeature(FeatureKeys.HealthCheckRecord))
  40. FunctionButton(
  41. label: "体检记录",
  42. icon: _buildImgIcon("体检记录.png"),
  43. onTap: controller.gotoHealthCheckRecord,
  44. ),
  45. if (Store.user.hasFeature(FeatureKeys.FollowUpRecord))
  46. FunctionButton(
  47. label: "随访记录",
  48. icon: _buildImgIcon("随访报告.png"),
  49. onTap: controller.gotoFollowUpRecord,
  50. ),
  51. // FunctionButton(
  52. // label: "双向转诊",
  53. // icon: _buildImgIcon("转诊.png"),
  54. // onTap: controller.gotoReferral,
  55. // ),
  56. if (Store.user.hasFeature(FeatureKeys.SigningRecord))
  57. FunctionButton(
  58. label: "签约记录",
  59. icon: _buildImgIcon("签约记录.png"),
  60. onTap: controller.gotoContractRecords,
  61. ),
  62. if (Store.user.hasFeature(FeatureKeys.HealthCheckupRecords))
  63. FunctionButton(
  64. label: "健康检测记录",
  65. icon: _buildImgIcon("诊疗.png"),
  66. onTap: controller.gotoExamRecord,
  67. ),
  68. ],
  69. ),
  70. );
  71. }
  72. Widget _buildImgIcon(String assetName) {
  73. return Image.asset(
  74. "assets/images/patient/$assetName",
  75. width: 120,
  76. height: 120,
  77. fit: BoxFit.contain,
  78. );
  79. }
  80. }