data_detail.dart 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. import 'package:application/widget.dart';
  2. import 'package:common_pub/ui/map_view/map_view.dart';
  3. import 'package:common_pub/ui/map_view/view_map_image.dart';
  4. import 'package:common_pub/ui/map_view/view_map_touch.dart';
  5. import 'package:common_pub/ui/map_view/view_plug_loading.dart';
  6. import 'package:get_storage/get_storage.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(onPressed: () {}, icon: const Icon(Icons.more_horiz)),
  70. ],
  71. ),
  72. Expanded(
  73. child: ListView(
  74. children: controller.userList
  75. .map((element) => _userElem(element))
  76. .toList(),
  77. ))
  78. ],
  79. ));
  80. });
  81. }
  82. Widget _userElem(UserInfo data) {
  83. return Obx(() {
  84. final children = <Widget>[
  85. Container(
  86. width: double.infinity,
  87. height: 42,
  88. margin: const EdgeInsets.only(top: 8),
  89. padding: const EdgeInsets.only(left: 4),
  90. decoration: BoxDecoration(
  91. color: Colors.white,
  92. boxShadow: const [
  93. BoxShadow(color: Color(0x29000000), blurRadius: 3)
  94. ],
  95. borderRadius: BorderRadius.circular(3.56)
  96. ),
  97. child: Row(
  98. children: [
  99. Container(
  100. height: double.infinity,
  101. width: 3.56,
  102. margin: const EdgeInsets.only(top: 8, bottom: 8, right: 3.55),
  103. decoration: BoxDecoration(color: data.data.oId == controller.selectedUserId.value
  104. ? Colors.orange: Colors.transparent, borderRadius: BorderRadius.circular(2.1)),
  105. ),
  106. Text(data.data.oName),
  107. const Spacer(),
  108. IconButton(onPressed: (){
  109. data.isExpand.value = !data.isExpand.value;
  110. }, icon: Icon(data.isExpand.value? Icons.arrow_drop_up: Icons.arrow_drop_down))
  111. ],
  112. ),
  113. )
  114. ];
  115. if(data.isExpand.value){
  116. children.add(Column(
  117. children: data.data.list.map((element) => GestureDetector(
  118. onTap: (){
  119. controller.selectedDetail.value = element;
  120. controller.selectedUserId.value = data.data.oId;
  121. },
  122. child: detailElem(element))).toList(),
  123. ));
  124. }
  125. return Column(
  126. children: children,
  127. );
  128. });
  129. }
  130. Widget detailElem(DetailSimple detail){
  131. return Container(
  132. margin: const EdgeInsets.only(left: 12, top: 2 , bottom: 4),
  133. width: double.infinity,
  134. height: 54,
  135. padding: const EdgeInsets.fromLTRB(4, 6, 4, 6),
  136. decoration: BoxDecoration(
  137. color: Colors.white,
  138. borderRadius: BorderRadius.circular(3.5),
  139. boxShadow: const [
  140. BoxShadow(color: Color(0x33000000), blurRadius: 1.3)
  141. ]
  142. ),
  143. child: Row(
  144. children: [
  145. Container(
  146. height: double.infinity,
  147. width: 3.56,
  148. margin: const EdgeInsets.only(right: 3.55),
  149. decoration: BoxDecoration(color: detail.gameId == controller.selectedDetail.value.gameId
  150. ? Colors.orange: Colors.transparent, borderRadius: BorderRadius.circular(2.1)),
  151. ),
  152. Expanded(child: Column(
  153. crossAxisAlignment: CrossAxisAlignment.start,
  154. children: [
  155. Text(detail.courseName, maxLines: 1, overflow: TextOverflow.ellipsis),
  156. Text(detail.actName, maxLines: 1, overflow: TextOverflow.ellipsis,),
  157. ],
  158. )),
  159. const SizedBox(width: 12),
  160. Text(detail.isComplete?'完赛':'未完赛')
  161. ],
  162. ),
  163. );
  164. }
  165. }