【发布时间】:2019-02-17 21:53:04
【问题描述】:
我正在尝试通过读取外部文件目录以及可能以 jpg 或 png 结尾的每个图像来自己显示所有手机图库图像。我实现了这一点,但由于它们的大小或编号,无法将它们全部显示在网格中。图像,应用程序崩溃。代码看起来有点像这样..
new GridView.count(
shrinkWrap: true,
physics: new ClampingScrollPhysics(),
crossAxisCount: 2,
// children: new List<Widget>.generate(_images.length, (index) {
// children: new List<Widget>.generate(allImages.length, (index) {
children: new List<Widget>.generate(_PhoneImages.length, (index) {
File imgFile = _phoneImageFiles[index];
thumbBytes = _phoneThumbBytes[index]; // assuming it got created!!!
// print('thumbbytes $thumbBytes');
print('phone image index: $index');
return new GridTile(
child: new GestureDetector(
child: new Stack(
children: [
new Card(
// color: Colors.blue.shade200,
color: Colors.white70,
child: new Center(
// child: new Text('tile $index'),
// child: new Image.asset(_images[index]),
/*
child: new CachedNetworkImage(
imageUrl: allImages[index].path,
// placeholder: new CircularProgressIndicator(),
errorWidget: new Icon(Icons.error),
)
*/
child: new Image.file(imgFile,
// child: new Image.memory(thumbBytes,
所以我尝试了 imageresize 库,它告诉我要进行繁重的调整大小操作,这需要将近 20 分钟才能显示缩略图。
我所需要的只是从画廊中读取缩略图,就像手机画廊的显示方式一样。我不需要分类。我需要所有内容和完整版本的链接,以便以后可以对它们进行操作。
【问题讨论】:
标签: image widget flutter image-resizing