Browse Source

模板节点展示扩展前

master
hejl 2 months ago
parent
commit
9e489b3da8
  1. 48
      win_text_editor/lib/modules/template_parser/widgets/template_parser_view.dart

48
win_text_editor/lib/modules/template_parser/widgets/template_parser_view.dart

@ -133,31 +133,31 @@ class _TemplateParserViewState extends State<TemplateParserView> { @@ -133,31 +133,31 @@ class _TemplateParserViewState extends State<TemplateParserView> {
final templateNode = node as TemplateNode;
final isAttribute = node.depth > 0 && node.name.startsWith('@');
return Padding(
padding: EdgeInsets.only(left: 12.0 * node.depth), //
child: ListTile(
dense: true,
leading:
isAttribute
? const Icon(Icons.code, size: 16, color: Colors.grey)
: const Icon(Icons.label_outline, size: 18, color: Colors.blue),
title: Text(
isAttribute ? templateNode.name.substring(1) : templateNode.name,
style: TextStyle(
color: isAttribute ? Colors.grey[600] : Colors.black,
fontWeight: isAttribute ? FontWeight.normal : FontWeight.w500,
return Consumer<TemplateParserController>(
builder: (context, controller, _) {
return Padding(
padding: EdgeInsets.only(left: 12.0 * node.depth), //
child: ListTile(
dense: true,
leading:
isAttribute
? const Icon(Icons.code, size: 16, color: Colors.grey)
: const Icon(Icons.label_outline, size: 18, color: Colors.blue),
title: Text(
isAttribute ? templateNode.name.substring(1) : templateNode.name,
style: TextStyle(
color: isAttribute ? Colors.grey[600] : Colors.black,
fontWeight: isAttribute ? FontWeight.normal : FontWeight.w500,
),
),
trailing:
templateNode.isRepeated
? const Text("(repeated)", style: TextStyle(color: Colors.grey))
: null,
onTap: () => controller.selectTreeNode(templateNode),
),
),
trailing:
templateNode.isRepeated
? const Text("(repeated)", style: TextStyle(color: Colors.grey))
: null,
onTap:
() => Provider.of<TemplateParserController>(
context,
listen: false,
).selectTreeNode(templateNode),
),
);
},
);
}

Loading…
Cancel
Save