|
|
|
@ -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), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|