flutter 疑难杂症

1. TextField无法正常显示

解决方法: 添加 Expanded

        new Expanded(
                  child: new TextField(

1. TextField显示位置偏离 

解决方法: border: InputBorder.none, contentPadding: new EdgeInsets.all(0.0)

              new Expanded(
                  child: new TextField(
                    controller: NameController,
                    //keyboardType: TextInputType.text,
                    textAlign: TextAlign.center,
                    autocorrect: true,

                    style: new TextStyle(
                      fontSize: 14, //字体大小
                      color: const Color(0xff000000),
                    ),
                    decoration: new InputDecoration(
                      //contentPadding: EdgeInsets.all(10.0),
                      hintText: '请输入负责人姓名',
                      hintStyle: new TextStyle(fontSize: 14.0),
                      border: InputBorder.none,
                        contentPadding: new EdgeInsets.all(0.0)
                    ),
                    autofocus: false,
                  ),
                )

猜你喜欢

转载自www.cnblogs.com/baldermurphy/p/10442623.html