How can I make rounded TextField in flutter?

前端 未结 5 604
予麋鹿
予麋鹿 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:54

    @Rockvole answer is correct but just in case u don't like the default border around the TextField, you can achieve it by overriding the borderSide attribute of the OutlineInputBorder like this:

    TextField(
        textAlign: TextAlign.center,
        controller: searchCtrl,
        keyboardType: TextInputType.text,
        decoration: InputDecoration(
            hintText: 'Enter a product name eg. pension',
            hintStyle: TextStyle(fontSize: 16),
            border: OutlineInputBorder(
                borderRadius: BorderRadius.circular(8),
                borderSide: BorderSide(
                    width: 0, 
                    style: BorderStyle.none,
                ),
            ),
            filled: true,
            contentPadding: EdgeInsets.all(16),
            fillColor: colorSearchBg,
        ),
    ),
    

提交回复
热议问题