How can I make rounded TextField in flutter?

前端 未结 5 781
予麋鹿
予麋鹿 2021-02-02 05:35

Material Design for iOS doesn\'t look good, especially the TextField. So is there any way to create your own ? Or Is ther any way to add some styling to TextFie

5条回答
  •  你的背包
    2021-02-02 05:55

    You could approach the purpose in a few different ways:

    First Approach:

    Container(
          child: new Text (
              "Some Text",
              style: TextStyle(
                  color: Colors.black
              )
          ),
          decoration: BoxDecoration (
              borderRadius: BorderRadius.all( Radius.circular(15)),
              color: Colors.white
          ),
          padding: EdgeInsets.all(16.0),
        ),
    

    Second Approach:

     TextField(
          decoration: InputDecoration(
              border: OutlineInputBorder(
                borderRadius: const BorderRadius.all(
                  Radius.circular(15.0),
                ),
              ),
              filled: true,
              hintStyle: new TextStyle(color: Colors.grey[600]),
              hintText: "Hint text",
              fillColor: Colors.white),
        )
    

    Third Approach:

    TextField(
        textAlign: TextAlign.center,
        controller: someTextXontroller,
        keyboardType: TextInputType.text,
        decoration: InputDecoration(
            hintText: 'Hint Text',
            border: OutlineInputBorder(
                borderRadius: BorderRadius.circular(12),
                borderSide: BorderSide(
                    width: 0, 
                    style: BorderStyle.none,
                ),
            ),
            filled: true,
            contentPadding: EdgeInsets.all(16),
            fillColor: Colors.blue,
        ),
    ),
    

提交回复
热议问题