DecorationImage
An image for a box decoration.
Properties
alignment- The alignment of the image within its bounds.anti_alias- Whether to paint the image in anti-aliased quality.color_filter- A color filter to apply to the image before painting it.filter_quality- The quality of the image filter.fit- How the image should be inscribed into the box.invert_colors- Whether to invert the colors of the image while drawing.match_text_direction- Whether to paint the image in the direction of the TextDirection.opacity- The opacity of the image.repeat- How the image should be repeated to fill the box.scale- The scale(image pixels to be shown per logical pixels) to apply to the image.src- The image source to paint.
Methods
copy- Returns a copy of this object with the specified properties overridden.
Properties
alignmentclass-attributeinstance-attribute
alignment: Alignment = field(
default_factory=lambda: Alignment.CENTER
)The alignment of the image within its bounds.
anti_aliasclass-attributeinstance-attribute
anti_alias: bool = FalseWhether to paint the image in anti-aliased quality.
color_filterclass-attributeinstance-attribute
color_filter: ColorFilter | None = NoneA color filter to apply to the image before painting it.
filter_qualityclass-attributeinstance-attribute
filter_quality: FilterQuality = FilterQuality.MEDIUMThe quality of the image filter.
fitclass-attributeinstance-attribute
fit: BoxFit | None = NoneHow the image should be inscribed into the box.
invert_colorsclass-attributeinstance-attribute
invert_colors: bool = FalseWhether to invert the colors of the image while drawing.
match_text_directionclass-attributeinstance-attribute
match_text_direction: bool = FalseWhether to paint the image in the direction of the TextDirection.
repeatclass-attributeinstance-attribute
repeat: ImageRepeat = ImageRepeat.NO_REPEATHow the image should be repeated to fill the box.
scaleclass-attributeinstance-attribute
scale: Number = 1.0The scale(image pixels to be shown per logical pixels) to apply to the image.
srcclass-attributeinstance-attribute
src: str | bytes | None = NoneThe image source to paint.
Accepts URLs, asset paths, base64 strings (with or without data: prefixes),
or raw bytes.
Methods
copy
copy(
src: str | bytes | None = None,
color_filter: ColorFilter | None = None,
fit: BoxFit | None = None,
alignment: Alignment | None = None,
repeat: ImageRepeat | None = None,
match_text_direction: bool | None = None,
scale: Number | None = None,
opacity: Number | None = None,
filter_quality: FilterQuality | None = None,
invert_colors: bool | None = None,
anti_alias: bool | None = None,
) -> DecorationImageReturns a copy of this object with the specified properties overridden.