import 'package:fixnum/fixnum.dart'; import 'package:get/get.dart'; import 'm_net_image.dart'; import 'm_position.dart'; import 'package:trackoffical_app/pb.dart' as pb; class ProjectInfo { Int64 id = Int64(0); // 方案图片 MNetImage pic = MNetImage(); String name = ""; String address = ""; MPosition position = MPosition(); // 项目介绍 String introduction = ""; // 及格线,关门时间 Duration passLine = 0.seconds; // 结束时限 Duration deadLine = 0.seconds; int totalControlNum = 0; // 直线距离:米 int straightLineDistance = 0; bool isInGame = false; // 地图图片 MNetImage image = MNetImage(); // 比例尺 int mapScale = 0; // 等高距(米) int contourIntervalM = 0; List routes = []; } class MapRoute { Int64 id = Int64(0); String name = ""; MNetImage image = MNetImage(); } extension PbProjectInfoExtension on pb.ProjectInfoSimple { ProjectInfo toModel() { return ProjectInfo() ..id = rsId ..name = rsName ..address = addr ..pic = projectImage.toModel() ..position = position.toModel() ..isInGame = isInGame; } } extension PbProjectDetailExtension on pb.ProjectDetailReply { ProjectInfo toModel() { final out = baseInfo.toModel(); out.introduction = content; out.passLine = lockup.seconds; out.deadLine = forcedEntTime.seconds; out.totalControlNum = totalControlNum; out.straightLineDistance = maxRange; out.image = image.toModel(); out.mapScale = mapScaleNumber; out.contourIntervalM = contourInterval; out.routes = routes .map((m) => MapRoute() ..id = m.id ..name = m.name ..image = m.image.toModel()) .toList(); return out; } }