Show width and height in inspector overlay (#140709)
 Fixes https://github.com/flutter/devtools/issues/6871 Add the width and height to the inspector overlay. 1 decimal precision is used since that matches the way Devtools displays the values. ## Examples <img width="442" alt="Screenshot 2023-12-28 at 2 39 49â¯PM" src="https://github.com/flutter/flutter/assets/1386322/2de40092-de15-4ada-a954-e911e6bef217"> <img width="645" alt="Screenshot 2023-12-28 at 2 39 42â¯PM" src="https://github.com/flutter/flutter/assets/1386322/8f53dad5-1aba-43d9-9419-ca93cd894624"> <img width="149" alt="Screenshot 2023-12-28 at 2 39 37â¯PM" src="https://github.com/flutter/flutter/assets/1386322/bbed74b7-c962-4c20-80d8-48e5eaa14de6">
This commit is contained in:
@@ -3188,11 +3188,15 @@ class _InspectorOverlayLayer extends Layer {
|
||||
}
|
||||
candidates.add(_TransformedRect(candidate, rootRenderObject));
|
||||
}
|
||||
final _TransformedRect selectedRect = _TransformedRect(selected, rootRenderObject);
|
||||
final String widgetName = selection.currentElement!.toStringShort();
|
||||
final String width = selectedRect.rect.width.toStringAsFixed(1);
|
||||
final String height = selectedRect.rect.height.toStringAsFixed(1);
|
||||
|
||||
final _InspectorOverlayRenderState state = _InspectorOverlayRenderState(
|
||||
overlayRect: overlayRect,
|
||||
selected: _TransformedRect(selected, rootRenderObject),
|
||||
tooltip: selection.currentElement!.toStringShort(),
|
||||
selected: selectedRect,
|
||||
tooltip: '$widgetName ($width x $height)',
|
||||
textDirection: TextDirection.ltr,
|
||||
candidates: candidates,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user