onFocus method
void
onFocus(
- Event event
)
Implementation
void onFocus(Event event) async {
// set focus
if (event.parameters != null) {
// key of model that opened the focsed tab
String? key = event.parameters!.containsKey('key')
? event.parameters!['key']
: null;
// node needs to be focused in the treeview?
if (key != null) {
// find node in model tree children
TreeNodeModel? node = findDescendantOfExactType(TreeNodeModel, id: key);
// found? set focus
if (node != null) {
event.handled = true;
focusTreeNode(node);
}
}
}
// set empty focus if event wasnt handled
if (!event.handled) focusTreeNode(null);
}