Add more debugging information to Widgets.
Also, fix comment mentioning syncConstructorArguments.
This commit is contained in:
parent
02535f50c1
commit
f5834c9abe
@ -712,6 +712,11 @@ class DefaultTextStyle extends InheritedWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool updateShouldNotify(DefaultTextStyle old) => style != old.style;
|
bool updateShouldNotify(DefaultTextStyle old) => style != old.style;
|
||||||
|
|
||||||
|
void debugFillDescription(List<String> description) {
|
||||||
|
super.debugFillDescription(description);
|
||||||
|
'$style'.split('\n').forEach(description.add);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Text extends StatelessComponent {
|
class Text extends StatelessComponent {
|
||||||
@ -738,6 +743,13 @@ class Text extends StatelessComponent {
|
|||||||
text = new StyledTextSpan(combinedStyle, [text]);
|
text = new StyledTextSpan(combinedStyle, [text]);
|
||||||
return new Paragraph(text: text);
|
return new Paragraph(text: text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void debugFillDescription(List<String> description) {
|
||||||
|
super.debugFillDescription(description);
|
||||||
|
description.add('"$data"');
|
||||||
|
if (style != null)
|
||||||
|
'$style'.split('\n').forEach(description.add);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Image extends LeafRenderObjectWidget {
|
class Image extends LeafRenderObjectWidget {
|
||||||
|
@ -182,10 +182,15 @@ abstract class Widget {
|
|||||||
Element createElement();
|
Element createElement();
|
||||||
|
|
||||||
String toString() {
|
String toString() {
|
||||||
if (key == null)
|
final String name = key == null ? '$runtimeType' : '$runtimeType-$key';
|
||||||
return '$runtimeType';
|
final List<String> data = <String>[];
|
||||||
return '$runtimeType-$key';
|
debugFillDescription(data);
|
||||||
|
if (data.isEmpty)
|
||||||
|
return 'name';
|
||||||
|
return 'name(${data.join("; ")})';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void debugFillDescription(List<String> description) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RenderObjectWidgets provide the configuration for [RenderObjectElement]s,
|
/// RenderObjectWidgets provide the configuration for [RenderObjectElement]s,
|
||||||
@ -786,6 +791,8 @@ abstract class Element<T extends Widget> implements BuildContext {
|
|||||||
description.add('no depth');
|
description.add('no depth');
|
||||||
if (widget == null)
|
if (widget == null)
|
||||||
description.add('no widget');
|
description.add('no widget');
|
||||||
|
else
|
||||||
|
widget.debugFillDescription(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
String toStringDeep([String prefixLineOne = '', String prefixOtherLines = '']) {
|
String toStringDeep([String prefixLineOne = '', String prefixOtherLines = '']) {
|
||||||
|
@ -318,7 +318,7 @@ class ScrollableViewportState extends ScrollableState<ScrollableViewport> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
void _updateScrollBehaviour() {
|
void _updateScrollBehaviour() {
|
||||||
// if you don't call this from build() or syncConstructorArguments(), you must call it from setState().
|
// if you don't call this from build(), you must call it from setState().
|
||||||
scrollTo(scrollBehavior.updateExtents(
|
scrollTo(scrollBehavior.updateExtents(
|
||||||
contentExtent: _childSize,
|
contentExtent: _childSize,
|
||||||
containerExtent: _viewportSize,
|
containerExtent: _viewportSize,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user