render_metrics 패키지는 Flutter 애플리케이션 내 위젯에 대한 정확한 레이아웃 메트릭을 검색할 수 있는 방법을 제공합니다. RenderObject를 활용하여 개발자는 위젯의 정확한 크기 및 화면 위치 데이터를 얻을 수 있으며, 위젯 상태 간의 차이를 측정할 수도 있습니다. 이는 레이아웃 문제 디버깅, 사용자 정의 애니메이션 구현 또는 특정 UI 요소와 일치하는 오버레이 요소 생성에 특히 유용합니다. 이 라이브러리는 Android, iOS, 웹, macOS, Windows, Linux 등 모든 주요 플랫폼을 지원합니다.
Get a bundle with the positioning coordinates of the wrapped widget.
RenderData data = renderManager.getRenderData("uniqueWidgetId");
Calculating the difference in positioning between two widgets
Wrap the widgets you want to compare in RenderMetricsObjects. Specify two different ids for each of them. Please note, that the manager parameter of both widgets should contain the link to the same RenderParametersManager instance.
Specify two unique widget identifiers when using the getDiffById() function and extract a bundle with the relative difference in positioning coordinates between the widgets.
RenderData instance contains a complete set of properties that characterize any widget in a two-dimensional space.
All metrics positioning coordinates are global, meaning they are relative to the entire screen coordinate space.
RenderData also provides you an ability to get all widget keypoint XY-coordinates by calling one of special getters.
ComparisonDiff
You can get the comparison relative results for each widget keypoint from the ComparisonDiff instance.
An additional set of special getters can help you calculate the difference between two adjacent sides of two different widgets (e.g. right to left, top to bottom, etc.).
Installation
Add render_metrics to your pubspec.yaml file:
dependencies:render_metrics:$currentVersion$
At this moment, the current version of render_metrics is .
Changelog
All notable changes to this project will be documented in this file.
Issues
To report your issues, submit them directly in the Issues section.
Contribute
If you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please read our contribution guide first and send us your pull request.
Your PRs are always welcome.
How to reach us
Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.