From 9addc098f2c33593341cd63e33fd0a671eefa6e9 Mon Sep 17 00:00:00 2001 From: Sensirex pc Date: Mon, 14 Aug 2023 15:30:29 +0700 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E2=9C=A8=20Add=20disabling=20auto?= =?UTF-8?q?=20scroll(disableAutoScroll)=20for=20concreate=20tooltip=20(Sho?= =?UTF-8?q?wcase)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/showcase.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/showcase.dart b/lib/src/showcase.dart index ee574a07..9bdb50e1 100644 --- a/lib/src/showcase.dart +++ b/lib/src/showcase.dart @@ -244,6 +244,7 @@ class Showcase extends StatefulWidget { /// will still provide a callback. final VoidCallback? onBarrierClick; + final bool disableAutoScroll; const Showcase({ required this.key, required this.description, @@ -288,6 +289,7 @@ class Showcase extends StatefulWidget { this.titleTextDirection, this.descriptionTextDirection, this.onBarrierClick, + this.disableAutoScroll = false }) : height = null, width = null, container = null, @@ -325,6 +327,7 @@ class Showcase extends StatefulWidget { this.disableDefaultTargetGestures = false, this.tooltipPosition, this.onBarrierClick, + this.disableAutoScroll = false }) : showArrow = false, onToolTipClick = null, scaleAnimationDuration = const Duration(milliseconds: 300), @@ -386,7 +389,7 @@ class _ShowcaseState extends State { }); if (activeStep == widget.key) { - if (showCaseWidgetState.enableAutoScroll) { + if (showCaseWidgetState.enableAutoScroll && !this.widget.disableAutoScroll) { _scrollIntoView(); } From 9e3d4e2f0fdb2b349c0198fabebee1394bbd178a Mon Sep 17 00:00:00 2001 From: Sahil-Simform Date: Tue, 3 Dec 2024 13:38:24 +0530 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=F0=9F=A9=B9Fixed=20review=20comment?= =?UTF-8?q?s=20and=20updated=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + README.md | 1 + lib/src/showcase.dart | 13 +++++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aea4e79f..8414db35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index a71787d6..5c4aef5d 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ WidgetsBinding.instance.addPostFrameCallback((_) => | toolTipSlideEndDistance | double | 7 | Defines motion range for tooltip slide animation | ✅ | ✅ | | tooltipActions | List? | [] | Provide a list of tooltip actions | ✅ | ✅ | | tooltipActionConfig | TooltipActionConfig? | | Give configurations (alignment, position, etc...) to the tooltip actionbar | ✅ | ✅ | +| disableAutoScroll | bool? | | This is used to override the `ShowCaseWidget.enableAutoScroll` behaviour | ✅ | ✅ | ## Properties of `TooltipActionButton` and `TooltipActionButton.custom`: diff --git a/lib/src/showcase.dart b/lib/src/showcase.dart index 15199500..baadce01 100644 --- a/lib/src/showcase.dart +++ b/lib/src/showcase.dart @@ -289,7 +289,11 @@ class Showcase extends StatefulWidget { /// Defaults to 0.5. final double scrollAlignment; - final bool disableAutoScroll; + /// 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. /// @@ -352,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:** /// @@ -409,7 +414,7 @@ class Showcase extends StatefulWidget { this.tooltipActions, this.tooltipActionConfig, this.scrollAlignment = 0.5, - this.disableAutoScroll = false + this.enableAutoScroll, }) : height = null, width = null, container = null, @@ -505,7 +510,7 @@ class Showcase extends StatefulWidget { this.tooltipActions, this.tooltipActionConfig, this.scrollAlignment = 0.5, - this.disableAutoScroll = false + this.enableAutoScroll, }) : showArrow = false, onToolTipClick = null, scaleAnimationDuration = const Duration(milliseconds: 300), @@ -584,7 +589,7 @@ class _ShowcaseState extends State { }); if (activeStep == widget.key) { - if (showCaseWidgetState.enableAutoScroll && !this.widget.disableAutoScroll) { + if (widget.enableAutoScroll ?? showCaseWidgetState.enableAutoScroll) { _scrollIntoView(); } From b0ea2206eab650990538db0e077b7f9891128b09 Mon Sep 17 00:00:00 2001 From: Sahil-Simform Date: Tue, 3 Dec 2024 16:47:34 +0530 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=F0=9F=91=8CUpdated=20`README.md`=20?= =?UTF-8?q?file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- lib/src/showcase.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c4aef5d..4cf29b9c 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,7 @@ WidgetsBinding.instance.addPostFrameCallback((_) => | toolTipSlideEndDistance | double | 7 | Defines motion range for tooltip slide animation | ✅ | ✅ | | tooltipActions | List? | [] | Provide a list of tooltip actions | ✅ | ✅ | | tooltipActionConfig | TooltipActionConfig? | | Give configurations (alignment, position, etc...) to the tooltip actionbar | ✅ | ✅ | -| disableAutoScroll | bool? | | This is used to override the `ShowCaseWidget.enableAutoScroll` behaviour | ✅ | ✅ | +| enableAutoScroll | bool? | ShowCaseWidget.enableAutoScroll | This is used to override the `ShowCaseWidget.enableAutoScroll` behaviour | ✅ | ✅ | ## Properties of `TooltipActionButton` and `TooltipActionButton.custom`: diff --git a/lib/src/showcase.dart b/lib/src/showcase.dart index baadce01..ae9fad84 100644 --- a/lib/src/showcase.dart +++ b/lib/src/showcase.dart @@ -356,7 +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 + /// - `enableAutoScroll`:This is used to override the [ShowCaseWidget.enableAutoScroll] behaviour for this showcase. /// /// **Assertions:** ///