Skip to content

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

Closed
@benedicte69

Description

@benedicte69

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

Activity

johnsonmh

johnsonmh commented on Aug 30, 2018

@johnsonmh
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

johnsonmh commented on Aug 31, 2018

@johnsonmh
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

benedicte69 commented on Sep 3, 2018

@benedicte69
Author
benedicte69

benedicte69 commented on Sep 3, 2018

@benedicte69
Author
johnsonmh

johnsonmh commented on Sep 3, 2018

@johnsonmh
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

benedicte69 commented on Sep 5, 2018

@benedicte69
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

johnsonmh commented on Sep 5, 2018

@johnsonmh
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?

self-assigned this
on Sep 5, 2018
willlarche

willlarche commented on Sep 10, 2018

@willlarche
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

benedicte69 commented on Sep 11, 2018

@benedicte69
Author
willlarche

willlarche commented on Sep 11, 2018

@willlarche
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

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @willlarche@johnsonmh@benedicte69

      Issue actions

        Changing yellow color and brightness did not work for me · Issue #106 · material-components/material-components-flutter-codelabs