@@ -10,7 +10,7 @@ class NodeWidget extends StatefulWidget {
10
10
const NodeWidget ({
11
11
super .key,
12
12
required this .treeNode,
13
- required this .state ,
13
+ required this .controller ,
14
14
required this .style,
15
15
this .level = 0 ,
16
16
});
@@ -19,7 +19,7 @@ class NodeWidget extends StatefulWidget {
19
19
final TreeNode treeNode;
20
20
21
21
/// Manages the state of the tree.
22
- final TreeController state ;
22
+ final TreeController controller ;
23
23
24
24
/// Style configuration for the node.
25
25
final NodeStyle style;
@@ -35,7 +35,11 @@ class _NodeWidgetState extends State<NodeWidget> {
35
35
bool get _isLeaf =>
36
36
widget.treeNode.children == null || widget.treeNode.children! .isEmpty;
37
37
38
- bool get _isExpanded => widget.state.isNodeExpanded (widget.treeNode.key! );
38
+ bool get _isExpanded =>
39
+ widget.controller.isNodeExpanded (widget.treeNode.key! );
40
+
41
+ void logEvent (String name, [Map <String , dynamic >? params]) =>
42
+ widget.controller.onEvent ((name: name, params: params));
39
43
40
44
@override
41
45
Widget build (BuildContext context) {
@@ -102,6 +106,11 @@ class _NodeWidgetState extends State<NodeWidget> {
102
106
iconData: Icons .open_in_new_rounded,
103
107
onTap: () {
104
108
openUrl (link! );
109
+ logEvent (
110
+ 'debug-panel-right-click' , {
111
+ 'option' : 'link' ,
112
+ 'link' : link,
113
+ });
105
114
Navigator .pop (context);
106
115
},
107
116
),
@@ -112,8 +121,14 @@ class _NodeWidgetState extends State<NodeWidget> {
112
121
iconData:
113
122
Icons .open_in_new_rounded,
114
123
onTap: () {
115
- openUrl (
116
- '$link &$searchReference ' );
124
+ final searchRefLink =
125
+ '$link &$searchReference ' ;
126
+ openUrl (searchRefLink);
127
+ logEvent (
128
+ 'debug-panel-right-click' , {
129
+ 'option' : 'search-reference' ,
130
+ 'link' : searchRefLink,
131
+ });
117
132
Navigator .pop (context);
118
133
},
119
134
),
@@ -131,7 +146,7 @@ class _NodeWidgetState extends State<NodeWidget> {
131
146
onTap: _isLeaf
132
147
? null
133
148
: () => setState (
134
- () => widget.state .toggleNodeExpanded (
149
+ () => widget.controller .toggleNodeExpanded (
135
150
widget.treeNode.key! ,
136
151
widget.treeNode.name,
137
152
),
0 commit comments