FeaturesTour constructor

const FeaturesTour({
  1. required FeaturesTourController controller,
  2. required double index,
  3. required Widget child,
  4. Key? key,
  5. double? nextIndex,
  6. Duration nextIndexTimeout = const Duration(seconds: 3),
  7. ChildConfig? childConfig,
  8. Widget introduce = const SizedBox.shrink(),
  9. IntroduceConfig? introduceConfig,
  10. NextConfig? nextConfig,
  11. SkipConfig? skipConfig,
  12. DoneConfig? doneConfig,
  13. bool enabled = true,
  14. FutureOr<void> onBeforeIntroduce()?,
  15. FutureOr<void> onAfterIntroduce(
    1. IntroduceResult introduceResult
    )?,
})

Creates a FeaturesTour to display a guided tour for a specific widget.

This widget requires a controller of type FeaturesTourController and a child widget to wrap. You can use childConfig to customize the appearance or behavior of the child widget.

The index is a unique identifier and determines the order in which widgets are shown. It is a double, which allows for the insertion of new features between existing ones. Ensure this value remains unchanged to prevent re-introducing the same feature unnecessarily.

Use nextIndex to specify the next index to display. The app will pause user interaction until the specified index becomes available, making it ideal for scenarios like displaying a FeaturesTour in a dialog that opens after the current feature. To avoid a poor user experience, configure a timeout using nextIndexTimeout, with a default of 3 seconds. Note that nextIndex only applies within the same controller.

You can disable a tour for specific widgets by setting enabled to false. This is particularly useful for lists where only one item should have the tour active. Set enabled to false for all other items.

Use introduce to display introductory information, which can be customized with introduceConfig.

Configure the Next and Skip buttons using nextConfig and skipConfig.

To perform actions before or after the introduction, use onBeforeIntroduce and onAfterIntroduce. In the onAfterIntroduce callback, you can access the IntroduceResult to determine whether the user pressed the Next or Skip button or if they tapped outside the introduction to dismiss it. This allows you to control the flow of the tour based on user interactions.

Implementation

const FeaturesTour({
  required this.controller,
  required this.index,
  required this.child,
  super.key,
  this.nextIndex,
  this.nextIndexTimeout = const Duration(seconds: 3),
  this.childConfig,
  this.introduce = const SizedBox.shrink(),
  this.introduceConfig,
  this.nextConfig,
  this.skipConfig,
  this.doneConfig,
  this.enabled = true,
  this.onBeforeIntroduce,
  this.onAfterIntroduce,
});