@@ -234,9 +234,9 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
234
234
final String ? baselineToBaseline;
235
235
final TextBaseline textBaseline;
236
236
237
- final bool center;
238
- final bool centerHorizontal;
239
- final bool centerVertical;
237
+ final String ? center;
238
+ final String ? centerHorizontal;
239
+ final String ? centerVertical;
240
240
241
241
final int ? zIndex;
242
242
final Offset translate;
@@ -269,9 +269,9 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
269
269
this .visibility = CL .visible,
270
270
this .margin = EdgeInsets .zero,
271
271
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,
275
275
this .horizontalBias = 0.5 ,
276
276
this .verticalBias = 0.5 ,
277
277
this .zIndex, // default is child index
@@ -344,9 +344,9 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
344
344
'When setting the width to match_parent for child with id $id , there is no need to set left or right constraint.' );
345
345
}
346
346
347
- if (centerHorizontal) {
347
+ if (centerHorizontal != null ) {
348
348
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.' );
350
350
}
351
351
return true ;
352
352
}());
@@ -369,9 +369,9 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
369
369
'When setting the height to match_parent for child with id $id , there is no need to set top or bottom or baseline constraint.' );
370
370
}
371
371
372
- if (centerVertical) {
372
+ if (centerVertical != null ) {
373
373
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.' );
375
375
}
376
376
return true ;
377
377
}());
@@ -386,32 +386,32 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
386
386
387
387
assert (() {
388
388
if (width == CL .matchParent && height == CL .matchParent) {
389
- if (center) {
389
+ if (center != null ) {
390
390
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.' );
392
392
}
393
393
}
394
394
return true ;
395
395
}());
396
396
397
- if (centerHorizontal) {
397
+ if (centerHorizontal != null ) {
398
398
assert (() {
399
399
if (leftToLeft != null ||
400
400
leftToRight != null ||
401
401
rightToLeft != null ||
402
402
rightToRight != null ) {
403
403
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.' );
405
405
}
406
406
return true ;
407
407
}());
408
- leftToLeft = CL .parent ;
409
- rightToRight = CL .parent ;
408
+ leftToLeft = centerHorizontal ;
409
+ rightToRight = centerHorizontal ;
410
410
leftToRight = null ;
411
411
rightToLeft = null ;
412
412
}
413
413
414
- if (centerVertical) {
414
+ if (centerVertical != null ) {
415
415
assert (() {
416
416
if (topToTop != null ||
417
417
topToBottom != null ||
@@ -421,20 +421,20 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
421
421
baselineToBottom != null ||
422
422
baselineToBaseline != null ) {
423
423
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.' );
425
425
}
426
426
return true ;
427
427
}());
428
- topToTop = CL .parent ;
429
- bottomToBottom = CL .parent ;
428
+ topToTop = centerVertical ;
429
+ bottomToBottom = centerVertical ;
430
430
topToBottom = null ;
431
431
bottomToTop = null ;
432
432
baselineToTop = null ;
433
433
baselineToBottom = null ;
434
434
baselineToBaseline = null ;
435
435
}
436
436
437
- if (center) {
437
+ if (center != null ) {
438
438
assert (() {
439
439
if (leftToLeft != null ||
440
440
leftToRight != null ||
@@ -448,14 +448,14 @@ class Constrained extends ParentDataWidget<_ConstraintBoxData> {
448
448
baselineToBottom != null ||
449
449
baselineToBaseline != null ) {
450
450
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.' );
452
452
}
453
453
return true ;
454
454
}());
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 ;
459
459
leftToRight = null ;
460
460
rightToLeft = null ;
461
461
topToBottom = null ;
0 commit comments