You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.3 KiB

import 'package:flutter/material.dart';
import 'package:win_text_editor/shared/components/tree_view.dart';
class TemplateNode implements TreeNode {
@override
final String name;
@override
final List<TemplateNode> children;
@override
final int depth;
@override
bool isExpanded;
final String path;
bool isRepeated;
bool isAttribute;
int repreatCount;
2 months ago
bool isChecked; // 新增属性,用于记录节点是否被选中
TemplateNode({
required this.name,
required this.children,
required this.depth,
required this.path,
this.isExpanded = false,
this.isRepeated = false,
this.isAttribute = false,
this.repreatCount = 1,
2 months ago
this.isChecked = false, // 初始化默认未选中
});
@override
bool get isDirectory => children.isNotEmpty;
@override
IconData? get iconData => isAttribute ? Icons.code : Icons.label_outline;
2 months ago
@override
String get id => path;
}
2 months ago
enum NodeType { element, attribute, text }
class TemplateItem {
final int id;
final String rowId;
final String content;
final String xPath;
final String value;
2 months ago
final NodeType nodeType;
TemplateItem({
required this.id,
required this.rowId,
2 months ago
required this.content,
required this.xPath,
required this.value,
required this.nodeType,
});
2 months ago
bool matchesPath(String path) {
return xPath == path;
}
}