使旋转后的图像适合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,],);
}

the result

解决方法

使用RotatedBox代替Transform.rotate()

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...