Skip to content

Commit 9757786

Browse files
authored
feat: ✨ Adds autoPlayDelay feature to Showcase widget (#538)
1 parent e8957bf commit 9757786

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/src/showcase/showcase.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class Showcase extends StatefulWidget {
8181
this.showArrow = true,
8282
this.onTargetClick,
8383
this.disposeOnTap,
84+
this.autoPlayDelay,
8485
this.movingAnimationDuration = const Duration(milliseconds: 2000),
8586
this.disableMovingAnimation,
8687
this.disableScaleAnimation,
@@ -184,6 +185,7 @@ class Showcase extends StatefulWidget {
184185
this.scrollLoadingWidget = Constants.defaultProgressIndicator,
185186
this.onTargetClick,
186187
this.disposeOnTap,
188+
this.autoPlayDelay,
187189
this.movingAnimationDuration = Constants.defaultAnimationDuration,
188190
this.disableMovingAnimation,
189191
this.targetPadding = EdgeInsets.zero,
@@ -346,6 +348,9 @@ class Showcase extends StatefulWidget {
346348
/// Default to [Duration(milliseconds: 2000)]
347349
final Duration movingAnimationDuration;
348350

351+
/// The delay before the next play start.
352+
final Duration? autoPlayDelay;
353+
349354
/// Triggered when default tooltip is tapped
350355
final VoidCallback? onToolTipClick;
351356

lib/src/showcase/showcase_view.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,12 @@ class ShowcaseView {
424424

425425
if (autoPlay) {
426426
_cancelTimer();
427-
_timer = Timer(autoPlayDelay, () => next(force: true));
427+
// Showcase is first.
428+
final config = _getCurrentActiveControllers.firstOrNull?.config;
429+
_timer = Timer(
430+
config?.autoPlayDelay ?? autoPlayDelay,
431+
() => next(force: true),
432+
);
428433
}
429434
}
430435

0 commit comments

Comments
 (0)