packages
packages copied to clipboard
[image_picker] Add limit parameter to pickMultiImage and pickMultipleMedia to ios and Android
Adds limit parameter to MediaOptions and MultiImagePickerOptions and supports its use on iOS and Android. The limit argument defines how many images or media files can be select.
Fixes: flutter/flutter#85772
Pre-launch Checklist
- [X] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [X] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [X] I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use
dart format.) - [X] I signed the CLA.
- [X] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [X] I linked to at least one issue that this PR fixes in the description above.
- [X] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [X] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style. - [X] I updated/added relevant documentation (doc comments with
///). - [X] I added new tests to check the change I am making, or this PR is test-exempt.
- [X] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
I've cleaned up packages which remain unchanged. I've removed limit from deprecated methods. I've updated iOS and Android implementations
Thanks for reverting the web package @pdenert!
I checked the web APIs again and there's nothing new to limit the number of files that the user selects (as in: disable file selection once the user selects limit files).
We could count how many they've selected and throw an exception, or discard extras if they've picked too many, but that's probably confusing, and can be implemented on the application layer too.
We could count how many they've selected and throw an exception, or discard extras if they've picked too many, but that's probably confusing, and can be implemented on the application layer too.
Yeah, I feel the same way. If we can't limit choice on the UI side, then it's better to do nothing.
@tarrinneal do you mind look at this again?
@vashworth thanks for the test examples. I've also added tests for variants where the limit is nil
Also, the existing tests will need to have the limit parameter added where needed... I think some of them should be failing as is? See this test, for example, which should certainly fail without the new limit parameter. cc @stuartmorgan do you happen to know if these tests aren't running as part of pre-submit?
Native unit tests are the step after lint in android_platform_tests, and CI stops after failures unless we explicitly tell it not to, so currently any failures in native unit tests would be masked by the lint failure.
@gmackall I've extracted getting final limit to getLimitFromOptions in ImagePickerUtils and suppressed the lint warning. I've also updated the native tests and added new ones for limit
Quick review of the platform interface. I'll try to get a full review in asap for you.
@tarrinneal hey, may you add your full review soon?
Quick review of the platform interface. I'll try to get a full review in asap for you.
@tarrinneal hey, may you add your full review soon?
@tarrinneal just friendly reminder that I'm still waiting for review
Sorry for the delays.
This seems ready to break up into it's respective pr's as per https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins
Let me know if you need help with any of this.
PR with platform interface changes only is ready here: https://github.com/flutter/packages/pull/6434
@tarrinneal I have updated the PR to the published platform interface changes
@tarrinneal may you look at this soon?