flutter / flutter/devtools

Provide a way to see inherited values in the Inspector

Aperta
#3,084 1 commento 1 reazione 0 assegnatari Vedi su GitHub
new feature P2 screen: inspector
Lingua principale
Dart
Stelle
1.7k
Fork
404
Merge medio
6g 17h
PR unite (30g)
18

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia esaminando il DevTools Flutter inspector e la issue 636 di DevTools collegata relativa all’albero RenderObject/Element mancante. Il lavoro è completo quando offre agli sviluppatori un modo più chiaro per ispezionare i valori DefaultTextStyle ereditati, ad esempio esponendo il debugLabel di TextStyle nell’albero dei widget.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
dart, flutter
Ambito
developer-experience, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.