data_detail.dart 6.2 KB

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