Commit 4913c4fc authored by Ian Hickson's avatar Ian Hickson

Merge pull request #1489 from Hixie/cleanup

Add more debugging information to Widgets.
parents 90a0f630 f5834c9a
...@@ -712,6 +712,11 @@ class DefaultTextStyle extends InheritedWidget { ...@@ -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 { ...@@ -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 { ...@@ -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,
...@@ -795,6 +800,8 @@ abstract class Element<T extends Widget> implements BuildContext { ...@@ -795,6 +800,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> { ...@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment