@@ -123,10 +123,14 @@ export class Flex extends MultiChildWidget implements CssMinHeightMixin {
123123 overflow : this . overflow ,
124124 ...css . justifyContent ( this . mainAxisAlignment ) ,
125125 "flex-direction" : direction ( this . direction ) ,
126- "align-items" : this . crossAxisAlignment ,
126+ "align-items" : flex_align_items ( this . crossAxisAlignment ) ,
127127 flex : this . flex ,
128128 "flex-wrap" : this . flexWrap ,
129- gap : this . itemSpacing && css . px ( this . itemSpacing ) ,
129+ gap :
130+ // if justify-content is set to space-between, do not set the gap.
131+ this . mainAxisAlignment == MainAxisAlignment . spaceBetween
132+ ? undefined
133+ : this . itemSpacing && css . px ( this . itemSpacing ) ,
130134 "box-shadow" : css . boxshadow ( ...( this . boxShadow ?? [ ] ) ) ,
131135 ...css . border ( this . border ) ,
132136 ...css . borderRadius ( this . borderRadius ) ,
@@ -153,3 +157,24 @@ function direction(axis: Axis): CSSProperty.FlexDirection {
153157 }
154158 throw `axis value of "${ axis } " is not a valid reflect Axis value.` ;
155159}
160+
161+ /**
162+ * explicit css value with `flex-` prefix for start, end
163+ * why? - "start" and "end" also attributes to the box itself -> to be more flex-specific.
164+ * @param alignment
165+ * @returns
166+ */
167+ function flex_align_items ( alignment : CrossAxisAlignment ) {
168+ switch ( alignment ) {
169+ case CrossAxisAlignment . start :
170+ return "flex-start" ;
171+ case CrossAxisAlignment . end :
172+ return "flex-end" ;
173+ case CrossAxisAlignment . center :
174+ return "center" ;
175+ case CrossAxisAlignment . stretch :
176+ return "stretch" ;
177+ case CrossAxisAlignment . baseline :
178+ return "baseline" ;
179+ }
180+ }
0 commit comments