[flutter-06] Column

1. Column

  • 垂直组件排版
  • 组件内小控件间距可以通过SizedBox设置
  • 整个组件内的间距可以通过padding设置
Widget build(BuildContext context) {
    return Container( // 通过Container包裹起来
      padding: const EdgeInsets.all(10), // 整个Column的四周间距
      decoration: BoxDecoration( // 边框修饰
        border: Border.all(),
        color: Colors.blue, // 边框颜色
      ),
      child: Column(
        children: [
          Text(
            title,
            style: TextStyle(fontSize: 20),
          ),
          SizedBox( // 设置每个单元的小部件的间距
            height: 5,
          ),
          Text(
            description,
            style: TextStyle(fontSize: 15),
          ),
          SizedBox(
            height: 10,
          ),
          Image.network(imageUrl),
        ],
      ),
    );
  }
posted @ 2021-06-01 14:59  comefromchina  阅读(96)  评论(0)    收藏  举报