iT邦幫忙

2021 iThome 鐵人賽

DAY 6
0
Mobile Development

30天 - Flutter 日常系列 第 6

[Day6] Flutter - 置中容器 ( Center )

前言

Hi, 我是魚板伯爵今天要教大家 Center 這個元件,教學內容只會擷取片段程式碼,建議大家搭配完整程式碼來練習。

完整程式碼

Center 容器

想讓元件置中的話,可以使用 Center。

class DemoCenter extends StatelessWidget {
  const DemoCenter({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        width: 100,
        height: 100,
        color: Colors.amber,
      ),
    );
  }
}


上一篇
[Day5] Flutter - 垂直佈局容器 ( Column )
下一篇
[Day7] Flutter - 堆疊佈局 ( Stack、Positioned )
系列文
30天 - Flutter 日常30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言