Skip to main content

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 = False

Whether to paint the image in anti-aliased quality.

color_filterclass-attributeinstance-attribute

color_filter: Optional[ColorFilter] = None

A color filter to apply to the image before painting it.

filter_qualityclass-attributeinstance-attribute

filter_quality: FilterQuality = FilterQuality.MEDIUM

The quality of the image filter.

fitclass-attributeinstance-attribute

fit: Optional[BoxFit] = None

How the image should be inscribed into the box.

invert_colorsclass-attributeinstance-attribute

invert_colors: bool = False

Whether to invert the colors of the image while drawing.

match_text_directionclass-attributeinstance-attribute

match_text_direction: bool = False

Whether to paint the image in the direction of the TextDirection.

opacityclass-attributeinstance-attribute

opacity: Number = 1.0

The opacity of the image.

repeatclass-attributeinstance-attribute

How the image should be repeated to fill the box.

scaleclass-attributeinstance-attribute

scale: Number = 1.0

The scale(image pixels to be shown per logical pixels) to apply to the image.

srcclass-attributeinstance-attribute

src: Optional[Union[str, bytes]] = None

The image source to paint.

Accepts URLs, asset paths, base64 strings (with or without data: prefixes), or raw bytes.

Methods

copy

copy(src: Optional[Union[str, bytes]] = None, color_filter: Optional[ColorFilter] = None, fit: Optional[BoxFit] = None, alignment: Optional[Alignment] = None, repeat: Optional[ImageRepeat] = None, match_text_direction: Optional[bool] = None, scale: Optional[Number] = None, opacity: Optional[Number] = None, filter_quality: Optional[FilterQuality] = None, invert_colors: Optional[bool] = None, anti_alias: Optional[bool] = None)

Returns a copy of this object with the specified properties overridden.