from static method
Implementation
static WidgetAction from(WidgetView target, String eventName, View view,
Map<String, API> apis, YamlMap map) {
Event? event;
try {
Event.values.forEach((e) {
if (e.toString() == 'Event.' + eventName.toLowerCase()) {
event = e;
}
});
} catch (e) {
throw Exception("Event by name=" + eventName + " is not supported");
}
WidgetAction? action;
map.forEach((k, v) {
if (k == "call") {
APIHandler handler = APIHandler.from(view, apis, v);
action = WidgetAction(target, event!, view, handler);
if (event == Event.click) {
final Widget orig = target.widget;
target.widget = GestureDetector(
onTap: () {
print('ontap on ' + orig.key.toString());
handler.handle(action!);
},
child: AbsorbPointer(child: orig));
}
} else {
throw Exception('no handler found for event ' + event.toString());
}
});
return action!;
}