fix(viewer): presenter audience preview does not match live presentation output

Problem Summary

Presenter Console Preview vs Live Audience Output

In the dual-screen presentation mode, the Audience Output Preview inside the Presenter Console (PresenterConsoleWindowView / SharedPresenterConsole) fails to match the actual live audience output display (FullScreenPresentationView / SharedSlideViewer).

When viewing a slide configured with a black background and text (e.g. B:Prayer from expert entry, or a black blank slide with custom text added via the slide editor):

  1. Live Output Window (Audience Display): Displays the slide content as intended (e.g., "Prayer" centered in white text on a black background).
  2. Presenter Console Preview (Audience Output Preview): Renders a completely solid black rectangle, completely omitting the slide’s text and custom elements.
  3. Presenter Console Controls: Incorrectly asserts that blackout is active:
    • The status tag displays [BLACKOUT] in red instead of LIVE in green.
    • The Blackout toggle button turns red (DestructiveButton).
    • The caption text reads Blackout Active.

Root Cause Analysis

Thorough investigation of the codebase revealed several interconnected issues and diverged code paths across sfw_shared and sfw_desktop:

1. Conflation of Dynamic Live Blackout with Slide Background Styling

In [packages/sfw_shared/lib/src/widgets/shared_presenter_console.dart](file:///Users/rodydavis/dev/slides-for-worship/packages/sfw_shared/lib/src/widgets/shared_presenter_console.dart#L609-L610):

final isBlack = state.isLiveBlackout || (activeSlide?.isBlack ?? false);
final isWhite = state.isLiveWhiteout || (activeSlide?.isWhite ?? false);
  • state.isLiveBlackout represents a dynamic runtime override toggled by the presenter (e.g., via shortcut key B or the blackout toolbar button).
  • activeSlide?.isBlack is simply a static styling attribute of the slide item (e.g., ServiceBlankItem(isBlack: true, content: 'Prayer')).
  • Conflating both into a single isBlack boolean causes any slide with a black background to be treated by the presenter console as if the user engaged an emergency blackout!

2. Short-Circuiting Slide Rendering in _buildSlideContent

In [packages/sfw_shared/lib/src/widgets/shared_presenter_console.dart](file:///Users/rodydavis/dev/slides-for-worship/packages/sfw_shared/lib/src/widgets/shared_presenter_console.dart#L1918-L1923):

Widget _buildSlideContent(
  RemoteSlideData? slide,
  bool isBlack,
  bool isWhite,
  bool isWidescreen,
) {
  if (isBlack) {
    return Container(color: m.Colors.black);
  }
  if (isWhite) {
    return Container(color: m.Colors.white);
  }
  ...
  return FittedBox(
    ...
    child: SharedSlideCompositionWidget.fromSlideData(slide, ...),
  );
}
  • Because isBlack is true whenever activeSlide?.isBlack is true, _buildSlideContent immediately returns Container(color: Colors.black) and never calls SharedSlideCompositionWidget!
  • Even though commit a5930db1 updated SharedSlideCompositionWidget so that isBlack && text.isEmpty only blacks out empty slides and renders text when present, shared_presenter_console.dart bypassed this completely.

3. Summary Slide Thumbnails Also Bypass Rendering

In [packages/sfw_shared/lib/src/widgets/shared_presenter_console.dart](file:///Users/rodydavis/dev/slides-for-worship/packages/sfw_shared/lib/src/widgets/shared_presenter_console.dart#L1951-L1964):

Widget _buildSummarySlideContent(
  RemoteSlideSummary summary,
  bool isWidescreen,
) {
  if (summary.isBlack) {
    return Container(
      color: m.Colors.black,
      alignment: Alignment.center,
      child: const Text('BLACK', ...),
    );
  }
  • The “Next Slide” (Up Next) preview and the overview thumbnails also bypass composition if summary.isBlack is true, displaying the word BLACK instead of rendering the slide preview text.

4. Duplicate and Diverged Slide Rendering Pipelines

  • Actual Presentation Output ([SharedSlideViewer](file:///Users/rodydavis/dev/slides-for-worship/packages/sfw_shared/lib/src/widgets/shared_slide_viewer.dart#L380-L414)):
    • Checks isLiveBlackout / isLiveWhiteout for dynamic blackouts.
    • Delegates all slides directly to SharedSlideCompositionWidget.fromSlideData().
    • Supports transitions via SlideTransitionEngineView.
  • Presenter Console Preview ([SharedPresenterConsole](file:///Users/rodydavis/dev/slides-for-worship/packages/sfw_shared/lib/src/widgets/shared_presenter_console.dart#L1062-L1113)):
    • Wraps in bespoke Container with shadow, border, and custom background logic.
    • Intercepts slides with custom _buildSlideContent logic that short-circuits.
  • Main Studio Editor ([ScaledSlidePreview](file:///Users/rodydavis/dev/slides-for-worship/packages/sfw_desktop/lib/widgets/scaled_slide_preview.dart)):
    • Uses AspectRatio + FittedBox + SlideCompositionWidget.

As a result, slides are not rendered consistently across the app.


Requirements & Proposed Solution

  1. Decouple Live Blackout/Whiteout from Slide Background Color:
    • In SharedPresenterConsole:
      • Toolbar button states (DestructiveButton), tooltip (Exit Blackout), status badge ([BLACKOUT]), and status label (Blackout Active) MUST inspect state.isLiveBlackout and state.isLiveWhiteout exclusively.
      • A slide having a black background (slide.isBlack == true) must NOT trigger the “Blackout Active” UI indicator.
  2. Single Canonical Slide Renderer:
    • Establish a single, shared slide presentation widget (or reuse SharedSlideCompositionWidget with a unified wrapper) used by:
      • SharedSlideViewer (Audience Display & Remote Audience View)
      • SharedPresenterConsole (Audience Output Preview)
      • SharedPresenterConsole (Next Slide Preview & Thumbnails)
      • ScaledSlidePreview (Studio Main Editor & Film Strip)
    • Only dynamic live blackout (isLiveBlackout) and whiteout (isLiveWhiteout) should overlay a blank color over the slide.
    • Any slide with text or custom elements must always render its content through SharedSlideCompositionWidget.
  3. Summary Slide Fix:
    • In _buildSummarySlideContent, only render placeholder text 'BLACK' / 'WHITE' if summary.previewText.isEmpty and no elements exist.

Resolution Implemented

  1. Created SharedSlideDisplayWidget in packages/sfw_shared/lib/src/widgets/slide_display_widget.dart as the canonical slide display component.
  2. Unified Slide Presentation:
    • SharedSlideViewer (Audience Display & Remote Audience View)
    • SharedPresenterConsole (Audience Output Preview & Next Slide Preview)
    • _buildSummarySlideContent (Filmstrip & overview thumbnails)
      All now delegate to SharedSlideDisplayWidget.
  3. Decoupled Dynamic Live Blackout/Whiteout:
    • The presenter console’s status badge (LIVE vs BLACKOUT/WHITEOUT), Blackout toggle button, and status label now strictly inspect state.isLiveBlackout / state.isLiveWhiteout.
    • Slides with a black background and text (e.g. B:Prayer) now display LIVE with white text on black background in the Audience Output Preview, matching the live presentation output.
  4. Verified with automated test suites in sfw_shared and sfw_desktop.