JunnyTreeConfig class
树形组件配置类
提供树形组件的所有可配置选项,包括外观、行为和交互设置
主要功能
外观配置
- 节点高度、缩进大小
- 连接线样式和颜色
- 主题适配
行为配置
- 展开/折叠行为
- 选择模式
- 数据字段映射
交互配置
- 点击行为
- 选择回调
- 筛选设置
使用示例
基础配置
final JunnyTreeConfig config = JunnyTreeConfig();
自定义配置
final JunnyTreeConfig config = JunnyTreeConfig(
nodeHeight: 56.0,
showConnectingLines: true,
expandAll: true,
lineIndent: 32.0,
lineColor: Colors.blue,
);
Constructors
- JunnyTreeConfig({Duration animationDuration = const Duration(milliseconds: 200), BoxDecoration? borderDecoration, String childrenKey = 'children', String emptyTextBuilder(BuildContext context)?, bool enableSearch = false, bool expandAll = false, Color? hoverColor, Color lineColor = Colors.grey, double lineIndent = 16.0, double lineWidth = 1.0, bool multiSelect = false, double nodeHeight = 40.0, VoidCallback? onEmptyTap, Color? parentLineColor, double rowLeadingIndent = 0.0, double rowTrailingIndent = 0.0, String? searchPlaceholder, Color? selectionColor, bool showBorder = false, bool showConnectingLines = true, bool useLocalFilter = true, bool useParentDashedLine = true, bool toggleOnTitleTap = false, bool toggleOnRowTap = false})
-
创建树形组件配置
const
Properties
- animationDuration → Duration
-
动画持续时间
final
- borderDecoration → BoxDecoration?
-
边框装饰
final
- childrenKey → String
-
子节点字段名
final
- emptyTextBuilder → String Function(BuildContext context)?
-
空状态文本构建器
final
- enableSearch → bool
-
是否启用搜索功能
final
- expandAll → bool
-
是否默认展开所有节点
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- hoverColor → Color?
-
悬停状态颜色
final
- lineColor → Color
-
连接线颜色
final
- lineIndent → double
-
连接线缩进距离
final
- lineWidth → double
-
连接线宽度
final
- multiSelect → bool
-
是否支持多选
final
- nodeHeight → double
-
节点高度
final
- onEmptyTap → VoidCallback?
-
空状态点击回调
final
- parentLineColor → Color?
-
父级连接线颜色
final
- rowLeadingIndent → double
-
树行头部缩进距离
final
- rowTrailingIndent → double
-
树行尾部缩进距离
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchPlaceholder → String?
-
搜索框占位符文本
final
- selectionColor → Color?
-
选中状态颜色
final
- showBorder → bool
-
是否显示边框
final
- showConnectingLines → bool
-
是否显示连接线
final
- toggleOnRowTap → bool
-
点击整行是否切换展开/收起(与自定义 nodeBuilder 的手势可能叠加,默认关闭)
final
- toggleOnTitleTap → bool
-
点击标题区域是否切换展开/收起(仅在使用默认节点构建器时生效)
final
- useLocalFilter → bool
-
是否使用本地筛选
final
- useParentDashedLine → bool
-
父级连线是否使用虚线
final
Methods
-
copyWith(
{Duration? animationDuration, BoxDecoration? borderDecoration, String? childrenKey, String emptyTextBuilder(BuildContext context)?, bool? enableSearch, bool? expandAll, Color? hoverColor, Color? lineColor, double? lineIndent, double? lineWidth, bool? multiSelect, double? nodeHeight, VoidCallback? onEmptyTap, Color? parentLineColor, double? rowLeadingIndent, double? rowTrailingIndent, String? searchPlaceholder, Color? selectionColor, bool? showBorder, bool? showConnectingLines, bool? useLocalFilter, bool? useParentDashedLine, bool? toggleOnTitleTap, bool? toggleOnRowTap}) → JunnyTreeConfig - 复制配置并修改部分参数
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override