Skip to content

Commit

Permalink
fix: 🐛 Ignore extra _nextIfAny function operations as showcase mayb…
Browse files Browse the repository at this point in the history
…e discarded at time of next call (#410)

- Added `isShowCaseCompleted` getter to check the showcase is completed or not
- If the showcase is already completed no need to further process the `_nextIfAny` function operations and we will stop execution of this function. This may happen if a user taps very fast and lots of time on the showcase barrier
  • Loading branch information
Sahil-Simform committed Mar 8, 2024
1 parent 3623642 commit 189a760
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ class _ShowcaseState extends State<Showcase> {
}

Future<void> _nextIfAny() async {
if (showCaseWidgetState.isShowCaseCompleted) return;

if (timer != null && timer!.isActive) {
if (showCaseWidgetState.enableAutoPlayLock) {
return;
Expand All @@ -483,6 +485,7 @@ class _ShowcaseState extends State<Showcase> {
timer = null;
}
await _reverseAnimateTooltip();
if (showCaseWidgetState.isShowCaseCompleted) return;
showCaseWidgetState.completed(widget.key);
}

Expand Down
2 changes: 2 additions & 0 deletions lib/src/showcase_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ class ShowCaseWidgetState extends State<ShowCaseWidget> {

bool get enableShowcase => widget.enableShowcase;

bool get isShowCaseCompleted => ids == null && activeWidgetId == null;

/// Returns value of [ShowCaseWidget.blurValue]
double get blurValue => widget.blurValue;

Expand Down

0 comments on commit 189a760

Please sign in to comment.