Skip to content

Commit 28ccf79

Browse files
committed
return Container instead of null for :if
1 parent 4111a08 commit 28ccf79

8 files changed

Lines changed: 14 additions & 14 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "XML Layout for Flutter",
44
"description": "XML Layout for Flutter. Brings Angular's style to Flutter!",
55
"publisher": "WaseemDev",
6-
"version": "0.0.21",
6+
"version": "0.0.22",
77
"icon": "images/logo.png",
88
"repository": {
99
"type": "github",

src/property-handlers/builder.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ suite("Builder Tests", function () {
8080
);
8181
},
8282
),
83-
() => null
83+
() => Container(width: 0, height: 0)
8484
)
8585
`;
8686

src/property-handlers/if.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ suite("If custom property", function () {
99
WidgetHelpers.ifTrue(true,
1010
() => Text(
1111
),
12-
() => null
12+
() => Container(width: 0, height: 0)
1313
)`;
1414

1515
const generated = generateWidget(xml);
@@ -30,7 +30,7 @@ WidgetHelpers.ifTrue(true,
3030
);
3131
},
3232
),
33-
() => null
33+
() => Container(width: 0, height: 0)
3434
)
3535
`;
3636

@@ -54,7 +54,7 @@ WidgetHelpers.ifTrue(true,
5454
),
5555
),
5656
),
57-
() => null
57+
() => Container(width: 0, height: 0)
5858
)
5959
`;
6060

src/property-handlers/if.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class IfHandler extends CustomPropertyHandler {
5151
const data = widget.tempData;
5252
const wrappedWidget = widget.wrappedWidgets[0];
5353
const elseWidget = widget.wrappedWidgets[1];
54-
const defaultElseWidget = 'null'; //'Container(width: 0, height: 0)';
54+
const defaultElseWidget = 'Container(width: 0, height: 0)'; // this must not be null (e.g. child of Row, StreamBuilder result can't be null)
5555

5656
if (data && wrappedWidget) {
5757
code = `WidgetHelpers.ifTrue(${data.condition},

src/property-handlers/item-builder.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ suite("ItemBuilder Tests", function () {
121121
);
122122
},
123123
),
124-
() => null
124+
() => Container(width: 0, height: 0)
125125
)
126126
`;
127127

@@ -149,7 +149,7 @@ suite("ItemBuilder Tests", function () {
149149
},
150150
),
151151
),
152-
() => null
152+
() => Container(width: 0, height: 0)
153153
)
154154
`;
155155

@@ -177,7 +177,7 @@ suite("ItemBuilder Tests", function () {
177177
},
178178
),
179179
),
180-
() => null
180+
() => Container(width: 0, height: 0)
181181
)
182182
`;
183183

@@ -231,7 +231,7 @@ suite("ItemBuilder Tests", function () {
231231
},
232232
),
233233
),
234-
() => null
234+
() => Container(width: 0, height: 0)
235235
)
236236
`;
237237

src/property-handlers/repeat.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ suite("Repeat Tests", function () {
4444
() => Text(
4545
4646
),
47-
() => null
47+
() => Container(width: 0, height: 0)
4848
);
4949
}
5050
)

src/property-handlers/switch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ suite("Switch Tests", function () {
300300
]
301301
),
302302
),
303-
() => null
303+
() => Container(width: 0, height: 0)
304304
)
305305
`;
306306

src/resolvers/pipes.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ suite("Pipes Tests", function () {
337337
),
338338
),
339339
),
340-
() => null
340+
() => Container(width: 0, height: 0)
341341
),
342342
],
343343
),
@@ -413,7 +413,7 @@ suite("Pipes Tests", function () {
413413
),
414414
),
415415
),
416-
() => null
416+
() => Container(width: 0, height: 0)
417417
),
418418
],
419419
),

0 commit comments

Comments
 (0)