buildDataColumn method

DataColumn buildDataColumn(
  1. BuildContext context,
  2. Map spec,
  3. bool sortable,
  4. StateSetter setState,
  5. Widget? labelWidget,
)

Implementation

DataColumn buildDataColumn(BuildContext context, Map spec, bool sortable,
    StateSetter setState, Widget? labelWidget) {
  final props = spec["properties"] ?? {};
  final label = props["label"] ?? spec["name"] ?? "";
  final specAlias = props["alias"] ?? label;

  return DataColumn(
    label: labelWidget ?? Text(Lowder.properties.getText(label, "title")),
    numeric: parseBool(props["numeric"]),
    tooltip: props["tooltip"],
    onSort: !parseBool(props["sortable"], defaultValue: sortable)
        ? null
        : (idx, asc) => setState(() {
              sortState["idx"] = idx;
              sortState["key"] = specAlias;
              sortState["asc"] = asc;
              sortState["ascKey"] = asc ? specAlias : null;
              sortState["descKey"] = asc ? null : specAlias;
              loadPage(page: 1);
            }),
  );
}