EnumColumn<TItem extends Object, TValue extends Enum> constructor

EnumColumn<TItem extends Object, TValue extends Enum>({
  1. required List<TValue> values,
  2. required String fieldName,
  3. ColumnHeader? header,
  4. Widget? customFieldWidget(
    1. TItem row
    )?,
  5. required String valueText(
    1. TValue e
    ),
  6. required TValue? value(
    1. TItem row
    ),
  7. FilterCriteria<TValue>? filter,
  8. OrderDirections sortDirection = OrderDirections.notSet,
  9. double? width,
  10. double? minWidth,
  11. double? maxWidth,
  12. int? xlCols,
  13. int? largeCols,
  14. int? mediumCols,
  15. int? smallCols,
  16. int? xsCols,
  17. TextStyle? textStyle,
  18. Color? backgroundColor,
  19. Color? foregroundColor,
  20. Color? accentColor,
  21. AlignmentGeometry alignment = Alignment.centerLeft,
})

Implementation

EnumColumn({
  required this.values,
  required String fieldName,
  ColumnHeader? header,
  Widget? Function(TItem row)? customFieldWidget,
  required String Function(TValue e) valueText,
  required TValue? Function(TItem row) value,
  FilterCriteria<TValue>? filter,
  OrderDirections sortDirection = OrderDirections.notSet,
  double? width,
  double? minWidth,
  double? maxWidth,
  int? xlCols,
  int? largeCols,
  int? mediumCols,
  int? smallCols,
  int? xsCols,
  TextStyle? textStyle,
  Color? backgroundColor,
  Color? foregroundColor,
  Color? accentColor,
  AlignmentGeometry alignment = Alignment.centerLeft,
}) : super(
        fieldName: fieldName,
        value: value,
        accentColor: accentColor,
        alignment: alignment,
        backgroundColor: backgroundColor,
        customFieldWidget: customFieldWidget ??
            (TItem row) {
              final val = value(row);
              if (val == null) return Container();

              return Text(valueText(val));
            },
        foregroundColor: foregroundColor,
        format: null,
        header: header ?? ColumnHeader(),
        largeCols: largeCols,
        maxWidth: maxWidth,
        mediumCols: mediumCols,
        minWidth: minWidth,
        smallCols: smallCols,
        textStyle: textStyle,
        width: width,
        xlCols: xlCols,
        xsCols: xsCols,
        filterRules: ValueMapFilterRules(
          valueMap: Map<TValue, Widget>.fromEntries(
            values.map(
              (e) => MapEntry(
                e,
                Text(
                  valueText(e),
                ),
              ),
            ),
          ),
          criteria: filter,
        ),
        sortDirection: sortDirection,
      );