-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Refactored ListTileTheme: ListTileThemeData, ThemeData.listThemeData #91449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nicely done. Just a few suggestions below.
_minLeadingWidth = minLeadingWidth, | ||
super(key: key, child: child); | ||
|
||
final ListTileThemeData? _data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make _data
non-nullable and create a ListTileThemeData
in the constructor from the parameters if they were given? That would simplify a lot of the getters below.
Is this because the constructor is const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's not possible to construct a const ListThemeData parameter value that absorbs all of the constructor parameters - error • Invalid constant value
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I thought. Bummer, it would be nice if that were possible.
f62adfe
to
b0fa008
Compare
…emeData (flutter#91449)" (flutter#91811) This reverts commit 94ff520.
…emeData (flutter#91449)" (flutter#91811) This reverts commit 94ff520.
When is this going to be in the stable branch? |
@anaurelian - it's not likely until mid to late December 2021 |
Thanks for the info @HansMuller glad to know that the drop for it appearing is soon. |
Refactored ListTileTheme to make it conform to Flutter's conventions for component themes.
ListTileThemeData
class which defines overrides for the defaults for visual ListTile properties.ListTileThemeData data
. This is now the preferred way to configure a ListTileTheme.listTileThemeData listTileTheme
property to ThemeData. This is now the preferred way to configure ListTiles in a MaterialApp.selectedColor
,textColor
,iconColor
and (ListTileStyle)style
parameters to ListTile, so that all of the properties that can be overridden via the theme can also be set on the widget itself.For example to configure the icon and text colors for all of the ListTiles in an app:
This is a non-breaking change. In an upcoming PR all of the ListTileTheme properties, except for
data
will be deprecated and a Dart Fix script will be provided to automatically migrate code.Fixes #31247