Skip to content

[BUG]: SwiftUI Image crops for fit "fill" and "none" instead of following CSS object-fit #4096

Closed

Description

@karolkulesza

The Basic Catalog says Image.fit follows CSS object-fit, with fill as the default (catalog.json). In SwiftUI, A2UIImage maps fill to aspect-fill, which crops, and none falls into the same branch (A2UIImage.swift). scaleDown is mapped to plain aspect-fit, so it also scales small images up. The avatar and header variants ignore fit.

a2ui_flutter maps all five values to BoxFit by name (image.dart).

A related question: web_core's Image (Image.ts) and the Angular v0.9 Image (image.component.ts) fall back to cover when fit is missing, while the catalog and Flutter use fill. I'll follow the catalog in SwiftUI. Should the web renderers change too?

I'll send a small PR with tests.

Activity

  1. moved this from Todo to In Progress in A2UIon Nov 9, 2026
  2. added
    status: needs-triage
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: first-line-handledstatus: needs-triage

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions