@@ -153,6 +153,10 @@ List<Constrained> vChain({
153153 return [];
154154}
155155
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+
156160bool _debugEnsureNotEmptyString (String name, String ? value) {
157161 if (value != null && value.trim ().isEmpty) {
158162 throw ConstraintLayoutException (
@@ -219,17 +223,29 @@ class _ConstraintBoxData extends ContainerBoxParentData<RenderBox> {
219223 EdgeInsets ? margin;
220224 EdgeInsets ? goneMargin;
221225
222- /// There are only basic constraints here
226+ /// There are only base constraints here
227+
228+ @_baseConstraints
223229 String ? leftToLeft;
230+ @_baseConstraints
224231 String ? leftToRight;
232+ @_baseConstraints
225233 String ? rightToLeft;
234+ @_baseConstraints
226235 String ? rightToRight;
236+ @_baseConstraints
227237 String ? topToTop;
238+ @_baseConstraints
228239 String ? topToBottom;
240+ @_baseConstraints
229241 String ? bottomToTop;
242+ @_baseConstraints
230243 String ? bottomToBottom;
244+ @_baseConstraints
231245 String ? baselineToTop;
246+ @_baseConstraints
232247 String ? baselineToBottom;
248+ @_baseConstraints
233249 String ? baselineToBaseline;
234250
235251 TextBaseline ? textBaseline;
@@ -261,16 +277,27 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
261277 final EdgeInsets goneMargin;
262278
263279 /// These are the base constraints constraint on sibling id or CL.parent
280+ @_baseConstraints
264281 final String ? leftToLeft;
282+ @_baseConstraints
265283 final String ? leftToRight;
284+ @_baseConstraints
266285 final String ? rightToLeft;
286+ @_baseConstraints
267287 final String ? rightToRight;
288+ @_baseConstraints
268289 final String ? topToTop;
290+ @_baseConstraints
269291 final String ? topToBottom;
292+ @_baseConstraints
270293 final String ? bottomToTop;
294+ @_baseConstraints
271295 final String ? bottomToBottom;
296+ @_baseConstraints
272297 final String ? baselineToTop;
298+ @_baseConstraints
273299 final String ? baselineToBottom;
300+ @_baseConstraints
274301 final String ? baselineToBaseline;
275302
276303 /// 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> {
297324 final double verticalBias;
298325
299326 /// These are wrapper constraints for simplicity of use, which will eventually convert to base constraints.
327+ @_wrapperConstraints
300328 final String ? topLeftTo;
329+ @_wrapperConstraints
301330 final String ? topCenterTo;
331+ @_wrapperConstraints
302332 final String ? topRightTo;
333+ @_wrapperConstraints
303334 final String ? centerLeftTo;
335+ @_wrapperConstraints
304336 final String ? centerTo;
337+ @_wrapperConstraints
305338 final String ? centerRightTo;
339+ @_wrapperConstraints
306340 final String ? bottomLeftTo;
341+ @_wrapperConstraints
307342 final String ? bottomCenterTo;
343+ @_wrapperConstraints
308344 final String ? bottomRightTo;
345+ @_wrapperConstraints
309346 final String ? centerHorizontalTo;
347+ @_wrapperConstraints
310348 final String ? centerVerticalTo;
311349
312350 /// TODO support chain
313351 /// final ChainStyle? chainStyle;
314352 /// TODO support circle positioned
315353 /// TODO support dimension ratio
316354 /// TODO support barrier
317- /// TODO support guideline
318355 /// TODO consider flow
319356 /// group is pointless
320357
@@ -324,17 +361,17 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
324361 this .id,
325362 required this .width,
326363 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,
338375 this .clickPadding = EdgeInsets .zero,
339376 this .visibility = CL .visible,
340377 this .margin = EdgeInsets .zero,
@@ -347,17 +384,17 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
347384 this .heightPercent = 1 ,
348385 this .horizontalBias = 0.5 ,
349386 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,
361398 }) : assert (child is ! Constrained ,
362399 'Constrained can not be wrapped with Constrained.' ),
363400 assert (child is ! Guideline ,
@@ -419,16 +456,27 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
419456 assert (_debugEnsurePercent ('horizontalBias' , horizontalBias));
420457 assert (_debugEnsurePercent ('verticalBias' , verticalBias));
421458
459+ @_baseConstraints
422460 String ? leftToLeft = this .leftToLeft;
461+ @_baseConstraints
423462 String ? leftToRight = this .leftToRight;
463+ @_baseConstraints
424464 String ? rightToLeft = this .rightToLeft;
465+ @_baseConstraints
425466 String ? rightToRight = this .rightToRight;
467+ @_baseConstraints
426468 String ? topToTop = this .topToTop;
469+ @_baseConstraints
427470 String ? topToBottom = this .topToBottom;
471+ @_baseConstraints
428472 String ? bottomToTop = this .bottomToTop;
473+ @_baseConstraints
429474 String ? bottomToBottom = this .bottomToBottom;
475+ @_baseConstraints
430476 String ? baselineToTop = this .baselineToTop;
477+ @_baseConstraints
431478 String ? baselineToBottom = this .baselineToBottom;
479+ @_baseConstraints
432480 String ? baselineToBaseline = this .baselineToBaseline;
433481
434482 /// Convert wrapper constraints first
0 commit comments