【问题标题】:here, I created _inputfields Widget for the text fields and I just want to remove underlines from the text fields but it doesn't allow me to do that在这里,我为文本字段创建了 _inputfields 小部件,我只想从文本字段中删除下划线,但它不允许我这样做
【发布时间】:2021-02-07 03:45:34
【问题描述】:
              _inputfields(context,"Username",_userName.focusNode,                 
                           _userName.mycontroller,false),

              _inputfields(context, "Password", _password.focusNode,
                           _password.mycontroller, true),

...........

Widget _inputfields(BuildContext context, String hinttext, FocusNode _focusnode, TextEditingController _controller, bool obscure, {bool 可选 = false}) { 返回容器( 装饰:盒子装饰( 颜色:Colors.purple,

  borderRadius: const BorderRadius.all(Radius.circular(100)),


),

【问题讨论】:

  • 它显示“InputDecoration不能分配给“Decoration”参数

标签: android-studio flutter android-layout flutter-layout textfield


【解决方案1】:

您需要应用一个没有下划线的 TextStyle,如下所示:

TextStyle(decoration: TextDecoration.none);

现在假设您使用的是 TextFormField

    TextFormField(style: TextStyle(decoration: TextDecoration.none),
                  decoration: InputDecoration(labelText: 'Enter your sample Username'), 

                  validator: (input) { return null;});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-22
    • 1970-01-01
    • 2022-01-21
    • 2022-08-20
    • 2021-12-17
    • 1970-01-01
    • 2013-09-07
    • 1970-01-01
    相关资源
    最近更新 更多