Styled widgets (StyledText, StyledIcon...) don't work like Box widgets #319
Replies: 2 comments
-
@Maksimka101 Thanks for the feedback; we have a work-in-progress PR to allow modifiers per Spec. Regarding your question, the plan is to try to have a 1-to-1 mapping of the utilities. I believe FlexBox is the only exception to this. If you have a $box and $text in the same style, you can pass them to the widget Box and StyledText, and their attributes will be resolved. However, StyledText and StyledIcon inherit $text and $icon attributes passed straight to Box. |
Beta Was this translation helpful? Give feedback.
-
Recently, we merged a PR (#517) that introduced a utility specific for $flexBox.chain
..alignment.center()
..padding(10)
..margin(10)
..flex.mainAxisAlignment.center()
..crossAxisAlignment.center() |
Beta Was this translation helpful? Give feedback.
-
It seems strange to me that the
StyledText
andFlexBox
widgets acceptStyle
, but onlyFlexBox
processes$box
attributes, whileStyledText
quietly ignores them. Firstly, it's very unpleasant to pass an attribute that isn't applied. Secondly, it's inconvenient that to create a decorator forRow
, you can useHBox
, but to create a decorator forText
, you need to useBox + StyledText
. And in general, it's strange that modifiers apply to everything, context variants also always work, but$box
works almost always. Why not follow the idea through and createTextBox
,ImageBox
, andIconBox
so that the$box
attribute always works?And secondly, most importantly, I did not notice any mention in the documentation that
Styled
widgets do not work with the$box
attributeSo, my question is: should absolutely any widget from the mix package support the
$box
attribute?Beta Was this translation helpful? Give feedback.
All reactions