Adjust TODOs
diff --git a/packages/devtools_app/lib/src/inspector/diagnostics_node.dart b/packages/devtools_app/lib/src/inspector/diagnostics_node.dart index 8d7bde3..4f15d7b 100644 --- a/packages/devtools_app/lib/src/inspector/diagnostics_node.dart +++ b/packages/devtools_app/lib/src/inspector/diagnostics_node.dart
@@ -65,12 +65,12 @@ final bool isProperty; + // TODO(albertusangga): Refactor to cleaner/more robust solution bool get isFlex => ['Row', 'Column', 'Flex'].contains(widgetRuntimeType); int get flexFactor => json['flexFactor']; - RemoteDiagnosticsNode get renderObject => - RemoteDiagnosticsNode(json['renderObject'], inspectorService, false, this); + Map<String, Object> get renderObject => json['renderObject']; Map<String, Object> get constraints => json['constraints'];
diff --git a/packages/devtools_app/lib/src/inspector/flutter/inspector_data_models.dart b/packages/devtools_app/lib/src/inspector/flutter/inspector_data_models.dart index 1e3db96..db8d81f 100644 --- a/packages/devtools_app/lib/src/inspector/flutter/inspector_data_models.dart +++ b/packages/devtools_app/lib/src/inspector/flutter/inspector_data_models.dart
@@ -195,7 +195,8 @@ } static FlexLayoutProperties _buildNode(RemoteDiagnosticsNode node) { - final Map<String, Object> renderObjectJson = node.json['renderObject']; + final Map<String, Object> renderObjectJson = node?.renderObject; + if (renderObjectJson == null) return null; final List<dynamic> properties = renderObjectJson['properties']; final Map<String, Object> data = Map<String, Object>.fromIterable( properties,
diff --git a/packages/devtools_app/lib/src/inspector/flutter/inspector_screen_details_tab.dart b/packages/devtools_app/lib/src/inspector/flutter/inspector_screen_details_tab.dart index d88cd7a..22961e4 100644 --- a/packages/devtools_app/lib/src/inspector/flutter/inspector_screen_details_tab.dart +++ b/packages/devtools_app/lib/src/inspector/flutter/inspector_screen_details_tab.dart
@@ -175,7 +175,6 @@ final highlightChild = selected.isFlex ? null : selected.parent.childrenNow.indexOf(selected); return StoryOfYourFlexWidget( - // TODO(albertusangga): Cache this instead of recomputing every build, flexLayoutProperties, highlightChild: highlightChild, inspectorController: controller,
diff --git a/packages/devtools_app/test/flutter/story_of_layout/flex_test.dart b/packages/devtools_app/test/flutter/story_of_layout/flex_test.dart index d0eddf0..d4a95e2 100644 --- a/packages/devtools_app/test/flutter/story_of_layout/flex_test.dart +++ b/packages/devtools_app/test/flutter/story_of_layout/flex_test.dart
@@ -29,16 +29,14 @@ "constraints": { "type": "BoxConstraints", "description": "BoxConstraints(w=300.0, h=60.0)", - "hasBoundedHeight": true, - "hasBoundedWidth": true, - "minWidth": 300.0, - "minHeight": 60.0, - "maxHeight": 60.0, - "maxWidth": 300.0 + "minWidth": "300.0", + "minHeight": "60.0", + "maxHeight": "60.0", + "maxWidth": "300.0" }, "size": { - "width": 300.0, - "height": 60.0 + "width": "300.0", + "height": "60.0" }, "isFlex": true, "children": [ @@ -54,15 +52,14 @@ "constraints": { "type": "BoxConstraints", "description": "BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=56.0)", - "hasBoundedHeight": true, - "hasBoundedWidth": false, - "minWidth": 0.0, - "minHeight": 0.0, - "maxHeight": 56.0 + "minWidth": "0.0", + "minHeight": "0.0", + "maxHeight": "56.0", + "maxWidth": "Infinity" }, "size": { - "width": 56.0, - "height": 25.0 + "width": "56.0", + "height": "25.0" }, "flexFactor": null, "createdByLocalProject": true, @@ -82,16 +79,14 @@ "constraints": { "type": "BoxConstraints", "description": "BoxConstraints(w=40.0, 0.0<=h<=56.0)", - "hasBoundedHeight": true, - "hasBoundedWidth": true, - "minWidth": 40.0, - "minHeight": 0.0, - "maxHeight": 56.0, - "maxWidth": 40.0 + "minWidth": "40.0", + "minHeight": "0.0", + "maxHeight": "56.0", + "maxWidth": "40.0" }, "size": { - "width": 40.0, - "height": 31.0 + "width": "40.0", + "height": "31.0" }, "flexFactor": 1, "createdByLocalProject": true,