Skip to content
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

Add support to the pathNameBuilder method of WebChat #53

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/src/assets_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class InstaAssetPickerConfig {
this.textDelegate,
this.gridThumbnailSize = defaultAssetGridPreviewSize,
this.previewThumbnailSize,
this.pathNameBuilder,

/// [InstaAssetPickerBuilder] config

Expand Down Expand Up @@ -102,6 +103,9 @@ class InstaAssetPickerConfig {
/// Preview thumbnail size in the crop viewer.
final ThumbnailSize? previewThumbnailSize;

/// {@macro wechat_assets_picker.PathNameBuilder}
final PathNameBuilder<AssetPathEntity>? pathNameBuilder;

/* [InstaAssetPickerBuilder] config */

/// Specifies the text title in the picker [AppBar].
Expand Down
3 changes: 2 additions & 1 deletion lib/src/widget/insta_asset_picker_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class InstaAssetPickerBuilder extends DefaultAssetPickerBuilderDelegate {
textDelegate: config.textDelegate,
gridThumbnailSize: config.gridThumbnailSize,
previewThumbnailSize: config.previewThumbnailSize,
pathNameBuilder: config.pathNameBuilder,
shouldRevertGrid: false,
);

Expand Down Expand Up @@ -325,7 +326,7 @@ class InstaAssetPickerBuilder extends DefaultAssetPickerBuilderDelegate {
child: Text(
isPermissionLimited && p.path.isAll
? textDelegate.accessiblePathName
: p.path.name,
: pathNameBuilder?.call(p.path) ?? p.path.name,
style: theme.textTheme.bodyLarge?.copyWith(
fontSize: 16,
fontWeight: FontWeight.bold,
Expand Down
Loading