美文网首页
No material widget found textfie

No material widget found textfie

作者: 天色将变 | 来源:发表于2020-04-15 06:25 被阅读0次

使用TextField时遇到的问题,只需要在TextField或其父祖widget上包一层Material即可。
如:

Material(
  borderRadius: BorderRadius.circular(15),
                            child: 
                                Container(
                                  margin: EdgeInsets.symmetric(horizontal: 20,vertical: 20),
                                  height: 60,
                                  child: TextField(
                                    decoration: InputDecoration(
                                        border: OutlineInputBorder(
                                          borderRadius: BorderRadius.circular(10),
                                            borderSide: BorderSide(color: Colors.grey)
                                        ),
                                        counterText: '',
                                        prefixIcon: Icon(Icons.phone),
                                        hintText: "用户名",
                                        hintStyle: TextStyle(
                                            color: Colors.black45, fontSize: 18)),
                                    autofocus: true,
                                    maxLength: 15,
                                    keyboardType: TextInputType.phone,
                                  ),
                                ),
                               
                              ],
                            ),
                          )                          

相关文章

网友评论

      本文标题:No material widget found textfie

      本文链接:https://www.haomeiwen.com/subject/mjsidhtx.html