AutoImageSize class

How large an icon should be drawn inside the slot CarPlay reserves for it.

The value is a fraction of that slot rather than an absolute point size, because the reserved slot differs per car and per app category — CarPlay exposes it at runtime as CPListItem.maximumImageSize and friends. A fraction stays correct across head units and can never overflow the slot.

The artwork is centred on a transparent canvas of exactly the reserved size, so the fraction controls how much visual weight the glyph carries. Roughly 0.7 (AutoImageSize.medium) matches the internal padding that SF Symbols ship with, which is why untouched edge-to-edge artwork reads as oversized next to native CarPlay icons.

Set a default for every icon via FlutterCarplay.iconSize, or override it per image:

FlutterCarplay.iconSize = const AutoImageSize.small();

CPListItem(
  text: 'Navigation',
  image: 'images/nav.svg',
  imageSize: const AutoImageSize.large(),
);

Constructors

AutoImageSize.fraction(double fraction)
A custom fraction of the reserved slot, from 0.05 to 1.0.
const
AutoImageSize.large()
Fills most of the reserved slot while keeping a small margin.
const
AutoImageSize.max()
Fills the reserved slot edge to edge. Appropriate for artwork that is meant to read as a tile or photo rather than as an icon.
const
AutoImageSize.medium()
The default. Approximates the padding built into SF Symbols, so icons sit visually alongside native CarPlay artwork.
const
AutoImageSize.small()
Half the reserved slot. Reads as a small, clearly inset glyph.
const

Properties

fraction → double
Fraction of the reserved slot the artwork occupies.
final
hashCode → int
The hash code for this object.
no setteroverride
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
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
override

Operators

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