-
Notifications
You must be signed in to change notification settings - Fork 29.7k
CupertinoDynamicColor improvements #44317
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
CupertinoDynamicColor improvements #44317
Conversation
| @override | ||
| void debugFillProperties(DiagnosticPropertiesBuilder properties) { | ||
| super.debugFillProperties(properties); | ||
| const CupertinoTextThemeData defaultData = CupertinoTextThemeData(); |
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.
Getting error • Evaluation of this constant expression throws an exception • packages/flutter/lib/src/cupertino/text_theme.dart:255:48 • const_eval_throws_exception but the analyzer won't let me change to final either.
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.
Is it because you're missing required parameters (this assertion https://github.com/flutter/flutter/pull/44317/files#diff-6cb3174a51ae9b800fc6377dfc24234cR161)?
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.
primaryColor has a default value CupertinoColors.systemBlue. The weird thing is I'm able to compile apps and they run without throwing, despite this analyzer error.
HansMuller
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.
This all looks pretty slick.
One the face of it, I'm not sure what https://github.com/flutter/flutter/pull/44317/files#r343507022 is all about.
| properties.add(DiagnosticsProperty<Element>('last resolved', _debugResolveContext)); | ||
| } | ||
|
|
||
| /// Asserts that the |
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.
This looks unfinished
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
Pretty cool, I didn't realize how to set up debug things like that.
| @override | ||
| void debugFillProperties(DiagnosticPropertiesBuilder properties) { | ||
| super.debugFillProperties(properties); | ||
| const CupertinoTextThemeData defaultData = CupertinoTextThemeData(); |
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.
Is it because you're missing required parameters (this assertion https://github.com/flutter/flutter/pull/44317/files#diff-6cb3174a51ae9b800fc6377dfc24234cR161)?
HansMuller
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
Description
This PR is an attempt at making the
CupertinoDynamicColormore debuggable.If a CupertinoDynamicColor is used to paint before being resolved, it should throwNot feasible because that will break people that are currently usingCupertinoColors.activeBlueas a concrete color. But this assert (now removed) did catch a few unresolved color usages in the framework and tests.debugLabelfield toCupertinoDynamicColor.Screenshots
Inspecting a dynamic color in the widget inspector.
Clicking on "last resolved" will link you to that element, thanks to the dev tool.

Enhanced
CupertinoThemedisplayRelated Issues
#35541
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?