【问题标题】:Display Chips and Text in multiple rows with flutter用颤动在多行中显示筹码和文本
【发布时间】:2018-06-15 13:23:40
【问题描述】:

我正在尝试在一行内显示以多行包裹的芯片和长文本行。

This is wrong

I want it like this, except for the label and the aligned on the same line.

我当前的代码:

        return new Column(
          mainAxisSize: MainAxisSize.max,
          children: <Widget>[
            new Wrap(
              spacing: 8.0,
              runSpacing: 4.0,
              direction: Axis.horizontal,
              children: <Widget>[
                new Tag(tagLabel: 'Chip1'),
                new Text('This is a very, very long text that should wrap. The second line should be shown below the first chip!'),
                new Chip(label: new Text('Chip2')),
                new Chip(label: new Text('Chip3')),
                new Chip(label: new Text('Chip4')),
                new Chip(label: new Text('Chip5')),
                new Chip(label: new Text('Chip6'))
              ],
            )
          ],
        );

有什么想法吗?

【问题讨论】:

  • 目前还没有这种复杂的文本布局。只有矩形框可用。
  • WidgetSpan 帮了我大忙。请参阅this 帖子。

标签: flutter flutter-layout


【解决方案1】:

您需要将标记 1 和文本 1 包装在一个行中,并且全部包装在一个列中。以及芯片尺寸的一些调整。默认情况下,它会从屏幕展开所有行。

【讨论】:

    猜你喜欢
    • 2021-05-25
    • 1970-01-01
    • 2021-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-19
    • 2020-10-05
    • 2021-08-24
    相关资源
    最近更新 更多