flutter / flutter/devtools

Provide a way to see inherited values in the Inspector

未关闭
#3,084 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
new feature P2 screen: inspector
主要语言
Dart
星标
1.7k
派生
404
平均合并
6 天 17 小时
30 天内合并 PR
18

描述

I'm often faced with one of the following questions:

* Why does this text look like this? (E.g. why is it gray even though I don't tell it to be gray anywhere?)
* Why doesn't this text react to changes in `TextTheme`?
* Where is this text style attribute coming from, exactly?

Text style comes from an inherited widget called `DefaultTextStyle`. In complex apps, there are several layers of `DefaultTextStyle`, and `Text` merges them all into the final style.

In the IntelliJ Flutter inspector (before DevTools integration), it was possible to show the RenderObject/Element tree, and from there, the developer was able to see the `debugLabel`. It was not perfect, but — as far as I know — it was the only way to debug issues like the ones listed above.

DevTools doesn't have a RenderObject/Element tree (https://github.com/flutter/devtools/issues/636), and afaik there is no other way to get to this information.

Screen Shot 2021-06-03 at 5 06 55 PM

For what it's worth, I don't think the "go to the Element tree" method was the best developer experience. If we can surface this information better, that would be amazing. Like, in the widget tree above, I can imagine showing information about the `Text`'s current `TextStyle`'s `debugLabel` somewhere in that tree.

贡献指南

打开贡献指南

调研方向

首先查看 DevTools Flutter inspector,以及关于缺少 RenderObject/Element 树的关联 DevTools issue 636。完成的标准是为开发者提供更清晰的方式来检查继承的 DefaultTextStyle 值,例如在 widget 树中公开 TextStyle debugLabel。

由索引模型根据 Issue 内容生成。

评估

技术栈
dart, flutter
领域
developer-experience, tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。