Skip to content

Commit bdd5c1e

Browse files
committed
fix: 🐛 Fixed Rendering issues with scrollable showcase views inside withWidget
1 parent 705b8d9 commit bdd5c1e

File tree

4 files changed

+71
-60
lines changed

4 files changed

+71
-60
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [5.0.2] (unreleased)
2+
3+
- Fixed [#590](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/590) - Fixed Rendering issues with scrollable showcase views inside withWidget
4+
15
## [5.0.1]
26

37
- Fixed [#576](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/576) - Fixed the showcase key update issue by removing the old controller entry and registering the new key.

example/lib/main.dart

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -441,37 +441,14 @@ class _MailPageState extends State<MailPage> {
441441
GestureDetector showcaseMailTile(GlobalKey<State<StatefulWidget>> key,
442442
bool showCaseDetail, BuildContext context, Mail mail) {
443443
return GestureDetector(
444-
onTap: () {
445-
Navigator.push<void>(
446-
context,
447-
MaterialPageRoute<void>(
448-
builder: (_) => const Detail(),
449-
),
450-
);
451-
},
444+
onTap:navigateToDetailScreen,
452445
child: Container(
453446
padding: const EdgeInsets.symmetric(vertical: 8),
454447
child: Showcase(
455448
key: key,
456449
description: 'Tap to check mail',
457450
disposeOnTap: true,
458-
onTargetClick: () {
459-
Navigator.push<void>(
460-
context,
461-
MaterialPageRoute<void>(
462-
builder: (_) => const Detail(),
463-
),
464-
).then((_) {
465-
// First we need to unregister the details screen showcase
466-
// as get method will use the latest registered scopes
467-
ShowcaseView.getNamed("_detailsScreen").unregister();
468-
469-
// Then we need to start the main screen showcase
470-
ShowcaseView.get().startShowCase(
471-
[_four, _lastShowcaseWidget],
472-
);
473-
});
474-
},
451+
onTargetClick: navigateToDetailScreen,
475452
tooltipActionConfig: const TooltipActionConfig(
476453
alignment: MainAxisAlignment.spaceBetween,
477454
actionGap: 16,
@@ -515,6 +492,24 @@ class _MailPageState extends State<MailPage> {
515492
),
516493
);
517494
}
495+
496+
void navigateToDetailScreen() {
497+
Navigator.push<void>(
498+
context,
499+
MaterialPageRoute<void>(
500+
builder: (_) => const Detail(),
501+
),
502+
).then((_) {
503+
// First we need to unregister the details screen showcase
504+
// as get method will use the latest registered scopes
505+
ShowcaseView.getNamed("_detailsScreen").unregister();
506+
507+
// Then we need to start the main screen showcase
508+
ShowcaseView.get().startShowCase(
509+
[_four, _lastShowcaseWidget],
510+
);
511+
});
512+
}
518513
}
519514

520515
class SAvatarExampleChild extends StatelessWidget {

lib/src/tooltip/render_animation_delegate.dart

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class _RenderAnimationDelegate extends _RenderPositionDelegate {
152152
'Tooltip should only take `_TooltipLayoutId` as a child',
153153
);
154154
final childParentData = child.parentData! as MultiChildLayoutParentData;
155-
context.canvas.save();
155+
final currentChild = child; // Capture non-null child for closure
156156

157157
// Calculate target widget bounds.
158158
final targetRect = Rect.fromLTWH(
@@ -206,21 +206,29 @@ class _RenderAnimationDelegate extends _RenderPositionDelegate {
206206
toolTipSlideEndDistance,
207207
);
208208

209-
context.canvas
209+
// Use pushTransform for RepaintBoundary compatibility
210+
// Create transformation matrix
211+
final transform = Matrix4.identity()
210212
..translate(scaleOrigin.dx, scaleOrigin.dy)
211213
..scale(_scaleAnimation.value);
212214

213-
// paint children
214-
_paintChildren(
215-
context.canvas,
216-
context.paintChild,
217-
child,
218-
childParentData,
219-
scaleOrigin,
220-
moveOffset,
215+
// Paint children with transform
216+
context.pushTransform(
217+
needsCompositing,
218+
offset,
219+
transform,
220+
(context, offset) {
221+
_paintChildren(
222+
context.canvas,
223+
context.paintChild,
224+
currentChild,
225+
childParentData,
226+
scaleOrigin,
227+
moveOffset,
228+
);
229+
},
221230
);
222231

223-
context.canvas.restore();
224232
child = childParentData.nextSibling;
225233
}
226234
_isPreviousRepaintInProgress = false;

lib/src/tooltip/tooltip_wrapper.dart

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ class _ToolTipWrapperState extends State<ToolTipWrapper>
179179
: SystemMouseCursors.click,
180180
child: GestureDetector(
181181
onTap: widget.onTooltipTap,
182-
child: widget.container ?? const SizedBox.shrink(),
182+
child: RepaintBoundary(
183+
child: widget.container ?? const SizedBox.shrink(),
184+
),
183185
),
184186
)
185187
: MouseRegion(
@@ -188,29 +190,31 @@ class _ToolTipWrapperState extends State<ToolTipWrapper>
188190
: SystemMouseCursors.click,
189191
child: GestureDetector(
190192
onTap: widget.onTooltipTap,
191-
child: Container(
192-
padding: widget.tooltipPadding,
193-
decoration: BoxDecoration(
194-
color: widget.tooltipBackgroundColor,
195-
borderRadius: widget.tooltipBorderRadius ??
196-
const BorderRadius.all(Radius.circular(8)),
197-
),
198-
child: ToolTipContent(
199-
title: widget.title,
200-
description: widget.description,
201-
titleTextAlign: widget.titleTextAlign,
202-
descriptionTextAlign: widget.descriptionTextAlign,
203-
titleAlignment: widget.titleAlignment,
204-
descriptionAlignment: widget.descriptionAlignment,
205-
textColor: widget.textColor,
206-
titleTextStyle: widget.titleTextStyle,
207-
descTextStyle: widget.descTextStyle,
208-
titlePadding: widget.titlePadding,
209-
descriptionPadding: widget.descriptionPadding,
210-
titleTextDirection: widget.titleTextDirection,
211-
descriptionTextDirection: widget.descriptionTextDirection,
212-
tooltipActionConfig: widget.tooltipActionConfig,
213-
tooltipActions: widget.tooltipActions,
193+
child: RepaintBoundary(
194+
child: Container(
195+
padding: widget.tooltipPadding,
196+
decoration: BoxDecoration(
197+
color: widget.tooltipBackgroundColor,
198+
borderRadius: widget.tooltipBorderRadius ??
199+
const BorderRadius.all(Radius.circular(8)),
200+
),
201+
child: ToolTipContent(
202+
title: widget.title,
203+
description: widget.description,
204+
titleTextAlign: widget.titleTextAlign,
205+
descriptionTextAlign: widget.descriptionTextAlign,
206+
titleAlignment: widget.titleAlignment,
207+
descriptionAlignment: widget.descriptionAlignment,
208+
textColor: widget.textColor,
209+
titleTextStyle: widget.titleTextStyle,
210+
descTextStyle: widget.descTextStyle,
211+
titlePadding: widget.titlePadding,
212+
descriptionPadding: widget.descriptionPadding,
213+
titleTextDirection: widget.titleTextDirection,
214+
descriptionTextDirection: widget.descriptionTextDirection,
215+
tooltipActionConfig: widget.tooltipActionConfig,
216+
tooltipActions: widget.tooltipActions,
217+
),
214218
),
215219
),
216220
),

0 commit comments

Comments
 (0)