diff --git a/CHANGELOG.md b/CHANGELOG.md index aea4e79f..8414db35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ feasibility to change margin of tooltip with `toolTipMargin`. - Feature [#478](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/478) - Added feasibility to change auto scroll widget alignment `scrollAlignment`. +- Feature ✨: Added `enableAutoScroll` to `showcase`. ## [3.0.0] - [BREAKING] Fixed [#434](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/434) removed deprecated text style after Flutter 3.22 follow [migration guide](https://docs.flutter.dev/release/breaking-changes/3-19-deprecations#texttheme) diff --git a/README.md b/README.md index a71787d6..4cf29b9c 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ WidgetsBinding.instance.addPostFrameCallback((_) => | toolTipSlideEndDistance | double | 7 | Defines motion range for tooltip slide animation | ✅ | ✅ | | tooltipActions | List? | [] | Provide a list of tooltip actions | ✅ | ✅ | | tooltipActionConfig | TooltipActionConfig? | | Give configurations (alignment, position, etc...) to the tooltip actionbar | ✅ | ✅ | +| enableAutoScroll | bool? | ShowCaseWidget.enableAutoScroll | This is used to override the `ShowCaseWidget.enableAutoScroll` behaviour | ✅ | ✅ | ## Properties of `TooltipActionButton` and `TooltipActionButton.custom`: diff --git a/lib/src/showcase.dart b/lib/src/showcase.dart index a3970c44..ae9fad84 100644 --- a/lib/src/showcase.dart +++ b/lib/src/showcase.dart @@ -289,6 +289,12 @@ class Showcase extends StatefulWidget { /// Defaults to 0.5. final double scrollAlignment; + /// While target widget is out viewport then + /// whether enabling auto scroll so as to make the target widget visible. + /// This is used to override the [ShowCaseWidget.enableAutoScroll] behaviour + /// for this showcase. + final bool? enableAutoScroll; + /// Highlights a specific widget on the screen with an informative tooltip. /// /// This widget helps you showcase specific parts of your UI by drawing an @@ -350,6 +356,7 @@ class Showcase extends StatefulWidget { /// - `tooltipActions`: A list of custom actions (widgets) to display within the tooltip. /// - `tooltipActionConfig`: Configuration options for custom tooltip actions. /// - `scrollAlignment`: Defines the alignment for the auto scroll function. + /// - `enableAutoScroll`:This is used to override the [ShowCaseWidget.enableAutoScroll] behaviour for this showcase. /// /// **Assertions:** /// @@ -407,6 +414,7 @@ class Showcase extends StatefulWidget { this.tooltipActions, this.tooltipActionConfig, this.scrollAlignment = 0.5, + this.enableAutoScroll, }) : height = null, width = null, container = null, @@ -502,6 +510,7 @@ class Showcase extends StatefulWidget { this.tooltipActions, this.tooltipActionConfig, this.scrollAlignment = 0.5, + this.enableAutoScroll, }) : showArrow = false, onToolTipClick = null, scaleAnimationDuration = const Duration(milliseconds: 300), @@ -580,7 +589,7 @@ class _ShowcaseState extends State { }); if (activeStep == widget.key) { - if (showCaseWidgetState.enableAutoScroll) { + if (widget.enableAutoScroll ?? showCaseWidgetState.enableAutoScroll) { _scrollIntoView(); }