2

Flutter 线性布局:Column 和 Row

 3 years ago
source link: https://www.kymjs.com/note/2020/03/18/01/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Flutter 线性布局:Column 和 Row

2020-03-18 By 张涛 | 本文已被访问551次

mainAxisSize:  控制自己的布局方式
  MainAxisSize.min  默认值,Column和Row自适应children;
  MainAxisSize.max  Column填充父控件竖屏,Row填充父控件横屏;需要搭配MainAxisAlignment使用才有效果;

mainAxisAlignment:  控制子集的对齐方式,Column上下对齐,Row左右对齐
  MainAxisAlignment.start  默认值,Column靠上,Row靠左;
  MainAxisAlignment.center  Column,Row居中;
  MainAxisAlignment.end  Column靠下,Row靠右;
  MainAxisAlignment.spaceAround  自己填充,等份分配空间给子集,子集各自居中对齐;
  MainAxisAlignment.spaceBetween  自己填充,等份分配空间给子集,子集两侧对齐;
  MainAxisAlignment.spaceEvenly  自己填充,等份分配空间给子集,子集同一中线居中对齐;
  注:当设置MainAxisSize.max时才该值有效果。

crossAxisAlignment:   控制子集各自的对齐方式,Column左右对齐,Row上下对齐
  CrossAxisAlignment.strech  Column中会使子控件宽度调到最大,Row则使子控件高度调到最大
  CrossAxisAlignment.start    Column中会使子控件向左对齐,Row中会使子控件向上对齐
  CrossAxisAlignment.center   默认值,子控件居中
  CrossAxisAlignment.end    Column中会使子控件向右对齐,Row中会使子控件向下对齐
  CrossAxisAlignment.baseline  按文本水平线对齐。与TextBaseline搭配使用

textBaseline
  TextBaseline.alphabetic   用于对齐字母字符底部的水平线。
  TextBaseline.ideographic  用于对齐表意字符的水平线。

verticalDirection:  控制子控件对齐方式是否相反方式
  VerticalDirection.down  默认值,按照默认方式
  VerticalDirection.up   CrossAxisAlignment.startCrossAxisAlignment.end对反

了解更多有深度技术的文章,与移动端、大前端未来方向的认知,前往订阅 开源实验室小专栏。


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK