ContentImage class

A widget for displaying images from various sources with advanced features.

Features:

  • Network image caching
  • CMS image reference support
  • Responsive sizing
  • Loading and error states
  • Image format control
  • Color blending options

Example:

// Network image
ContentImage(
  url: 'https://example.com/image.jpg',
  width: 300,
  height: 200,
  fit: BoxFit.cover,
)

// CMS image reference
ContentImage(
  ref: imageReference,
  format: 'webp',
  fit: BoxFit.contain,
)

The widget automatically:

  • Handles device pixel ratio for optimal quality
  • Rounds dimensions for better caching
  • Provides fallback for missing images
  • Shows loading indicators
Inheritance

Constructors

ContentImage({Key? key, String? url, double? width, double? height, ImageReference? ref, BoxFit fit = BoxFit.cover, String? format, Color? color, BlendMode? colorBlendMode, AlignmentGeometry alignment = Alignment.center})
const

Properties

alignment → AlignmentGeometry
final
color → Color?
final
colorBlendMode → BlendMode?
final
fit → BoxFit
final
format → String?
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
ref → ImageReference?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
url → String?
final
width → double?
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

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

Constants

nearestSize → const int
The size multiple to round dimensions to for better caching performance. For example, a width of 123 would be rounded to 120.