@@ -18,8 +18,8 @@ Future<void> main() async {
1818 expect (
1919 explained,
2020 equals (
21- '[HtmlFlex:direction=horizontal,mainAxisAlignment=start ,'
22- 'crossAxisAlignment =start,children=[RichText:(:Foo)]]' ,
21+ '[HtmlFlex:crossAxisAlignment=start,direction=horizontal ,'
22+ 'mainAxisAlignment =start,children=[RichText:(:Foo)]]' ,
2323 ),
2424 );
2525 });
@@ -31,7 +31,7 @@ Future<void> main() async {
3131 expect (
3232 explained,
3333 equals (
34- '[HtmlFlex:direction=horizontal,mainAxisAlignment=start,crossAxisAlignment =start,children='
34+ '[HtmlFlex:crossAxisAlignment=start, direction=horizontal,mainAxisAlignment=start,children='
3535 '[CssBlock:child=[RichText:(:Foo)]],'
3636 '[CssBlock:child=[RichText:(:Bar)]]'
3737 ']' ,
@@ -46,7 +46,7 @@ Future<void> main() async {
4646 expect (
4747 explained,
4848 equals (
49- '[HtmlFlex:direction=horizontal,mainAxisAlignment=start,crossAxisAlignment =start,children='
49+ '[HtmlFlex:crossAxisAlignment=start, direction=horizontal,mainAxisAlignment=start,children='
5050 '[CssBlock:child=[RichText:(:Foo)]],'
5151 '[CssBlock:child=[RichText:(:Bar)]]'
5252 ']' ,
@@ -194,6 +194,27 @@ Future<void> main() async {
194194 expect (barRightAfter, equals (tester.windowWidth));
195195 });
196196
197+ testWidgets ('updates spacing' , (WidgetTester tester) async {
198+ await explain (
199+ tester,
200+ '<div style="display: flex; gap: 10px">'
201+ '<div>Foo</div><div>Bar</div>'
202+ '</div>' ,
203+ );
204+ final barBefore = tester.bar;
205+ final barLeftBefore = barBefore.left;
206+
207+ await explain (
208+ tester,
209+ '<div style="display: flex; gap: 20px">'
210+ '<div>Foo</div><div>Bar</div>'
211+ '</div>' ,
212+ );
213+ final barAfter = tester.bar;
214+ final barLeftAfter = barAfter.left;
215+ expect (barLeftAfter, greaterThan (barLeftBefore));
216+ });
217+
197218 testWidgets ('updates textDirection' , (WidgetTester tester) async {
198219 await explain (
199220 tester,
@@ -445,6 +466,8 @@ Future<void> main() async {
445466 kCssAlignItemsStretch,
446467 ];
447468
469+ const List <double ?> gaps = [null , 10 ];
470+
448471 const justifyContents = [
449472 kCssJustifyContentFlexStart,
450473 kCssJustifyContentFlexEnd,
@@ -457,24 +480,28 @@ Future<void> main() async {
457480 for (final flexDirection in flexDirections) {
458481 for (final alignItem in alignItems) {
459482 for (final justifyContent in justifyContents) {
460- final key = '$flexDirection /$alignItem /$justifyContent ' ;
461- testGoldens (
462- key,
463- (tester) async {
464- await tester.pumpWidgetBuilder (
465- _Golden (
466- flexDirection: flexDirection,
467- alignItem: alignItem,
468- justifyContent: justifyContent,
469- ),
470- wrapper: materialAppWrapper (theme: ThemeData .light ()),
471- surfaceSize: const Size (316 , 166 ),
472- );
473-
474- await screenMatchesGolden (tester, key);
475- },
476- skip: goldenSkip != null ,
477- );
483+ for (final gap in gaps) {
484+ final key =
485+ '$flexDirection /$alignItem /${gap != null ? 'gap-${gap }px' : '' }$justifyContent ' ;
486+ testGoldens (
487+ key,
488+ (tester) async {
489+ await tester.pumpWidgetBuilder (
490+ _Golden (
491+ flexDirection: flexDirection,
492+ alignItem: alignItem,
493+ gap: gap,
494+ justifyContent: justifyContent,
495+ ),
496+ wrapper: materialAppWrapper (theme: ThemeData .light ()),
497+ surfaceSize: const Size (316 , 166 ),
498+ );
499+
500+ await screenMatchesGolden (tester, key);
501+ },
502+ skip: goldenSkip != null ,
503+ );
504+ }
478505 }
479506 }
480507 }
@@ -497,11 +524,13 @@ extension on WidgetTester {
497524class _Golden extends StatelessWidget {
498525 final String flexDirection;
499526 final String alignItem;
527+ final double ? gap;
500528 final String justifyContent;
501529
502530 const _Golden ({
503531 required this .flexDirection,
504532 required this .alignItem,
533+ this .gap,
505534 required this .justifyContent,
506535 });
507536
@@ -510,6 +539,7 @@ class _Golden extends StatelessWidget {
510539 final inlineStyle = '$kCssDisplay : $kCssDisplayFlex ; '
511540 '$kCssFlexDirection : $flexDirection ; '
512541 '$kCssAlignItems : $alignItem ; '
542+ '${gap != null ? '$kCssGap : ${gap }px' : '' }'
513543 '$kCssJustifyContent : $justifyContent ' ;
514544 return Scaffold (
515545 body: Padding (
@@ -518,6 +548,7 @@ class _Golden extends StatelessWidget {
518548<div style="background: lightgray; height: 150px; width: 300px; $inlineStyle ">
519549 <div style="background: red; padding: 5px">$flexDirection </div>
520550 <div style="background: green; margin-top: 5px; padding: 5px">$alignItem </div><!-- added margin to verify baseline alignment -->
551+ ${gap != null ? '<div style="padding: 5px">gap-${gap }px</div>' : '' }
521552 <div style="background: blue; color: white; padding: 5px">$justifyContent </div>
522553</div>''' ),
523554 ),
0 commit comments