【问题标题】:Three sides circular textinputfield with one side rectangle in flutter三边圆形文本输入字段,一侧矩形颤动
【发布时间】:2023-03-28 21:15:01
【问题描述】:

我需要添加一个文本字段,该文本字段具有 3 个侧面圆形和一个顶部右侧与正常矩形边。 我正在尝试使用给我边框的 OutlineInputBorder 来做到这一点。 但是我需要实现这个设计。

由于我没有足够的声望,我不能添加图像。 如果有人帮助我,会很有帮助。

    new Theme(
          data: new ThemeData(
            primaryColor: Colors.blue,
          ),
          child: TextFormField(
            style: new TextStyle(
              color: Color(0xff651515),
            ),
            autofocus: false,
            obscureText: false,
            keyboardType: TextInputType.text,

            decoration: InputDecoration(
              filled: true,
              border: new OutlineInputBorder(
                borderRadius: BorderRadius.all(Radius.circular(10))
              ),
              fillColor: Colors.black12,
              labelText: TextDisplayConstants.EMAIL,
              labelStyle: TextStyle(
                color: Color(0xffa4a4a4),
                fontSize: 14,
              ),
            ),[enter image description here][1]
          ),
        ),

【问题讨论】:

    标签: flutter textinput


    【解决方案1】:

    试试这个:

    演示:

    示例代码:

    OutlineInputBorder(
               borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10),
                    bottomLeft: Radius.circular(10),
                    bottomRight: Radius.circular(10),
                    topRight: Radius.circular(0)),
              )
    

    【讨论】:

    • 另外,如果有人需要为边框使用颜色,你可以使用 like-----borderSide: BorderSide(color: Colors.transparent)。
    【解决方案2】:

    只需在 Textformfield 代码中替换您的边框,例如,

    border: new OutlineInputBorder(
                        borderRadius: BorderRadius.only(
                          topLeft: Radius.circular(20),
                          topRight: Radius.circular(20),
                          bottomLeft: Radius.circular(20),
                          bottomRight: Radius.circular(0),
                        ),
                      ),
    

    在您想要矩形边框的一侧添加 Radius.circular(0),bottomRight: Radius.circular(0)

    【讨论】:

      【解决方案3】:
          border: new OutlineInputBorder(
                          borderRadius: BorderRadius.only(
                                 bottomLeft: Radius.circular(20),
                                 topLeft: Radius.circular(20),
                                 topRight: Radius.circular(20)
                                                         )
                                        ),
      

      文本表单域

      TextFormField(
              style: new TextStyle(
                color: Color(0xff651515),
              ),
              autofocus: false,
              obscureText: false,
              keyboardType: TextInputType.text,
      
              decoration: InputDecoration(
                filled: true,
                border: new OutlineInputBorder(
                  borderRadius: BorderRadius.only(bottomLeft: Radius.circular(20),topLeft: Radius.circular(20),topRight: Radius.circular(20))
                ),
                fillColor: Colors.black12,
      
                labelStyle: TextStyle(
                  color: Color(0xffa4a4a4),
                  fontSize: 14,
                ),
              )
            ),
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-12-09
        • 2021-11-14
        • 2010-11-16
        • 2019-11-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多