【问题标题】:Keyboard is not showing on clicking on TextFormField in Flutter Android在 Flutter Android 中单击 TextFormField 时未显示键盘
【发布时间】:2022-09-23 05:01:31
【问题描述】:

我在颤振应用程序中使用 TextFormField 。在我的应用程序中无处不在它工作正常,但只是在一个屏幕上它给了我一个错误。当我单击 TextFormField 时,键盘打开并立即自动隐藏。这是我的 TextFormField 代码。

TextFormField(
  controller: offerController,
  maxLines: 1,
  keyboardType: TextInputType.number,
  textInputAction: TextInputAction.next,
  style: GoogleFonts.arimo(
    textStyle: const TextStyle(
      color: Color(ColorConstants.TEXT_COLOR_GREY),
      fontSize: 14.0,
      fontWeight: FontWeight.w400,
    ),
  ),
  decoration: InputDecoration(
    border: InputBorder.none,
    enabledBorder: InputBorder.none,
    hintText: \"Add the Offer Value\",
    hintStyle: GoogleFonts.arimo(
      textStyle: const TextStyle(
        color: Color(ColorConstants.COLOR_BFBFBF),
        fontSize: 14.0,
        fontWeight: FontWeight.w400,
      ),
    ),
  ),
)

    标签: android flutter dart flutter-layout


    【解决方案1】:

    将此添加到您的 textFormField。

    keyboardType: TextInputType.numberWithOptions(signed: true),
    inputFormatters: [
      FilteringTextInputFormatter.digitsOnly,
    ],
    

    【讨论】:

      【解决方案2】:
      onTap(){
         FocusNode.requestFocus();
      }
      

      【讨论】:

        【解决方案3】:

        在这种情况下,如果你使用ios模拟器,你可以看到这个链接Flutter - Keyboard not showing when TextFormField is selected

        【讨论】:

          猜你喜欢
          • 2020-10-31
          • 1970-01-01
          • 2020-10-15
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2022-11-14
          • 2019-05-04
          • 2020-04-28
          相关资源
          最近更新 更多