问题描述
Flutter中是否有一种方法可以获取适合整个屏幕且没有空角且不缩放图像(可能仅使用重复)的旋转图像?
这是当前代码:
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Container(
width: size.width,height: size.height,decoration: Boxdecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,end: Alignment.topCenter,colors: [
Colors.black,Colors.blue
],),child: Stack(
alignment: Alignment.center,children: <Widget>[
Opacity(
opacity: 0.15,child: Transform.rotate(
angle: -0.45,child: Image(
image: Assetimage("assets/images/food.png"),repeat: ImageRepeat.repeat,Text(
"test",style: TextStyle(
fontSize: 100,color: Colors.white,],);
}
解决方法
使用RotatedBox
代替Transform.rotate()