getWidgetLine static method

Widget getWidgetLine(
  1. SelectModel selectModel,
  2. MapEntry item,
  3. Map? map,
  4. int typeScreen,
  5. void onTap()?,
)

Implementation

static Widget getWidgetLine(SelectModel selectModel, MapEntry item, Map? map,
    int typeScreen, void Function()? onTap) {
  Line? linha =
      selectModel.lines.firstWhereOrNull((linha) => linha.key == item.key);
  if (linha == null) {
    return SizedBox();
  }
  if (linha.customLine != null) {
    return linha
        .customLine!(CustomLineData(data: map, typeScreen: typeScreen));
  } else {
    ObjFormatData objFormatData = ObjFormatData(data: item.value, map: map);
    if (linha.formatData != null) {
      return _getText(linha.formatData!.formatData(objFormatData), onTap,
          linha, selectModel, objFormatData);
    }
    if (item.value?.toString().isNullOrBlank != false) {
      return _getText(linha.defaultValue?.call(map) ?? '', onTap, linha,
          selectModel, objFormatData);
    }
    if (linha.typeData is TDDateTimestamp) {
      return _getText(
          DateTime.fromMillisecondsSinceEpoch(item.value)
              .string((linha.typeData as TDDateTimestamp).outputFormat),
          onTap,
          linha,
          selectModel,
          objFormatData);
    }
    return _getText(
        item.value?.toString(), onTap, linha, selectModel, objFormatData);
  }
}