Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- 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.
- Fixed [#578](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/578) - Fixed showcase key issue.
- Fixed [#583](https://github.com/SimformSolutionsPvtLtd/showcaseview/pull/583) - Accommodate
over scroll when auto scroll is enabled.

## [5.0.0]

Expand Down
2 changes: 1 addition & 1 deletion lib/src/showcase/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ class _ShowcaseState extends State<Showcase> {
super.didUpdateWidget(oldWidget);
if (oldWidget == widget) return;
_updateControllerValues();
if(oldWidget.showcaseKey != widget.showcaseKey) {
if (oldWidget.showcaseKey != widget.showcaseKey) {
ShowcaseService.instance.removeController(
key: oldWidget.showcaseKey,
id: _uniqueId,
Expand Down
24 changes: 24 additions & 0 deletions lib/src/showcase/showcase_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ class ShowcaseController {
duration: showcaseView.scrollDuration,
alignment: config.scrollAlignment,
);
// For the cases when scrollAlignment causes overscroll.
await _waitForScrollToSettle();

isScrollRunning = false;
setupShowcase(shouldUpdateOverlay: shouldUpdateOverlay);
Expand Down Expand Up @@ -456,6 +458,28 @@ class ShowcaseController {
scheduler.addPostFrameCallback((_) => process());
}

/// Waits until the scroll position stops changing (settles).
Future<void> _waitForScrollToSettle({
Duration checkInterval = const Duration(milliseconds: 60),
int maxChecks = 120,
}) async {
final scrollableState = Scrollable.maybeOf(_context);
if (scrollableState == null) return;

final position = scrollableState.position;
var lastPixels = position.pixels;
var checks = 0;

while (checks < maxChecks) {
await Future<void>.delayed(checkInterval);
if (!position.hasPixels) break;
final currentPixels = position.pixels;
if ((currentPixels - lastPixels).abs() < 0.5) break;
lastPixels = currentPixels;
checks++;
}
}

@override
int get hashCode => Object.hash(id, key);

Expand Down
7 changes: 6 additions & 1 deletion lib/src/tooltip/tooltip_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ class ToolTipContent extends StatelessWidget {
if (titleWidget != null) titleWidget,
if (descriptionWidget != null) descriptionWidget,
if (actionWidget != null &&
tooltipActionConfig.position.isInsideVertical)
tooltipActionConfig.position.isInsideVertical) ...[
SizedBox(
height: tooltipActionConfig.gapBetweenContentAndAction,
),
actionWidget,
],
],
);

Expand All @@ -116,6 +120,7 @@ class ToolTipContent extends StatelessWidget {
final gap = SizedBox(
width: tooltipActionConfig.gapBetweenContentAndAction,
);

return Row(
mainAxisSize: MainAxisSize.min,
children: [
Expand Down