Skip to content

ContinuousRectangleBorder doesn't match iOS implementation #91523

@cpboyd

Description

@cpboyd

There was a prior PR #27523 that attempted to change it to an approximation, which was based on this article (by a company selling an app which creates such approximations): https://www.paintcodeapp.com/news/code-for-ios-7-rounded-rectangles

I'd imagine Apple uses a specific bezier curve and suspect that many of the lineTos within that code are probably just due to discrete pixels that happen to line up.

That said, SwiftUI (not exactly sure when it was made a public API) now includes RoundedRectangle with RoundedCornerStyle.continuous.

This seems to be similar to the aforementioned approximation, but does NOT match iOS 15's built-in apps. Specifically, the grouped sections within Settings. The closest approximation for those sections seems to be with a cornerRadius of ~10.2.

Although Apple's own implementations aren't consistent, Flutter's ContinuousRectangleBorder should probably match one of them (probably the SwiftUI RoundedRectangle as that's the primary public API analogue).

Currently, ContinuousRectangleBorder requires a borderRadius of ~24 to resemble the RoundedRectangle with a cornerRadius of ~10.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: fidelityMatching the OEM platforms betterf: cupertinoflutter/packages/flutter/cupertino repositoryfound in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions