@@ -77,7 +77,7 @@ class ConstraintLayout extends MultiChildRenderObjectWidget {
7777
7878 ConstraintLayout ({
7979 Key ? key,
80- List <Widget > children = const < Widget > [] ,
80+ required List <Widget > children,
8181 this .debugShowGuideline = false ,
8282 this .debugShowPreview = false ,
8383 this .debugShowClickArea = false ,
@@ -126,6 +126,30 @@ class ConstraintLayout extends MultiChildRenderObjectWidget {
126126 }
127127}
128128
129+ List <Constrained > hChain ({
130+ String ? leftToLeft,
131+ String ? leftToRight,
132+ String ? rightToLeft,
133+ String ? rightToRight,
134+ required List <Constrained > hChainList,
135+ }) {
136+ assert (hChainList.length > 1 ,
137+ 'The number of child elements in the chain must be > 1.' );
138+ return [];
139+ }
140+
141+ List <Constrained > vChain ({
142+ String ? topToTop,
143+ String ? topToBottom,
144+ String ? bottomToTop,
145+ String ? bottomToBottom,
146+ required List <Constrained > vChainList,
147+ }) {
148+ assert (vChainList.length > 1 ,
149+ 'The number of child elements in the chain must be > 1.' );
150+ return [];
151+ }
152+
129153bool _debugEnsureNotEmptyString (String name, String ? value) {
130154 if (value != null && value.trim ().isEmpty) {
131155 throw ConstraintLayoutException (
@@ -208,7 +232,6 @@ class _ConstraintBoxData extends ContainerBoxParentData<RenderBox> {
208232 String ? baselineToBottom;
209233 String ? baselineToBaseline;
210234 TextBaseline ? textBaseline;
211- bool ? wrappedByConstraint;
212235}
213236
214237class Constrained extends ParentDataWidget <_ConstraintBoxData > {
@@ -320,6 +343,9 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
320343
321344 @override
322345 void applyParentData (RenderObject renderObject) {
346+ assert (renderObject is ! _InternalBox ,
347+ 'Guideline, Barrier can not be wrapped with Constrained.' );
348+
323349 // bounds check
324350 assert (checkSize (width));
325351 assert (checkSize (height));
@@ -615,8 +641,6 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
615641 }
616642 }
617643
618- parentData.wrappedByConstraint = true ;
619-
620644 if (needsLayout) {
621645 AbstractNode ? targetParent = renderObject.parent;
622646 if (targetParent is RenderObject ) {
@@ -904,11 +928,6 @@ class _ConstraintRenderBox extends RenderBox
904928 if (childParentData.width == null ) {
905929 throw ConstraintLayoutException (
906930 'Child elements must be wrapped with Constrained.' );
907- } else if (childParentData.wrappedByConstraint == true ) {
908- if (child is _InternalBox ) {
909- throw ConstraintLayoutException (
910- 'Guideline, Barrier can not be wrapped with Constrained.' );
911- }
912931 }
913932 }
914933 return true ;
0 commit comments