Unverified Commit 646d2b01 authored by Dan Field's avatar Dan Field Committed by GitHub

properties (#51650)

parent 515027a9
...@@ -7094,6 +7094,12 @@ class ColoredBox extends SingleChildRenderObjectWidget { ...@@ -7094,6 +7094,12 @@ class ColoredBox extends SingleChildRenderObjectWidget {
void updateRenderObject(BuildContext context, _RenderColoredBox renderObject) { void updateRenderObject(BuildContext context, _RenderColoredBox renderObject) {
renderObject.color = color; renderObject.color = color;
} }
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<Color>('color', color));
}
} }
class _RenderColoredBox extends RenderProxyBoxWithHitTestBehavior { class _RenderColoredBox extends RenderProxyBoxWithHitTestBehavior {
......
...@@ -473,7 +473,10 @@ class Container extends StatelessWidget { ...@@ -473,7 +473,10 @@ class Container extends StatelessWidget {
properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, showName: false, defaultValue: null)); properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, showName: false, defaultValue: null));
properties.add(DiagnosticsProperty<EdgeInsetsGeometry>('padding', padding, defaultValue: null)); properties.add(DiagnosticsProperty<EdgeInsetsGeometry>('padding', padding, defaultValue: null));
properties.add(DiagnosticsProperty<Clip>('clipBehavior', clipBehavior, defaultValue: Clip.none)); properties.add(DiagnosticsProperty<Clip>('clipBehavior', clipBehavior, defaultValue: Clip.none));
properties.add(DiagnosticsProperty<Decoration>('bg', decoration, defaultValue: null)); if (color != null)
properties.add(DiagnosticsProperty<Color>('bg', color));
else
properties.add(DiagnosticsProperty<Decoration>('bg', decoration, defaultValue: null));
properties.add(DiagnosticsProperty<Decoration>('fg', foregroundDecoration, defaultValue: null)); properties.add(DiagnosticsProperty<Decoration>('fg', foregroundDecoration, defaultValue: null));
properties.add(DiagnosticsProperty<BoxConstraints>('constraints', constraints, defaultValue: null)); properties.add(DiagnosticsProperty<BoxConstraints>('constraints', constraints, defaultValue: null));
properties.add(DiagnosticsProperty<EdgeInsetsGeometry>('margin', margin, defaultValue: null)); properties.add(DiagnosticsProperty<EdgeInsetsGeometry>('margin', margin, defaultValue: null));
......
...@@ -361,7 +361,15 @@ void main() { ...@@ -361,7 +361,15 @@ void main() {
expect(drawRect[0], const Rect.fromLTWH(0, 0, 800, 600)); expect(drawRect[0], const Rect.fromLTWH(0, 0, 800, 600));
expect(drawRect[1].color, colorToPaint); expect(drawRect[1].color, colorToPaint);
verify(mockContext.paintChild(renderSizedBox, Offset.zero)).called(1); verify(mockContext.paintChild(renderSizedBox, Offset.zero)).called(1);
}); });
testWidgets('ColoredBox - properties', (WidgetTester tester) async {
const ColoredBox box = ColoredBox(color: colorToPaint);
final DiagnosticPropertiesBuilder properties = DiagnosticPropertiesBuilder();
box.debugFillProperties(properties);
expect(properties.properties.first.value, colorToPaint);
});
}); });
} }
......
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