-
-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
大图缩放消失 #30
Comments
估计是内存爆炸了吧。。这种需求。我感觉需要使用插件来压缩你的图片。。flutter里面大图片的问题。蛮多的 |
有什么解决方案吗 我们强需求需要放大图后展示要很清晰。 我现在想到的就是是不是可以直接调安卓原生的图片展示功能。 |
这种要定制吧。。比如直接拿出放大区域的数据进行显示,感觉原生也一样够呛 |
有没有办法直接调高他对内存的容忍, 就是调高显示图片的内存上限, 讲道理7000*9000的图也没多大才对。 |
Transform.scale(scale: null) 我试了下,用官方的,一样也是这样的,我怀疑是引擎的问题,你可以去官方提一下issue //import 'package:example/main.dart';
//import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';
class ZoomImageDemo extends StatefulWidget {
@override
_ZoomImageDemoState createState() => _ZoomImageDemoState();
}
class _ZoomImageDemoState extends State<ZoomImageDemo> {
double scale = 1.0;
@override
Widget build(BuildContext context) {
return Material(
child: Column(children: <Widget>[
AppBar(
title: Text("zoom/pan image demo"),
),
Expanded(
child: GestureDetector(
onScaleUpdate: (value) {
setState(() {
scale = value.scale;
});
},
child: Transform.scale(
scale: scale,
child: Image.network(
"https://user-images.githubusercontent.com/6860451/61188926-e48ab680-a6b8-11e9-9eec-c14c9c3279f9.jpg",
fit: BoxFit.contain,
//enableLoadState: false,
// mode: ExtendedImageMode.Gesture,
// initGestureConfigHandler: (state) {
// return GestureConfig(
// minScale: 0.9,
// animationMinScale: 0.7,
// maxScale: 3.0,
// animationMaxScale: 3.5,
// speed: 1.0,
// inertialSpeed: 100.0,
// initialScale: 1.0,
// inPageView: false);
// },
),
)),
)
]));
}
} |
@liushiqi9 你开的issue 有人回复了。。 void main() {
WidgetsFlutterBinding.ensureInitialized();
const maxBytes = 768 * (1 << 20);
// Invoke both method names to ensure the correct one gets invoked.
SystemChannels.skia.invokeMethod('setResourceCacheMaxBytes', maxBytes);
SystemChannels.skia.invokeMethod('Skia.setResourceCacheMaxBytes', maxBytes);
runApp(MyApp());
} |
放大一张高清图时会发生黑屏。 一开始可以正常放大, 放大到大约1.2倍之后就会黑屏, 缩放比例恢复后又会恢复显示。
复现步骤:
将demo中的图片路径换成附件的图片, 然后放大。
图片:
The text was updated successfully, but these errors were encountered: