mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
Minor RenderBox improvements (#4837)
* Make the size setter on RenderBox protected to avoid setting from outside the class. * Make normalize on BoxConstraints always return an object that isNormalized.
This commit is contained in:
parent
04dca44f27
commit
e8a638ecf9
|
@ -392,6 +392,10 @@ class BoxConstraints extends Constraints {
|
|||
/// The returned [maxWidth] is at least as large as the [minWidth]. Similarly,
|
||||
/// the returned [maxHeight] is at least as large as the [minHeight].
|
||||
BoxConstraints normalize() {
|
||||
if (isNormalized)
|
||||
return this;
|
||||
final double minWidth = this.minWidth >= 0.0 ? this.minWidth : 0.0;
|
||||
final double minHeight = this.minHeight >= 0.0 ? this.minHeight : 0.0;
|
||||
return new BoxConstraints(
|
||||
minWidth: minWidth,
|
||||
maxWidth: minWidth > maxWidth ? minWidth : maxWidth,
|
||||
|
@ -829,6 +833,7 @@ abstract class RenderBox extends RenderObject {
|
|||
return _size;
|
||||
}
|
||||
Size _size;
|
||||
@protected
|
||||
set size(Size value) {
|
||||
assert(!(debugDoingThisResize && debugDoingThisLayout));
|
||||
assert(sizedByParent || !debugDoingThisResize);
|
||||
|
|
Loading…
Reference in a new issue