Skip to content
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

Changing yellow color and brightness did not work for me #106

Closed
benedicte69 opened this issue Aug 24, 2018 · 10 comments
Closed

Changing yellow color and brightness did not work for me #106

benedicte69 opened this issue Aug 24, 2018 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@benedicte69
Copy link

In home.dart, change the brightness to dark
in login.dart, change the primary override to yellow for both text fields
When I did that it had no effect.
https://github.com/benedicte69/flutter_mdc_100_series

@johnsonmh
Copy link
Contributor

Hi there, thanks for spotting this! The issue comes from the PrimaryColorOverride in login.dart. We're using primaryColor when we should be using accentColor.

I'm working on updating the code and docs, in the meantime, all you need to get it working is to change primaryColor to accentColor in the build method of PrimaryColorOverride.

See pull 114 for more info.

@johnsonmh
Copy link
Contributor

Codelab has been updated, as well as the code itself, to override the accentColor instead of the primaryColor. Thanks again for spotting this!

@benedicte69
Copy link
Author

benedicte69 commented Sep 3, 2018 via email

@benedicte69
Copy link
Author

benedicte69 commented Sep 3, 2018 via email

@johnsonmh
Copy link
Contributor

Hi,

I tried cloning your repo at your latest commit, and I was actually able to get it working as intended. Just to clarify, what we are overriding is the color of the text field outline, only after the text field has been selected.

Hope this helps, let me know if you have any more questions.

@benedicte69
Copy link
Author

Hello, Thank you for having taken the time to look at my GitHub. I have a last concerned, if I am using theme 01 the overriding does not work, if I am using theme 02, the overriding works. I have renamed the themes to clarify the situation but do not understand why it is only working if I am using theme number 02. Perhaps You can tell me. Thanks in advance.

@johnsonmh
Copy link
Contributor

Hm, I can't actually figure out what's going on. My original fix actually was not complete. It turns out that when our ThemeData (in app.dart) uses the ThemeData.light() theme as a base, the TextField border color is determined by primaryColor. But when we use the ThemeData.dark() theme as a base, the border color is determined by accentColor.

@willlarche do you happen to know why this is?

@johnsonmh johnsonmh reopened this Sep 5, 2018
@willlarche willlarche self-assigned this Sep 5, 2018
@willlarche
Copy link
Collaborator

Don't know why this is but accept that it is :) We've updated the code to use accentColor. Should be good to go.

@benedicte69
Copy link
Author

benedicte69 commented Sep 11, 2018 via email

@willlarche
Copy link
Collaborator

Oh, this isn't a case of technical mystery. If you follow the calls, you can find the code. https://github.com/flutter/flutter/blob/fc1b304326214296ac02bddfed9396e2a716e63d/packages/flutter/lib/src/material/input_decorator.dart#L1588

The mystery is why that logic is how it is. This was long before we had a Material Theming spec. So, the Flutter team had to make decisions. And they did a really great job. Material Theming ended up having different rules for text inputs but it came years later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants