Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ Added enableAutoScroll to showcase #386

Merged
merged 4 commits into from
Dec 3, 2024
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
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
Loading