EasyTableColumn<ROW> constructor
EasyTableColumn<ROW> ({
- 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,
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);
}