TTableHeader<T, K>.editable constructor
TTableHeader<T, K>.editable (})
Creates an editable cell header.
Implementation
TTableHeader.editable(
this.text, {
required Object? Function(T) get,
required Widget Function(BuildContext ctx, T data) builder,
this.flex,
this.minWidth = 150,
this.maxWidth,
this.alignment,
}) : map = get,
builder = ((ctx, item, index) {
final activeCursor = TTableScope.maybeOf(ctx)?.activeCellNotifier;
final data = item.data;
final cellKey = "${item.key}_$text";
final textStyle = ctx.theme.tableTheme.rowCardTheme.getContentTextStyle(ctx.colors);
if (activeCursor != null) {
return InkWell(
onTap: () => activeCursor.value = cellKey,
child: ValueListenableBuilder(
valueListenable: activeCursor,
builder: (ctx, active, _) => active == cellKey ? builder(ctx, data) : Text(get(data)?.toString() ?? '', style: textStyle),
),
);
}
return Text(get(data)?.toString() ?? '', style: textStyle);
});