如何管理Wrap小部件的排序?

huangapple go评论54阅读模式
英文:

How to manage sorting of Wrap widget?

问题

我有a、b和c个小部件。
这些小部件的宽度都是100。
我用Wrap小部件包装这些小部件,像这样:

Wrap(children: [a, b, c])

通常情况下,当屏幕宽度为200时,UI将显示这些小部件如下:

a b
c

但我想要:

a b
  c

Wrap小部件中是否有选项可以实现这个效果?

英文:

I have a, b, and c widgets.
These widgets have the same width as 100.
I wrap these widgets with the Wrap widget like

Wrap(children: [a, b, c])

In general, when the screen width is 200, the UI will display these widgets like this.

a b
c

But I want

a b
c

Is there an option in the Wrap widget to do this?

答案1

得分: 2

在您的 Wrap 小部件上设置 alignment

Wrap(
    alignment: WrapAlignment.end,
    children: [a, b, c],
)

Dartpad 示例

Wrap 类文档

英文:

Set alignment on your Wrap widget:

Wrap(
    alignment: WrapAlignment.end,
    children: [a, b, c],
)

Dartpad example

Wrap class documentation

huangapple
  • 本文由 发表于 2023年7月4日 21:06:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76612972.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定