TableBuilder class

Table Builder - 用于创建表格布局的建造者类

A builder class for creating table layouts with Tailwind CSS-like utility methods.

Example:

TableBuilder(
  children: [
    TableRow(children: [Text('Header 1'), Text('Header 2')]),
    TableRow(children: [Text('Cell 1'), Text('Cell 2')]),
  ],
)
  .borderCollapse()
  .borderSpacing(8.0)
  .build()
Available extensions

Constructors

TableBuilder({required List<TableRow> children})
Creates a TableBuilder with the given children.

Properties

children List<TableRow>
Table rows
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

border(TableBorder border) TableBuilder
设置边框
borderCollapse() TableBuilder
border-collapse: collapse - 合并边框 ⚠️ 部分支持:Flutter Table 不支持 borderCollapse 参数,通过 border 实现
borderColor(Color color) TableBuilder

Available on TableBuilder, provided by the TableBuilderExtensions extension

设置边框颜色
borderRadius(double radius) TableBuilder

Available on TableBuilder, provided by the TableBuilderExtensions extension

设置边框圆角(通过自定义边框实现)
borderSeparate() TableBuilder
border-collapse: separate - 分离边框 ⚠️ 部分支持:Flutter Table 不支持 borderCollapse 参数
borderSpacing(double spacing) TableBuilder
border-spacing: {value} - 设置边框间距 ⚠️ 部分支持:Flutter Table 不支持 borderSpacing,使用 border 实现
borderWidth(double width) TableBuilder

Available on TableBuilder, provided by the TableBuilderExtensions extension

设置边框宽度
build() Table
构建 Table widget
columnWidths(Map<int, TableColumnWidth> columnWidths) TableBuilder
设置列宽
defaultColumnWidth(TableColumnWidth width) TableBuilder
设置默认列宽
defaultVerticalAlignment(TableCellVerticalAlignment alignment) TableBuilder
设置默认垂直对齐
fixedColumnWidths(double width) TableBuilder

Available on TableBuilder, provided by the TableBuilderExtensions extension

设置所有列宽为固定值
flexColumnWidths(double flex) TableBuilder

Available on TableBuilder, provided by the TableBuilderExtensions extension

设置所有列宽为弹性值
intrinsicColumnWidths() TableBuilder

Available on TableBuilder, provided by the TableBuilderExtensions extension

设置所有列宽为内容宽度
maxColumnWidths(double maxWidth) TableBuilder

Available on TableBuilder, provided by the TableBuilderExtensions extension

设置所有列宽为最大内容宽度
minColumnWidths(double minWidth) TableBuilder

Available on TableBuilder, provided by the TableBuilderExtensions extension

设置所有列宽为最小内容宽度
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
textBaseline(TextBaseline baseline) TableBuilder
设置文本基线
textDirection(TextDirection direction) TableBuilder
设置文本方向
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited