ObjectFit enum

Describes how an image should be resized to fit its container.

Mirrors the CSS object-fit property.

Commonly used in ImageStyle to ensure consistent rendering in both HTML and email output contexts.

Inheritance
Available extensions

Values

fill → const ObjectFit

The image is stretched to fill the element’s content box.

const ObjectFit('fill')
contain → const ObjectFit

The image is scaled to maintain its aspect ratio while fitting completely inside the container.

const ObjectFit('contain')
cover → const ObjectFit

The image is scaled to maintain its aspect ratio while covering the entire container.

const ObjectFit('cover')
none → const ObjectFit

The image is not resized.

const ObjectFit('none')
scaleDown → const ObjectFit

The image is scaled down to fit within the container if larger, otherwise rendered at its original size.

const ObjectFit('scale-down')

Properties

cssValue String
The CSS-compatible value of this fit mode.
final
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

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toCss() String
Converts this value to its CSS representation.
toString() String
A string representation of this object.
inherited

Operators

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

Constants

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