Parcourir la source

添加了一个预览的尺寸选项

Caijinglong il y a 6 ans
Parent
révision
d9e13292d7

+ 4
- 0
CHANGELOG.md Voir le fichier

@@ -1,3 +1,7 @@
1
+## [0.0.3] add the thumb size to option
2
+
3
+add a params for pick image , thumb size
4
+
1 5
 ## [0.0.2] fix bug
2 6
 preview sure button bug
3 7
 preview bottom safeArea

+ 3
- 2
README.md Voir le fichier

@@ -12,7 +12,7 @@ if you want to build custom ui, you just need api to make custom ui. to use [pho
12 12
 
13 13
 ```yaml
14 14
 dependencies:
15
-  photo: ^0.0.1
15
+  photo: ^0.0.3
16 16
 ```
17 17
 
18 18
 ## import
@@ -35,9 +35,10 @@ void _pickImage() async{
35 35
       disableColor: Colors.grey.shade300, // the check box disable color
36 36
       itemRadio: 0.88, // the content item radio
37 37
       maxSelected: 8, // max picker image count
38
-      provider: CNProvider(), // i18n provider ,default is chinese.
38
+      provider: CNProvider(), // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
39 39
       rowCount: 5,  // item row count
40 40
       textColor: Colors.white, // text color
41
+      thumbSize: 150, // preview thumb size, optional, default is 64
41 42
     );
42 43
 
43 44
     imgList.forEach((e) async {

+ 1
- 0
example/lib/main.dart Voir le fichier

@@ -41,6 +41,7 @@ class _MyHomePageState extends State<MyHomePage> {
41 41
       provider: CNProvider(),
42 42
       rowCount: 5,
43 43
       textColor: Colors.white,
44
+      thumbSize: 250,
44 45
     );
45 46
 
46 47
     List<String> r = [];

+ 2
- 0
lib/photo.dart Voir le fichier

@@ -51,6 +51,7 @@ class PhotoPicker {
51 51
     Color dividerColor,
52 52
     Color textColor,
53 53
     Color disableColor,
54
+    int thumbSize = 64,
54 55
     I18nProvider provider = I18nProvider.chinese,
55 56
   }) {
56 57
     assert(provider != null, "provider must be not null");
@@ -70,6 +71,7 @@ class PhotoPicker {
70 71
       disableColor: disableColor,
71 72
       textColor: textColor,
72 73
       themeColor: themeColor,
74
+      thumbSize: thumbSize,
73 75
     );
74 76
 
75 77
     return PhotoPicker()._pickImage(context, options, provider);

+ 3
- 2
lib/src/entity/options.dart Voir le fichier

@@ -17,6 +17,8 @@ class Options {
17 17
 
18 18
   final Color disableColor;
19 19
 
20
+  final int thumbSize;
21
+
20 22
   const Options({
21 23
     this.rowCount,
22 24
     this.maxSelected,
@@ -26,7 +28,6 @@ class Options {
26 28
     this.dividerColor,
27 29
     this.textColor,
28 30
     this.disableColor,
31
+    this.thumbSize,
29 32
   });
30
-
31
-
32 33
 }

+ 5
- 1
lib/src/ui/page/photo_main_page.dart Voir le fichier

@@ -185,6 +185,7 @@ class _PhotoMainPageState extends State<PhotoMainPage>
185 185
           ImageItem(
186 186
             entity: data,
187 187
             themeColor: themeColor,
188
+            size: options.thumbSize,
188 189
           ),
189 190
           _buildMask(containsEntity(data)),
190 191
           _buildSelected(data),
@@ -445,10 +446,13 @@ class ImageItem extends StatelessWidget {
445 446
 
446 447
   final Color themeColor;
447 448
 
449
+  final int size;
450
+
448 451
   const ImageItem({
449 452
     Key key,
450 453
     this.entity,
451 454
     this.themeColor,
455
+    this.size = 64,
452 456
   }) : super(key: key);
453 457
 
454 458
   @override
@@ -459,7 +463,7 @@ class ImageItem extends StatelessWidget {
459 463
     }
460 464
 
461 465
     return FutureBuilder<Uint8List>(
462
-      future: entity.thumbData,
466
+      future: entity.thumbDataWithSize(size, size),
463 467
       builder: (BuildContext context, AsyncSnapshot<Uint8List> snapshot) {
464 468
         var futureData = snapshot.data;
465 469
         if (snapshot.connectionState == ConnectionState.done &&

+ 1
- 0
lib/src/ui/page/photo_preview_page.dart Voir le fichier

@@ -249,6 +249,7 @@ class _PhotoPreviewPageState extends State<PhotoPreviewPage> {
249 249
             ImageItem(
250 250
               themeColor: themeColor,
251 251
               entity: item,
252
+              size: options.thumbSize,
252 253
             ),
253 254
             IgnorePointer(
254 255
               child: StreamBuilder(

+ 1
- 1
pubspec.lock Voir le fichier

@@ -213,7 +213,7 @@ packages:
213 213
       name: photo_manager
214 214
       url: "https://pub.flutter-io.cn"
215 215
     source: hosted
216
-    version: "0.0.1"
216
+    version: "0.0.2"
217 217
   plugin:
218 218
     dependency: transitive
219 219
     description:

+ 2
- 2
pubspec.yaml Voir le fichier

@@ -1,6 +1,6 @@
1 1
 name: photo
2 2
 description: image picker, multi picker,use flutter as ui, if you want to build custom ui,you just use photo_manager.
3
-version: 0.0.2
3
+version: 0.0.3
4 4
 author: caijinglong<cjl_spy@163.com>
5 5
 homepage: https://github.com/CaiJingLong/flutter_photo
6 6
 
@@ -11,7 +11,7 @@ dependencies:
11 11
   flutter:
12 12
     sdk: flutter
13 13
 
14
-  photo_manager: ^0.0.1
14
+  photo_manager: ^0.0.2
15 15
 #  photo_manager:
16 16
 #    git:
17 17
 #      url: https://github.com/CaiJingLong/flutter_photo_manager.git