areViewsPresent static method
void
areViewsPresent()
Implementation
static void areViewsPresent(String listenerId, searchElements,
double pixRatio, int screenWidth, int screenHeight) {
try {
screenHeight = (MediaQuery.of(_ctx).size.height * pixRatio).round();
screenWidth = (MediaQuery.of(_ctx).size.width * pixRatio).round();
List<Map<String, dynamic>> presentElements = [];
for (int i = 0; i < searchElements.length; i++) {
var key = searchElements[i]["clientElementId"];
if (!key.contains("<'") && !key.contains("'>")) {
key = "[<'$key'>]";
}
if(visibilityMap[key] == 100.0) {
BuildContext? element = findViewByKey(key, _ctx);
if (element != null) {
RenderBox box = element.findRenderObject() as RenderBox;
Offset position = box.localToGlobal(Offset.zero);
if (isWithinBounds(
element, position, pixRatio, screenWidth, screenHeight)) {
presentElements.add(searchElements[i]);
}
}
}
}
plotlineChannel.invokeMethod('areViewsPresent', <String, dynamic>{
"listenerId": listenerId,
"presentElements": presentElements
});
} catch (e) {
debugPrint("Error in areViewsPresent: $e");
}
}