EasyTableColumn<ROW> constructor

EasyTableColumn<ROW>({
  1. dynamic id,
  2. double width = 100,
  3. double? grow,
  4. String? name,
  5. int? fractionDigits,
  6. bool sortable = true,
  7. bool resizable = true,
  8. PinStatus pinStatus = PinStatus.none,
  9. EdgeInsets? headerPadding,
  10. EdgeInsets? cellPadding,
  11. Alignment? headerAlignment,
  12. Alignment? cellAlignment,
  13. TextStyle? cellTextStyle,
  14. TextOverflow? cellOverflow,
  15. CellBackgroundBuilder<ROW>? cellBackground,
  16. TextStyle? headerTextStyle,
  17. bool cellClip = false,
  18. Widget? leading,
  19. EasyTableCellBuilder<ROW>? cellBuilder,
  20. EasyTableColumnSort<ROW>? sort,
  21. EasyTableIntValueMapper<ROW>? intValue,
  22. EasyTableDoubleValueMapper<ROW>? doubleValue,
  23. EasyTableStringValueMapper<ROW>? stringValue,
  24. EasyTableIconValueMapper<ROW>? iconValue,
  25. EasyTableObjectValueMapper<ROW>? objectValue,
  26. CellStyleBuilder<ROW>? cellStyleBuilder,
})

Implementation

factory EasyTableColumn(
    {dynamic id,
    double width = 100,
    double? grow,
    String? name,
    int? fractionDigits,
    bool sortable = true,
    bool resizable = true,
    PinStatus pinStatus = PinStatus.none,
    EdgeInsets? headerPadding,
    EdgeInsets? cellPadding,
    Alignment? headerAlignment,
    Alignment? cellAlignment,
    TextStyle? cellTextStyle,
    TextOverflow? cellOverflow,
    CellBackgroundBuilder<ROW>? cellBackground,
    TextStyle? headerTextStyle,
    bool cellClip = false,
    Widget? leading,
    EasyTableCellBuilder<ROW>? cellBuilder,
    EasyTableColumnSort<ROW>? sort,
    EasyTableIntValueMapper<ROW>? intValue,
    EasyTableDoubleValueMapper<ROW>? doubleValue,
    EasyTableStringValueMapper<ROW>? stringValue,
    EasyTableIconValueMapper<ROW>? iconValue,
    EasyTableObjectValueMapper<ROW>? objectValue,
    CellStyleBuilder<ROW>? cellStyleBuilder}) {
  if (sort == null) {
    if (intValue != null) {
      sort = (a, b) {
        int? v1 = intValue(a);
        int? v2 = intValue(b);
        if (v1 == null && v2 == null) {
          return 0;
        }
        if (v1 == null) {
          return -1;
        }
        if (v2 == null) {
          return 1;
        }
        return v1.compareTo(v2);
      };
    } else if (doubleValue != null) {
      sort = (a, b) {
        double? v1 = doubleValue(a);
        double? v2 = doubleValue(b);
        if (v1 == null && v2 == null) {
          return 0;
        }
        if (v1 == null) {
          return -1;
        }
        if (v2 == null) {
          return 1;
        }
        return v1.compareTo(v2);
      };
    } else if (stringValue != null) {
      sort = (a, b) {
        String? v1 = stringValue(a);
        String? v2 = stringValue(b);
        if (v1 == null && v2 == null) {
          return 0;
        }
        if (v1 == null) {
          return -1;
        }
        if (v2 == null) {
          return 1;
        }
        return v1.compareTo(v2);
      };
    } else if (objectValue != null) {
      sort = (a, b) {
        Object? v1 = objectValue(a);
        Object? v2 = objectValue(b);
        if (v1 == null && v2 == null) {
          return 0;
        }
        if (v1 == null) {
          return -1;
        }
        if (v2 == null) {
          return 1;
        }
        if (a is Comparable && b is Comparable) {
          return a.compareTo(b);
        }
        return 0;
      };
    }
  }
  //TODO check multiple value mappers
  return EasyTableColumn._(
      id: id,
      width: width,
      grow: grow,
      name: name,
      fractionDigits: fractionDigits,
      cellBuilder: cellBuilder,
      leading: leading,
      sort: sort,
      pinStatus: pinStatus,
      stringValueMapper: stringValue,
      intValueMapper: intValue,
      doubleValueMapper: doubleValue,
      objectValueMapper: objectValue,
      iconValueMapper: iconValue,
      sortable: sortable,
      resizable: resizable,
      headerPadding: headerPadding,
      cellPadding: cellPadding,
      cellBackground: cellBackground,
      cellOverflow: cellOverflow,
      headerAlignment: headerAlignment,
      cellAlignment: cellAlignment,
      headerTextStyle: headerTextStyle,
      cellTextStyle: cellTextStyle,
      cellStyleBuilder: cellStyleBuilder,
      cellClip: cellClip);
}