ArcoTreeSelect class

树选择器,还原官方 TreeSelect。

结构对应官方 tsx:arco-tree-select → SelectView(选择框)+ Trigger → -popup(max-height: 200; padding: 4px 0 4px 10px)内嵌 Tree (blockNode,节点 padding-left: 0)。

  • 单选 / 多选(multiple):树的 selectedKeys 受控,点选标题切换;
  • 勾选模式(treeCheckable):树的 checkedKeys 受控,标题点击等同 勾选(官方 handleCheckableSelect),父子联动与 checkedStrategy(默认 child)由 ArcoTree 承担;
  • 搜索(showSearch):默认按节点标题匹配(官方按 value 字段,本库 节点无 value 字段、以标题替代),命中节点及其祖先可见,标题内命中 片段加粗(.arco-tree-select-highlight { font-weight: 500 })。
Inheritance

Constructors

ArcoTreeSelect({Key? key, List<ArcoTreeNodeData> treeData = const [], Object? value, Object? defaultValue, void onChange(Object? value, {bool? checked, bool? selected, ArcoTreeNodeData? trigger})?, bool multiple = false, bool treeCheckable = false, bool treeCheckStrictly = false, ArcoCheckedStrategy checkedStrategy = ArcoCheckedStrategy.child, bool labelInValue = false, ArcoTreeSelectSize size = ArcoTreeSelectSize.defaultSize, String? placeholder, bool disabled = false, ArcoTreeSelectStatus status = ArcoTreeSelectStatus.normal, bool bordered = true, bool allowClear = true, bool showSearch = false, bool filterTreeNode(String inputText, ArcoTreeNodeData node)?, Widget? notFoundContent, Future<void> loadMore(ArcoTreeNodeData node)?, double maxHeight = 200, Widget? prefix, Widget? suffixIcon, bool? popupVisible, void onVisibleChange(bool visible)?, void onClear(bool visible)?})
创建树选择器。
const

Properties

allowClear → bool
是否允许清空(hover 出现清除按钮)。
final
bordered → bool
是否显示边框(官方 bordered);false 时无背景无边框。
final
checkedStrategy → ArcoCheckedStrategy
勾选回填方式(官方 treeCheckedStrategy,默认 child)。
final
defaultValue → Object?
非受控初始值,类型同 value。
final
disabled → bool
是否禁用。
final
filterTreeNode → bool Function(String inputText, ArcoTreeNodeData node)?
自定义过滤:返回 true 表示命中(官方 filterTreeNode)。
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelInValue → bool
值格式是否为 { label, value } 对象(官方 labelInValue)。
final
loadMore → Future<void> Function(ArcoTreeNodeData node)?
异步加载子数据(官方 loadMore),透传给 ArcoTree。
final
maxHeight → double
弹层最大高度(官方 .arco-tree-select-popup { max-height: 200px })。
final
multiple → bool
是否多选(官方 multiple);treeCheckable 恒为多选。
final
notFoundContent → Widget?
没有数据时显示的内容(官方 notFoundContent)。
final
onChange → void Function(Object? value, {bool? checked, bool? selected, ArcoTreeNodeData? trigger})?
选中值改变回调(官方 onChange):labelInValue 为 true 时值为 LabelValue(列表),否则为 String(列表)。
final
onClear → void Function(bool visible)?
点击清除回调(官方 onClear)。
final
onVisibleChange → void Function(bool visible)?
弹层展开收起回调(官方 onVisibleChange)。
final
placeholder → String?
占位文案。
final
popupVisible → bool?
受控弹层展开状态(官方 popupVisible)。
final
prefix → Widget?
前缀图标。
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showSearch → bool
是否可搜索(官方 showSearch)。
final
size → ArcoTreeSelectSize
尺寸。
final
status → ArcoTreeSelectStatus
校验状态。
final
suffixIcon → Widget?
自定义后缀图标。
final
treeCheckable → bool
是否展示复选框(官方 treeCheckable)。
final
treeCheckStrictly → bool
取消父子勾选关联(官方 treeCheckStrictly)。
final
treeData → List<ArcoTreeNodeData>
树数据(官方 treeData),key 即值。
final
value → Object?
受控值:String / List<String> / ArcoTreeSelectLabelValue / 其列表(官方 value)。
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<ArcoTreeSelect>
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