使用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,
),
),
],
),
)
网友评论