SantoPairInfoTable class

key-value 展示信息的集合,需要配合SantoInfoModal使用

该组件有两种显示样式isValueAlign,value字段是否对齐展示。

除了基本的信息展示之外,该组件也可以展开收起。expandAtIndex是从第几个索引开始 具备展开收起的功能

规则: 1:对齐的情况 1.1: key的最大长度为92(以七个字作为标准),当key超过7个字的时候,折行展示 1.2: value 占满剩余空间,可以折行展示 1.3: 如果存在箭头的情况,那么key和value最多显示一行,其余...截断

2:不对齐的情况 2.1: key和value一行铺开,key尽可能展示,value截断...

3:展开收起规则: 如果expandAtIndex是-1、大于等于孩子的长度-1,则不具备展开收起功能 isFolded控制 初始的展开收起状态 折叠态:只展示到 expandAtIndex 这一行,且该行内容折成一行(超出省略), 行尾放"展开"按钮,点击后展示已有全部内容 展开态:展示全部内容,并在末尾右侧放"收起"按钮,点击后重新折成一行

对齐的情况是使用Table实现,通过自定义的TableColumnWidth来达到对齐的效果。 TableColumnWidth提供了获取所有子节点宽度的API。

除了基本的信息展示外,使用SantoInfoModal还可以实现富文本、复杂Widget的功能。 样式: 支持文本、富文本和自定义的widget 常用的情况可以通过类中的静态函数构造 富文本和Icon的情况推荐使用 SantoRichTextGenerator 构造

如果不想要展开收起的功能,把 SantoPairInfoTable.expandAtIndex 保持为 -1 即可; value 是否对齐通过 SantoPairInfoTable.isValueAlign 控制。

SantoPairInfoTable(
   children: <SantoInfoModal>[
      SantoInfoModal(keyPart: "名称:", valuePart: "内容内容内容内容"),
      SantoInfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"),
      SantoInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"),
      SantoInfoModal(keyPart: "名称名称名称名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"),
     ],
),

SantoPairInfoTable(
   isValueAlign : false,
   children: <SantoInfoModal>[
      SantoInfoModal(keyPart: "名称:", valuePart: "内容内容内容内容"),
      SantoInfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"),
      SantoInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"),
      SantoInfoModal(keyPart: "名称名称名称名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"),
     ],
),

其他信息展示组件

Inheritance

Constructors

SantoPairInfoTable({Key? key, required List<SantoInfoModal> children, TableCellVerticalAlignment defaultVerticalAlignment = TableCellVerticalAlignment.baseline, bool isValueAlign = true, int expandAtIndex = -1, double? rowDistance, double? itemSpacing, bool isFolded = true, ValueChanged<bool>? onFolded, TableColumnWidth? customKeyWidth, SantoPairInfoTableConfig? themeData})
create SantoPairInfoTable

Properties

children → List<SantoInfoModal>
待展示的文本信息集合
final
customKeyWidth → TableColumnWidth?
对齐情况下,自定义的key展示规则 默认是最大的Key展示长度是107 可以参考_MaxWrapTableWidth实现自定义的展示规则,指定长度等
final
defaultVerticalAlignment → TableCellVerticalAlignment
TableCell 默认垂直对齐方式, 默认值为 TableCellVerticalAlignment.baseline 当 SantoInfoModal.valuePart 为自定义 Widget 时,可设置该参数调整对齐方式,仅在 isValueAlign 为 true 时设置才生效
final
expandAtIndex → int
从第几个索引开始 具备展开收起的功能 如果是-1则不具备展开收起功能 默认-1
final
hashCode → int
The hash code for this object.
no setterinherited
isFolded → bool
是否是收起的状态 默认true ,展示部分(如果具备了展开收起功能)
final
isValueAlign → bool
文本信息是否对齐 默认不对齐
final
itemSpacing → double?
key和value的间距 默认2
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onFolded → ValueChanged<bool>?
Table 展开收起状态变化的回调
final
rowDistance → double?
每一行的间距 默认4
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
themeData → SantoPairInfoTableConfig?
the theme config of SantoPairInfoTable
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _SantoPairInfoTableState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

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