copyWith method
AssetPickerConfig
copyWith({
- List<
AssetEntity> ? selectedAssets, - int? maxAssets,
- int? pageSize,
- ThumbnailSize? gridThumbnailSize,
- ThumbnailSize? pathThumbnailSize,
- ThumbnailSize? previewThumbnailSize,
- RequestType? requestType,
- SpecialPickerType? specialPickerType,
- bool? keepScrollOffset,
- SortPathDelegate<
AssetPathEntity> ? sortPathDelegate, - bool? sortPathsByModifiedDate,
- FilterOptionGroup? filterOptions,
- int? gridCount,
- Color? themeColor,
- ThemeData? pickerTheme,
- AssetPickerTextDelegate? textDelegate,
- SpecialItemPosition? specialItemPosition,
- SpecialItemBuilder<
AssetPathEntity> ? specialItemBuilder, - LoadingIndicatorBuilder? loadingIndicatorBuilder,
- AssetSelectPredicate<
AssetEntity> ? selectPredicate, - bool? shouldRevertGrid,
- LimitedPermissionOverlayPredicate? limitedPermissionOverlayPredicate,
- PathNameBuilder<
AssetPathEntity> ? pathNameBuilder,
Implementation
AssetPickerConfig copyWith({
/// Selected assets.
/// 已选中的资源
List<AssetEntity>? selectedAssets,
/// Maximum count for asset selection.
/// 资源选择的最大数量
int? maxAssets,
/// Assets should be loaded per page.
/// 资源选择的最大数量
///
/// Use `null` to display all assets into a single grid.
int? pageSize,
/// Thumbnail size in the grid.
/// 预览时网络的缩略图大小
///
/// This only works on images and videos since other types does not have to
/// request for the thumbnail data. The preview can speed up by reducing it.
/// 该参数仅生效于图片和视频类型的资源,因为其他资源不需要请求缩略图数据。
/// 预览图片的速度可以通过适当降低它的数值来提升。
///
/// This cannot be `null` or a large value since you shouldn't use the
/// original data for the grid.
/// 该值不能为空或者非常大,因为在网格中使用原数据不是一个好的决定。
ThumbnailSize? gridThumbnailSize,
/// Thumbnail size for path selector.
/// 路径选择器中缩略图的大小
ThumbnailSize? pathThumbnailSize,
/// Preview thumbnail size in the viewer.
/// 预览时图片的缩略图大小
///
/// This only works on images and videos since other types does not have to
/// request for the thumbnail data. The preview can speed up by reducing it.
/// 该参数仅生效于图片和视频类型的资源,因为其他资源不需要请求缩略图数据。
/// 预览图片的速度可以通过适当降低它的数值来提升。
///
/// Default is `null`, which will request the origin data.
/// 默认为空,即读取原图。
ThumbnailSize? previewThumbnailSize,
/// Request assets type.
/// 请求的资源类型
RequestType? requestType,
/// The current special picker type for the picker.
/// 当前特殊选择类型
///
/// Several types which are special:
/// * [SpecialPickerType.wechatMoment] When user selected video,
/// no more images can be selected.
/// * [SpecialPickerType.noPreview] Disable preview of asset,
/// Clicking on an asset selects it.
///
/// 这里包含一些特殊选择类型:
/// * [SpecialPickerType.wechatMoment] 微信朋友圈模式。
/// 当用户选择了视频,将不能选择图片。
/// * [SpecialPickerType.noPreview] 禁用资源预览。
/// 多选时单击资产将直接选中,单选时选中并返回。
SpecialPickerType? specialPickerType,
/// Whether the picker should save the scroll offset between pushes and pops.
/// 选择器是否可以从同样的位置开始选择
bool? keepScrollOffset,
/// @{macro wechat_assets_picker.delegates.SortPathDelegate}
SortPathDelegate<AssetPathEntity>? sortPathDelegate,
/// {@template wechat_assets_picker.constants.AssetPickerConfig.sortPathsByModifiedDate}
/// Whether to allow sort delegates to sort paths with
/// [FilterOptionGroup.containsPathModified].
/// 是否结合 [FilterOptionGroup.containsPathModified] 进行路径排序
/// {@endtemplate}
bool? sortPathsByModifiedDate,
/// Filter options for the picker.
/// 选择器的筛选条件
///
/// Will be merged into the base selectedAssets??thisuration.
/// 将会与基础条件进行合并。
FilterOptionGroup? filterOptions,
/// Assets count for the picker.
/// 资源网格数
int? gridCount,
/// Main color for the picker.
/// 选择器的主题色
Color? themeColor,
/// Theme for the picker.
/// 选择器的主题
///
/// Usually the WeChat uses the dark version (dark background color)
/// for the picker. However, some others want a light or a custom version.
/// 通常情况下微信选择器使用的是暗色(暗色背景)的主题,
/// 但某些情况下开发者需要亮色或自定义主题。
ThemeData? pickerTheme,
AssetPickerTextDelegate? textDelegate,
/// Allow users set a special item in the picker with several positions.
/// 允许用户在选择器中添加一个自定义item,并指定位置
SpecialItemPosition? specialItemPosition,
/// The widget builder for the the special item.
/// 自定义item的构造方法
SpecialItemBuilder<AssetPathEntity>? specialItemBuilder,
/// Indicates the loading status for the builder.
/// 指示目前加载的状态
LoadingIndicatorBuilder? loadingIndicatorBuilder,
/// {@macro wechat_assets_picker.AssetSelectPredicate}
AssetSelectPredicate<AssetEntity>? selectPredicate,
/// Whether the assets grid should revert.
/// 判断资源网格是否需要倒序排列
///
/// [Null] means judging by Apple OS.
/// 使用 [Null] 即使用是否为 Apple 系统进行判断。
bool? shouldRevertGrid,
/// {@macro wechat_assets_picker.LimitedPermissionOverlayPredicate}
LimitedPermissionOverlayPredicate? limitedPermissionOverlayPredicate,
/// {@macro wechat_assets_picker.PathNameBuilder}
PathNameBuilder<AssetPathEntity>? pathNameBuilder,
}) =>
AssetPickerConfig(
selectedAssets: selectedAssets ?? this.selectedAssets,
maxAssets: maxAssets ?? this.maxAssets,
pageSize: pageSize ?? this.pageSize,
gridThumbnailSize: gridThumbnailSize ?? this.gridThumbnailSize,
pathThumbnailSize: pathThumbnailSize ?? this.pathThumbnailSize,
previewThumbnailSize:
previewThumbnailSize ?? this.previewThumbnailSize,
requestType: requestType ?? this.requestType,
specialPickerType: specialPickerType ?? this.specialPickerType,
keepScrollOffset: keepScrollOffset ?? this.keepScrollOffset,
sortPathDelegate: sortPathDelegate ?? this.sortPathDelegate,
sortPathsByModifiedDate:
sortPathsByModifiedDate ?? this.sortPathsByModifiedDate,
filterOptions: filterOptions ?? this.filterOptions,
gridCount: gridCount ?? this.gridCount,
themeColor: themeColor ?? this.themeColor,
pickerTheme: pickerTheme ?? this.pickerTheme,
textDelegate: textDelegate ?? this.textDelegate,
specialItemPosition: specialItemPosition ?? this.specialItemPosition,
specialItemBuilder: specialItemBuilder ?? this.specialItemBuilder,
loadingIndicatorBuilder:
loadingIndicatorBuilder ?? this.loadingIndicatorBuilder,
selectPredicate: selectPredicate ?? this.selectPredicate,
shouldRevertGrid: shouldRevertGrid ?? this.shouldRevertGrid,
limitedPermissionOverlayPredicate:
limitedPermissionOverlayPredicate ??
this.limitedPermissionOverlayPredicate,
pathNameBuilder: pathNameBuilder ?? this.pathNameBuilder);