-
Notifications
You must be signed in to change notification settings - Fork 29.7k
un-break ThemeData equality
#154695
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
un-break ThemeData equality
#154695
Conversation
f7b1358 to
afc0073
Compare
nate-thegrate
left a comment
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.
@navaronbracke thanks very much for the review!
justinmc
left a comment
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 👍
This looks like a huge win to me. It's nice seeing all of the new consts. I wonder if there's anywhere in the docs where we should encourage people to use .fromMap for performance reasons?
Thanks for jumping on this.
As it so happens, I have another PR aimed to improve documentation; I'll definitely be pushing an update there once this guy lands :) |
This comment was marked as outdated.
This comment was marked as outdated.
17b69f6 to
0b41a64
Compare
|
Thanks @nate-thegrate for working on this, expanding the Question about this comment:
Did you mean that some If so, any plans on addressing it? Or did you mean to that consumers of I am bringing this up, because, if custom themes use even a single All more involved custom theming in Flutter currently rely heavily on using many different versions of
Then we have specialized ones like e.g.:
They are all used and needed a lot when you make custom themes. Are there now with these updates, We really need that. To then teach users to use These would also be a great target for a Flutter lint, to at least detect any In any cases, awesome work, thanks! 👏🏻 💙 |
Nope! Fortunately, any configuration that can be represented using a
Yes indeed! This PR was specifically targeted at the
Yes! Any situation where you could use
I've considered opening a PR to deprecate the It's a very noticeable issue when a But my guess would be that most of the less-experienced developers are going to prefer |
|
Awesome, thanks for the response with clarifications @nate-thegrate 🙏🏻 💙 Looking forward to replacing all the
Might be a good idea to do so. I would be totally onboard with it too, even if it is a lot of re-work for me, but I plan to do it anyway 😄 If you make even a bit more advanced themes, you will have a lot of Still, getting a nagging deprecation reminder to replace them is even better than a lint. Only way to get rid of the wrongly triggered rebuilds of This Seems like some found this second explanation more clear #89127 (comment) Anyway, thanks again for coming up with a fix for this and as a bonus a much nicer syntax! 💙 |
This PR is almost able to close issue #89127.
Sadly, no
InheritedModelor customRenderObjects today; instead the WidgetState operators have been restructured to support equality checks.WidgetStateProperty.fromMap()is now capable of accurate equality checks, and all of the.styleFrom()methods have been refactored to use that constructor.(Equality checks are still broken for
WidgetStateProperty.resolveWith(), and any other non-constobjects that implement the interface.)credit for this idea goes to @justinmc: #89127 (comment)