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: ✨Provided barrier click disable functionality for a particular … #392

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [2.0.4] (Un-Released)
- Feature [#387](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/387) - Provided barrier click disable functionality for a particular showcase.

## [2.0.3]
- Feature [#148](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/148) - Add feasibility to add `textDirection` of `title` and `description`.
- Feature [#272](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/272) - Add barrier click callback.
Expand Down
1 change: 0 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ class _MailPageState extends State<MailPage> {
Showcase(
key: _one,
description: 'Tap to see menu options',
disableDefaultTargetGestures: true,
onBarrierClick: () =>
debugPrint('Barrier clicked'),
child: GestureDetector(
Expand Down
16 changes: 13 additions & 3 deletions lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ class Showcase extends StatefulWidget {
/// will still provide a callback.
final VoidCallback? onBarrierClick;

/// Disables barrier interaction for a particular showCase.
final bool disableBarrierInteraction;

const Showcase({
required this.key,
required this.description,
Expand Down Expand Up @@ -288,6 +291,7 @@ class Showcase extends StatefulWidget {
this.titleTextDirection,
this.descriptionTextDirection,
this.onBarrierClick,
this.disableBarrierInteraction = false,
}) : height = null,
width = null,
container = null,
Expand All @@ -296,7 +300,9 @@ class Showcase extends StatefulWidget {
assert(onTargetClick == null || disposeOnTap != null,
"disposeOnTap is required if you're using onTargetClick"),
assert(disposeOnTap == null || onTargetClick != null,
"onTargetClick is required if you're using disposeOnTap");
"onTargetClick is required if you're using disposeOnTap"),
assert(onBarrierClick == null || disableBarrierInteraction == false,
"can't use onBarrierClick & disableBarrierInteraction property at same time");

const Showcase.withWidget({
required this.key,
Expand Down Expand Up @@ -325,6 +331,7 @@ class Showcase extends StatefulWidget {
this.disableDefaultTargetGestures = false,
this.tooltipPosition,
this.onBarrierClick,
this.disableBarrierInteraction = false,
}) : showArrow = false,
onToolTipClick = null,
scaleAnimationDuration = const Duration(milliseconds: 300),
Expand All @@ -346,7 +353,9 @@ class Showcase extends StatefulWidget {
titleTextDirection = null,
descriptionTextDirection = null,
assert(overlayOpacity >= 0.0 && overlayOpacity <= 1.0,
"overlay opacity must be between 0 and 1.");
"overlay opacity must be between 0 and 1."),
assert(onBarrierClick == null || disableBarrierInteraction == false,
"can't use onBarrierClick & disableBarrierInteraction property at same time");

@override
State<Showcase> createState() => _ShowcaseState();
Expand Down Expand Up @@ -491,7 +500,8 @@ class _ShowcaseState extends State<Showcase> {
children: [
GestureDetector(
onTap: () {
if (!showCaseWidgetState.disableBarrierInteraction) {
if (!showCaseWidgetState.disableBarrierInteraction &&
!widget.disableBarrierInteraction) {
_nextIfAny();
}
widget.onBarrierClick?.call();
Expand Down
Loading