10

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'

enter image description here

2 Answers2

19

I think you can achieve what you want with the placeholder property of CupertinoTextField.

Example:

CupertinoTextField(
   placeholder: "Enter Email",
)
bytesizedwizard
  • 5,529
  • 3
  • 17
  • 39
3

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.

  • 1
    Hi, Welcome to SO. As explained in the tour, this site is a repository of useful questions and their answers. Your answer is not essentially different from the other answer and not very useful since it does not add any new value or information. Please avoid writing duplicate answers, either edit your answer to add value or delete it altogether, this will ensure all questions and answers on the site remain useful not scattered/duplicated. Cheers! – bytesizedwizard Mar 11 '19 at 11:56