Flutter常用widget “Stack”

顾名思义:栈布局,有的文章说是像安卓里面的线性布局,不过这里我觉得更像帧布局吧。
构造方法:

Stack({
    Key key,
    this.alignment: AlignmentDirectional.topStart,
    this.textDirection,
    this.fit: StackFit.loose,
    this.overflow: Overflow.clip,
    List children: const [],
  }) : super(key: key, children: children);

默认的没有设置位置参数的子项将会放在左上角

  • alignment
    这个参数还是主要负责子项的位置,具体使用规则可以参照Container里面的alignment
  • fit
    如何测量没有位置的子元素的大小
  • overflow
    子项超出部分是否需要被裁剪

你可能感兴趣的:(Flutter常用widget “Stack”)