颤振中的行文本填充问题

时间:2018-09-03 13:08:56

标签: alignment row padding flutter-layout

我正在尝试使用按钮在行中添加多行内容,但是存在一些填充问题...如何分隔文本的填充

    return Container(
                        alignment: Alignment.topLeft,
                        height: 30.0,
                        child: Row(
                          crossAxisAlignment: CrossAxisAlignment.stretch,
                          //mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: <Widget>[
                            Container(child: Text("${address1+', '+address2+', '+city+', '+state+', '+country}")),
                            IconButton(
                              padding: EdgeInsets.all(1.0),
                              icon: Icon(Icons.edit,size: 20.0,), 
                              onPressed: () => print("a")
                            )
                          ],
                        ),
                      );

1 个答案:

答案 0 :(得分:0)

您可以使用Padding Widget

在任何小部件中添加填充
return Container(
    alignment: Alignment.topLeft,
    height: 30.0,
    child: Row(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      //mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: <Widget>[
        Container(
            child: Padding(
                padding: const EdgeInsets.all(5.0),
                child: Text("${address1+', '+address2+', '+city+', '+state+', '+country}")),
            )
        ),
        IconButton(
          padding: EdgeInsets.all(1.0),
          icon: Icon(Icons.edit,size: 20.0,), 
          onPressed: () => print("a")
        )
      ],
    ),
);