Skip to content

Commit

Permalink
feat: ✨ Add callback when barrier has been clicked (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
ujas-m-simformsolutions committed Mar 22, 2023
1 parent 1f43302 commit 5495cee
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## (Unreleased)
## [2.0.3] (Unreleased)
- 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.

## [2.0.2]
- Fixed [#335](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/335) - Fixed flutter inspector makes screen grey
- Fixed [#335](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/335) - Flutter inspector makes screen grey
- Fixed [#346](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/346) - Dont respond to any clicks in target.

## [2.0.1]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ WidgetsBinding.instance.addPostFrameCallback((_) =>
| onTargetClick | VoidCallback? | | Triggers when target widget is being clicked |||
| onTargetDoubleTap | VoidCallback? | | Triggers when target widget is being double clicked |||
| onTargetLongPress | VoidCallback? | | Triggers when target widget is being long pressed |||
| onBarrierClick | VoidCallback? | | Triggers when barrier is clicked |||
| tooltipPosition | TooltipPosition? | | Defines vertical position of tooltip respective to Target widget |||
| titlePadding | EdgeInsets? | EdgeInsets.zero | Padding to title || |
| descriptionPadding | EdgeInsets? | EdgeInsets.zero | Padding to description || |
Expand Down
2 changes: 2 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ class _MailPageState extends State<MailPage> {
key: _one,
description: 'Tap to see menu options',
disableDefaultTargetGestures: true,
onBarrierClick: () =>
debugPrint('Barrier clicked'),
child: GestureDetector(
onTap: () =>
debugPrint('menu button clicked'),
Expand Down
9 changes: 9 additions & 0 deletions lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ class Showcase extends StatefulWidget {
/// Provides text direction of tooltip description.
final TextDirection? descriptionTextDirection;

/// Provides a callback when barrier has been clicked.
///
/// Note-: Even if barrier interactions are disabled, this handler
/// will still provide a callback.
final VoidCallback? onBarrierClick;

const Showcase({
required this.key,
required this.description,
Expand Down Expand Up @@ -281,6 +287,7 @@ class Showcase extends StatefulWidget {
this.descriptionPadding,
this.titleTextDirection,
this.descriptionTextDirection,
this.onBarrierClick,
}) : height = null,
width = null,
container = null,
Expand Down Expand Up @@ -317,6 +324,7 @@ class Showcase extends StatefulWidget {
this.onTargetDoubleTap,
this.disableDefaultTargetGestures = false,
this.tooltipPosition,
this.onBarrierClick,
}) : showArrow = false,
onToolTipClick = null,
scaleAnimationDuration = const Duration(milliseconds: 300),
Expand Down Expand Up @@ -486,6 +494,7 @@ class _ShowcaseState extends State<Showcase> {
if (!showCaseWidgetState.disableBarrierInteraction) {
_nextIfAny();
}
widget.onBarrierClick?.call();
},
child: ClipPath(
clipper: RRectClipper(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: showcaseview
description: A Flutter package to Showcase/Highlight widgets step by step.
version: 2.0.2
version: 2.0.3
homepage: https://github.com/simformsolutions/flutter_showcaseview
issue_tracker: https://github.com/simformsolutions/flutter_showcaseview/issues

Expand Down

0 comments on commit 5495cee

Please sign in to comment.