@@ -234,9 +234,9 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
234234 final String ? baselineToBaseline;
235235 final TextBaseline textBaseline;
236236
237- final bool center;
238- final bool centerHorizontal;
239- final bool centerVertical;
237+ final String ? center;
238+ final String ? centerHorizontal;
239+ final String ? centerVertical;
240240
241241 final int ? zIndex;
242242 final Offset translate;
@@ -269,9 +269,9 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
269269 this .visibility = CL .visible,
270270 this .margin = EdgeInsets .zero,
271271 this .goneMargin = EdgeInsets .zero,
272- this .center = false ,
273- this .centerHorizontal = false ,
274- this .centerVertical = false ,
272+ this .center,
273+ this .centerHorizontal,
274+ this .centerVertical,
275275 this .horizontalBias = 0.5 ,
276276 this .verticalBias = 0.5 ,
277277 this .zIndex, // default is child index
@@ -344,9 +344,9 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
344344 'When setting the width to match_parent for child with id $id , there is no need to set left or right constraint.' );
345345 }
346346
347- if (centerHorizontal) {
347+ if (centerHorizontal != null ) {
348348 throw Exception (
349- 'When setting the width to match_parent for child with id $id , there is no need to set centerHorizontal = true .' );
349+ 'When setting the width to match_parent for child with id $id , there is no need to set centerHorizontal.' );
350350 }
351351 return true ;
352352 }());
@@ -369,9 +369,9 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
369369 'When setting the height to match_parent for child with id $id , there is no need to set top or bottom or baseline constraint.' );
370370 }
371371
372- if (centerVertical) {
372+ if (centerVertical != null ) {
373373 throw Exception (
374- 'When setting the height to match_parent for child with id $id , there is no need to set centerVertical = true .' );
374+ 'When setting the height to match_parent for child with id $id , there is no need to set centerVertical.' );
375375 }
376376 return true ;
377377 }());
@@ -386,32 +386,32 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
386386
387387 assert (() {
388388 if (width == CL .matchParent && height == CL .matchParent) {
389- if (center) {
389+ if (center != null ) {
390390 throw Exception (
391- 'When setting the width and height to match_parent for child with id $id , there is no need to set center = true .' );
391+ 'When setting the width and height to match_parent for child with id $id , there is no need to set center.' );
392392 }
393393 }
394394 return true ;
395395 }());
396396
397- if (centerHorizontal) {
397+ if (centerHorizontal != null ) {
398398 assert (() {
399399 if (leftToLeft != null ||
400400 leftToRight != null ||
401401 rightToLeft != null ||
402402 rightToRight != null ) {
403403 throw Exception (
404- 'When setting centerHorizontal = true for child with id $id , there is no need to set left or right constraint.' );
404+ 'When setting centerHorizontal for child with id $id , there is no need to set left or right constraint.' );
405405 }
406406 return true ;
407407 }());
408- leftToLeft = CL .parent ;
409- rightToRight = CL .parent ;
408+ leftToLeft = centerHorizontal ;
409+ rightToRight = centerHorizontal ;
410410 leftToRight = null ;
411411 rightToLeft = null ;
412412 }
413413
414- if (centerVertical) {
414+ if (centerVertical != null ) {
415415 assert (() {
416416 if (topToTop != null ||
417417 topToBottom != null ||
@@ -421,20 +421,20 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
421421 baselineToBottom != null ||
422422 baselineToBaseline != null ) {
423423 throw Exception (
424- 'When setting centerVertical = true for child with id $id , there is no need to set top or bottom or baseline constraint.' );
424+ 'When setting centerVertical for child with id $id , there is no need to set top or bottom or baseline constraint.' );
425425 }
426426 return true ;
427427 }());
428- topToTop = CL .parent ;
429- bottomToBottom = CL .parent ;
428+ topToTop = centerVertical ;
429+ bottomToBottom = centerVertical ;
430430 topToBottom = null ;
431431 bottomToTop = null ;
432432 baselineToTop = null ;
433433 baselineToBottom = null ;
434434 baselineToBaseline = null ;
435435 }
436436
437- if (center) {
437+ if (center != null ) {
438438 assert (() {
439439 if (leftToLeft != null ||
440440 leftToRight != null ||
@@ -448,14 +448,14 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
448448 baselineToBottom != null ||
449449 baselineToBaseline != null ) {
450450 throw Exception (
451- 'When setting center = true for child with id $id , there is no need to set left or right or top or bottom or baseline constraint.' );
451+ 'When setting center for child with id $id , there is no need to set left or right or top or bottom or baseline constraint.' );
452452 }
453453 return true ;
454454 }());
455- leftToLeft = CL .parent ;
456- rightToRight = CL .parent ;
457- topToTop = CL .parent ;
458- bottomToBottom = CL .parent ;
455+ leftToLeft = center ;
456+ rightToRight = center ;
457+ topToTop = center ;
458+ bottomToBottom = center ;
459459 leftToRight = null ;
460460 rightToLeft = null ;
461461 topToBottom = null ;
0 commit comments