getTargetRectGetter method

NextStepInfo getTargetRectGetter(
  1. int stepIndex
)

取得某個步驟的Rect Getter

Implementation

NextStepInfo getTargetRectGetter(
  int stepIndex,
) {
  final step = widget.builder(context, stepIndex);

  final rectGetter = step.targets.map((e) {
    return TargetRectGetter(
      target: e,
      animationVsync: this,
      defaultAnimationDuration: widget.animationDuration,
      defaultAnimationType: widget.animationType,
      defaultAnimationCurve: widget.animationCurve,
      onRectGet: (rect) {
        if (mounted) {
          setState(() {});
        }
        // displayRect[e] = rect;
      },
      rootOverlay: widget.rootOverlay,
    );
  });

  FocusAnimationType? animationType;

  if (rectGetter.isEmpty) {
    animationType = widget.animationType;
  } else {
    if (rectGetter.any((element) => element.animationType.isScreen)) {
      animationType = FocusAnimationType.screen;
    } else {
      animationType = FocusAnimationType.targetCenter;
    }
  }

  return NextStepInfo(
    step: step,
    rectGetter: rectGetter,
    animationType: animationType,
  );
}