【问题标题】:How can i make text field with border radius in flutter ???如何在颤动中制作具有边框半径的文本字段???
【发布时间】:2018-07-18 14:35:40
【问题描述】:

我想在 Flutter 中为这个文本字段添加边框半径。 我的代码是

 new Container(
            padding: const EdgeInsets.only(bottom: 10.0, top: 20.0),
            child: new Opacity(
                opacity: 0.7,
                child: new TextField(
                  style: new TextStyle(
                      fontSize: 18.0,
                      height: 1.1,
                      color: Colors.white,
                      fontFamily: 'Akrobat-Bold'),
                  decoration: InputDecoration(
                      filled: true,
                      fillColor: const Color(0xFF808285),
                      hintStyle: TextStyle(
                          color: Colors.white, fontFamily: 'Akrobat-Bold'),
                      border: InputBorder.none,
                      hintText: 'User ID'),
                )),
          ),

提前致谢。

【问题讨论】:

    标签: flutter flutter-layout


    【解决方案1】:

    你可以使用OutlineInputBorder类

    TextField(
      decoration: InputDecoration(
        border: UnderlineInputBorder(
        borderRadius:BorderRadius.circular(5.0)),
        hintText: 'Please enter a search term'
      ),
    );
    

    【讨论】:

    • 感谢@RaoufRahiche 工作顺利。
    【解决方案2】:

    在 Flutter 中为textFormField 添加borderRadius

    decoration: InputDecoration(
      border: OutlineInputBorder(
        borderRadius: BorderRadius.all(Radius.circular(20.0)),
          borderSide: BorderSide(color: Colors.white), 
      ),
      enabledBorder: OutlineInputBorder(
        borderRadius: BorderRadius.all(Radius.circular(20.0)),
        borderSide: BorderSide(color: Colors.white),
      )
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-11
      • 2021-07-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多