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: ✨ Add disableAutoScroll to Showcase #386

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ class Showcase extends StatefulWidget {
/// will still provide a callback.
final VoidCallback? onBarrierClick;

final bool disableAutoScroll;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add documentation for this variable?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please rename this to the same variable used in ShowCaseWidget as they serve the same purpose? i.e. enableAutoScroll

const Showcase({
required this.key,
required this.description,
Expand Down Expand Up @@ -288,6 +289,7 @@ class Showcase extends StatefulWidget {
this.titleTextDirection,
this.descriptionTextDirection,
this.onBarrierClick,
this.disableAutoScroll = false
}) : height = null,
width = null,
container = null,
Expand Down Expand Up @@ -325,6 +327,7 @@ class Showcase extends StatefulWidget {
this.disableDefaultTargetGestures = false,
this.tooltipPosition,
this.onBarrierClick,
this.disableAutoScroll = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make default value true as if parent class(ShowCaseViewWidget) variable enableAutoScroll is true than we don't need to add enableAutoScroll in all child class(ShowCase)

}) : showArrow = false,
onToolTipClick = null,
scaleAnimationDuration = const Duration(milliseconds: 300),
Expand Down Expand Up @@ -386,7 +389,7 @@ class _ShowcaseState extends State<Showcase> {
});

if (activeStep == widget.key) {
if (showCaseWidgetState.enableAutoScroll) {
if (showCaseWidgetState.enableAutoScroll && !this.widget.disableAutoScroll) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can directly use widget and remove this here.

_scrollIntoView();
}

Expand Down
Loading