show<T extends TutorialEntry> method

void show<T extends TutorialEntry>(
  1. BuildContext context, {
  2. GlobalKey<TutorialWidgetState>? key,
  3. required List<T> children,
  4. DialogBuilder? dialogBuilder,
  5. Color backgroundColor = Colors.black,
  6. double backgroundMaxOpacity = 0.5,
  7. AnimationController? opacityAnimationController,
  8. AnimationController? highlightAnimationController,
  9. Animation<double>? opacityAnimation,
  10. Animation<double>? highlightAnimation,
  11. OnPressedBehavior onPressedBehavior = OnPressedBehavior.next,
  12. Future<void> prepareNext()?,
})

Implementation

void show<T extends TutorialEntry>(
  BuildContext context, {
  GlobalKey<TutorialWidgetState>? key,
  required List<T> children,
  DialogBuilder? dialogBuilder,
  Color backgroundColor = Colors.black,
  double backgroundMaxOpacity = 0.5,
  AnimationController? opacityAnimationController,
  AnimationController? highlightAnimationController,
  Animation<double>? opacityAnimation,
  Animation<double>? highlightAnimation,
  OnPressedBehavior onPressedBehavior = OnPressedBehavior.next,

  /// Place to wait for any animations between tutorial items to finish.
  ///
  /// Works only with [onPressedBehaviour] set to [OnPressedBehavior.next].
  /// Called before firing next event on tap.
  Future<void> Function()? prepareNext,
}) {
  if (!_isVisible) {
    _isVisible = true;

    key = key ?? GlobalKey<TutorialWidgetState>();

    _overlayBackground = _overlayBackground ??
        OverlayEntry(
          builder: (BuildContext context) => TutorialWidget<T>(
            key: key,
            children: children,
            close: () => _close(key!),
            dialogBuilder: dialogBuilder,
            backgroundColor: backgroundColor,
            backgroundMaxOpacity: backgroundMaxOpacity,
            highlightAnimation: highlightAnimation,
            opacityAnimation: opacityAnimation,
            opacityAnimationController: opacityAnimationController,
            highlightAnimationController: highlightAnimationController,
            onPressedBehavior: onPressedBehavior,
            prepareNext: prepareNext,
          ),
        );

    Overlay.of(context)?.insert(_overlayBackground!);
  }
}