Jim*_*hiu 1

没有正确的方法在提示中添加图标,但您可以尝试这种替代方法,在文本字段上使用富文本作为提示文本,点击文本字段时隐藏,并在文本字段为空且键盘隐藏时按条件显示:

            Stack(
              alignment: AlignmentDirectional.center,
              children: [
                Offstage(
                  offstage: _isHide,
                  child: IgnorePointer(
                    ignoring: true,
                    child: Text.rich(
                      TextSpan(
                        children: [
                          WidgetSpan(
                            child: Icon(
                              Icons.search,
                              color: Colors.grey,
                            ),
                          ),
                          TextSpan(
                            text: "blablablablabla",
                            style: TextStyle(color: Colors.grey),
                          ),
                        ],
                      ),
                    ),
                  ),
                ),
                TextField(onTap: () {
                  _isHide = true;
                  setState(() {});
                }),
              ],
            ),
Run Code Online (Sandbox Code Playgroud)