Skip to content

Commit cf351c2

Browse files
authored
Merge pull request #386 from Sensirex/master
feat: ✨ Added `enableAutoScroll` to `showcase`
2 parents 772b28c + b0ea220 commit cf351c2

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
feasibility to change margin of tooltip with `toolTipMargin`.
66
- Feature [#478](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/478) - Added
77
feasibility to change auto scroll widget alignment `scrollAlignment`.
8+
- Feature ✨: Added `enableAutoScroll` to `showcase`.
89

910
## [3.0.0]
1011
- [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)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ WidgetsBinding.instance.addPostFrameCallback((_) =>
209209
| toolTipSlideEndDistance | double | 7 | Defines motion range for tooltip slide animation |||
210210
| tooltipActions | List<TooltipActionButton>? | [] | Provide a list of tooltip actions |||
211211
| tooltipActionConfig | TooltipActionConfig? | | Give configurations (alignment, position, etc...) to the tooltip actionbar |||
212+
| enableAutoScroll | bool? | ShowCaseWidget.enableAutoScroll | This is used to override the `ShowCaseWidget.enableAutoScroll` behaviour |||
212213

213214
## Properties of `TooltipActionButton` and `TooltipActionButton.custom`:
214215

lib/src/showcase.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,12 @@ class Showcase extends StatefulWidget {
289289
/// Defaults to 0.5.
290290
final double scrollAlignment;
291291

292+
/// While target widget is out viewport then
293+
/// whether enabling auto scroll so as to make the target widget visible.
294+
/// This is used to override the [ShowCaseWidget.enableAutoScroll] behaviour
295+
/// for this showcase.
296+
final bool? enableAutoScroll;
297+
292298
/// Highlights a specific widget on the screen with an informative tooltip.
293299
///
294300
/// This widget helps you showcase specific parts of your UI by drawing an
@@ -350,6 +356,7 @@ class Showcase extends StatefulWidget {
350356
/// - `tooltipActions`: A list of custom actions (widgets) to display within the tooltip.
351357
/// - `tooltipActionConfig`: Configuration options for custom tooltip actions.
352358
/// - `scrollAlignment`: Defines the alignment for the auto scroll function.
359+
/// - `enableAutoScroll`:This is used to override the [ShowCaseWidget.enableAutoScroll] behaviour for this showcase.
353360
///
354361
/// **Assertions:**
355362
///
@@ -407,6 +414,7 @@ class Showcase extends StatefulWidget {
407414
this.tooltipActions,
408415
this.tooltipActionConfig,
409416
this.scrollAlignment = 0.5,
417+
this.enableAutoScroll,
410418
}) : height = null,
411419
width = null,
412420
container = null,
@@ -502,6 +510,7 @@ class Showcase extends StatefulWidget {
502510
this.tooltipActions,
503511
this.tooltipActionConfig,
504512
this.scrollAlignment = 0.5,
513+
this.enableAutoScroll,
505514
}) : showArrow = false,
506515
onToolTipClick = null,
507516
scaleAnimationDuration = const Duration(milliseconds: 300),
@@ -580,7 +589,7 @@ class _ShowcaseState extends State<Showcase> {
580589
});
581590

582591
if (activeStep == widget.key) {
583-
if (showCaseWidgetState.enableAutoScroll) {
592+
if (widget.enableAutoScroll ?? showCaseWidgetState.enableAutoScroll) {
584593
_scrollIntoView();
585594
}
586595

0 commit comments

Comments
 (0)