-
-
Notifications
You must be signed in to change notification settings - Fork 505
Merge v10 changes #728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merge v10 changes #728
Conversation
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
# Conflicts: # example/lib/customs/pickers/directory_file_asset_picker.dart # lib/src/delegates/asset_picker_builder_delegate.dart # lib/src/delegates/asset_picker_viewer_builder_delegate.dart # lib/src/widget/asset_picker_viewer.dart
We have `Asset` and `Path` generic abstractions, but we didn't consider the delegate's generic abstractions. They are necessary when building delegates that rely on custom data source providers.
### ✨ What's the context?
Current `AssetPickerConfig` only accept single `specialItemPosition` and `specialItemBuilder` which is is not suitable for cases where multiple special items is required.
### 🛠 Changes being made
- Added `specialItems` in `AssetPickerConfig` and which accept list of `specialItemPosition` and `specialItemBuilder`.
- Added `isPermissionLimited` param to `SpecialItemBuilder` typedef for case where special item is required to remove when `isPermissionLimited` is false. Example as below.
```dart
SpecialItem(
itemPosition: SpecialItemPosition.append,
itemBuilder: (
BuildContext context,
AssetPathEntity? path,
int length,
bool isPermissionLimited,
) {
if (!isPermissionLimited) {
return null;
}
return const Center(
child: Text('Append Widget', textAlign: TextAlign.center),
);
},
)
```
- Removed unused `SpecialPosition.none` enum.
### ✨ Result
<img
src="https://github.com/user-attachments/assets/5f16edcf-f9f9-4411-b4d3-ea389839c934"
width="300" />
---------
Co-authored-by: yujune <[email protected]>
Co-authored-by: Alex Li <[email protected]>
Add `enableLivePhoto` flag to `AssetPickerConfig` to control Live Photo functionality ## Summary This PR implements the feature requested in issue #716. It adds a new `enableLivePhoto` bool flag to `AssetPickerConfig` that controls whether Live Photo functionality is enabled throughout the picker. ## Changes Made - [x] Added `enableLivePhoto` bool parameter to AssetPickerConfig (defaults to `true` for backward compatibility) - [x] Passed `enableLivePhoto` from AssetPickerConfig to `DefaultAssetPickerBuilderDelegate` - [x] Added `enableLivePhoto` field to `DefaultAssetPickerBuilderDelegate` - [x] Updated `buildLivePhotoIndicator` call to check the `enableLivePhoto` flag before showing the indicator in the grid - [x] Added `enableLivePhoto` to `DefaultAssetPickerViewerBuilderDelegate` - [x] Updated `ImagePageBuilder` to accept enableLivePhoto parameter - [x] Updated `_isLivePhoto` getter to check both `enableLivePhoto` flag and asset property - [x] Updated `AssetPickerViewer.pushToViewer `to pass `enableLivePhoto` parameter - [x] Added unit tests to verify the new flag works correctly - [x] Added clarifying comment for `_isLivePhoto` getter - [x] Fixed lint error in test_utils.dart (const → final) ## Behavior - **When `enableLivePhoto` is `true` (default)**: All Live-Photo indicators and interactions work as before, maintaining full backward compatibility - **When `enableLivePhoto` is `false`**: - Live Photo indicators are hidden in the grid view - Live Photo video controller is not initialized in preview - No Live Photo widget is rendered in the image viewer ## Implementation Details The flag is propagated through the entire component hierarchy: 1. `AssetPickerConfig` → `AssetPickerDelegate` → `DefaultAssetPickerBuilderDelegate` 2. `DefaultAssetPickerBuilderDelegate` → `AssetPickerViewer.pushToViewer` → `DefaultAssetPickerViewerBuilderDelegate` 3. `DefaultAssetPickerViewerBuilderDelegate` → `ImagePageBuilder` This ensures that all Live-Photo-related functionality is consistently controlled by a single flag, making it easy for users to disable Live Photo features when needed while maintaining full backward compatibility. --------- Co-authored-by: Alex Li <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: AlexV525 <[email protected]>
# Conflicts: # lib/src/delegates/asset_picker_builder_delegate.dart # lib/src/delegates/asset_picker_delegate.dart # lib/src/delegates/asset_picker_viewer_builder_delegate.dart # lib/src/widget/asset_picker.dart
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.