Skip to content

Commit

Permalink
Merge pull request #386 from Sensirex/master
Browse files Browse the repository at this point in the history
feat: ✨ Added `enableAutoScroll` to `showcase`
  • Loading branch information
aditya-css authored Dec 3, 2024
2 parents 772b28c + b0ea220 commit cf351c2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ WidgetsBinding.instance.addPostFrameCallback((_) =>
| toolTipSlideEndDistance | double | 7 | Defines motion range for tooltip slide animation |||
| tooltipActions | List<TooltipActionButton>? | [] | 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`:

Expand Down
11 changes: 10 additions & 1 deletion lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:**
///
Expand Down Expand Up @@ -407,6 +414,7 @@ class Showcase extends StatefulWidget {
this.tooltipActions,
this.tooltipActionConfig,
this.scrollAlignment = 0.5,
this.enableAutoScroll,
}) : height = null,
width = null,
container = null,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -580,7 +589,7 @@ class _ShowcaseState extends State<Showcase> {
});

if (activeStep == widget.key) {
if (showCaseWidgetState.enableAutoScroll) {
if (widget.enableAutoScroll ?? showCaseWidgetState.enableAutoScroll) {
_scrollIntoView();
}

Expand Down

0 comments on commit cf351c2

Please sign in to comment.