activity_view.dart 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:trackoffical_app/view/mapto/map_to_controller.dart';
  4. import '../../generated/assets.dart';
  5. import '../../screen.dart';
  6. import 'package:trackoffical_app/pb.dart' as pb;
  7. class ActivityView extends GetView {
  8. const ActivityView(this.data, {super.key});
  9. // final MapToController mapToController = Get.find();
  10. final List<pb.MapActivitySimpleInfo> data;
  11. @override
  12. Widget build(BuildContext context) {
  13. return Container(
  14. width: 25.69.wp,
  15. height: context.height,
  16. padding: EdgeInsets.symmetric(horizontal: 1.wp, vertical: 1.wp),
  17. decoration: BoxDecoration(
  18. color: Colors.white,
  19. // borderRadius: BorderRadius.circular(8),
  20. // shape: BoxShape.rectangle,
  21. boxShadow: [
  22. BoxShadow(
  23. color: const Color(0x33000000),
  24. offset: Offset(-0.28.wp, 0.21.wp),
  25. blurRadius: 0.42.wp)
  26. ],
  27. ),
  28. child: Column(
  29. mainAxisAlignment: MainAxisAlignment.start,
  30. children: [wActivitys()],
  31. ),
  32. );
  33. }
  34. Widget wActivitys() {
  35. // var data = mapToController.mapActivitySimpleInfo;
  36. return Expanded(
  37. child: ListView.builder(
  38. padding: EdgeInsets.only(top: 0.wp),
  39. itemCount: data.length,
  40. itemBuilder: (ctx, i) {
  41. return _wElem(ctx, i);
  42. }));
  43. }
  44. Widget _wElem(BuildContext ctx, int i) {
  45. return Obx(() {
  46. var info = data[i].obs;
  47. return GestureDetector(
  48. // onTap: info.isOpen? ()=>ActivityDetailView.to(info): null,
  49. child: Container(
  50. margin: EdgeInsets.only(left: 0.wp, right: 0.wp, top: 0.wp, bottom: 1.wp),
  51. // padding: EdgeInsets.only(left: 0.8.wp, right: 0.8.wp, top: 0.8.wp, bottom: 0.8.wp),
  52. padding: EdgeInsets.all(0.8.wp),
  53. decoration: BoxDecoration(
  54. color: const Color(0xffe0e0e0),
  55. borderRadius: BorderRadius.circular(0.35.wp),
  56. ),
  57. child: Column(
  58. children: [
  59. _activityTitle(info.value.name, info.value.totalControlNum),
  60. _activityControl(info.value.totalControlNum),
  61. ],
  62. ),
  63. ));
  64. });
  65. }
  66. Widget _activityTitle(String title, int num) {
  67. return Container(
  68. padding: EdgeInsets.only(bottom: 1.wp),
  69. child: Row(
  70. mainAxisAlignment: MainAxisAlignment.start,
  71. crossAxisAlignment: CrossAxisAlignment.center,
  72. children: [
  73. // SizedBox(
  74. // width: 20.wp,
  75. // child: Text.rich(
  76. // softWrap: false,
  77. // maxLines: 1,
  78. // overflow: TextOverflow.ellipsis,
  79. // TextSpan(
  80. // text: title,
  81. // style: TextStyle(fontSize: 1.39.wp, fontWeight: FontWeight.w700, color: Color(0xff333333)),
  82. // children: [
  83. // TextSpan(
  84. // text: "($num人)",
  85. // style: TextStyle(fontSize: 1.11.wp, fontWeight: FontWeight.w500, color: Color(0xff333333)),
  86. // ),
  87. // ])),
  88. // ),
  89. SizedBox(
  90. width: 16.8.wp,
  91. child: Text(title,
  92. softWrap: false,
  93. maxLines: 1,
  94. overflow: TextOverflow.ellipsis,
  95. style: TextStyle(
  96. fontSize: 1.39.wp,
  97. fontWeight: FontWeight.w700,
  98. color: Color(0xff333333))),
  99. ),
  100. SizedBox(width: 0.3.wp),
  101. Text("($num人)",
  102. style: TextStyle(
  103. fontSize: 1.11.wp,
  104. fontWeight: FontWeight.w500,
  105. color: Color(0xff333333))),
  106. SizedBox(width: 0.6.wp),
  107. Image.asset(
  108. Assets.imagesIcArrowUp,
  109. height: 0.86.wp,
  110. fit: BoxFit.fitHeight,
  111. ),
  112. ],
  113. ),
  114. );
  115. }
  116. Widget _activityControl(int totalControlNum) {
  117. return Container(
  118. padding: EdgeInsets.symmetric(vertical: 0.8.wp, horizontal: 1.wp),
  119. decoration: BoxDecoration(
  120. color: Colors.white,
  121. borderRadius: BorderRadius.circular(0.42.wp),
  122. ),
  123. child: Row(
  124. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  125. children: [
  126. Row(
  127. children: [
  128. Text("广播"),
  129. SizedBox(width: 0.5.wp),
  130. Image.asset(
  131. Assets.imagesIcBullhorn,
  132. height: 1.33.wp,
  133. fit: BoxFit.fitHeight,
  134. ),
  135. ],
  136. ),
  137. Row(
  138. children: [
  139. Image.asset(
  140. Assets.imagesIcCp,
  141. height: 1.35.wp,
  142. fit: BoxFit.fitHeight,
  143. ),
  144. SizedBox(width: 0.3.wp),
  145. Text("$totalControlNum"),
  146. ],
  147. ),
  148. Row(
  149. children: [
  150. Text("全部隐藏"),
  151. SizedBox(width: 0.5.wp),
  152. Image.asset(
  153. Assets.imagesIcEye,
  154. height: 1.1.wp,
  155. fit: BoxFit.fitHeight,
  156. ),
  157. ],
  158. ),
  159. ],
  160. )
  161. );
  162. }
  163. Widget wUserList() {
  164. return Expanded(
  165. child: ListView.builder(
  166. padding: EdgeInsets.only(top: 0.wp),
  167. itemCount: data.length,
  168. itemBuilder: (ctx, i) {
  169. return _wUserElem(ctx, i);
  170. }));
  171. }
  172. Widget _wUserElem(BuildContext ctx, int i) {
  173. return Container(
  174. padding: EdgeInsets.symmetric(vertical: 0.8.wp, horizontal: 1.wp),
  175. decoration: BoxDecoration(
  176. color: Colors.white,
  177. borderRadius: BorderRadius.circular(0.42.wp),
  178. ),
  179. child: Row(
  180. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  181. children: [
  182. ],
  183. )
  184. );
  185. }
  186. }