data_detail.dart 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. import 'package:application/view/home/data_detail/data_detail_cp.dart';
  2. import 'package:application/widget.dart';
  3. import 'package:common_pub/ui/map_view/map_view.dart';
  4. import 'package:common_pub/ui/map_view/view_map_cp.dart';
  5. import 'package:common_pub/ui/map_view/view_map_image.dart';
  6. import 'package:common_pub/ui/map_view/view_map_touch.dart';
  7. import 'package:common_pub/ui/map_view/view_map_trace.dart';
  8. import 'package:common_pub/ui/map_view/view_plug_loading.dart';
  9. import 'data_detail_controller.dart';
  10. class DataDetailPage extends StatelessWidget {
  11. const DataDetailPage({super.key});
  12. @override
  13. Widget build(BuildContext context) {
  14. return GetBuilder(
  15. init: DataDetailController(),
  16. builder: (c) {
  17. return Container(
  18. height: double.infinity,
  19. width: double.infinity,
  20. color: const Color(0xffc9c0c0),
  21. alignment: Alignment.center,
  22. child: c.mapWatch != null
  23. ? content(context, c.mapWatch!, c)
  24. : noData());
  25. });
  26. }
  27. Widget noData() {
  28. return Center(
  29. child: Column(
  30. mainAxisSize: MainAxisSize.min,
  31. children: [
  32. Image.asset(Assets.imagesIcNoData, height: 64),
  33. const SizedBox(height: 25),
  34. const Text('没有数据, 请选择地图',
  35. style: TextStyle(color: Color(0xff707070), fontSize: 18.5)),
  36. ],
  37. ),
  38. );
  39. }
  40. static const cpColor = Color(0xffcc00ff);
  41. Widget content(
  42. BuildContext context, MapWatchService map, DataDetailController c) {
  43. return Obx(() {
  44. final children = <Widget>[
  45. ViewPlugLoading(map.plugMap),
  46. ViewMapImage(map.plugMap),
  47. ];
  48. final data = c.selectedDetail.value;
  49. if (data != null) {
  50. children.add(ViewMapCP(
  51. map.plugMap,
  52. cpWantAndHistoryList: data.controlPoints,
  53. isHideRouteBeforeStart: false,
  54. isShowPath: false,
  55. cpTheme: ViewMapCPTheme()
  56. ..cpJumpColor = cpColor
  57. ..cpPunchedColor = cpColor,
  58. ));
  59. // children.add(ViewMapTrace(map.plugMap, data));
  60. }
  61. children.add(ViewMapTouch(map.plugMap));
  62. return Row(
  63. children: [
  64. Expanded(child: ViewMapStack(plug: map.plugMap, children: children)),
  65. _UserListView(),
  66. ],
  67. );
  68. });
  69. }
  70. }
  71. class _UserListView extends GetView<DataDetailController> {
  72. @override
  73. Widget build(BuildContext context) {
  74. return Obx(() {
  75. return Container(
  76. width: 263,
  77. height: double.infinity,
  78. decoration: const BoxDecoration(color: Colors.white, boxShadow: [
  79. BoxShadow(color: Color(0x33000000), blurRadius: 4.3)
  80. ]),
  81. padding: const EdgeInsets.all(20),
  82. child: Column(
  83. children: [
  84. Row(
  85. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  86. children: [
  87. const Text('用户列表'),
  88. IconButton(
  89. onPressed: controller.selectedDetail.value != null
  90. ? () => controller.showDetail.value =
  91. !controller.showDetail.value
  92. : null,
  93. icon: const Icon(Icons.more_horiz)),
  94. ],
  95. ),
  96. Expanded(
  97. child: ListView(
  98. children: controller.showDetail.value
  99. ? _detailView()
  100. : controller.userList
  101. .map((element) => _userElem(element))
  102. .toList(),
  103. ))
  104. ],
  105. ));
  106. });
  107. }
  108. List<Widget> _detailView() {
  109. final detail = controller.selectedDetail.value!;
  110. return [DataDetailCP(cpList: detail.controlPoints)];
  111. }
  112. Widget _userElem(UserInfo data) {
  113. return Obx(() {
  114. final children = <Widget>[
  115. Container(
  116. width: double.infinity,
  117. height: 42,
  118. margin: const EdgeInsets.only(top: 8),
  119. padding: const EdgeInsets.only(left: 4),
  120. decoration: BoxDecoration(
  121. color: Colors.white,
  122. boxShadow: const [
  123. BoxShadow(color: Color(0x29000000), blurRadius: 3)
  124. ],
  125. borderRadius: BorderRadius.circular(3.56)),
  126. child: Row(
  127. children: [
  128. Container(
  129. height: double.infinity,
  130. width: 3.56,
  131. margin: const EdgeInsets.only(top: 8, bottom: 8, right: 3.55),
  132. decoration: BoxDecoration(
  133. color: data.data.oId == controller.selectedUserId.value
  134. ? Colors.orange
  135. : Colors.transparent,
  136. borderRadius: BorderRadius.circular(2.1)),
  137. ),
  138. Text(data.data.oName),
  139. const Spacer(),
  140. IconButton(
  141. onPressed: () {
  142. data.isExpand.value = !data.isExpand.value;
  143. },
  144. icon: Icon(data.isExpand.value
  145. ? Icons.arrow_drop_up
  146. : Icons.arrow_drop_down))
  147. ],
  148. ),
  149. )
  150. ];
  151. if (data.isExpand.value) {
  152. children.add(Column(
  153. children: data.data.list
  154. .map((element) => GestureDetector(
  155. onTap: () => controller.selectDetail(element, data),
  156. child: detailElem(element)))
  157. .toList(),
  158. ));
  159. }
  160. return Column(
  161. children: children,
  162. );
  163. });
  164. }
  165. Widget detailElem(DetailSimple detail) {
  166. return Container(
  167. margin: const EdgeInsets.only(left: 12, top: 2, bottom: 4),
  168. width: double.infinity,
  169. height: 54,
  170. padding: const EdgeInsets.fromLTRB(4, 6, 4, 6),
  171. decoration: BoxDecoration(
  172. color: Colors.white,
  173. borderRadius: BorderRadius.circular(3.5),
  174. boxShadow: const [
  175. BoxShadow(color: Color(0x33000000), blurRadius: 1.3)
  176. ]),
  177. child: Row(
  178. children: [
  179. Container(
  180. height: double.infinity,
  181. width: 3.56,
  182. margin: const EdgeInsets.only(right: 3.55),
  183. decoration: BoxDecoration(
  184. color: detail.gameId ==
  185. controller.selectedDetailSimple.value.gameId
  186. ? Colors.orange
  187. : Colors.transparent,
  188. borderRadius: BorderRadius.circular(2.1)),
  189. ),
  190. Expanded(
  191. child: Column(
  192. crossAxisAlignment: CrossAxisAlignment.start,
  193. children: [
  194. Text(detail.courseName,
  195. maxLines: 1, overflow: TextOverflow.ellipsis),
  196. Text(
  197. detail.actName,
  198. maxLines: 1,
  199. overflow: TextOverflow.ellipsis,
  200. ),
  201. ],
  202. )),
  203. const SizedBox(width: 12),
  204. Text(detail.isComplete ? '完赛' : '未完赛')
  205. ],
  206. ),
  207. );
  208. }
  209. }