Skip to content

Conversation

@SadraKafiri
Copy link

📜 Description

  • Add a nullable ScreenshotController? parameter as the fourth argument to the FeedbackBuilder typedef so custom feedback forms can receive the overlay’s internal ScreenshotController instance and call capture(...) directly.
  • Forward the overlay’s internal screenshotController instance from FeedbackWidget down to FeedbackBottomSheet and then into the feedbackBuilder.
  • Update simpleFeedbackBuilder / StringFeedback signatures to accept the new nullable parameter to avoid compile errors.
  • Preserve existing behavior: the new parameter is nullable and nothing changes unless a custom builder uses it.
  • Include an example CustomFeedbackForm that demonstrates capturing, previewing, retaking, and attaching screenshot bytes to extras.

💡 Motivation and Context

  • Problem: Custom feedback forms had no reliable way to capture the exact overlay repaint boundary (including user annotations). Creating separate ScreenshotController instances caused race conditions or captured the wrong render boundary.
  • Solution: Expose the same ScreenshotController instance used by the overlay so custom forms can safely call await screenshotController?.capture(...) and obtain the correct screenshot bytes.
  • Benefit: Enables preview, retake, saving to temp, or adding screenshot bytes to extras without changing default behavior or breaking existing integrations.

💚 How did you test it?

  • Performed a static code review to ensure null-safety and correct propagation of the controller.

  • Recommended manual test steps for reviewers / QA:

    1. Build and run the app with the default feedback builder (StringFeedback) and verify feedback submission still works unchanged.
    2. Add a custom feedback builder that accepts the ScreenshotController? parameter; open the feedback sheet, tap “Take screenshot”, and verify capture() returns non-null bytes after the sheet is visible.
    3. Test both draggable and non-draggable sheet modes to ensure the controller is forwarded in both flows.
    4. Verify that extras on submit contains the 'screenshot' key with image bytes when used in the example form.
    5. Test pages that include PlatformViews (WebView/Maps) to observe platform limitations for screenshots.
    6. Run flutter analyze and flutter format to ensure code quality and style.
  • Note: No automated widget/unit tests are included in this change (see next steps).

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

  • Update README/examples: document the new feedbackBuilder signature and show a CustomFeedbackForm example demonstrating capturing and attaching screenshots.

@SadraKafiri SadraKafiri requested a review from ueman as a code owner August 14, 2025 14:18
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