Skip to content

[image_picker] feat:ios camera overlays#1

Open
tsinis wants to merge 13 commits intomainfrom
feat/image-picker-ios-overlays
Open

[image_picker] feat:ios camera overlays#1
tsinis wants to merge 13 commits intomainfrom
feat/image-picker-ios-overlays

Conversation

@tsinis
Copy link
Copy Markdown
Owner

@tsinis tsinis commented Nov 21, 2025

Added overlays to photo camera view on iOS. Replaces old implementation tsinis/plugins#1

- 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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 overlayOpacity and overlayImage parameters throughout the API layer (platform interface, method channel, and iOS implementation)
  • Created new Objective-C classes OverlayView and CUIImagePickerController to 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.

Comment thread packages/image_picker/image_picker_ios/pubspec.yaml
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 overlayOpacity and overlayImage parameters 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 like imageQuality are 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.

Comment thread packages/image_picker/image_picker_ios/example/lib/main.dart
Comment thread packages/image_picker/image_picker_ios/lib/image_picker_ios.dart
Comment thread packages/image_picker/image_picker_ios/example/pubspec.yaml
Comment thread packages/image_picker/image_picker_ios/example/lib/main.dart
Comment thread packages/image_picker/image_picker_ios/example/lib/main.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants