|
@@ -37,37 +37,43 @@ import 'package:photo_manager/photo_manager.dart';
|
37
|
37
|
## use
|
38
|
38
|
|
39
|
39
|
```dart
|
40
|
|
- void _pickImage() async {
|
|
40
|
+void _pickImage() async {
|
41
|
41
|
List<AssetEntity> imgList = await PhotoPicker.pickImage(
|
42
|
|
- context: context, // BuildContext requied
|
|
42
|
+ context: context,
|
|
43
|
+ // BuildContext requied
|
43
|
44
|
|
44
|
45
|
/// The following are optional parameters.
|
45
|
|
- themeColor: Colors.green, // the title color and bottom color
|
46
|
|
- padding: 1.0, // item padding
|
47
|
|
- dividerColor: Colors.deepOrange, // divider color
|
48
|
|
- disableColor: Colors.grey.shade300, // the check box disable color
|
49
|
|
- itemRadio: 0.88, // the content item radio
|
50
|
|
- maxSelected: 8, // max picker image count
|
51
|
|
- provider: I18nProvider.chinese, // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
|
52
|
|
- rowCount: 5, // item row count
|
53
|
|
- textColor: Colors.white, // text color
|
54
|
|
- thumbSize: 150, // preview thumb size , default is 64
|
55
|
|
- sortDelegate: SortDelegate.common, // default is common ,or you make custom delegate to sort your gallery
|
56
|
|
- checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(), // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox
|
|
46
|
+ themeColor: Colors.green,
|
|
47
|
+ // the title color and bottom color
|
|
48
|
+ padding: 1.0,
|
|
49
|
+ // item padding
|
|
50
|
+ dividerColor: Colors.grey,
|
|
51
|
+ // divider color
|
|
52
|
+ disableColor: Colors.grey.shade300,
|
|
53
|
+ // the check box disable color
|
|
54
|
+ itemRadio: 0.88,
|
|
55
|
+ // the content item radio
|
|
56
|
+ maxSelected: 8,
|
|
57
|
+ // max picker image count
|
|
58
|
+ provider: I18nProvider.chinese,
|
|
59
|
+ // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
|
|
60
|
+ rowCount: 5,
|
|
61
|
+ // item row count
|
|
62
|
+ textColor: Colors.white,
|
|
63
|
+ // text color
|
|
64
|
+ thumbSize: 150,
|
|
65
|
+ // preview thumb size , default is 64
|
|
66
|
+ sortDelegate: SortDelegate.common,
|
|
67
|
+ // default is common ,or you make custom delegate to sort your gallery
|
|
68
|
+ checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(
|
|
69
|
+ activeColor: Colors.white,
|
|
70
|
+ unselectedColor: Colors.white,
|
|
71
|
+ ), // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox
|
|
72
|
+
|
|
73
|
+ loadingDelegate:
|
|
74
|
+ this, // if you want to build custom loading widget,extends LoadingDelegate [see example/lib/main.dart]
|
57
|
75
|
);
|
58
|
76
|
|
59
|
|
- if (imgList == null) {
|
60
|
|
- currentSelected = "not select item";
|
61
|
|
- } else {
|
62
|
|
- List<String> r = [];
|
63
|
|
- for (var e in imgList) {
|
64
|
|
- var file = await e.file;
|
65
|
|
- r.add(file.absolute.path);
|
66
|
|
- }
|
67
|
|
- currentSelected = r.join("\n\n");
|
68
|
|
- }
|
69
|
|
- setState(() {});
|
70
|
|
- }
|
71
|
77
|
```
|
72
|
78
|
|
73
|
79
|
## whole example
|