Skip to content

Commit 8a6b9d7

Browse files
fix: 🐛 Fixed tooltip rendering issue (#575)
Co-authored-by: Sahil-simform <[email protected]>
1 parent 721e823 commit 8a6b9d7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/src/tooltip/tooltip_layout_id.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class _TooltipLayoutId extends ParentDataWidget<MultiChildLayoutParentData> {
2525
const _TooltipLayoutId({
2626
required this.id,
2727
required super.child,
28+
required super.key,
2829
});
2930

3031
final Object id;

lib/src/tooltip/tooltip_wrapper.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ class _ToolTipWrapperState extends State<ToolTipWrapper>
215215
),
216216
),
217217
);
218-
219218
return Material(
220219
type: MaterialType.transparency,
221220
child: _AnimatedTooltipMultiLayout(
@@ -243,15 +242,22 @@ class _ToolTipWrapperState extends State<ToolTipWrapper>
243242
Offset.zero,
244243
targetTooltipGap: widget.targetTooltipGap,
245244
children: [
245+
// We have to use UniqueKey here to avoid the issue with the
246+
// _TooltipLayoutId being reused and causing layout issues
247+
// See: documentation of [MultiChildRenderObjectWidget] for more
248+
// details and to reproduce issue navigate to details screen in
249+
// example app with route transition
246250
_TooltipLayoutId(
247251
id: TooltipLayoutSlot.tooltipBox,
252+
key: UniqueKey(),
248253
child: defaultToolTipWidget,
249254
),
250255
if (widget.tooltipActions.isNotEmpty &&
251256
(widget.tooltipActionConfig.position.isOutside ||
252257
widget.container != null))
253258
_TooltipLayoutId(
254259
id: TooltipLayoutSlot.actionBox,
260+
key: UniqueKey(),
255261
child: ActionWidget(
256262
tooltipActionConfig: widget.tooltipActionConfig,
257263
children: widget.tooltipActions,
@@ -260,6 +266,7 @@ class _ToolTipWrapperState extends State<ToolTipWrapper>
260266
if (widget.showArrow)
261267
_TooltipLayoutId(
262268
id: TooltipLayoutSlot.arrow,
269+
key: UniqueKey(),
263270
child: ShowcaseArrow(
264271
strokeColor: widget.tooltipBackgroundColor,
265272
),

0 commit comments

Comments
 (0)