Skip to content

Commit

Permalink
✨ exposes pathNameBuilder (#53)
Browse files Browse the repository at this point in the history
* Add support to the pathNameBuilder method of WebChat

* fix path name builder in path entity selector

* Delete example/devtools_options.yaml

---------

Co-authored-by: Gabriel Perez <gabriel@techandpeople.com>
Co-authored-by: Maël <legoffmael@gmail.com>
  • Loading branch information
3 people authored Sep 20, 2024
1 parent 1b0ef5c commit a206532
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit a206532

Please sign in to comment.