简体   繁体   中英

Wrapping CupertinoTextField placeholder text

I'm trying to get the placeholder text in a CupertinoTextField to wrap to the next line, rather than being cut off with an ellipsis.

When I set maxLines to a value (eg 5), the placeholder text wraps. However, I want the TextField to expand with the user's input, so I need to set maxLines to null.

    return CupertinoTextField(
      controller: _textController,
      autofocus: true,
      placeholder:
          "This is a very long placeholder text that should wrap to the next line.",
      maxLines: null,
    );

Is there a workaround to get the placeholder text to wrap?

我的解决方案是设置minLines: 2并设置maxLines: (greater than 2)确保expands设置为 false 或排除。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM