No material widget found textfie

2020-04-15  本文已影响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,
                                  ),
                                ),
                               
                              ],
                            ),
                          )                          
上一篇 下一篇

猜你喜欢

热点阅读