Flutter-Bounty-Hunters / swift_ui

Flutter port of Swift UI
MIT License
63 stars 4 forks source link

[Shapes] - Implement Ellipse (resolves #29) #30

Closed suragch closed 3 months ago

suragch commented 3 months ago

This PR adds an Ellipse widget along with examples to the SwiftUI gallery and Flutter demo apps. Here are the comparisons side by side (SwiftUI is first):

Screenshot 2024-06-13 at 09 21 04 Screenshot 2024-06-13 at 09 51 16

Issues of note

Unlike Rectangle, half the stroke line of an ellipse is painted outside of the ellipse area.

SwiftUI clips the stroke of Ellipse when embedded directly in a VStack. I had to manually ensure the SwiftUI VStack was wide enough to contain the stroke width in order for this not to happen. This behavior is not matched in Flutter. The Flutter VStack does not clip the Ellipse stroke by default:

Screenshot 2024-06-13 at 09 03 47 Screenshot 2024-06-13 at 09 51 16

I'm not sure it's even worth trying to implement this behavior in Flutter since the Flutter default seems better. In any case, this is probably a VStack or Frame issue rather than an Ellipse issue, so I'm not attempting to solve it in this PR.