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

Skip Showcase feature #491

Closed
wants to merge 1 commit into from
Closed
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
35 changes: 35 additions & 0 deletions lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,16 @@ class Showcase extends StatefulWidget {
/// This is used to override the [ShowCaseWidget.enableAutoScroll] behaviour
/// for this showcase.
final bool? enableAutoScroll;

/// Shows skip showcase button.
final bool enableSkipButton;

/// Skip showcase button label.
final String SkipButtonLabel;

/// Skip showcase button label style.
final TextStyle skipLabelStyle;


/// Highlights a specific widget on the screen with an informative tooltip.
///
Expand Down Expand Up @@ -421,6 +431,9 @@ class Showcase extends StatefulWidget {
this.scrollAlignment = 0.5,
this.enableAutoScroll,
this.floatingActionWidget,
this.enableSkipButton = false,
this.SkipButtonLabel = 'SKIP',
this.skipLabelStyle = const TextStyle(color: Colors.white),
}) : height = null,
width = null,
container = null,
Expand Down Expand Up @@ -519,6 +532,9 @@ class Showcase extends StatefulWidget {
this.tooltipActionConfig,
this.scrollAlignment = 0.5,
this.enableAutoScroll,
this.enableSkipButton = false,
this.SkipButtonLabel = 'SKIP',
this.skipLabelStyle = const TextStyle(color: Colors.white),
}) : showArrow = false,
onToolTipClick = null,
scaleAnimationDuration = const Duration(milliseconds: 300),
Expand Down Expand Up @@ -830,6 +846,25 @@ class _ShowcaseState extends State<Showcase> {
tooltipActions: _getTooltipActions(),
),
],
if (widget.enableSkipButton)
Positioned(
bottom: 0,
right: 0,
child: GestureDetector(
onTap: () {
ShowCaseWidget.of(context).dismiss();
},
child: Padding(
padding: EdgeInsets.all(50),
child: Text(
widget.SkipButtonLabel,
style: Theme.of(context).textTheme.titleLarge!.merge(
widget.skipLabelStyle,
),
),
),
),
),
],
);
}
Expand Down
Loading