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:
Build and run the app with the default feedback builder (StringFeedback) and verify feedback submission still works unchanged.
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.
Test both draggable and non-draggable sheet modes to ensure the controller is forwarded in both flows.
Verify that extras on submit contains the 'screenshot' key with image bytes when used in the example form.
Test pages that include PlatformViews (WebView/Maps) to observe platform limitations for screenshots.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
💡 Motivation and Context
💚 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:
Note: No automated widget/unit tests are included in this change (see next steps).
📝 Checklist
🔮 Next steps