Setting icon color to first ListTile in ExpansionTile. Fixes #23053 #23118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In issue #23053, developer reports being unable to set the trailing icon color in the first ListTile of the ExpansionTile.
This behaviour can be seen in the Gallery app. Go to Material > Expand/collapse list control. The trailing arrow does not get the same blue color the title gets.
The problem is the following:
The
ExpansionTile
sets anIconThemeData
before creating theListTile
and sets the color to be used forward. This is the original code:The problem with this code is that the
ListTile
itself creates anotherIconThemeData
in itsbuild()
method. And this newIconThemeData
does not take into account the one created outside in theExpansionTile
.This PR substitutes the
IconThemeData
by aListTileTheme
that is used natively by the code inside theListTile
to set its style.Since the
ListTileTheme
can also provide a text style, it is used to provide the style for the title so it is no longer necessary to create aDefaultTextStyle
, that is also removed from the code.