You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CupertinoTextField unable to override the default placeholder color. #24175
I'm having problems on overriding the default color for placeholder in CupertinoTextField. As I'm trying to set it white it always turns to gray. I've inspected the flutter source base and found this:
if (widget.placeholder !=null&& text.text.isEmpty) {
stackChildren.add(
Padding(
padding: widget.padding,
child:Text(
widget.placeholder,
maxLines:1,
overflow:TextOverflow.ellipsis,
style: widget.style.merge(
constTextStyle(
color: _kInactiveTextColor,
fontWeight:FontWeight.w300,
),
),
),
),
);
}
Is there any other way around this?
Here is my flutter installation details:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.10.2, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
[✓] Android Studio (version 3.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
[✓] Connected device (1 available)
• No issues found!
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
xster commentedon Nov 12, 2018
Indeed it is static since it's not customizable on iOS either. https://developer.apple.com/documentation/uikit/uitextfield/1619621-placeholder?language=objc
Do you have a mock-up of the effects you're trying to achieve?
ffimnsr commentedon Nov 13, 2018
Indeed @xster, but what do I override it? The default
placeholderis just text in regards to that, developers given an option to customize it usingattributedPlaceholderto set UIColor.https://developer.apple.com/documentation/uikit/uitextfield/1619610-attributedplaceholder?language=objc
Well, what I'm trying to achieve is set the placeholder color similar to the text color of the
UITextField.xster commentedon Nov 13, 2018
Ah, sensible to add a placeholderStyle to CupertinoTextField in this case. Feel free to send us a PR as well :)
ffimnsr commentedon Nov 21, 2018
Hi @xster, I've submitted a minor update for the placeholder customization.
github-actions commentedon Aug 14, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.