resizePhoto method
Returns a new Uri, Based on this photo url, under which a dynamically resized version of the original photo can be accessed.
Unsplash supports dynamic resizing of photos. The transformations applied to the original photo can be configured through a set of query parameters in the requested url.
The officially supported parameters are:
width
,height
: for adjusting the width and height of a photocrop
: for applying cropping to the photoformat
: for converting image formatautoFormat
: for automatically choosing the optimal image format depending on user browserquality
: for changing the compression quality when using lossy file formatsfit
: for changing the fit of the image within the specified dimensionsdevicePixelRatio
: for adjusting the device pixel ratio of the image
Under the hood unsplash uses imgix. The
other parameters offered by Imgix can be
used through imgixParams
, but unsplash dose not officially support them
and may remove support for them at any time in the future.
See: Unsplash docs
Implementation
Uri resizePhoto({
int? quality,
int? width,
int? height,
CropMode? crop,
int? devicePixelRatio,
ImageFormat? format,
bool? autoFormat,
ResizeFitMode? fit,
Map<String, String>? imgixParams,
}) =>
resizePhotoUrl(
this,
quality: quality,
width: width,
height: height,
crop: crop,
devicePixelRatio: devicePixelRatio,
format: format,
fit: fit,
autoFormat: autoFormat,
imgixParams: imgixParams,
);