【问题标题】:How to add hint in the TextFormField in Flutter?如何在 Flutter 的 TextFormField 中添加提示?
【发布时间】:2020-05-04 22:24:57
【问题描述】:

我有以下使用 TextFormField 的文本字段代码。但是我没有看到 TextFormField 中的任何函数属性,就像我们以前在 Android 中的 TextField 中看到的那样添加标签或提示。如何添加?

【问题讨论】:

    标签: android flutter text dart hint


    【解决方案1】:

    提示不能作为其直接可用的属性或功能使用,但它位于您可以在您拥有的菜单中选择的装饰之下。在其下您可以找到标签和提示。

    【讨论】:

      【解决方案2】:

      您可以使用 hintTextlabelText

      TextField(
                  decoration: InputDecoration(labelText: 'labelText'),
                ),
                TextField(
                  decoration: InputDecoration(hintText: 'hintText'),
                ),
                TextField(
                  decoration:
                      InputDecoration(hintText: 'both', labelText: 'both'),
                ),
      

      More Information- TextFormField and TextField PlaceHolder

      【讨论】:

        【解决方案3】:

        装饰:输入装饰( 提示文本:“您的提示” )

        【讨论】:

          猜你喜欢
          • 2019-06-09
          • 1970-01-01
          • 2020-06-18
          • 2020-08-21
          • 2019-06-25
          • 2020-03-10
          • 2021-11-15
          • 2021-03-04
          相关资源
          最近更新 更多