Conversation
- Added overlayOpacity and overlayImage parameters to pickImage method. - Updated related files to support new parameters.
- Added overlayOpacity and overlayImage parameters to pickImage method. - Updated related methods and tests to support new overlay options.
- Added CUIImagePickerController to manage camera overlays. - Introduced OverlayView for customizable overlay images and opacity. - Updated FLTImagePickerPlugin to utilize CUIImagePickerController.
- Added a boolean flag to prevent duplicate observer registrations. - Removed unused offset property from OverlayView.
- Implemented a method to load the overlay image from assets. - Updated image picker functionality to include overlay image and opacity. - Added the overlay image asset to pubspec.yaml.
There was a problem hiding this comment.
Pull Request Overview
This PR adds iOS camera overlay functionality to the image_picker plugin, allowing developers to display custom overlay images with configurable opacity on the camera view when taking photos. The implementation uses a custom UIImagePickerController subclass to manage overlay visibility and handle device-specific positioning.
Key Changes:
- Added
overlayOpacityandoverlayImageparameters throughout the API layer (platform interface, method channel, and iOS implementation) - Created new Objective-C classes
OverlayViewandCUIImagePickerControllerto handle overlay rendering and camera view customization - Updated Pigeon definitions and generated code to support the new parameters
Reviewed Changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
image_picker_platform.dart |
Added overlayOpacity and overlayImage parameters to pickImage method signature |
method_channel_image_picker.dart |
Added overlay parameters to method channel implementation and platform method invocation |
image_picker_ios_test.dart |
Updated mock API to accept new overlay parameters |
pubspec.yaml |
Changed to local path dependency and added publish_to: none for development |
messages.dart |
Updated Pigeon interface definition to include overlay parameters in method signature |
messages.g.dart |
Regenerated Pigeon code with Pigeon v26.1.1 to include overlay parameters |
image_picker_ios.dart |
Added overlay parameter forwarding in iOS implementation |
messages.g.m |
Regenerated Objective-C message handling code with new overlay parameters |
messages.g.h |
Regenerated Objective-C header with updated method signature |
OverlayView.h |
New header defining OverlayView class for custom overlay rendering |
CUIImagePickerController.h |
New header for custom UIImagePickerController subclass |
OverlayView.m |
Implementation of overlay view with device-specific positioning logic |
FLTImagePickerPlugin_Test.h |
Added overlay properties to plugin test interface |
FLTImagePickerPlugin.m |
Integrated overlay creation and visibility management into camera flow |
CUIImagePickerController.m |
Custom controller implementation with orientation handling and notification-based overlay visibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 17 out of 18 changed files in this pull request and generated 11 comments.
Comments suppressed due to low confidence (1)
packages/image_picker/image_picker_ios/test/image_picker_ios_test.dart:914
- The new
overlayOpacityandoverlayImageparameters are not being tested. The test mock accepts these parameters but doesn't validate or store them for assertion. Add properties to capture these values and create tests to verify they are passed correctly, similar to how other parameters likeimageQualityare tested.
Add to the _FakeImagePickerApi class:
int? passedOverlayOpacity;
String? passedOverlayImage;And in the pickImage method:
passedOverlayOpacity = overlayOpacity;
passedOverlayImage = overlayImage;Then add test cases to verify these parameters are passed correctly.
@override
Future<String?> pickImage(
SourceSpecification source,
MaxSize maxSize,
int? imageQuality,
bool requestFullMetadata,
int? overlayOpacity,
String? overlayImage,
) async {
passedSelectionType = _SelectionType.image;
passedSource = source;
passedMaxSize = maxSize;
passedImageQuality = imageQuality;
passedRequestFullMetadata = requestFullMetadata;
return returnValue.firstOrNull;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Added overlays to photo camera view on iOS. Replaces old implementation tsinis/plugins#1