Closed
Description
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
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
johnsonmh commentedon Aug 30, 2018
Hi there, thanks for spotting this! The issue comes from the
PrimaryColorOverride
inlogin.dart
. We're usingprimaryColor
when we should be usingaccentColor
.I'm working on updating the code and docs, in the meantime, all you need to get it working is to change
primaryColor
toaccentColor
in thebuild
method ofPrimaryColorOverride
.See pull 114 for more info.
johnsonmh commentedon Aug 31, 2018
Codelab has been updated, as well as the code itself, to override the accentColor instead of the primaryColor. Thanks again for spotting this!
benedicte69 commentedon Sep 3, 2018
benedicte69 commentedon Sep 3, 2018
johnsonmh commentedon Sep 3, 2018
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 commentedon Sep 5, 2018
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 commentedon Sep 5, 2018
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
(inapp.dart
) uses theThemeData.light()
theme as a base, theTextField
border color is determined byprimaryColor
. But when we use theThemeData.dark()
theme as a base, the border color is determined byaccentColor
.@willlarche do you happen to know why this is?
willlarche commentedon Sep 10, 2018
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 commentedon Sep 11, 2018
willlarche commentedon Sep 11, 2018
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.