Flutter中Row中不能直接使用textfield控件

解决方案

class LogingUi extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var size = MediaQuery.of(context).size;
    // TODO: implement build
    return new Stack(
      fit: StackFit.loose,
      children: [
        new Container(
          color: Colors.white,
          width: size.width,
          height: size.height,
        ),
        new Column(
          mainAxisSize: MainAxisSize.max,
          children: [
            new Container(
              padding: EdgeInsets.all(30),
            ),
            new Row(
              mainAxisAlignment: MainAxisAlignment.center, //对其方式
              children: [
                new Image.asset(
                  "images/login_logo.png",
                  width: 119,
                  height: 151,
                  fit: BoxFit.fill,
                ),
              ],
            ),
            new Row(
              children: [
                new Expanded(
                    child: new TextField(

                        //相当于Android属性hint
                        decoration: new InputDecoration(
                  hintText: "用户名",
                )))
              ],
            )
          ],
        ),
      ],
    );
  }
}

你可能感兴趣的:(Flutter)