瀏覽代碼

更新了一个获取指定缩略图尺寸的方法

cjl_macbook 6 年之前
父節點
當前提交
e312161d03
共有 3 個文件被更改,包括 12 次插入13 次删除
  1. 4
    3
      lib/src/ui/page/photo_preview_page.dart
  2. 3
    5
      pubspec.lock
  3. 5
    5
      pubspec.yaml

+ 4
- 3
lib/src/ui/page/photo_preview_page.dart 查看文件

@@ -1,5 +1,6 @@
1 1
 import 'dart:async';
2 2
 import 'dart:io';
3
+import 'dart:typed_data';
3 4
 
4 5
 import 'package:flutter/material.dart';
5 6
 import 'package:photo/src/entity/options.dart';
@@ -247,13 +248,13 @@ class _BigPhotoImageState extends State<BigPhotoImage>
247 248
   @override
248 249
   Widget build(BuildContext context) {
249 250
     return FutureBuilder(
250
-      future: widget.imageEntity.file,
251
-      builder: (BuildContext context, AsyncSnapshot<File> snapshot) {
251
+      future: widget.imageEntity.thumbDataWithSize(1300, 1300),
252
+      builder: (BuildContext context, AsyncSnapshot<Uint8List> snapshot) {
252 253
         var file = snapshot.data;
253 254
         if (snapshot.connectionState == ConnectionState.done && file != null) {
254 255
           // todo ios 图片优化,在返回时再生成图片
255 256
           // 展示时,不允许放大,使用原生方案生成一个与屏幕同宽的图片
256
-          return Image.file(
257
+          return Image.memory(
257 258
             file,
258 259
             fit: BoxFit.contain,
259 260
             width: double.infinity,

+ 3
- 5
pubspec.lock 查看文件

@@ -210,11 +210,9 @@ packages:
210 210
   photo_manager:
211 211
     dependency: "direct main"
212 212
     description:
213
-      path: "."
214
-      ref: da04bdf1b629cf14322e795613d7e77fb933034c
215
-      resolved-ref: da04bdf1b629cf14322e795613d7e77fb933034c
216
-      url: "https://github.com/CaiJingLong/flutter_photo_manager.git"
217
-    source: git
213
+      path: "/Users/caijinglong/code/flutter/plugin/flutter_photo_manager/"
214
+      relative: false
215
+    source: path
218 216
     version: "0.0.1"
219 217
   plugin:
220 218
     dependency: transitive

+ 5
- 5
pubspec.yaml 查看文件

@@ -10,12 +10,12 @@ environment:
10 10
 dependencies:
11 11
   flutter:
12 12
     sdk: flutter
13
-  photo_manager:
14
-    git:
15
-      url: https://github.com/CaiJingLong/flutter_photo_manager.git
16
-      ref: da04bdf1b629cf14322e795613d7e77fb933034c
17 13
 #  photo_manager:
18
-#    path: /Users/caijinglong/code/flutter/plugin/flutter_photo_manager/
14
+#    git:
15
+#      url: https://github.com/CaiJingLong/flutter_photo_manager.git
16
+#      ref: da04bdf1b629cf14322e795613d7e77fb933034c
17
+  photo_manager:
18
+    path: /Users/caijinglong/code/flutter/plugin/flutter_photo_manager/
19 19
 
20 20
 dev_dependencies:
21 21
   flutter_test: