Skip to content

Commit c76100b

Browse files
Sahil-Simformvasu-nageshri
authored andcommitted
fix: 🐛 Resolve issue where long tooltip text was rendered outside the screen bounds
1 parent 89a7f15 commit c76100b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Fixed [#587](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/587) - Fixed ShowcaseView.withWidget container positioning issues on web
55
- Fixed [#588](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/588) & [#593](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/593) - Fixed incorrect ShowcaseView callback scope by adding optional scope parameter
66
- Feature [#600](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/600) - Added dynamic onComplete callback registration with `addOnCompleteCallback` and `removeOnCompleteCallback` methods
7+
- Fixed [#577](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/577) - Resolve issue where long tooltip text was rendered outside the screen bounds
78

89
## [5.0.1]
910

lib/src/tooltip/render_position_delegate.dart

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,28 @@ class _RenderPositionDelegate extends RenderBox
208208
),
209209
);
210210

211-
// Dry layout main tooltip content
211+
// Dry layout main tooltip content with tight constraints to get natural size
212+
// Using tightFor() with no parameters allows content to size naturally
212213
TooltipLayoutSlot.tooltipBox.getObjectManager?.performDryLayout(
213-
const BoxConstraints.tightFor(),
214+
const BoxConstraints(),
214215
);
215216

216-
// Dry layout action box (if exists)
217+
// If content exceeds available width, constrain it
218+
if (_toolTipBoxSize.width > _availableScreenWidth) {
219+
TooltipLayoutSlot.tooltipBox.getObjectManager?.performDryLayout(
220+
BoxConstraints(maxWidth: _availableScreenWidth),
221+
);
222+
}
223+
224+
// Dry layout action box (if exists) with same strategy
217225
TooltipLayoutSlot.actionBox.getObjectManager?.performDryLayout(
218-
const BoxConstraints.tightFor(),
226+
const BoxConstraints(),
219227
);
228+
if (_actionBoxSize.width > _availableScreenWidth) {
229+
TooltipLayoutSlot.actionBox.getObjectManager?.performDryLayout(
230+
BoxConstraints(maxWidth: _availableScreenWidth),
231+
);
232+
}
220233
_minimumActionBoxSize = _actionBoxSize;
221234
}
222235

0 commit comments

Comments
 (0)