|
|
@@ -7,29 +7,29 @@ import 'package:common_pub/ui/map_view/view_plug_loading.dart';
|
|
|
import 'package:common_pub/utils.dart';
|
|
|
import 'field_control_controller.dart';
|
|
|
|
|
|
-
|
|
|
-class FieldControlPage extends StatelessWidget{
|
|
|
+class FieldControlPage extends StatelessWidget {
|
|
|
const FieldControlPage({super.key});
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return GetBuilder(
|
|
|
init: FieldControlController(),
|
|
|
- builder: (c){
|
|
|
+ builder: (c) {
|
|
|
return Container(
|
|
|
- height: double.infinity,
|
|
|
- width: double.infinity,
|
|
|
- color: const Color(0xffc9c0c0),
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Obx((){
|
|
|
- final mapWatch = c.mapWatch;
|
|
|
- return mapWatch != null? content(context, mapWatch, c): noData();
|
|
|
- }));
|
|
|
- });
|
|
|
+ height: double.infinity,
|
|
|
+ width: double.infinity,
|
|
|
+ color: const Color(0xffc9c0c0),
|
|
|
+ alignment: Alignment.center,
|
|
|
+ child: Obx(() {
|
|
|
+ final mapWatch = c.mapWatch;
|
|
|
+ return mapWatch != null
|
|
|
+ ? content(context, mapWatch, c)
|
|
|
+ : noData();
|
|
|
+ }));
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- Widget noData(){
|
|
|
+ Widget noData() {
|
|
|
return Center(
|
|
|
child: Column(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
@@ -43,12 +43,15 @@ class FieldControlPage extends StatelessWidget{
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget content(BuildContext context, MapWatchService map, FieldControlController c){
|
|
|
+ Widget content(
|
|
|
+ BuildContext context, MapWatchService map, FieldControlController c) {
|
|
|
return Row(
|
|
|
children: [
|
|
|
- Expanded(child: Column(
|
|
|
+ Expanded(
|
|
|
+ child: Column(
|
|
|
children: [
|
|
|
- Expanded(child: ViewMapStack(plug: map.plugMap, children: [
|
|
|
+ Expanded(
|
|
|
+ child: ViewMapStack(plug: map.plugMap, children: [
|
|
|
ViewPlugLoading(map.plugMap),
|
|
|
ViewMapImage(map.plugMap),
|
|
|
_ViewTrace(map: map),
|
|
|
@@ -62,65 +65,70 @@ class FieldControlPage extends StatelessWidget{
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
-class _ViewTrace extends GetView<FieldControlController>{
|
|
|
+
|
|
|
+class _ViewTrace extends GetView<FieldControlController> {
|
|
|
const _ViewTrace({required this.map});
|
|
|
+
|
|
|
final MapWatchService map;
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- return Obx((){
|
|
|
+ return Obx(() {
|
|
|
final children = <Widget>[];
|
|
|
|
|
|
- for(final act in map.activeList){
|
|
|
- for(final user in act.userList){
|
|
|
- if(user.isHide.value){
|
|
|
+ for (final act in map.activeList) {
|
|
|
+ for (final user in act.userList) {
|
|
|
+ if (user.isHide.value) {
|
|
|
continue;
|
|
|
}
|
|
|
final trace = user.trace.lastOrNull;
|
|
|
- if(trace != null){
|
|
|
- children.add(ViewMapUserPoint(map.plugMap, trace, info: user.name, color: user.flag.value.color));
|
|
|
+ if (trace != null) {
|
|
|
+ children.add(ViewMapUserPoint(map.plugMap, trace,
|
|
|
+ info: user.name, color: user.flag.value.color));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return Stack(
|
|
|
- alignment: Alignment.topLeft,
|
|
|
- children: children
|
|
|
- );
|
|
|
+ return Stack(alignment: Alignment.topLeft, children: children);
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-class _ActiveInfoView extends GetView<FieldControlController>{
|
|
|
|
|
|
+class _ActiveInfoView extends GetView<FieldControlController> {
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Obx(() => Container(
|
|
|
- width: 370,
|
|
|
- height: double.infinity,
|
|
|
- color: Colors.white,
|
|
|
- child: ListView(
|
|
|
- children: controller.activeList.map((element) => activeView(element)).toList(),
|
|
|
- ),
|
|
|
- )) ;
|
|
|
+ width: 370,
|
|
|
+ height: double.infinity,
|
|
|
+ color: Colors.white,
|
|
|
+ child: ListView(
|
|
|
+ children: controller.activeList
|
|
|
+ .map((element) => activeView(element))
|
|
|
+ .toList(),
|
|
|
+ ),
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
- Widget activeView(ActiveInfo info){
|
|
|
+ Widget activeView(ActiveInfo info) {
|
|
|
final children = <Widget>[
|
|
|
Row(children: [
|
|
|
Text('${info.name} (${info.userList.length}人)'),
|
|
|
const Spacer(),
|
|
|
- IconButton(onPressed: (){
|
|
|
- info.isHide.value=!info.isHide.value;
|
|
|
- }, icon: info.isHide.value?const Icon(Icons.arrow_drop_down):const Icon(Icons.arrow_drop_up))
|
|
|
+ IconButton(
|
|
|
+ onPressed: () {
|
|
|
+ info.isHide.value = !info.isHide.value;
|
|
|
+ },
|
|
|
+ icon: info.isHide.value
|
|
|
+ ? const Icon(Icons.arrow_drop_down)
|
|
|
+ : const Icon(Icons.arrow_drop_up))
|
|
|
]),
|
|
|
-
|
|
|
];
|
|
|
|
|
|
- if(!info.isHide.value){
|
|
|
+ if (!info.isHide.value) {
|
|
|
children.addAll([
|
|
|
Container(
|
|
|
- decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
|
|
padding: const EdgeInsets.fromLTRB(26, 11, 26, 11),
|
|
|
child: Row(
|
|
|
children: [
|
|
|
@@ -134,15 +142,14 @@ class _ActiveInfoView extends GetView<FieldControlController>{
|
|
|
),
|
|
|
)
|
|
|
]);
|
|
|
- children.addAll(info.userList.map((e) => _UserInfoView(data: e)).toList());
|
|
|
+ children
|
|
|
+ .addAll(info.userList.map((e) => _UserInfoView(data: e)).toList());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
return Container(
|
|
|
- decoration: BoxDecoration(color: const Color(0xffe0e0e0), borderRadius: BorderRadius.circular(5)),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xffe0e0e0),
|
|
|
+ borderRadius: BorderRadius.circular(5)),
|
|
|
margin: const EdgeInsets.fromLTRB(9, 12, 9, 12),
|
|
|
padding: const EdgeInsets.all(9),
|
|
|
child: Column(
|
|
|
@@ -152,7 +159,7 @@ class _ActiveInfoView extends GetView<FieldControlController>{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-class _UserInfoView extends GetView<FieldControlController>{
|
|
|
+class _UserInfoView extends GetView<FieldControlController> {
|
|
|
const _UserInfoView({required this.data});
|
|
|
|
|
|
final UserInfo data;
|
|
|
@@ -160,7 +167,8 @@ class _UserInfoView extends GetView<FieldControlController>{
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Container(
|
|
|
- decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
|
|
padding: const EdgeInsets.fromLTRB(7, 11, 7, 11),
|
|
|
margin: const EdgeInsets.only(top: 5),
|
|
|
child: Row(
|
|
|
@@ -168,21 +176,35 @@ class _UserInfoView extends GetView<FieldControlController>{
|
|
|
children: [
|
|
|
Obx(() => Container(
|
|
|
margin: const EdgeInsets.only(top: 2),
|
|
|
- decoration: BoxDecoration(color: data.flag.value.color, borderRadius: BorderRadius.circular(4)),
|
|
|
- width: 7, height: 16)),
|
|
|
- const SizedBox(width: 8,),
|
|
|
- Expanded(child: Column(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: data.flag.value.color,
|
|
|
+ borderRadius: BorderRadius.circular(4)),
|
|
|
+ width: 7,
|
|
|
+ height: 16)),
|
|
|
+ const SizedBox(
|
|
|
+ width: 8,
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
- Text.rich(TextSpan(text: data.name, children: [
|
|
|
- TextSpan(text: ' [${data.routeName}]')
|
|
|
- ])),
|
|
|
+ Text.rich(TextSpan(
|
|
|
+ text: data.name,
|
|
|
+ children: [TextSpan(text: ' [${data.routeName}]')])),
|
|
|
const SizedBox(height: 5),
|
|
|
Row(
|
|
|
children: [
|
|
|
container(null, cpInfo, Colors.blue),
|
|
|
- container(const Icon(Icons.favorite, size: 13, color: Colors.white,), ' ${hr==0?'--':hr}', 0.toHRPColor()),
|
|
|
- container(null, paceInfo, Colors.blue)
|
|
|
+ container(
|
|
|
+ const Icon(
|
|
|
+ Icons.favorite,
|
|
|
+ size: 13,
|
|
|
+ color: Colors.white,
|
|
|
+ ),
|
|
|
+ ' ${hr == 0 ? '--' : hr}',
|
|
|
+ (data.gameInfo.hrInfo.hrInfo.lastOrNull?.hrPer ?? 0)
|
|
|
+ .toHRPColor()),
|
|
|
+ container(null, paceInfo, data.pace.color)
|
|
|
],
|
|
|
),
|
|
|
const SizedBox(height: 5),
|
|
|
@@ -197,59 +219,59 @@ class _UserInfoView extends GetView<FieldControlController>{
|
|
|
],
|
|
|
)),
|
|
|
GestureDetector(
|
|
|
- onTap: (){
|
|
|
- data.isHide.value=!data.isHide.value;
|
|
|
+ onTap: () {
|
|
|
+ data.isHide.value = !data.isHide.value;
|
|
|
},
|
|
|
- child: Obx(()=> Icon(
|
|
|
- data.isHide.value?
|
|
|
- Icons.visibility_off
|
|
|
- :Icons.visibility,
|
|
|
- color: data.isHide.value? Colors.grey: const Color(0xffffbb77),)) ,
|
|
|
+ child: Obx(() => Icon(
|
|
|
+ data.isHide.value ? Icons.visibility_off : Icons.visibility,
|
|
|
+ color:
|
|
|
+ data.isHide.value ? Colors.grey : const Color(0xffffbb77),
|
|
|
+ )),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
- int get hr{
|
|
|
- return data.gameInfo.hrInfo.hrInfo.lastOrNull?.hr??0;
|
|
|
+
|
|
|
+ int get hr {
|
|
|
+ return data.gameInfo.hrInfo.hrInfo.lastOrNull?.hr ?? 0;
|
|
|
}
|
|
|
|
|
|
- String get cpInfo{
|
|
|
+ String get cpInfo {
|
|
|
final next = data.nextWant;
|
|
|
return '${data.gameInfo.gameSaveInfo.nextControlPoint.orderNo}号点(${next?.sn})';
|
|
|
}
|
|
|
- String get paceInfo{
|
|
|
+
|
|
|
+ String get paceInfo {
|
|
|
Duration;
|
|
|
return data.pace.toString();
|
|
|
}
|
|
|
|
|
|
- Widget container(Widget? icon, String text, Color color){
|
|
|
+ Widget container(Widget? icon, String text, Color color) {
|
|
|
final children = <Widget>[];
|
|
|
- if(icon!= null){
|
|
|
+ if (icon != null) {
|
|
|
children.add(icon);
|
|
|
}
|
|
|
- children.add(Text(text, style: const TextStyle(color: Colors.white, fontSize: 14)));
|
|
|
+ children.add(
|
|
|
+ Text(text, style: const TextStyle(color: Colors.white, fontSize: 14)));
|
|
|
|
|
|
return Container(
|
|
|
height: 18,
|
|
|
- padding: const EdgeInsets.fromLTRB(12, 0, 12, 0),
|
|
|
- margin: const EdgeInsets.only(right: 10),
|
|
|
+ padding: const EdgeInsets.fromLTRB(10, 0, 12, 0),
|
|
|
+ margin: const EdgeInsets.only(right: 6),
|
|
|
alignment: Alignment.center,
|
|
|
- decoration: BoxDecoration(color: color, borderRadius: BorderRadius.circular(9)),
|
|
|
+ decoration:
|
|
|
+ BoxDecoration(color: color, borderRadius: BorderRadius.circular(9)),
|
|
|
child: Row(
|
|
|
children: children,
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-class _MsgView extends GetView<FieldControlController>{
|
|
|
-
|
|
|
+class _MsgView extends GetView<FieldControlController> {
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Container();
|
|
|
}
|
|
|
-
|
|
|
-}
|
|
|
+}
|