ImageFit enum

CSS object-fit sizing behaviors for responsive image scaling.

Specifies how an <img> element's content should resize to fit its container box. Emitted as an inline object-fit CSS property in BloomImage and bloomImage.

bloomImage(
  src: '/assets/avatar.jpg',
  alt: 'User profile picture',
  width: 96,
  height: 96,
  fit: ImageFit.cover,
);

See also:

Inheritance
Available extensions

Values

cover → const ImageFit

The image is sized to maintain its aspect ratio while filling the element's entire content box, clipping if necessary.

const ImageFit('cover')
contain → const ImageFit

The image is scaled to maintain its aspect ratio while fitting completely within the element's content box without clipping.

const ImageFit('contain')
fill → const ImageFit

The image is stretched to fill the element's content box completely, without maintaining aspect ratio.

const ImageFit('fill')
none → const ImageFit

The image is rendered at its natural size without resizing or scaling.

const ImageFit('none')
scaleDown → const ImageFit

The image is sized as if none or contain were specified, whichever results in a smaller rendered size.

const ImageFit('scale-down')

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value String
The raw CSS property value string (e.g. "cover", "contain").
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<ImageFit>
A constant List of the values in this enum, in order of their declaration.