颤动:将所有窗口小部件排列

时间:2019-01-16 10:01:19

标签: android flutter row

我正在设计“登录”页面,但其中的一个问题是TextField没有沿分隔线显示。

   new Expanded(
     child: new Container(//DCFFF9
     margin: const EdgeInsets.only(top: 20.0),
     padding: const EdgeInsets.all(10.0),
     width: 600.0,height: 60.0,
     decoration: new BoxDecoration(
     color: Colors.white30,),
  child: new Row(
     mainAxisAlignment: MainAxisAlignment.spaceAround,
     mainAxisSize: MainAxisSize.max,
     children: <Widget>[
             new Image.asset('assets/images/avatar.png'),
             new Container(height: 90.0, width: 1.0,
                   color: new Color(0xFFEDEDED),                          
                   margin: const EdgeInsets.only(left: 15.0, right: 15.0)
                           ),
                   new TextField(
                     keyboardType: TextInputType.text,
                     style:new TextStyle( fontFamily: "WorkSansLight",
                                fontSize: 30.0,
                                color: Colors.white70),
                                decoration:new InputDecoration(
                                          border: InputBorder.none,
                                          hintText: "USER NAME",
                                          hintStyle:new TextStyle(
                                          color: Colors.white70 ,
                                          fontFamily: "WorkSansLight", fontSize: 30.0),
                                              ),   ), ], )))

enter image description here

1 个答案:

答案 0 :(得分:1)

尝试将Row个小部件放在Expanded个中。

Expanded(flex: 0, child: Image.asset('assets/images/avatar.png')),
Expanded(
    flex: 0,
    child: Container(
    height: 90.0,
    width: 1,
    color: new Color(0xFFEDEDED))),
Expanded(
    flex: 1,
    child: Container(
        child: TextField(
             keyboardType: TextInputType.text,
                 style: new TextStyle(
                 fontFamily: "WorkSansLight",
                 fontSize: 30.0,
                 color: Colors.white70),
                 decoration: new InputDecoration(
                          border: InputBorder.none,
                          hintText: "USER NAME",
                          hintStyle: new TextStyle(
                              color: Colors.black,
                              fontFamily: "WorkSansLight",
                              fontSize: 30.0)))))