@@ -153,6 +153,10 @@ List<Constrained> vChain({
153
153
return [];
154
154
}
155
155
156
+ /// Wrapper constraints design for simplicity of use, it will eventually convert to base constraints.
157
+ const Object _wrapperConstraints = Object ();
158
+ const Object _baseConstraints = Object ();
159
+
156
160
bool _debugEnsureNotEmptyString (String name, String ? value) {
157
161
if (value != null && value.trim ().isEmpty) {
158
162
throw ConstraintLayoutException (
@@ -219,17 +223,29 @@ class _ConstraintBoxData extends ContainerBoxParentData<RenderBox> {
219
223
EdgeInsets ? margin;
220
224
EdgeInsets ? goneMargin;
221
225
222
- /// There are only basic constraints here
226
+ /// There are only base constraints here
227
+
228
+ @_baseConstraints
223
229
String ? leftToLeft;
230
+ @_baseConstraints
224
231
String ? leftToRight;
232
+ @_baseConstraints
225
233
String ? rightToLeft;
234
+ @_baseConstraints
226
235
String ? rightToRight;
236
+ @_baseConstraints
227
237
String ? topToTop;
238
+ @_baseConstraints
228
239
String ? topToBottom;
240
+ @_baseConstraints
229
241
String ? bottomToTop;
242
+ @_baseConstraints
230
243
String ? bottomToBottom;
244
+ @_baseConstraints
231
245
String ? baselineToTop;
246
+ @_baseConstraints
232
247
String ? baselineToBottom;
248
+ @_baseConstraints
233
249
String ? baselineToBaseline;
234
250
235
251
TextBaseline ? textBaseline;
@@ -261,16 +277,27 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
261
277
final EdgeInsets goneMargin;
262
278
263
279
/// These are the base constraints constraint on sibling id or CL.parent
280
+ @_baseConstraints
264
281
final String ? leftToLeft;
282
+ @_baseConstraints
265
283
final String ? leftToRight;
284
+ @_baseConstraints
266
285
final String ? rightToLeft;
286
+ @_baseConstraints
267
287
final String ? rightToRight;
288
+ @_baseConstraints
268
289
final String ? topToTop;
290
+ @_baseConstraints
269
291
final String ? topToBottom;
292
+ @_baseConstraints
270
293
final String ? bottomToTop;
294
+ @_baseConstraints
271
295
final String ? bottomToBottom;
296
+ @_baseConstraints
272
297
final String ? baselineToTop;
298
+ @_baseConstraints
273
299
final String ? baselineToBottom;
300
+ @_baseConstraints
274
301
final String ? baselineToBaseline;
275
302
276
303
/// When setting baseline alignment, height must be wrap_content or fixed size, other vertical constraints will be illegal.
@@ -297,24 +324,34 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
297
324
final double verticalBias;
298
325
299
326
/// These are wrapper constraints for simplicity of use, which will eventually convert to base constraints.
327
+ @_wrapperConstraints
300
328
final String ? topLeftTo;
329
+ @_wrapperConstraints
301
330
final String ? topCenterTo;
331
+ @_wrapperConstraints
302
332
final String ? topRightTo;
333
+ @_wrapperConstraints
303
334
final String ? centerLeftTo;
335
+ @_wrapperConstraints
304
336
final String ? centerTo;
337
+ @_wrapperConstraints
305
338
final String ? centerRightTo;
339
+ @_wrapperConstraints
306
340
final String ? bottomLeftTo;
341
+ @_wrapperConstraints
307
342
final String ? bottomCenterTo;
343
+ @_wrapperConstraints
308
344
final String ? bottomRightTo;
345
+ @_wrapperConstraints
309
346
final String ? centerHorizontalTo;
347
+ @_wrapperConstraints
310
348
final String ? centerVerticalTo;
311
349
312
350
/// TODO support chain
313
351
/// final ChainStyle? chainStyle;
314
352
/// TODO support circle positioned
315
353
/// TODO support dimension ratio
316
354
/// TODO support barrier
317
- /// TODO support guideline
318
355
/// TODO consider flow
319
356
/// group is pointless
320
357
@@ -324,17 +361,17 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
324
361
this .id,
325
362
required this .width,
326
363
required this .height,
327
- this .leftToLeft,
328
- this .leftToRight,
329
- this .rightToLeft,
330
- this .rightToRight,
331
- this .topToTop,
332
- this .topToBottom,
333
- this .bottomToTop,
334
- this .bottomToBottom,
335
- this .baselineToTop,
336
- this .baselineToBottom,
337
- this .baselineToBaseline,
364
+ @_baseConstraints this .leftToLeft,
365
+ @_baseConstraints this .leftToRight,
366
+ @_baseConstraints this .rightToLeft,
367
+ @_baseConstraints this .rightToRight,
368
+ @_baseConstraints this .topToTop,
369
+ @_baseConstraints this .topToBottom,
370
+ @_baseConstraints this .bottomToTop,
371
+ @_baseConstraints this .bottomToBottom,
372
+ @_baseConstraints this .baselineToTop,
373
+ @_baseConstraints this .baselineToBottom,
374
+ @_baseConstraints this .baselineToBaseline,
338
375
this .clickPadding = EdgeInsets .zero,
339
376
this .visibility = CL .visible,
340
377
this .margin = EdgeInsets .zero,
@@ -347,17 +384,17 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
347
384
this .heightPercent = 1 ,
348
385
this .horizontalBias = 0.5 ,
349
386
this .verticalBias = 0.5 ,
350
- this .topLeftTo,
351
- this .topCenterTo,
352
- this .topRightTo,
353
- this .centerLeftTo,
354
- this .centerTo,
355
- this .centerRightTo,
356
- this .bottomLeftTo,
357
- this .bottomCenterTo,
358
- this .bottomRightTo,
359
- this .centerHorizontalTo,
360
- this .centerVerticalTo,
387
+ @_wrapperConstraints this .topLeftTo,
388
+ @_wrapperConstraints this .topCenterTo,
389
+ @_wrapperConstraints this .topRightTo,
390
+ @_wrapperConstraints this .centerLeftTo,
391
+ @_wrapperConstraints this .centerTo,
392
+ @_wrapperConstraints this .centerRightTo,
393
+ @_wrapperConstraints this .bottomLeftTo,
394
+ @_wrapperConstraints this .bottomCenterTo,
395
+ @_wrapperConstraints this .bottomRightTo,
396
+ @_wrapperConstraints this .centerHorizontalTo,
397
+ @_wrapperConstraints this .centerVerticalTo,
361
398
}) : assert (child is ! Constrained ,
362
399
'Constrained can not be wrapped with Constrained.' ),
363
400
assert (child is ! Guideline ,
@@ -419,16 +456,27 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
419
456
assert (_debugEnsurePercent ('horizontalBias' , horizontalBias));
420
457
assert (_debugEnsurePercent ('verticalBias' , verticalBias));
421
458
459
+ @_baseConstraints
422
460
String ? leftToLeft = this .leftToLeft;
461
+ @_baseConstraints
423
462
String ? leftToRight = this .leftToRight;
463
+ @_baseConstraints
424
464
String ? rightToLeft = this .rightToLeft;
465
+ @_baseConstraints
425
466
String ? rightToRight = this .rightToRight;
467
+ @_baseConstraints
426
468
String ? topToTop = this .topToTop;
469
+ @_baseConstraints
427
470
String ? topToBottom = this .topToBottom;
471
+ @_baseConstraints
428
472
String ? bottomToTop = this .bottomToTop;
473
+ @_baseConstraints
429
474
String ? bottomToBottom = this .bottomToBottom;
475
+ @_baseConstraints
430
476
String ? baselineToTop = this .baselineToTop;
477
+ @_baseConstraints
431
478
String ? baselineToBottom = this .baselineToBottom;
479
+ @_baseConstraints
432
480
String ? baselineToBaseline = this .baselineToBaseline;
433
481
434
482
/// Convert wrapper constraints first
0 commit comments