PairInfoTable class
key-value 展示信息的集合,需要配合InfoModal使用
该组件有两种显示样式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控制 初始的展开收起状态 展开和收起的button是蒙层
对齐的情况是使用Table实现,通过自定义的TableColumnWidth来达到对齐的效果。 TableColumnWidth提供了获取所有子节点宽度的API。
除了基本的信息展示外,使用InfoModal还可以实现富文本、复杂Widget的功能。
样式:
支持文本、富文本和自定义的widget
常用的情况可以通过类中的静态函数构造
富文本和Icon的情况推荐使用 RichTextGenerator
构造
如果不想要展开收起的功能,那么可以使用FollowPairInfo和AlignPairInfo
FollowPairInfo的value紧跟随者key,只具备展示的功能
AlignPairInfo
的value具备对齐的功能,只具备展示的功能
PairInfoTable(
children: <InfoModal>[
InfoModal(keyPart: "名称:", valuePart: "内容内容内容内容"),
InfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"),
InfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"),
InfoModal(keyPart: "名称名称名称名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"),
],
),
PairInfoTable(
isValueAlign : false,
children: <InfoModal>[
InfoModal(keyPart: "名称:", valuePart: "内容内容内容内容"),
InfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"),
InfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"),
InfoModal(keyPart: "名称名称名称名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"),
],
),
其他信息展示组件
- EnhanceNumberCard, 强化数字信息展示组件
- RichInfoGrid, 两列富文本展示组件
AlignPairInfo
, value对齐的文本组件- FollowPairInfo, key-value紧紧相随的的文本组件
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PairInfoTable
Constructors
-
PairInfoTable({Key? key, required List<
InfoModal> children, TableCellVerticalAlignment defaultVerticalAlignment = TableCellVerticalAlignment.baseline, bool isValueAlign = true, int expandAtIndex = -1, double? rowDistance, double? itemSpacing, bool isFolded = true, ValueChanged<bool> ? onFolded, TableColumnWidth? customKeyWidth, PairInfoTableConfig? themeData}) -
create BrnPairInfoTable
const
Properties
-
children
→ List<
InfoModal> -
待展示的文本信息集合
final
- customKeyWidth → TableColumnWidth?
-
对齐情况下,自定义的key展示规则
默认是最大的Key展示长度是107
可以参考
_MaxWrapTableWidth
实现自定义的展示规则,指定长度等final - defaultVerticalAlignment → TableCellVerticalAlignment
-
TableCell 默认垂直对齐方式, 默认值为 TableCellVerticalAlignment.baseline
当
BrnInfoModal.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 → PairInfoTableConfig?
-
the theme config of BrnPairInfoTable
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _BrnPairInfoTableState -
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