发布于 4年前

flutter Container 旋转变换

// 方式一
Container(
  width: 100.0,
  height: 100.0,
  color: Colors.red,
  // rotationZ 的参数为弧度,1.6 大概等于 90°
  // 转换公式 ( 度数 * 3.14 / 180 )
  transform: Matrix4.rotationZ(1.6),
)

// 方式二
Transform(
  child: Container(
    width: 100.0,
    height: 100.0,
    color: Colors.red
  ),
  alignment: Alignment.center,
  transform: Matrix4.retationZ(90 * 3.14 / 180)
)
©2020 edoou.com   京ICP备16001874号-3