可容纳一个子组件,将其沿顺时针旋转quarterTurns*90°。
相关组件
RotatedBox基本使用
<br />【child】 : 孩子组件 【Widget】<br />【quarterTurns】 : 旋转多少个90° 【int】<br />![195.gif](https://cdn.nlark.com/yuque/0/2020/gif/326147/1589508681741-9372b749-5f82-45a2-9ceb-66a721cf330c.gif#align=left&display=inline&height=91&margin=%5Bobject%20Object%5D&name=195.gif&originHeight=91&originWidth=144&size=44416&status=done&style=none&width=144)
import 'package:flutter/material.dart';
class CustomRotatedBox extends StatefulWidget {
@override
_CustomRotatedBoxState createState() => _CustomRotatedBoxState();
}
class _CustomRotatedBoxState extends State<CustomRotatedBox> {
int _quarterTurns = 0;
@override
Widget build(BuildContext context) {
return RotatedBox(
quarterTurns: _quarterTurns,
child: GestureDetector(
onTap: () => setState(() => _quarterTurns++),
child: Icon(
Icons.android,
size: 60,
color: Colors.blue,
)),
);
}
}