presentationFor method
The presentation for anchorKey under the active guide, or null when no
guide is active or no step targets this anchor.
Implementation
ShowcasePresentation? presentationFor(String anchorKey) {
final state = _orchestrator.state;
if (state == null) return null;
final scope = VariableScope.fromSchemas(
state.campaign.config.defaultVariables,
state.payload.variables,
);
final config = state.config;
// Honor the dashboard's `outsideTapBehavior` for scrim/barrier taps instead
// of the engine default (which always advances — silently completing the
// last step and stealing taps meant for the bubble button). 'nothing' makes
// the scrim inert (buttons drive the flow); 'dismiss' dismisses; 'next'
// (default) keeps the engine's advance.
final behavior = config.outsideTapBehavior.trim().toLowerCase();
final disableBarrier = behavior == 'nothing';
final onBarrier = behavior == 'dismiss' ? () => _view.dismiss() : null;
if (config is TooltipGuideConfig) {
final step = _firstWhere(config.steps, (s) => s.anchorKey == anchorKey);
if (step == null) return null;
return ShowcasePresentation(
container: GuideBubble.tooltip(
step: step, scope: scope, onAction: handleAction),
// Tooltip = no dim (RN renders the bubble over a transparent scrim).
overlayColor: const Color(0x00000000),
overlayOpacity: 0,
targetShapeBorder:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
targetPadding: EdgeInsets.zero,
tooltipPosition: _tooltipPosition(step.placement),
showArrow: step.showArrow,
// RN: arrowColor ?? backgroundColor — the arrow matches the bubble.
arrowColor: step.arrowColor ?? step.backgroundColor,
// RN: arrowBorderColor ?? borderColor; border width follows the bubble.
arrowBorderColor: step.arrowBorderColor ?? step.borderColor,
arrowBorderWidth: step.borderWidth,
disableBarrierInteraction: disableBarrier,
onBarrierClick: onBarrier,
);
}
if (config is SpotlightGuideConfig) {
final step = _firstWhere(config.steps, (s) => s.anchorKey == anchorKey);
if (step == null) return null;
return ShowcasePresentation(
container: GuideBubble.spotlight(
step: step, scope: scope, onAction: handleAction),
overlayColor: step.overlayColor,
overlayOpacity: step.overlayOpacity,
targetShapeBorder: _highlightShape(step),
targetPadding: EdgeInsets.all(step.highlightPadding),
tooltipPosition: _calloutPosition(step.calloutPosition),
showArrow: step.showArrow,
arrowColor: step.arrowColor ?? step.calloutBackgroundColor,
arrowBorderColor: step.arrowBorderColor ?? step.calloutBorderColor,
arrowBorderWidth: step.calloutBorderWidth,
disableBarrierInteraction: disableBarrier,
onBarrierClick: onBarrier,
);
}
return null;
}