如何将容器向右移动。
我有3个图标,我需要把最后一个图标移到右边,这样其他2个图标就在左边
我为颤振写应用程序
example a post from my app

Row(
                                      children: <Widget>[
                                        Container(
                                          margin: EdgeInsets.only(right: 10),
                                          child: Row(
                                            children: <Widget>[
                                              Icon(Icons.insert_emoticon),
                                              Text(memes.graphql.hashtag.edgeHashtagToMedia.edges[value].node.edgeLikedBy.count.toString()),
                                            ],
                                          ),
                                        ),
                                        Icon(Icons.comment),
                                        Text(memes.graphql.hashtag.edgeHashtagToMedia.edges[value].node.edgeMediaToComment.count.toString()),
                                        Container(
                                          margin: EdgeInsets.only(left: 230),
                                          child: Icon(Icons.thumb_up),
                                        )
                                      ],
                                    ),

最佳答案

只需使用-Spacer()小部件填充中间的空间。

Row(
              children: <Widget>[
                Container(
                  margin: EdgeInsets.only(right: 10),
                  child: Row(
                    children: <Widget>[
                      Icon(Icons.insert_emoticon),
                      Text('10'),
                      Text(memes.graphql.hashtag.edgeHashtagToMedia.edges[value]
                          .node.edgeLikedBy.count
                          .toString()),
                    ],
                  ),
                ),
                Icon(Icons.comment),
                Text(memes.graphql.hashtag.edgeHashtagToMedia.edges[value].node
                    .edgeMediaToComment.count
                    .toString()),
                Spacer(),  // Add this
                Container(
                  margin: EdgeInsets.only(left: 230),
                  child: Icon(Icons.thumb_up),
                )
              ],
            ),

08-04 00:58