私はコンテナウィジェット(いくつかの他のウィジェットが含まれています)の非常に単純な2D回転を実行したいと思います。このウィジェットは、変形なしで中央の単一の固定ポイントを中心に回転します。コンテナウィジェットを指定したアンカーポイントを中心に2Dで回転させるにはどうすればよいですか?
私はやや働く、Matrix4.rotationZ
でtransform
プロパティを使用してみました - しかし、アンカーポイントは、左上隅ではなく、中央です。アンカーポイントを指定する簡単な方法はありますか?
さらに、Matrix4を必要としないこのウィジェットを2D回転する方が簡単ですか?
var container = new Container (
child: new Stack (
children: [
new Image.asset (// background photo
"assets/texture.jpg",
fit: ImageFit.cover,
),
new Center (
child: new Container (
child: new Text (
"Lorem ipsum",
style: new TextStyle(
color: Colors.white,
fontSize: 42.0,
fontWeight: FontWeight.w900
)
),
decoration: new BoxDecoration (
backgroundColor: Colors.black,
),
padding: new EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 16.0),
transform: new Matrix4.rotationZ(0.174533), // rotate -10 deg
),
),
],
),
width: 400.0,
height: 200.0,
);