소스 검색

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

Caijinglong 6 년 전
부모
커밋
d9e13292d7
9개의 변경된 파일22개의 추가작업 그리고 8개의 파일을 삭제
  1. 4
    0
      CHANGELOG.md
  2. 3
    2
      README.md
  3. 1
    0
      example/lib/main.dart
  4. 2
    0
      lib/photo.dart
  5. 3
    2
      lib/src/entity/options.dart
  6. 5
    1
      lib/src/ui/page/photo_main_page.dart
  7. 1
    0
      lib/src/ui/page/photo_preview_page.dart
  8. 1
    1
      pubspec.lock
  9. 2
    2
      pubspec.yaml

+ 4
- 0
CHANGELOG.md 파일 보기

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

+ 3
- 2
README.md 파일 보기

12
 
12
 
13
 ```yaml
13
 ```yaml
14
 dependencies:
14
 dependencies:
15
-  photo: ^0.0.1
15
+  photo: ^0.0.3
16
 ```
16
 ```
17
 
17
 
18
 ## import
18
 ## import
35
       disableColor: Colors.grey.shade300, // the check box disable color
35
       disableColor: Colors.grey.shade300, // the check box disable color
36
       itemRadio: 0.88, // the content item radio
36
       itemRadio: 0.88, // the content item radio
37
       maxSelected: 8, // max picker image count
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
       rowCount: 5,  // item row count
39
       rowCount: 5,  // item row count
40
       textColor: Colors.white, // text color
40
       textColor: Colors.white, // text color
41
+      thumbSize: 150, // preview thumb size, optional, default is 64
41
     );
42
     );
42
 
43
 
43
     imgList.forEach((e) async {
44
     imgList.forEach((e) async {

+ 1
- 0
example/lib/main.dart 파일 보기

41
       provider: CNProvider(),
41
       provider: CNProvider(),
42
       rowCount: 5,
42
       rowCount: 5,
43
       textColor: Colors.white,
43
       textColor: Colors.white,
44
+      thumbSize: 250,
44
     );
45
     );
45
 
46
 
46
     List<String> r = [];
47
     List<String> r = [];

+ 2
- 0
lib/photo.dart 파일 보기

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

+ 3
- 2
lib/src/entity/options.dart 파일 보기

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

+ 5
- 1
lib/src/ui/page/photo_main_page.dart 파일 보기

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

+ 1
- 0
lib/src/ui/page/photo_preview_page.dart 파일 보기

249
             ImageItem(
249
             ImageItem(
250
               themeColor: themeColor,
250
               themeColor: themeColor,
251
               entity: item,
251
               entity: item,
252
+              size: options.thumbSize,
252
             ),
253
             ),
253
             IgnorePointer(
254
             IgnorePointer(
254
               child: StreamBuilder(
255
               child: StreamBuilder(

+ 1
- 1
pubspec.lock 파일 보기

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

+ 2
- 2
pubspec.yaml 파일 보기

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