Skip to content

fix: getScreenshot white screen under hybrid composition (#175) - #356

Merged
endigo merged 1 commit into
migrate/kotlin-swiftfrom
wt/fix-screenshot-175
Aug 3, 2026
Merged

fix: getScreenshot white screen under hybrid composition (#175)#356
endigo merged 1 commit into
migrate/kotlin-swiftfrom
wt/fix-screenshot-175

Conversation

@endigo

@endigo endigo commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #175: getScreenshot returned a blank white image.

Hybrid composition (initExpensiveAndroidView) and hardware layers break drawing-cache / plain View.draw captures. This PR captures real PDF content instead:

  • Android: Prefer PixelCopy of the attached platform view; fall back to a temporary LAYER_TYPE_SOFTWARE + View.draw (no drawing cache).
  • iOS: Implement getScreenshot by rasterizing the PDFKit layer; if that is blank, draw the current PDFPage into the viewport.

No package version bump (coordinator releases 1.5.0-beta.N).

Test plan

  • flutter pub get && dart format . && flutter analyze && flutter test — all passed
  • Android ./gradlew testDebugUnitTest — all passed, including new FlutterPDFViewScreenshotTest
  • Manual: load a PDF in the example app, call controller.getScreenshot(path), open PNG and confirm page content (not white) on Android and iOS

Hybrid composition and hardware layers made View.draw / drawing-cache
screenshots blank white. Android now prefers PixelCopy of the platform
view with a software-layer draw fallback; iOS implements getScreenshot by
rasterizing the PDFKit layer and falling back to PDFPage.draw.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae62302b-5d0d-4042-ab97-6cf364903344

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

endigo pushed a commit that referenced this pull request Aug 3, 2026
Fix getScreenshot white screen under hybrid composition (#175) after merge of #356.
@endigo
endigo merged commit d2bb149 into migrate/kotlin-swift Aug 3, 2026
1 check passed
@endigo

endigo commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Review results (worker review-release-prs-353-357)

Quality gates

Check Result
flutter analyze
flutter test ✅ 95 passed
Android unit tests ✅ including FlutterPDFViewScreenshotTest

Review notes

  • Android: PixelCopy primary path + temporary LAYER_TYPE_SOFTWARE draw fallback (restores layer type after).
  • iOS: layer render + current PDFPage draw fallback.
  • Correct fix for hybrid composition blank captures.

Merge + release

Merged into migrate/kotlin-swift as 1.5.0-beta.6 (tag v1.5.0-beta.6). pub.dev publish may retry after rate-limit window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant