view.dart 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. import 'package:flutter/material.dart';
  2. import 'package:flyinsono/global.dart';
  3. import 'package:flyinsono/lab/color/lab_colors.dart';
  4. import 'package:flyinsono/lab/manager/page_manager.dart';
  5. import 'package:flyinsono/lab/pages/lab_data/widgets/widgets.dart';
  6. import 'package:flyinsono/lab/router/lab_route_names.dart';
  7. import 'package:get/get.dart';
  8. import 'package:fis_common/index.dart';
  9. import 'index.dart';
  10. class LabDataPage extends GetView<LabDataController> {
  11. const LabDataPage({
  12. Key? key,
  13. }) : super(key: key);
  14. // 主视图
  15. Widget _buildView() {
  16. return Obx(
  17. () => controller.state.noData
  18. ? _buildNoPatientTip()
  19. : Row(
  20. children: [
  21. _buildLeftPart(),
  22. Expanded(
  23. child: _buildMainContent(),
  24. ),
  25. SizedBox(width: 10),
  26. ],
  27. ),
  28. );
  29. }
  30. @override
  31. Widget build(BuildContext context) {
  32. return GetBuilder<LabDataController>(
  33. init: LabDataController(
  34. tabHashCode: this.hashCode,
  35. ),
  36. builder: (_) {
  37. return Scaffold(
  38. backgroundColor: LabColors.base300,
  39. body: SafeArea(
  40. child: _buildView(),
  41. ),
  42. );
  43. },
  44. );
  45. }
  46. Widget _buildLeftPart() {
  47. return Container(
  48. width: 300,
  49. height: double.infinity,
  50. padding: EdgeInsets.all(10),
  51. child: DataSourcePanel(),
  52. );
  53. }
  54. Widget _buildMainContent() {
  55. return Obx(() {
  56. if (controller.state.noPatient) {
  57. return _buildNoPatientTip();
  58. }
  59. if (controller.state.noRecord) {
  60. return _buildNoRecordTip();
  61. }
  62. return Container(
  63. height: double.infinity,
  64. padding: EdgeInsets.symmetric(vertical: 10),
  65. child: Column(
  66. crossAxisAlignment: CrossAxisAlignment.stretch,
  67. children: [
  68. // OperateBar(),
  69. // SizedBox(height: 5),
  70. RecordList(),
  71. SizedBox(height: 10),
  72. Expanded(
  73. child: USImagePool(),
  74. ),
  75. ],
  76. ),
  77. );
  78. });
  79. }
  80. Widget _buildNoRecordTip() {
  81. return Center(
  82. child: Column(
  83. mainAxisSize: MainAxisSize.min,
  84. children: [
  85. Container(
  86. height: 200,
  87. child: ColorFiltered(
  88. colorFilter: ColorFilter.mode(LabColors.base400, BlendMode.srcIn),
  89. child: Image.asset(
  90. Global.isVStationSlave
  91. ? "assets/images/logo_icon_0.png"
  92. : "assets/images/logo_icon.png",
  93. filterQuality: FilterQuality.medium,
  94. isAntiAlias: true,
  95. fit: BoxFit.contain,
  96. ),
  97. ),
  98. ),
  99. SizedBox(
  100. height: 10,
  101. ),
  102. Text(
  103. "该样本下暂无数据",
  104. style: TextStyle(
  105. color: LabColors.text600,
  106. fontSize: 16,
  107. ),
  108. ),
  109. SizedBox(
  110. height: 30,
  111. ),
  112. ],
  113. ),
  114. );
  115. }
  116. Widget _buildNoPatientTip() {
  117. return Center(
  118. child: Column(
  119. mainAxisSize: MainAxisSize.min,
  120. children: [
  121. Container(
  122. height: 200,
  123. child: ColorFiltered(
  124. colorFilter: ColorFilter.mode(LabColors.base400, BlendMode.srcIn),
  125. child: Image.asset(
  126. Global.isVStationSlave
  127. ? "assets/images/logo_icon_0.png"
  128. : "assets/images/logo_icon.png",
  129. filterQuality: FilterQuality.medium,
  130. isAntiAlias: true,
  131. fit: BoxFit.contain,
  132. ),
  133. ),
  134. ),
  135. SizedBox(
  136. height: 10,
  137. ),
  138. Text(
  139. "该项目内暂无数据",
  140. style: TextStyle(
  141. color: LabColors.text600,
  142. fontSize: 16,
  143. ),
  144. ),
  145. SizedBox(
  146. height: 30,
  147. ),
  148. if (!FPlatform.isPureWeb) ...[
  149. Column(
  150. children: [
  151. Text(
  152. "请先导入数据",
  153. style: TextStyle(
  154. color: LabColors.text700,
  155. fontSize: 14,
  156. ),
  157. ),
  158. SizedBox(
  159. height: 10,
  160. ),
  161. Container(
  162. // width: 120,
  163. height: 40,
  164. child: ElevatedButton.icon(
  165. icon: const Icon(Icons.file_download_outlined),
  166. style: ElevatedButton.styleFrom(
  167. elevation: 0.0,
  168. backgroundColor: LabColors.buttonColor,
  169. ),
  170. label: const Text("去导入"),
  171. onPressed: () {
  172. PageManager.ins.openNewTab(LabRouteNames.Import, "导入数据",
  173. multiple: false,
  174. args: controller.selectedDataSourceId);
  175. },
  176. ),
  177. ),
  178. ],
  179. ),
  180. ],
  181. ],
  182. ),
  183. );
  184. }
  185. }