version 0.4.9
This commit is contained in:
parent
70914f22c3
commit
a8f7405938
@ -1,11 +1,12 @@
|
||||
# This is a generated file; do not edit or check into version control.
|
||||
permission_handler=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler-10.2.0\\
|
||||
permission_handler_android=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_android-10.2.0\\
|
||||
permission_handler_apple=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_apple-9.0.8\\
|
||||
permission_handler_windows=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_windows-0.1.2\\
|
||||
photo_gallery=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\photo_gallery-1.2.2\\
|
||||
video_player=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_player-2.6.1\\
|
||||
video_player_android=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_player_android-2.4.4\\
|
||||
video_player_avfoundation=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_player_avfoundation-2.4.3\\
|
||||
video_player_web=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_player_web-2.0.16\\
|
||||
video_thumbnail=C:\\Users\\MrWorldWide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_thumbnail-0.5.3\\
|
||||
device_info_plus=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\device_info_plus-9.0.2\\
|
||||
permission_handler=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler-10.4.3\\
|
||||
permission_handler_android=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_android-10.3.2\\
|
||||
permission_handler_apple=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_apple-9.1.4\\
|
||||
permission_handler_windows=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_windows-0.1.3\\
|
||||
photo_gallery=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\photo_gallery-1.2.2\\
|
||||
video_player=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_player-2.7.0\\
|
||||
video_player_android=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_player_android-2.4.4\\
|
||||
video_player_avfoundation=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_player_avfoundation-2.4.3\\
|
||||
video_player_web=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_player_web-2.0.16\\
|
||||
video_thumbnail=C:\\Users\\MrWorldwide\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\video_thumbnail-0.5.3\\
|
||||
|
@ -1 +1 @@
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"permission_handler_apple","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_apple-9.0.8\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\photo_gallery-1.2.2\\\\","native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_player_avfoundation-2.4.3\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"permission_handler_android","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_android-10.2.0\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\photo_gallery-1.2.2\\\\","native_build":true,"dependencies":[]},{"name":"video_player_android","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_player_android-2.4.4\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[{"name":"permission_handler_windows","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_windows-0.1.2\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"video_player_web","path":"C:\\\\Users\\\\MrWorldWide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_player_web-2.0.16\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]},{"name":"photo_gallery","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]},{"name":"video_thumbnail","dependencies":[]}],"date_created":"2023-05-16 15:46:42.053591","version":"3.10.0"}
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info_plus","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.2\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_apple-9.1.4\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\photo_gallery-1.2.2\\\\","native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_player_avfoundation-2.4.3\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"device_info_plus","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.2\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_android-10.3.2\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\photo_gallery-1.2.2\\\\","native_build":true,"dependencies":[]},{"name":"video_player_android","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_player_android-2.4.4\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"device_info_plus","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.2\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"device_info_plus","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.2\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"device_info_plus","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.2\\\\","native_build":false,"dependencies":[]},{"name":"permission_handler_windows","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_windows-0.1.3\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"device_info_plus","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.2\\\\","dependencies":[]},{"name":"video_player_web","path":"C:\\\\Users\\\\MrWorldwide\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\video_player_web-2.0.16\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"device_info_plus","dependencies":[]},{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]},{"name":"photo_gallery","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]},{"name":"video_thumbnail","dependencies":[]}],"date_created":"2023-07-15 16:44:05.568875","version":"3.10.5"}
|
@ -173,3 +173,8 @@
|
||||
|
||||
* Dart 3 & Flutter 3.10 compatibility
|
||||
|
||||
## 0.4.9
|
||||
|
||||
* Fixed permission issue for android sdk 33 and above.
|
||||
* https://github.com/FlutterWay/gallery_picker/issues/1 is fixed
|
||||
|
@ -64,9 +64,16 @@ You could find the code samples of the given gifs below in `/example/lib/example
|
||||
|
||||
#### Android
|
||||
Add uses-permission `android/app/src/main/AndroidManifest.xml` file
|
||||
|
||||
```xml
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
```
|
||||
for android sdk 33 and above
|
||||
```xml
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
|
||||
```
|
||||
|
||||
#### Ios
|
||||
Add these configurations to your `ios/Runner/info.plist` file
|
||||
```xml
|
||||
|
@ -2,6 +2,8 @@
|
||||
package="com.example.gallery_picker_example">
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<application
|
||||
android:label="gallery_picker_example"
|
||||
|
@ -113,6 +113,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
device_info_plus:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: device_info_plus
|
||||
sha256: "2c35b6d1682b028e42d07b3aee4b98fa62996c10bc12cb651ec856a80d6a761b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.0.2"
|
||||
device_info_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: device_info_plus_platform_interface
|
||||
sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -121,6 +137,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@ -158,7 +190,7 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.4.8"
|
||||
version: "0.4.9"
|
||||
get:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -179,10 +211,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intl
|
||||
sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91"
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.17.0"
|
||||
version: "0.18.1"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -243,42 +275,42 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler
|
||||
sha256: "33c6a1253d1f95fd06fa74b65b7ba907ae9811f9d5c1d3150e51417d04b8d6a8"
|
||||
sha256: "63e5216aae014a72fe9579ccd027323395ce7a98271d9defa9d57320d001af81"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.2.0"
|
||||
version: "10.4.3"
|
||||
permission_handler_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_android
|
||||
sha256: "8028362b40c4a45298f1cbfccd227c8dd6caf0e27088a69f2ba2ab15464159e2"
|
||||
sha256: c0c9754479a4c4b1c1f3862ddc11930c9b3f03bef2816bb4ea6eed1e13551d6f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.2.0"
|
||||
version: "10.3.2"
|
||||
permission_handler_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_apple
|
||||
sha256: ee96ac32f5a8e6f80756e25b25b9f8e535816c8e6665a96b6d70681f8c4f7e85
|
||||
sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.0.8"
|
||||
version: "9.1.4"
|
||||
permission_handler_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_platform_interface
|
||||
sha256: "68abbc472002b5e6dfce47fe9898c6b7d8328d58b5d2524f75e277c07a97eb84"
|
||||
sha256: "7c6b1500385dd1d2ca61bb89e2488ca178e274a69144d26bbd65e33eae7c02a9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.9.0"
|
||||
version: "3.11.3"
|
||||
permission_handler_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_windows
|
||||
sha256: f67cab14b4328574938ecea2db3475dad7af7ead6afab6338772c5f88963e38b
|
||||
sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
version: "0.1.3"
|
||||
photo_gallery:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -384,10 +416,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: video_player
|
||||
sha256: de95f0e9405f29b5582573d4166132e71f83b3158aac14e8ee5767a54f4f1fbd
|
||||
sha256: "3fd106c74da32f336dc7feb65021da9b0207cb3124392935f1552834f7cce822"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.6.1"
|
||||
version: "2.7.0"
|
||||
video_player_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -428,6 +460,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.3"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: dfdf0136e0aa7a1b474ea133e67cb0154a0acd2599c4f3ada3b49d38d38793ee
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.5"
|
||||
win32_registry:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32_registry
|
||||
sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
sdks:
|
||||
dart: ">=3.0.0-0 <4.0.0"
|
||||
dart: ">=3.0.0 <4.0.0"
|
||||
flutter: ">=3.3.0"
|
||||
|
@ -1,15 +1,18 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:photo_gallery/photo_gallery.dart';
|
||||
import '../models/config.dart';
|
||||
import '../models/gallery_media.dart';
|
||||
|
||||
import '/models/gallery_album.dart';
|
||||
import '/models/medium.dart';
|
||||
import '../models/config.dart';
|
||||
import '../models/gallery_media.dart';
|
||||
import '../models/media_file.dart';
|
||||
import 'picker_listener.dart';
|
||||
|
||||
@ -168,28 +171,39 @@ class PhoneGalleryController extends GetxController {
|
||||
}
|
||||
|
||||
static Future<bool> promptPermissionSetting() async {
|
||||
await PhoneGalleryController.requestStatus(Permission.storage);
|
||||
if (Platform.isIOS) {
|
||||
await PhoneGalleryController.requestStatus(Permission.photos);
|
||||
if (Platform.isAndroid) {
|
||||
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||
final AndroidDeviceInfo info = await deviceInfoPlugin.androidInfo;
|
||||
if (info.version.sdkInt >= 33) {
|
||||
if (await PhoneGalleryController.requestPermission(Permission.photos)) {
|
||||
return await PhoneGalleryController.requestPermission(
|
||||
Permission.videos);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return await PhoneGalleryController.requestPermission(
|
||||
Permission.storage);
|
||||
}
|
||||
}
|
||||
if (Platform.isIOS &&
|
||||
await Permission.storage.isGranted &&
|
||||
await Permission.photos.isGranted ||
|
||||
Platform.isAndroid && await Permission.storage.isGranted) {
|
||||
return true;
|
||||
bool statusStorage =
|
||||
await PhoneGalleryController.requestPermission(Permission.storage);
|
||||
if (statusStorage) {
|
||||
return await PhoneGalleryController.requestPermission(Permission.photos);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static Future<void> requestStatus(Permission permission) async {
|
||||
while (true) {
|
||||
try {
|
||||
await permission.request();
|
||||
break;
|
||||
} catch (e) {
|
||||
await Future.delayed(const Duration(milliseconds: 500), () {});
|
||||
static Future<bool> requestPermission(Permission permission) async {
|
||||
if (await permission.isGranted) {
|
||||
return true;
|
||||
} else {
|
||||
var result = await permission.request();
|
||||
if (result == PermissionStatus.granted) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<void> initializeAlbums() async {
|
||||
@ -213,13 +227,31 @@ class PhoneGalleryController extends GetxController {
|
||||
|
||||
void permissionListener() {
|
||||
Timer.periodic(const Duration(seconds: 1), (timer) async {
|
||||
if (await Permission.storage.isGranted) {
|
||||
if (await isGranted()) {
|
||||
initializeAlbums();
|
||||
timer.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<bool> isGranted() async {
|
||||
if (Platform.isAndroid) {
|
||||
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||
final AndroidDeviceInfo info = await deviceInfoPlugin.androidInfo;
|
||||
if (info.version.sdkInt >= 33) {
|
||||
if (await Permission.photos.isGranted) {
|
||||
return await Permission.videos.isGranted;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return await Permission.storage.isGranted;
|
||||
}
|
||||
}
|
||||
return (await Permission.storage.isGranted) &&
|
||||
(await Permission.photos.isGranted);
|
||||
}
|
||||
|
||||
static Future<GalleryMedia?> get collectGallery async {
|
||||
if (await promptPermissionSetting()) {
|
||||
List<GalleryAlbum> tempGalleryAlbums = [];
|
||||
@ -228,14 +260,13 @@ class PhoneGalleryController extends GetxController {
|
||||
await PhotoGallery.listAlbums(mediumType: MediumType.image);
|
||||
List<Album> videoAlbums =
|
||||
await PhotoGallery.listAlbums(mediumType: MediumType.video);
|
||||
|
||||
for (var photoAlbum in photoAlbums) {
|
||||
GalleryAlbum entireGalleryAlbum = GalleryAlbum.album(photoAlbum);
|
||||
await entireGalleryAlbum.initialize();
|
||||
entireGalleryAlbum.setType = AlbumType.image;
|
||||
if (videoAlbums.any((element) => element.name == photoAlbum.name)) {
|
||||
Album videoAlbum = videoAlbums
|
||||
.singleWhere((element) => element.name == photoAlbum.name);
|
||||
if (videoAlbums.any((element) => element.id == photoAlbum.id)) {
|
||||
Album videoAlbum =
|
||||
videoAlbums.singleWhere((element) => element.id == photoAlbum.id);
|
||||
GalleryAlbum videoGalleryAlbum = GalleryAlbum.album(videoAlbum);
|
||||
await videoGalleryAlbum.initialize();
|
||||
DateTime? lastPhotoDate = entireGalleryAlbum.lastDate;
|
||||
|
@ -1,12 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../controller/gallery_controller.dart';
|
||||
import '../../models/config.dart';
|
||||
import '../../models/gallery_album.dart';
|
||||
import '../../models/media_file.dart';
|
||||
import '../album_categories_view/album_categories_view.dart';
|
||||
import '../album_view/album_page.dart';
|
||||
import '../album_view/album_medias_view.dart';
|
||||
import '../album_view/album_page.dart';
|
||||
import 'permission_denied_view.dart';
|
||||
import 'picker_appbar.dart';
|
||||
import 'reload_gallery.dart';
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: gallery_picker
|
||||
description: Gallery Picker is a flutter package that will allow you to pick media file(s), manage and navigate inside your gallery with modern tools and views.
|
||||
version: 0.4.8
|
||||
version: 0.4.9
|
||||
homepage: https://github.com/FlutterWay/gallery_picker
|
||||
|
||||
environment:
|
||||
@ -12,12 +12,13 @@ dependencies:
|
||||
sdk: flutter
|
||||
cupertino_icons: ^1.0.5
|
||||
photo_gallery: ^1.2.2
|
||||
permission_handler: ^10.2.0
|
||||
permission_handler: ^10.4.3
|
||||
transparent_image: ^2.0.1
|
||||
video_player: ^2.6.1
|
||||
video_player: ^2.7.0
|
||||
device_info_plus: ^9.0.2
|
||||
get: ^4.6.5
|
||||
video_thumbnail: ^0.5.3
|
||||
intl: ^0.17.0
|
||||
intl: ^0.18.1
|
||||
page_transition: ^2.0.9
|
||||
bottom_sheet_scaffold: ^0.1.6
|
||||
dev_dependencies:
|
||||
|
Loading…
x
Reference in New Issue
Block a user