fix build scope messages and docs (#18637)
This commit is contained in:
parent
c39f2f26f7
commit
a57aff053e
@ -1464,10 +1464,10 @@ abstract class RenderBox extends RenderObject {
|
|||||||
return _size;
|
return _size;
|
||||||
}
|
}
|
||||||
Size _size;
|
Size _size;
|
||||||
@protected
|
|
||||||
/// Setting the size, in checked mode, triggers some analysis of the render box,
|
/// Setting the size, in checked mode, triggers some analysis of the render box,
|
||||||
/// as implemented by [debugAssertDoesMeetConstraints], including calling the intrinsic
|
/// as implemented by [debugAssertDoesMeetConstraints], including calling the intrinsic
|
||||||
/// sizing methods and checking that they meet certain invariants.
|
/// sizing methods and checking that they meet certain invariants.
|
||||||
|
@protected
|
||||||
set size(Size value) {
|
set size(Size value) {
|
||||||
assert(!(debugDoingThisResize && debugDoingThisLayout));
|
assert(!(debugDoingThisResize && debugDoingThisLayout));
|
||||||
assert(sizedByParent || !debugDoingThisResize);
|
assert(sizedByParent || !debugDoingThisResize);
|
||||||
|
@ -1339,7 +1339,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||||||
/// [markParentNeedsLayout], in the case where the parent needs to be laid out
|
/// [markParentNeedsLayout], in the case where the parent needs to be laid out
|
||||||
/// as well as the child.
|
/// as well as the child.
|
||||||
///
|
///
|
||||||
/// If [sizedByParent] has changed, called
|
/// If [sizedByParent] has changed, calls
|
||||||
/// [markNeedsLayoutForSizedByParentChange] instead of [markNeedsLayout].
|
/// [markNeedsLayoutForSizedByParentChange] instead of [markNeedsLayout].
|
||||||
void markNeedsLayout() {
|
void markNeedsLayout() {
|
||||||
assert(_debugCanPerformMutations);
|
assert(_debugCanPerformMutations);
|
||||||
@ -1636,7 +1636,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||||||
/// children, passing true for parentUsesSize if your layout information is
|
/// children, passing true for parentUsesSize if your layout information is
|
||||||
/// dependent on your child's layout information. Passing true for
|
/// dependent on your child's layout information. Passing true for
|
||||||
/// parentUsesSize ensures that this render object will undergo layout if the
|
/// parentUsesSize ensures that this render object will undergo layout if the
|
||||||
/// child undergoes layout. Otherwise, the child can changes its layout
|
/// child undergoes layout. Otherwise, the child can change its layout
|
||||||
/// information without informing this render object.
|
/// information without informing this render object.
|
||||||
@protected
|
@protected
|
||||||
void performLayout();
|
void performLayout();
|
||||||
|
@ -2073,7 +2073,20 @@ class BuildOwner {
|
|||||||
|
|
||||||
final List<Element> _dirtyElements = <Element>[];
|
final List<Element> _dirtyElements = <Element>[];
|
||||||
bool _scheduledFlushDirtyElements = false;
|
bool _scheduledFlushDirtyElements = false;
|
||||||
bool _dirtyElementsNeedsResorting; // null means we're not in a buildScope
|
|
||||||
|
/// Whether [_dirtyElements] need to be sorted again as a result of more
|
||||||
|
/// elements becoming dirty during the build.
|
||||||
|
///
|
||||||
|
/// This is necessary to preserve the sort order defined by [Element._sort].
|
||||||
|
///
|
||||||
|
/// This field is set to null when [buildScope] is not actively rebuilding
|
||||||
|
/// the widget tree.
|
||||||
|
bool _dirtyElementsNeedsResorting;
|
||||||
|
|
||||||
|
/// Whether [buildScope] is actively rebuilding the widget tree.
|
||||||
|
///
|
||||||
|
/// [scheduleBuildFor] should only be called when this value is true.
|
||||||
|
bool get _debugIsInBuildScope => _dirtyElementsNeedsResorting != null;
|
||||||
|
|
||||||
/// The object in charge of the focus tree.
|
/// The object in charge of the focus tree.
|
||||||
///
|
///
|
||||||
@ -2108,11 +2121,11 @@ class BuildOwner {
|
|||||||
if (element._inDirtyList) {
|
if (element._inDirtyList) {
|
||||||
assert(() {
|
assert(() {
|
||||||
if (debugPrintScheduleBuildForStacks)
|
if (debugPrintScheduleBuildForStacks)
|
||||||
debugPrintStack(label: 'markNeedsToResortDirtyElements() called; _dirtyElementsNeedsResorting was $_dirtyElementsNeedsResorting (now true); dirty list is: $_dirtyElements');
|
debugPrintStack(label: 'BuildOwner.scheduleBuildFor() called; _dirtyElementsNeedsResorting was $_dirtyElementsNeedsResorting (now true); dirty list is: $_dirtyElements');
|
||||||
if (_dirtyElementsNeedsResorting == null) {
|
if (!_debugIsInBuildScope) {
|
||||||
throw new FlutterError(
|
throw new FlutterError(
|
||||||
'markNeedsToResortDirtyElements() called inappropriately.\n'
|
'BuildOwner.scheduleBuildFor() called inappropriately.\n'
|
||||||
'The markNeedsToResortDirtyElements() method should only be called while the '
|
'The BuildOwner.scheduleBuildFor() method should only be called while the '
|
||||||
'buildScope() method is actively rebuilding the widget tree.'
|
'buildScope() method is actively rebuilding the widget tree.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user