Skip to content

Commit 772b28c

Browse files
feat: ✨Provided alignment parameter to adjust the auto scroll alignment property (#478). (#482)
Co-authored-by: Vatsal Tanna <[email protected]>
1 parent 8f0ac0a commit 772b28c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
- Feature ✨: Added Action widget for tooltip
44
- Feature [#475](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/475) - Add
55
feasibility to change margin of tooltip with `toolTipMargin`.
6+
- Feature [#478](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/478) - Added
7+
feasibility to change auto scroll widget alignment `scrollAlignment`.
68

79
## [3.0.0]
810
- [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
@@ -155,6 +155,7 @@ WidgetsBinding.instance.addPostFrameCallback((_) =>
155155
| toolTipMargin | double | 14 | For tooltip margin |
156156
| globalTooltipActionConfig | TooltipActionConfig? | | Global tooltip actionbar config |
157157
| globalTooltipActions | List<TooltipActionButton>? | | Global list of tooltip actions |
158+
| scrollAlignment | double | 0.5 | For Auto scroll widget alignment |
158159

159160
## Properties of `Showcase` and `Showcase.withWidget`:
160161

lib/src/showcase.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ class Showcase extends StatefulWidget {
284284
/// Default to [const TooltipActionConfig()]
285285
final TooltipActionConfig? tooltipActionConfig;
286286

287+
/// Defines the alignment for the auto scroll function.
288+
///
289+
/// Defaults to 0.5.
290+
final double scrollAlignment;
291+
287292
/// Highlights a specific widget on the screen with an informative tooltip.
288293
///
289294
/// This widget helps you showcase specific parts of your UI by drawing an
@@ -344,6 +349,7 @@ class Showcase extends StatefulWidget {
344349
/// - `toolTipMargin`: The margin around the tooltip (defaults to 14dp).
345350
/// - `tooltipActions`: A list of custom actions (widgets) to display within the tooltip.
346351
/// - `tooltipActionConfig`: Configuration options for custom tooltip actions.
352+
/// - `scrollAlignment`: Defines the alignment for the auto scroll function.
347353
///
348354
/// **Assertions:**
349355
///
@@ -400,6 +406,7 @@ class Showcase extends StatefulWidget {
400406
this.toolTipMargin = 14,
401407
this.tooltipActions,
402408
this.tooltipActionConfig,
409+
this.scrollAlignment = 0.5,
403410
}) : height = null,
404411
width = null,
405412
container = null,
@@ -494,6 +501,7 @@ class Showcase extends StatefulWidget {
494501
this.toolTipSlideEndDistance = 7,
495502
this.tooltipActions,
496503
this.tooltipActionConfig,
504+
this.scrollAlignment = 0.5,
497505
}) : showArrow = false,
498506
onToolTipClick = null,
499507
scaleAnimationDuration = const Duration(milliseconds: 300),
@@ -590,7 +598,7 @@ class _ShowcaseState extends State<Showcase> {
590598
await Scrollable.ensureVisible(
591599
widget.key.currentContext!,
592600
duration: showCaseWidgetState.widget.scrollDuration,
593-
alignment: 0.5,
601+
alignment: widget.scrollAlignment,
594602
);
595603
setState(() => _isScrollRunning = false);
596604
});

0 commit comments

Comments
 (0)