1. translate 平移
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(16),
color: Colors.deepOrange,
child: Transform.translate(
offset: const Offset(20,5),
child: const Text("Hello world"),
),
);
}
2. rotate 旋转
@override
Widget build(BuildContext context) {
return Container(
color: Colors.orange,
margin: const EdgeInsets.all(50),
child: Transform.rotate(
angle: math.pi / 2,
child: const Text("Hello world"),
),
);
}
3. scale 缩放
@override
Widget build(BuildContext context) {
return Container(
color: Colors.yellow,
child: Transform.scale(
scale: 1.5,
child: const Text("Hello world!"),
),
);
}