view.dart 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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/pages/lab_task/widgets/task_detail_list.dart';
  5. import 'package:flyinsono/lab/pages/lab_task/widgets/task_header_panel.dart';
  6. import 'package:get/get.dart';
  7. import 'index.dart';
  8. import 'widgets/widgets.dart';
  9. class LabTaskPage extends GetView<LabTaskController> {
  10. const LabTaskPage({Key? key}) : super(key: key);
  11. get tabHashCode => this.hashCode.toString();
  12. @override
  13. String? get tag => tabHashCode;
  14. // 主视图
  15. Widget _buildView() {
  16. return Row(
  17. children: [
  18. _buildLeftPart(),
  19. Expanded(
  20. child: _buildMainContent(),
  21. ),
  22. SizedBox(width: 10),
  23. ],
  24. );
  25. }
  26. @override
  27. Widget build(BuildContext context) {
  28. return GetBuilder<LabTaskController>(
  29. init: LabTaskController(tabHashCode: this.hashCode),
  30. tag: tabHashCode, // 如果一个页面要想实现多开,必须加 tag
  31. id: LabTaskController.taskPageId,
  32. builder: (_) {
  33. return Scaffold(
  34. backgroundColor: LabColors.base300,
  35. body: SafeArea(
  36. child: _buildView(),
  37. ),
  38. );
  39. },
  40. );
  41. }
  42. Widget _buildLeftPart() {
  43. return Container(
  44. width: 300,
  45. padding: EdgeInsets.all(10),
  46. child: Column(
  47. children: [
  48. Expanded(
  49. child: TaskList(
  50. tabHashCode: tabHashCode,
  51. ),
  52. )
  53. ],
  54. ),
  55. );
  56. }
  57. Widget _buildMainContent() {
  58. if (controller.noProcessingTask && controller.selectedClassifyIndex == 0) {
  59. return _buildNoTask();
  60. }
  61. return Container(
  62. height: double.infinity,
  63. padding: EdgeInsets.symmetric(vertical: 10),
  64. child: Column(
  65. crossAxisAlignment: CrossAxisAlignment.stretch,
  66. children: [
  67. TaskHeaderPanel(
  68. tabHashCode: tabHashCode,
  69. ),
  70. SizedBox(height: 10),
  71. Expanded(
  72. child: TaskDetailList(
  73. tabHashCode: tabHashCode,
  74. ),
  75. ),
  76. ],
  77. ),
  78. );
  79. }
  80. Widget _buildNoTask() {
  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. }