I'd like to add hint text to CupertinoTextField
without importing the material theme.
Up to this point I tried mixing CupertinoTextField
with InputDecoration
like so:
CupertinoTextField(
decoration: InputDecoration.collapsed(
hintText: 'Enter you email'
)
)
which results in the following error:
The argument type 'InputDecoration' can't be assigned to the parameter type 'BoxDecoration'
Here is the step by step instructions: Step 1: Locate the file where you have placed the TextField widget. Step 2: Inside the TextField widget, add the decoration parameter and assign the InputDecoration widget. Step 3: Inside the InputDecoration widget, add the hintStyle parameter and assign the TextStyle widget.
Steps to Remove TextField Underline/Border in Flutter To remove TextField underline/border in Flutter, you can simply set the border property to InputBorder. none. This will remove the underline for all states such as Focused, Enabled, Error, Disabled.
By default, a TextField is decorated with an underline. You can add a label, icon, inline hint text, and error text by supplying an InputDecoration as the decoration property of the TextField . To remove the decoration entirely (including the underline and the space reserved for the label), set the decoration to null.
I think you can achieve what you want with the placeholder
property of CupertinoTextField
.
Example:
CupertinoTextField(
placeholder: "Enter Email",
)
In the CupertinoTextField it's called placeholder not hint
you cant add like that
CupertinoTextField(
placeholder: "Your placeholder here",
)
and for styling the placeholder i think you can't at the moment because its static and it's not customizable on iOS either.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With