Flutter: Cupertino TextField with hintText

kosiara - Bartosz Kosarzycki picture kosiara - Bartosz Kosarzycki · Mar 11, 2019 · Viewed 7.1k times · Source

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

Answer

thebuggycoder picture thebuggycoder · Mar 11, 2019

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

Example:

CupertinoTextField(
   placeholder: "Enter Email",
)