-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add color to CupertinoButton.filled constructor #161660
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
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Hey @vizakenjack welcome! Thanks for contributing, this will need a test to verify it works as expected, and a signed CLA. |
MitchellGoodwin
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.
Ack, we've got our colors messed up. I don't believe the proposed solution will fully fix the problem, however.
The use case you are trying to solve should be for CupertinoButton.filled. Regular CupertinoButton should have no background color.

So color should be exposed for CupertinoButton.filled. The text color of which is the primaryContrastingColor from the theme. But also, color should not be changing the background of plain CupertinoButton, it should be changing the foreground. A plain CupertinoButton should have purple text with no background.
Also as said above, we will need a CLA signed to move forward with this PR. It also will need a test to be merged, especially as this is a regression.
|
@MitchellGoodwin thanks! I think I have filled a CLA. I'll post another commit later, with a CupertinoButton.filled and However, it would be a breaking change for people upgrading to 3.27 |
Somewhat, but because Cupertino is trying to match Apple's designs at the default, we kind of have to make breaking changes according to what they do. If there was a way to guess how people are using these colors and convert them to the right API, then we'd do that, but I don't think that exists here. We should at least make it so that the APIs enable them to swap over to what use case they wanted. |
|
Added |
MitchellGoodwin
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.
Change looks good. Please also update the documentation for CupertinoButton.filled to say the background defaults to the theme's primaryColor if color isn't provided.
|
@vizakenjack can you also update the PR description to reflect what the changes here are? |
|
Added tests, fixed documentation, edited PR description |
MitchellGoodwin
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.
Tentatively LGTM. Thank you for putting this together. Check failures match the failures on the tree, so unlikely caused by this PR. Waiting for the tree issues to be resolved.
9d940ee to
02931a7
Compare
|
@vizakenjack I rebased the PR to pick up the tree fixes. The linter check is all that's failing, and just needs you to format the button test file. |
Thanks! That's strange but I have no idea how to fix the linter (did all the edits in github editor) |
I'm not sure the best way to apply the formatting with the github editor. I'm not familiar with it, and I believe a lot of Flutter specific actions aren't supported by it. Locally you can enable autoformatting on save with your IDE, or run If you want to try and get it to work with the github editor, from the Linux analyze check it seems to want this: decoration = tester
.widget<DecoratedBox>(
find.descendant(
of: find.byType(CupertinoButton),
matching: find.byType(DecoratedBox),
),
)
.decoration as BoxDecoration;turned into roughly this, but I do not think I have the spacing right: decoration =
tester
.widget<DecoratedBox>(
find.descendant(
of: find.byType(CupertinoButton),
matching: find.byType(DecoratedBox),
),
)
.decoration
as BoxDecoration;I would strongly request that you try and fix it locally, or at least try not to manually format it and see if it passes more than once or twice. When PRs are updated all the checks run again which can be expensive on our infrastructure, and slow down other PRs. |
|
It looks like the formatting fix is done, I am going to rebase to see if it resolves the remaining failures. |
Issue: #161590
This pull request adds
colorargument for CupertinoButton.filled constructor