|
|
@@ -1,14 +1,26 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
+import 'package:trackoffical_app/utils.dart';
|
|
|
import 'package:trackoffical_app/view/mapto/map_to_controller.dart';
|
|
|
+import '../../generated/app_api.pb.dart';
|
|
|
import '../../generated/assets.dart';
|
|
|
import '../../screen.dart';
|
|
|
import 'package:trackoffical_app/pb.dart' as pb;
|
|
|
|
|
|
-class ActivityView extends GetView {
|
|
|
- const ActivityView(this.data, {super.key});
|
|
|
+import '../../widget/common.dart';
|
|
|
+
|
|
|
+class ActivityView extends GetView<MapToController> {
|
|
|
+ const ActivityView({super.key});
|
|
|
+ // const ActivityView(this.mapActivitySimpleInfo, this.userInfo, {super.key});
|
|
|
// final MapToController mapToController = Get.find();
|
|
|
- final List<pb.MapActivitySimpleInfo> data;
|
|
|
+ // final List<pb.MapActivitySimpleInfo> mapActivitySimpleInfo;
|
|
|
+ // final List<ModelUserInfo> userInfo;
|
|
|
+
|
|
|
+ static Bindings bindings() {
|
|
|
+ return BindingsBuilder(() {
|
|
|
+ Get.lazyPut<MapToController>(() => MapToController());
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
@@ -29,100 +41,97 @@ class ActivityView extends GetView {
|
|
|
),
|
|
|
child: Column(
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
- children: [wActivitys()],
|
|
|
+ children: [_wActivitys()],
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget wActivitys() {
|
|
|
- // var data = mapToController.mapActivitySimpleInfo;
|
|
|
- return Expanded(
|
|
|
- child: ListView.builder(
|
|
|
- padding: EdgeInsets.only(top: 0.wp),
|
|
|
- itemCount: data.length,
|
|
|
- itemBuilder: (ctx, i) {
|
|
|
- return _wElem(ctx, i);
|
|
|
- }));
|
|
|
+ Widget _wActivitys() {
|
|
|
+ // var mapActivitySimpleInfo = mapToController.mapActivitySimpleInfo;
|
|
|
+ return Obx(() {
|
|
|
+ return Expanded(
|
|
|
+ child: ListView.builder(
|
|
|
+ padding: EdgeInsets.only(top: 0.wp),
|
|
|
+ // itemCount: mapActivitySimpleInfo.length,
|
|
|
+ itemCount: controller.mapActivityList.value.list.length,
|
|
|
+ itemBuilder: (ctx, i) {
|
|
|
+ return _wActivityElem(ctx, i);
|
|
|
+ }));
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- Widget _wElem(BuildContext ctx, int i) {
|
|
|
+ Widget _wActivityElem(BuildContext ctx, int i) {
|
|
|
+ // var info = mapActivitySimpleInfo[i].obs;
|
|
|
+ var info = controller.mapActivityList.value.list[i];
|
|
|
+ var expand = true.obs;
|
|
|
+
|
|
|
return Obx(() {
|
|
|
- var info = data[i].obs;
|
|
|
return GestureDetector(
|
|
|
- // onTap: info.isOpen? ()=>ActivityDetailView.to(info): null,
|
|
|
+ // onTap: info.isOpen? ()=>ActivityDetailView.to(info): null,
|
|
|
child: Container(
|
|
|
- margin: EdgeInsets.only(left: 0.wp, right: 0.wp, top: 0.wp, bottom: 1.wp),
|
|
|
- // padding: EdgeInsets.only(left: 0.8.wp, right: 0.8.wp, top: 0.8.wp, bottom: 0.8.wp),
|
|
|
- padding: EdgeInsets.all(0.8.wp),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: const Color(0xffe0e0e0),
|
|
|
- borderRadius: BorderRadius.circular(0.35.wp),
|
|
|
- ),
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- _activityTitle(info.value.name, info.value.totalControlNum),
|
|
|
- _activityControl(info.value.totalControlNum),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ));
|
|
|
+ margin:
|
|
|
+ EdgeInsets.only(left: 0.wp, right: 0.wp, top: 0.wp, bottom: 1.wp),
|
|
|
+ // padding: EdgeInsets.only(left: 0.8.wp, right: 0.8.wp, top: 0.8.wp, bottom: 0.8.wp),
|
|
|
+ padding: EdgeInsets.all(0.8.wp),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xffe0e0e0),
|
|
|
+ borderRadius: BorderRadius.circular(0.35.wp),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ _activityTitle(info, expand),
|
|
|
+ expand.value ? _activityControl(info) : Container(),
|
|
|
+ expand.value ? _wUserList() : Container(),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- Widget _activityTitle(String title, int num) {
|
|
|
+ Widget _activityTitle(MapActivitySimpleInfo info, var expand) {
|
|
|
return Container(
|
|
|
- padding: EdgeInsets.only(bottom: 1.wp),
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.start,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- // SizedBox(
|
|
|
- // width: 20.wp,
|
|
|
- // child: Text.rich(
|
|
|
- // softWrap: false,
|
|
|
- // maxLines: 1,
|
|
|
- // overflow: TextOverflow.ellipsis,
|
|
|
- // TextSpan(
|
|
|
- // text: title,
|
|
|
- // style: TextStyle(fontSize: 1.39.wp, fontWeight: FontWeight.w700, color: Color(0xff333333)),
|
|
|
- // children: [
|
|
|
- // TextSpan(
|
|
|
- // text: "($num人)",
|
|
|
- // style: TextStyle(fontSize: 1.11.wp, fontWeight: FontWeight.w500, color: Color(0xff333333)),
|
|
|
- // ),
|
|
|
- // ])),
|
|
|
- // ),
|
|
|
-
|
|
|
- SizedBox(
|
|
|
- width: 16.8.wp,
|
|
|
- child: Text(title,
|
|
|
- softWrap: false,
|
|
|
- maxLines: 1,
|
|
|
- overflow: TextOverflow.ellipsis,
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ // debugPrint("expand.value = ${expand.value}");
|
|
|
+ expand.value = !(expand.value);
|
|
|
+ },
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ width: 16.8.wp,
|
|
|
+ child: Text(info.name,
|
|
|
+ softWrap: false,
|
|
|
+ maxLines: 1,
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 1.29.wp,
|
|
|
+ fontWeight: FontWeight.w700,
|
|
|
+ color: const Color(0xff333333))),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 0.3.wp),
|
|
|
+ Text("(${info.totalControlNum}人)",
|
|
|
style: TextStyle(
|
|
|
- fontSize: 1.39.wp,
|
|
|
- fontWeight: FontWeight.w700,
|
|
|
- color: Color(0xff333333))),
|
|
|
- ),
|
|
|
- SizedBox(width: 0.3.wp),
|
|
|
- Text("($num人)",
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 1.11.wp,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- color: Color(0xff333333))),
|
|
|
- SizedBox(width: 0.6.wp),
|
|
|
- Image.asset(
|
|
|
- Assets.imagesIcArrowUp,
|
|
|
- height: 0.86.wp,
|
|
|
- fit: BoxFit.fitHeight,
|
|
|
- ),
|
|
|
- ],
|
|
|
+ fontSize: 1.11.wp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ color: const Color(0xff333333))),
|
|
|
+ SizedBox(width: 0.6.wp),
|
|
|
+ Image.asset(
|
|
|
+ expand.value ? Assets.imagesIcArrowUp : Assets.imagesIcArrowDown,
|
|
|
+ height: 0.86.wp,
|
|
|
+ fit: BoxFit.fitHeight,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget _activityControl(int totalControlNum) {
|
|
|
+ Widget _activityControl(MapActivitySimpleInfo info) {
|
|
|
return Container(
|
|
|
- padding: EdgeInsets.symmetric(vertical: 0.8.wp, horizontal: 1.wp),
|
|
|
+ margin: EdgeInsets.only(top: 0.6.wp),
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 0.5.wp, horizontal: 1.wp),
|
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.white,
|
|
|
borderRadius: BorderRadius.circular(0.42.wp),
|
|
|
@@ -132,11 +141,15 @@ class ActivityView extends GetView {
|
|
|
children: [
|
|
|
Row(
|
|
|
children: [
|
|
|
- Text("广播"),
|
|
|
+ Text("广播",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 1.11.wp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ color: Colors.black)),
|
|
|
SizedBox(width: 0.5.wp),
|
|
|
Image.asset(
|
|
|
Assets.imagesIcBullhorn,
|
|
|
- height: 1.33.wp,
|
|
|
+ height: 1.13.wp,
|
|
|
fit: BoxFit.fitHeight,
|
|
|
),
|
|
|
],
|
|
|
@@ -149,12 +162,16 @@ class ActivityView extends GetView {
|
|
|
fit: BoxFit.fitHeight,
|
|
|
),
|
|
|
SizedBox(width: 0.3.wp),
|
|
|
- Text("$totalControlNum"),
|
|
|
+ Text("${info.totalControlNum}"),
|
|
|
],
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
- Text("全部隐藏"),
|
|
|
+ Text("全部隐藏",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 1.11.wp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ color: Colors.black)),
|
|
|
SizedBox(width: 0.5.wp),
|
|
|
Image.asset(
|
|
|
Assets.imagesIcEye,
|
|
|
@@ -164,34 +181,154 @@ class ActivityView extends GetView {
|
|
|
],
|
|
|
),
|
|
|
],
|
|
|
- )
|
|
|
- );
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
- Widget wUserList() {
|
|
|
- return Expanded(
|
|
|
- child: ListView.builder(
|
|
|
- padding: EdgeInsets.only(top: 0.wp),
|
|
|
- itemCount: data.length,
|
|
|
- itemBuilder: (ctx, i) {
|
|
|
- return _wUserElem(ctx, i);
|
|
|
- }));
|
|
|
+ Widget _wUserList() {
|
|
|
+ final children = <Widget>[];
|
|
|
+
|
|
|
+ return Obx(() {
|
|
|
+ for (var i = 0; i < controller.userInfoList.length; i++) {
|
|
|
+ final userInfo = controller.userInfoList[i];
|
|
|
+
|
|
|
+ children.add(Container(
|
|
|
+ height: 6.25.wp,
|
|
|
+ margin: EdgeInsets.only(top: 0.5.wp),
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 0.5.wp, horizontal: 0.5.wp),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ borderRadius: BorderRadius.circular(0.42.wp),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ _wUserInfoRow1(userInfo),
|
|
|
+ _wUserInfoRow2(userInfo),
|
|
|
+ _wUserInfoRow3(userInfo),
|
|
|
+ ],
|
|
|
+ )));
|
|
|
+ }
|
|
|
+ return Column(
|
|
|
+ children: children,
|
|
|
+ );
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- Widget _wUserElem(BuildContext ctx, int i) {
|
|
|
- return Container(
|
|
|
- padding: EdgeInsets.symmetric(vertical: 0.8.wp, horizontal: 1.wp),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- borderRadius: BorderRadius.circular(0.42.wp),
|
|
|
+ Widget _wUserInfoRow1(ModelUserInfo userInfo) {
|
|
|
+ return Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ wUserMark(userInfo.iUserid!),
|
|
|
+ SizedBox(width: 0.5.wp),
|
|
|
+ Text(userInfo.sUserName!,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 1.25.wp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ color: Colors.black)),
|
|
|
+ SizedBox(width: 0.5.wp),
|
|
|
+ Text("[${userInfo.sRouteCode}]",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 0.97.wp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ color: Colors.black)),
|
|
|
+ const Spacer(),
|
|
|
+ Image.asset(
|
|
|
+ true ? Assets.imagesIcEye : Assets.imagesIcEyeOff,
|
|
|
+ height: 1.1.wp,
|
|
|
+ fit: BoxFit.fitHeight,
|
|
|
),
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
+ SizedBox(width: 0.5.wp),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- ],
|
|
|
- )
|
|
|
+ Widget _wUserInfoRow2(ModelUserInfo userInfo) {
|
|
|
+ return Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ //待打点位
|
|
|
+ Container(
|
|
|
+ width: 7.81.wp,
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 0.wp, horizontal: 0.6.wp),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xff00a0ff),
|
|
|
+ borderRadius: BorderRadius.circular(0.63.wp)),
|
|
|
+ child: Text("${userInfo.iNextCPId}号点 (${userInfo.sNextCPCode})",
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ softWrap: false,
|
|
|
+ maxLines: 1,
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 0.97.wp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ color: Colors.white)),
|
|
|
+ ),
|
|
|
+ // 心率
|
|
|
+ Container(
|
|
|
+ width: 4.67.wp,
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 0.wp, horizontal: 0.9.wp),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: userInfo.iHr!.toHRPColor(),
|
|
|
+ borderRadius: BorderRadius.circular(0.63.wp)),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
+ children: [
|
|
|
+ Image.asset(Assets.imagesIcHeart,
|
|
|
+ height: 0.82.wp, fit: BoxFit.fitHeight),
|
|
|
+ // SizedBox(width: 0.5.wp),
|
|
|
+ Text("${userInfo.iHr}",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 0.97.wp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ color: Colors.white)),
|
|
|
+ ],
|
|
|
+ )),
|
|
|
+ //配速
|
|
|
+ Container(
|
|
|
+ width: 6.39.wp,
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 0.wp, horizontal: 0.6.wp),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xffff880f),
|
|
|
+ borderRadius: BorderRadius.circular(0.63.wp)),
|
|
|
+ child: Text("${userInfo.pacePerKm?.toMinSecondString()}/km",
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ softWrap: false,
|
|
|
+ maxLines: 1,
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 0.97.wp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ color: Colors.white)),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Widget _wUserInfoRow3(ModelUserInfo userInfo) {
|
|
|
+ return Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Text("距离 ${userInfo.iDistance!}m",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 0.97.wp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ color: Colors.black)),
|
|
|
+ SizedBox(width: 0.5.wp),
|
|
|
+ Text("时间 ${userInfo.iTime}",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 0.97.wp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ color: Colors.black)),
|
|
|
+ SizedBox(width: 0.5.wp),
|
|
|
+ Text("里程 ${userInfo.iMileage} km",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 0.97.wp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ color: Colors.black)),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|