proccessTabList static method

List<RoomDetailTabModel> proccessTabList(
  1. StationData stationData
)

Implementation

static List<RoomDetailTabModel> proccessTabList(StationData stationData) {
  StationResultData data = stationData.resultData!;
  List<RoomDetailTabModel> listTemp = [];
  if (data.wall != null && data.wall!.isNotEmpty) {
    Map<String, dynamic> flatness = data.micro_flatness ?? {};
    if (flatness.isNotEmpty) {
      data.wall!.forEach((key, value) {
        if (flatness[key] != null) {
          data.wall![key]!.flatness = flatness[key];
        }
      });
    }

    data.wall!.forEach((key, value) {
      RoomDetailTabModel model = RoomDetailTabModel(
          uniqueId: value.id,
          id: key,
          name: key,
          checked: true,
          children: []);
      listTemp.add(model);
    });
  }
  if (data.plane != null && data.plane!.isNotEmpty) {
    data.plane!.forEach((key, value) {
      RoomDetailTabModel model = RoomDetailTabModel(
        uniqueId: value.id,
        id: key,
        name: key,
        checked: true,
      );
      listTemp.add(model);
    });
  }
  //方正度
  if ((data.squareness2 != null && data.squareness2!.isNotEmpty) ||
      (data.squareness3 != null && data.squareness3!.isNotEmpty)) {
    RoomDetailTabModel model = RoomDetailTabModel(
      id: "squareness",
      name: "方正度",
      checked: true,
    );
    listTemp.add(model);
  }

  if (data.corner != null && data.corner!.isNotEmpty) {
    RoomDetailTabModel model = RoomDetailTabModel(
      id: "corner",
      name: "阴阳角",
      checked: true,
    );
    listTemp.add(model);
  }
  Map<String, dynamic> widthDepth2 = data.widthDepth2 ?? {};
  bool existDepth = false;
  if (widthDepth2.isNotEmpty) {
    widthDepth2.forEach((key, value) {
      if (value["data"] != null) {
        List list = value["data"] as List;
        if (list.isNotEmpty) {
          existDepth = true;
        }
      }
    });
    if (existDepth) {
      Map depth = widthDepth2["depth"] ?? {};
      Map width = widthDepth2["width"] ?? {};
      if (depth.isNotEmpty || width.isNotEmpty) {
        RoomDetailTabModel model = RoomDetailTabModel(
          id: "width_depth",
          name: "开间进深",
          checked: true,
        );
        listTemp.add(model);
      }
    }
  }

  if (data.height != null) {
    if (data.height!.height! > 0) {
      RoomDetailTabModel model = RoomDetailTabModel(
        id: "height",
        name: "净高",
        checked: true,
      );
      listTemp.add(model);
    }
  }

  if (data.floorHeight != null) {
    if (data.floorHeight!.height! > 0) {
      RoomDetailTabModel model = RoomDetailTabModel(
        id: "floorHeight",
        name: "净低",
        checked: true,
      );
      listTemp.add(model);
    }
  }

  if (data.wireboxHeight != null) {
    if (data.wireboxHeight!.isNotEmpty) {
      RoomDetailTabModel model = RoomDetailTabModel(
        id: "wireboxHeight",
        name: "线盒高度",
        checked: true,
      );
      listTemp.add(model);
    }
  }

  return listTemp;
}