gpt4 book ai didi

image - Flutter web Image.network旋转图片

转载 作者:行者123 更新时间:2023-12-05 08:06:24 25 4
gpt4 key购买 nike

我遇到了问题,Image.network 显示了一个在 webapp 中旋转的图像。但是如果我在浏览器中打开相同的 url,方向是正确的。

In my webap

In the browser

有人可以帮帮我吗?

我的代码:

import 'package:flutter/material.dart';
import 'package:firebase/firebase.dart' as fb;
import 'dart:js' as js;

class NetworkImageError extends StatefulWidget {
@override
_NetworkImageErrorState createState() => _NetworkImageErrorState();
}

class _NetworkImageErrorState extends State<NetworkImageError> {
String DownloadUrl='https://upload.wikimedia.org/wikipedia/commons/a/ad/Placeholder_no_text.svg'; //Placeholder

GetURL()async{
var _DownloadURL = await fb
.storage()
.refFromURL('gs://myBucket')
.child('Pb_0000.png')
.getDownloadURL();
setState(() {
DownloadUrl=_DownloadURL.toString();
});
}

@override
void initState(){
GetURL();
super.initState();
}

@override
Widget build(BuildContext context) {
return Container(
child: Center(
child: GestureDetector(
onTap: (){
js.context.callMethod("open", [DownloadUrl]);
},
child: Image.network(DownloadUrl)),
),
);
}
}

最佳答案

使用变换部件将“dart:math”导入为数学;

然后

Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(math.pi),
child: Image.network( "url", scale: 8, alignment: Alignment.center)
)

关于image - Flutter web Image.network旋转图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60948300/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com