From b71e7f12078c354094c1b7d35d0070ecea8fd463 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 1 Feb 2023 08:44:36 -0300 Subject: [PATCH 1/2] View hierarchy reads size from RenderBox only --- CHANGELOG.md | 6 ++++++ .../lib/src/view_hierarchy/sentry_tree_walker.dart | 13 ++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47d8c604bb..15acaaa62d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- View hierarchy reads size from RenderBox only ([#1249](https://github.com/getsentry/sentry-dart/pull/1249)) + ## 7.0.0-beta.1 ### Fixes diff --git a/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart b/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart index 4da7a0d905..2e0f1aa594 100644 --- a/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart +++ b/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart @@ -52,13 +52,6 @@ class _TreeWalker { bool? visible; double? alpha; - // Widget has to be RenderBox to have a size - if (widget is RenderBox) { - final size = element.size; - width = size?.width; - height = size?.height; - } - final renderObject = element.renderObject; if (renderObject is RenderBox) { final offset = renderObject.localToGlobal(Offset.zero); @@ -69,6 +62,12 @@ class _TreeWalker { y = offset.dy; } // no z axes in 2d + + final size = element.size; + if (size != null) { + width = size.width; + height = size.height; + } } if (widget is Visibility) { From fa847a76cd1ddbcf26ad47cd2c1b20de2ec82b8f Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 1 Feb 2023 08:46:41 -0300 Subject: [PATCH 2/2] fix pr id --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15acaaa62d..a93758ff0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixes -- View hierarchy reads size from RenderBox only ([#1249](https://github.com/getsentry/sentry-dart/pull/1249)) +- View hierarchy reads size from RenderBox only ([#1258](https://github.com/getsentry/sentry-dart/pull/1258)) ## 7.0.0-beta.1