Chiekko Red
Chiekko Red

Reputation: 41

Flutter: How to use filterOption in photo_manager package

I am puzzled on how to use filterOption for durationConstraint and sizeConstraint in photo_manager dart package. Can someone enlighten me on how to use it? Hint says I must use FilterOptionGroup()

List<AssetPathEntity> albums = await PhotoManager.getAssetPathList(
        onlyAll: true,
        type: RequestType.video,
        filterOption: FilterOptionGroup(),
      ); 

Upvotes: 0

Views: 1312

Answers (1)

MikeStack
MikeStack

Reputation: 29

You should define a SizeConstraint, define a FilterOption with that constraint and use it to set an option of the FilterOptionGroup:

SizeConstraint szc = SizeConstraint(
  minWidth: 0,
  maxWidth: 100,
  minHeight: 0,
  maxHeight: 100,
  ignoreSize: false,
);

final option = FilterOption(
  sizeConstraint: szc,
);

FilterOptionGroup filter = new FilterOptionGroup();
filter.setOption( AssetType.image , option );

Identically, you could set the DurationConstraint and set the respective option.

Upvotes: 1

Related Questions