cellBuilder method
Widget?
cellBuilder(
- BuildContext context,
- FtViewModel<
FtModel< viewModel,Cell> , Cell> - Cell cell,
- LayoutPanelIndex layoutPanelIndex,
- CellIndex tableCellIndex,
override
Implementation
@override
Widget? cellBuilder(
BuildContext context,
FtViewModel<FtModel<Cell>, Cell> viewModel,
Cell cell,
LayoutPanelIndex layoutPanelIndex,
CellIndex tableCellIndex,
) {
Widget text = Text(
'${cell.value}',
textAlign: cell.attr[CellAttr.textAlign],
style: cell.attr[CellAttr.textStyle],
textScaleFactor: viewModel.tableScale,
);
if (cell.attr.containsKey(CellAttr.rotate)) {
text = TableTextRotate(
angle: math.pi * 2.0 / 360 * cell.attr[CellAttr.rotate], child: text);
}
Widget child = Container(
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5.0) *
viewModel.tableScale,
alignment: cell.attr[CellAttr.alignment] ?? Alignment.center,
color: cell.attr[CellAttr.background],
child: text);
if (cell.attr.containsKey(CellAttr.percentagBackground)) {
final pbg =
cell.attr[CellAttr.percentagBackground] as PercentageBackground;
child = CustomPaint(
painter: PercentagePainter(pbg),
child: child,
);
} else {
child = child;
}
return cell.addRepaintBoundaries ? RepaintBoundary(child: child) : child;
}