RichImage constructor

const RichImage({
  1. required String url,
  2. String? alt,
  3. @JsonKey.new(name: 'aspect_ratio') @Default.new('16:9') String aspectRatio,
  4. @Default.new(false) bool loading,
  5. @JsonKey.new(name: 'on_tap_callback') OnTapCallback? onTapCallback,
})

Implementation

const factory RichImage({
  required String url,
  String? alt,
  @JsonKey(name: 'aspect_ratio') @Default('16:9') String aspectRatio,

  /// When true, the renderer paints a shimmer placeholder over the image
  /// area instead of the actual `url`. Use this when the backend has
  /// triggered an async generation (e.g. a nail design render) and
  /// wants the chat surface to feel alive while the task is still
  /// pending. The accompanying card typically carries a `callback`
  /// action whose `payload.task_id` the host polls; when the task
  /// resolves, the host updates the message in place with `loading:
  /// false` and the real URL.
  @Default(false) bool loading,

  /// Fires a host callback when the image is tapped, instead of the
  /// SDK's default zoomable full-screen preview. Use this when the
  /// host wants per-image-kind behaviour — e.g. opening a viewer
  /// with share / report / delete actions for a generated design, or
  /// pushing a dedicated result page for a try-on. Shimmer
  /// placeholders (loading=true) ignore this and stay non-tappable.
  @JsonKey(name: 'on_tap_callback') OnTapCallback? onTapCallback,
}) = _RichImage;