lucky1213 399b176e8b upgrade 0.5.4 | 4 years ago | |
---|---|---|
.github | 4 years ago | |
.vscode | 5 years ago | |
example | 4 years ago | |
lib | 4 years ago | |
test | 6 years ago | |
.gitignore | 5 years ago | |
CHANGELOG.md | 4 years ago | |
LICENSE | 6 years ago | |
README.md | 4 years ago | |
pubspec.lock | 4 years ago | |
pubspec.yaml | 4 years ago |
image picker, multi picker
support ios icloud
support video
support camera
use flutter as ui
if you want to build custom ui, you just need api to make custom ui. to use photo_manager or fork the library to custom ui.
dependencies:
photo:
git:
url: https://git.links123.net/lucky1213/mutli_image_picker.git
import 'package:photo/photo.dart';
import 'package:photo_manager/photo_manager.dart';
void pickAssets() async {
PickedEntity result = await PhotoPicker.pickAsset(
context: context,
provider: locale,
type: PickType.onlyImage,
);
/// Use assetList to do something.
}
The context is required, other params is optional.
void pickAsset() async {
PickedEntity result = await PhotoPicker.pickAsset(
// BuildContext requied
context: context,
// item row count
rowCount: 4,
// item radio
itemRadio: 1,
// max picker image count
maxSelected: 8,
// item padding
padding: 1,
// i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
provider: I18nProvider.chinese,
// preview thumb size , default is 128
thumbSize: 150,
// theme, 默认使用MaterialApp定义的theme
theme: PhotoTheme(),
// default is common ,or you make custom delegate to sort your gallery
sortDelegate: SortDelegate.common,
// if you want to build custom loading widget,extends LoadingDelegate [see example/lib/main.dart]
loadingDelegate: DefaultLoadingDelegate(),
// all/image/video
pickType: type,
// 可以理解为相册文件夹 when [photoPathList] is not null , [pickType] invalid .
List<AssetPathEntity> photoPathList,
// 已选择的asset
List<AssetEntity> pickedAssetList
);
void pickCamera() async {
// 参数来源自 ImagePicker.pickImage
File result = await PhotoPicker.pickCamera(
maxWidth: 100,
maxHeight: 100,
imageQuality: 100,
preferredCameraDevice: CameraDevice.rear,
);
}
PickedEntity
// 选中的assets 取消/默认 是空数组
List<AssetEntity> asset
// 是否是原图 默认 false
bool isFullImage
You can use [photo_manager] package to get List<AssetPathEntity>
and handle or cache.
This parameter is then passed into the pickAsset
method, where the incoming photoList is rendered instead of the data in the album.
See the gitbook
Android native use glide to create image thumb bytes, version is 4.8.0.
If your other android library use the library, and version is not same, then you need edit your android project’s build.gradle.
rootProject.allprojects {
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.github.bumptech.glide'
&& details.requested.name.contains('glide')) {
details.useVersion "4.8.0"
}
}
}
}
}
if you use the proguard
see the github
Because the album is a privacy privilege, you need user permission to access it. You must to modify the Info.plist
file in Runner project.
like next
<key>NSPhotoLibraryUsageDescription</key>
<string>App need your agree, can visit your album</string>
if you build error like include of non-modular header inside framework module, see #10 or so