将旋转后的图像适配到Flutter中的屏幕



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()

最新更新