|
@@ -13,7 +13,7 @@ if you want to build custom ui, you just need api to make custom ui. to use [pho
|
13
|
13
|
|
14
|
14
|
```yaml
|
15
|
15
|
dependencies:
|
16
|
|
- photo: ^0.0.6
|
|
16
|
+ photo: ^0.0.7
|
17
|
17
|
```
|
18
|
18
|
|
19
|
19
|
## import
|
|
@@ -27,29 +27,43 @@ import 'package:photo_manager/photo_manager.dart';
|
27
|
27
|
|
28
|
28
|
```dart
|
29
|
29
|
void _pickImage() async {
|
30
|
|
- List<ImageEntity> imgList = await PhotoPicker.pickImage(
|
31
|
|
- context: context, // BuildContext requied
|
32
|
|
-
|
33
|
|
- /// The following are optional parameters.
|
34
|
|
- themeColor: Colors.green, // the title color and bottom color
|
35
|
|
- padding: 5.0, // item padding
|
36
|
|
- dividerColor: Colors.deepOrange, // divider color
|
37
|
|
- disableColor: Colors.grey.shade300, // the check box disable color
|
38
|
|
- itemRadio: 0.88, // the content item radio
|
39
|
|
- maxSelected: 8, // max picker image count
|
40
|
|
- provider: CNProvider(), // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
|
41
|
|
- rowCount: 5, // item row count
|
42
|
|
- textColor: Colors.white, // text color
|
43
|
|
- thumbSize: 150, // preview thumb size , default is 64
|
44
|
|
- sortDelegate: SortDelegate.common, // default is common ,or you make custom delegate
|
45
|
|
- );
|
46
|
|
-
|
47
|
|
- imgList.forEach((e) async {
|
48
|
|
- print(e.id);
|
49
|
|
- });
|
|
30
|
+ List<ImageEntity> imgList = await PhotoPicker.pickImage(
|
|
31
|
+ context: context, // BuildContext requied
|
|
32
|
+
|
|
33
|
+ /// The following are optional parameters.
|
|
34
|
+ themeColor: Colors.green, // the title color and bottom color
|
|
35
|
+ padding: 1.0, // item padding
|
|
36
|
+ dividerColor: Colors.deepOrange, // divider color
|
|
37
|
+ disableColor: Colors.grey.shade300, // the check box disable color
|
|
38
|
+ itemRadio: 0.88, // the content item radio
|
|
39
|
+ maxSelected: 8, // max picker image count
|
|
40
|
+ provider: I18nProvider.chinese, // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
|
|
41
|
+ rowCount: 5, // item row count
|
|
42
|
+ textColor: Colors.white, // text color
|
|
43
|
+ thumbSize: 150, // preview thumb size , default is 64
|
|
44
|
+ sortDelegate: SortDelegate.common, // default is common ,or you make custom delegate to sort your gallery
|
|
45
|
+ checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(), // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox
|
|
46
|
+ );
|
|
47
|
+
|
|
48
|
+ if (imgList == null) {
|
|
49
|
+ currentSelected = "not select item";
|
|
50
|
+ } else {
|
|
51
|
+ List<String> r = [];
|
|
52
|
+ for (var e in imgList) {
|
|
53
|
+ var file = await e.file;
|
|
54
|
+ r.add(file.absolute.path);
|
|
55
|
+ }
|
|
56
|
+ currentSelected = r.join("\n\n");
|
|
57
|
+ }
|
|
58
|
+ setState(() {});
|
50
|
59
|
}
|
|
60
|
+
|
51
|
61
|
```
|
52
|
62
|
|
|
63
|
+## whole example
|
|
64
|
+
|
|
65
|
+you can see [github](https://github.com/caijinglong/flutter_photo/blob/master/example/) [main.dart](https://github.com/caijinglong/flutter_photo/blob/master/example/lib/main.dart)
|
|
66
|
+
|
53
|
67
|
## about android
|
54
|
68
|
|
55
|
69
|
### glide
|