android - flutter :将所有小部件排列成行

标签 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

最佳答案

尝试将您的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)))))

关于android - flutter :将所有小部件排列成行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54214561/

相关文章:

JQuery 从输入中获取表行值并保存到数组

flutter - 在这种情况下我如何使用提供程序

android - 三星 Galaxy Note sgh i717 的应用在 Google Play 商店中不可见

javascript - React Native - 不变违规 : Objects are not valid as a React child

android - 拖放:ImageView 不会在屏幕上一直移动

android - Flutter:类型 'Future<bool>' 不是类型转换中类型 'bool' 的子类型

android - 如何在 flutter 中获取当前路由名称?

row - 如何在cypress中获取一行并选择特定的td?

java - 如何向 Tapestry Grid 添加额外的行?

android - 使用对话框启用 GPS