logo

该视频仅会员有权观看

立即开通课程「Flutter 移动端应用开发实践」权限。

¥
199
/ 年

使用 Container 小部件

  • Container小部件可以定制尺寸、背景色、边距、装饰和变形等属性。
  • 可以设定Container的子组件,比如使用Image Asset展示图片's s images logo.png',图像宽度设置为96。
  • 图像颜色设置为白色(Color white),Container背景色设置为深紫色强调色(Colors.deepPurpleAccent)。
  • 通过设置Container padding参数,在四周添加60的内边距(EdgeInsets.all(60))。
  • 用Alignment参数设置子部件的对齐方式,如顶部居中(Alignment.topCenter)。若不设定尺寸,Container会尽可能大。
  • 可设置Container宽高为305。
  • 使用Transform属性进行变形,如旋转(值matrix4 rotationZ(0.5)),并设定变形对齐为右上角(Transform alignment aligned.topRight)。