-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add OutlinedBorder class #56341
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
Add OutlinedBorder class #56341
Conversation
|
I don't think we should do this. There's no reason why a border needs to support a BorderSide. It could have many, it could have none. We could have a subclass of ShapeBorder, ShapeBorderWithSide or something, that the others inherit from if we want to do this, but fundamentally the core type shouldn't have to know about sides IMHO. Having the default not do anything, in particular, seems like a confusing API. That said, what's the use case? |
|
The use case I'm concerned about at the moment is enabling one to specify a button's shape separately from the outline that decorates its border. An app theme needs to be able to specify the shape of buttons (or other components) without disturbing the outline (if any) that the buttons decorate their border with. Similarly, a theme should be able to specify a button's border decoration, independently of its shape. |
|
We could have an OutlineableShape class that is between ShapeBorder and those subclasses that have a side, and the button theming could require that it be used, while allowing other widgets to use the regular ShapeBorder. We have precedent for that, e. g. IIRC the text fields require a particular shape subclass. |
|
Yes, that sounds reasonable although "outlineable" stretches our common language. It's a shame that we can't have Shape and BorderedShape but those ships have sailed (and "BorderedShapeBorder" is terrible). Maybe OutlinedShape? |
Hixie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defined a new
OutlinedBorderabstract class in between ShapeBorder and the existing concrete subclasses like RoundedRectangleBorder. OutlinedBorder adds a BorderSide property and acopyWithmethod with the usual semantics. That makes it possible to combine an OutlinedBorder that defines a component's shape, with a BorderSide that defines how the border outline is to appear.For example:
BeveledRectangleBorder, CircleBorder, ContinuousRectangleBorder, RoundedRectangleBorder, and StadiumBorder are now OutlinedBorders.
This PR does not update the existing InputBorder class to be an OutlinedBorder. InputBorder's BorderSide property and constructor parameter is called "borderSide"; other than that, the two classes are compatible. A future PR could make InputBorder an OutlinedBorder however, that would be a breaking change.