-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Shapes] - Implementing property method alternatives in Flutter #27
Comments
@suragch to help us answer that question, can you investigate a little more deeply on modifiers like Probably the most important detail that differentiates a property from a widget is how generally applicable a modifier is meant to be. For example, I don't know that it's even possible for us to implement a generic |
@matthew-carroll I started out by taking a list of Swift property methods and going through them one by one to see if they should be a widget property or a composable widget. After while I discovered that some of these were extensions on Rather than completely rewrite my original answer, I'll keep the examples, and then move on to what belongs to
|
Thanks for looking into it. That rationale makes sense to me. Feel free to start with whatever piece you'd like. |
I'm implementing the a
Rectangle
widget (#26).Here is what a Rectangle view in SwiftUI can do:
The swift code for that looks like so:
In that code you can see a number of different modifier methods:
fill
frame
stroke
cornerRadius
shadow
One of the guiding principles is that
swift_ui
doesn't use modifier methods.How to avoid modifier methods gives a hypothetical alternative for Flutter:
Is this how we want to define the API, by creating widgets for all of the following?
Fill
Frame
Stroke
CornerRadius
Shadow
Not widget properties?
@matthew-carroll
The text was updated successfully, but these errors were encountered: