AssetPickerConfig constructor
const
AssetPickerConfig({
- List<
AssetEntity> ? selectedAssets, - int maxAssets = defaultMaxAssetsCount,
- int pageSize = defaultAssetsPerPage,
- ThumbnailSize gridThumbnailSize = defaultAssetGridPreviewSize,
- ThumbnailSize pathThumbnailSize = defaultPathThumbnailSize,
- ThumbnailSize? previewThumbnailSize,
- RequestType requestType = RequestType.common,
- SpecialPickerType? specialPickerType,
- bool keepScrollOffset = false,
- SortPathDelegate<
AssetPathEntity> ? sortPathDelegate, - bool sortPathsByModifiedDate = false,
- PMFilter? filterOptions,
- int gridCount = 4,
- Color? themeColor,
- ThemeData? pickerTheme,
- AssetPickerTextDelegate? textDelegate,
- SpecialItemPosition specialItemPosition = SpecialItemPosition.none,
- SpecialItemBuilder<
AssetPathEntity> ? specialItemBuilder, - LoadingIndicatorBuilder? loadingIndicatorBuilder,
- AssetSelectPredicate<
AssetEntity> ? selectPredicate, - bool? shouldRevertGrid,
- LimitedPermissionOverlayPredicate? limitedPermissionOverlayPredicate,
- PathNameBuilder<
AssetPathEntity> ? pathNameBuilder,
Implementation
const AssetPickerConfig({
this.selectedAssets,
this.maxAssets = defaultMaxAssetsCount,
this.pageSize = defaultAssetsPerPage,
this.gridThumbnailSize = defaultAssetGridPreviewSize,
this.pathThumbnailSize = defaultPathThumbnailSize,
this.previewThumbnailSize,
this.requestType = RequestType.common,
this.specialPickerType,
this.keepScrollOffset = false,
this.sortPathDelegate,
this.sortPathsByModifiedDate = false,
this.filterOptions,
this.gridCount = 4,
this.themeColor,
this.pickerTheme,
this.textDelegate,
this.specialItemPosition = SpecialItemPosition.none,
this.specialItemBuilder,
this.loadingIndicatorBuilder,
this.selectPredicate,
this.shouldRevertGrid,
this.limitedPermissionOverlayPredicate,
this.pathNameBuilder,
}) : assert(
pickerTheme == null || themeColor == null,
'pickerTheme and themeColor cannot be set at the same time.',
),
assert(maxAssets > 0, 'maxAssets must be greater than 0.'),
assert(pageSize > 0, 'pageSize must be greater than 0.'),
assert(gridCount > 0, 'gridCount must be greater than 0.'),
assert(
pageSize % gridCount == 0,
'pageSize must be a multiple of gridCount.',
),
assert(
specialPickerType != SpecialPickerType.wechatMoment ||
requestType == RequestType.common,
'SpecialPickerType.wechatMoment and requestType '
'cannot be set at the same time.',
),
assert(
(specialItemBuilder == null &&
identical(specialItemPosition, SpecialItemPosition.none)) ||
(specialItemBuilder != null &&
!identical(specialItemPosition, SpecialItemPosition.none)),
'Custom item did not set properly.',
);