update README

This commit is contained in:
Wenqi Li 2023-05-14 03:35:32 +08:00
parent c43961ba94
commit 96d756c8f0

View File

@ -23,22 +23,11 @@ Add the following permissions to your *AndroidManifest.xml*, located in ```<proj
```xml ```xml
<manifest ...> <manifest ...>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> android:name="android.permission.READ_EXTERNAL_STORAGE"
... android:maxSdkVersion="32" />
<manifest/> <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
``` <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
API 29+
Add the following property to your *AndroidManifest.xml*, located in ```<project root>/android/app/src/main/AndroidManifest.xml``` to [opt-out of scoped storage](https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage):
```xml
<manifest ...>
...
<application
android:requestLegacyExternalStorage="true"
...>
<application/>
<manifest/> <manifest/>
``` ```
@ -46,22 +35,17 @@ Add the following property to your *AndroidManifest.xml*, located in ```<project
* Listing albums in the gallery * Listing albums in the gallery
```dart ```dart
final List<Album> imageAlbums = await PhotoGallery.listAlbums( final List<Album> imageAlbums = await PhotoGallery.listAlbums();
mediumType: MediumType.image,
);
final List<Album> videoAlbums = await PhotoGallery.listAlbums( final List<Album> videoAlbums = await PhotoGallery.listAlbums(
mediumType: MediumType.video, mediumType: MediumType.video,
hideIfEmpty: false newest: false,
hideIfEmpty: false,
); );
``` ```
* Listing media in an album * Listing media in an album
```dart ```dart
final MediaPage imagePage = await imageAlbum.listMedia( final MediaPage imagePage = await imageAlbum.listMedia();
skip: 5, final MediaPage videoPage = await imageAlbum.listMedia(
take: 10,
);
final MediaPage videoPage = await videoAlbum.listMedia(
newest: false,
skip: 5, skip: 5,
take: 10, take: 10,
); );
@ -133,6 +117,8 @@ final List<int> data = await album.getThumbnail(
```dart ```dart
final List<int> data = await PhotoGallery.getAlbumThumbnail( final List<int> data = await PhotoGallery.getAlbumThumbnail(
albumId: albumId, albumId: albumId,
mediumType: MediumType.image,
newest: false,
width: 128, width: 128,
height: 128, height: 128,
highQuality: true, highQuality: true,
@ -164,7 +150,7 @@ FadeInImage(
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: MemoryImage(kTransparentImage), placeholder: MemoryImage(kTransparentImage),
image: AlbumThumbnailProvider( image: AlbumThumbnailProvider(
albumId: albumId, album: album,
width: 128, width: 128,
height: 128, height: 128,
hightQuality: true, hightQuality: true,