From 0947bc91af2603c4080223a160564e13bf49643a Mon Sep 17 00:00:00 2001 From: Vatsal Tanna Date: Tue, 22 Oct 2024 10:54:21 +0530 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8Provided=20alignment=20paramet?= =?UTF-8?q?er=20to=20adjust=20the=20auto=20scroll=20alignment=20property?= =?UTF-8?q?=20(#478).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ README.md | 1 + lib/src/showcase.dart | 10 +++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b4a4cca..aea4e79f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ - Feature ✨: Added Action widget for tooltip - Feature [#475](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/475) - Add 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`. ## [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 9e5dbe91..84b0f39a 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ WidgetsBinding.instance.addPostFrameCallback((_) => | toolTipMargin | double | 14 | For tooltip margin | | globalTooltipActionConfig | TooltipActionConfig? | | Global tooltip actionbar config | | globalTooltipActions | List? | | Global list of tooltip actions | +| scrollAlignment | double | 0.5 | For Auto scroll widget alignment | ## Properties of `Showcase` and `Showcase.withWidget`: diff --git a/lib/src/showcase.dart b/lib/src/showcase.dart index faeb98e0..a3970c44 100644 --- a/lib/src/showcase.dart +++ b/lib/src/showcase.dart @@ -284,6 +284,11 @@ class Showcase extends StatefulWidget { /// Default to [const TooltipActionConfig()] final TooltipActionConfig? tooltipActionConfig; + /// Defines the alignment for the auto scroll function. + /// + /// Defaults to 0.5. + final double scrollAlignment; + /// Highlights a specific widget on the screen with an informative tooltip. /// /// This widget helps you showcase specific parts of your UI by drawing an @@ -344,6 +349,7 @@ class Showcase extends StatefulWidget { /// - `toolTipMargin`: The margin around the tooltip (defaults to 14dp). /// - `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. /// /// **Assertions:** /// @@ -400,6 +406,7 @@ class Showcase extends StatefulWidget { this.toolTipMargin = 14, this.tooltipActions, this.tooltipActionConfig, + this.scrollAlignment = 0.5, }) : height = null, width = null, container = null, @@ -494,6 +501,7 @@ class Showcase extends StatefulWidget { this.toolTipSlideEndDistance = 7, this.tooltipActions, this.tooltipActionConfig, + this.scrollAlignment = 0.5, }) : showArrow = false, onToolTipClick = null, scaleAnimationDuration = const Duration(milliseconds: 300), @@ -590,7 +598,7 @@ class _ShowcaseState extends State { await Scrollable.ensureVisible( widget.key.currentContext!, duration: showCaseWidgetState.widget.scrollDuration, - alignment: 0.5, + alignment: widget.scrollAlignment, ); setState(() => _isScrollRunning = false); });