Variable type of MediaFile.type changed to MediaType

This commit is contained in:
Furkan 2023-01-01 17:15:26 +03:00
parent d015b9e20d
commit 6cf4776aac
9 changed files with 26 additions and 19 deletions

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"permission_handler_apple","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_apple-9.0.7\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\photo_gallery-1.1.1\\\\","native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_avfoundation-2.3.8\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"permission_handler_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_android-10.2.0\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\photo_gallery-1.1.1\\\\","native_build":true,"dependencies":[]},{"name":"video_player_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_android-2.3.10\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[{"name":"permission_handler_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_windows-0.1.2\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"video_player_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_web-2.0.13\\\\","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-01-01 10:09:14.777712","version":"3.3.10"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"permission_handler_apple","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_apple-9.0.7\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\photo_gallery-1.1.1\\\\","native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_avfoundation-2.3.8\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"permission_handler_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_android-10.2.0\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\photo_gallery-1.1.1\\\\","native_build":true,"dependencies":[]},{"name":"video_player_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_android-2.3.10\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[{"name":"permission_handler_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_windows-0.1.2\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"video_player_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_web-2.0.13\\\\","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-01-01 17:14:11.502400","version":"3.3.10"}

View File

@ -42,3 +42,7 @@
* The problem at collectGallery function has solved
## 0.1.1
* Variable type of MediaFile.type changed to MediaType

View File

@ -316,7 +316,7 @@ GalleryPicker returns MediaFile list. You can reach out features below.
[✔] Medium
[✔] Id
[✔] MediumType
[✔] MediaType
[✔] Thumbnail
[✔] Check with thumbnailFailed if fetching thumbnail fails
[✔] Check with fileFailed if getting file fails

View File

@ -141,7 +141,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.0"
version: "0.1.1"
get:
dependency: transitive
description:

View File

@ -10,20 +10,27 @@ enum MediaType { image, video }
class MediaFile {
late Medium medium;
MediumType? type;
late MediaType type;
Uint8List? thumbnail;
Uint8List? data;
late String id;
bool thumbnailFailed = false;
File? file;
bool get isVideo => type == MediaType.video;
bool get isImage => type == MediaType.image;
MediaFile({required this.medium}) {
type = medium.mediumType;
type = medium.mediumType == MediumType.video
? MediaType.video
: MediaType.image;
id = medium.id;
}
MediaFile.file(
{required this.id, required this.file, required MediaType type}) {
this.type = type == MediaType.image ? MediumType.image : MediumType.video;
medium = Medium(id: id);
MediaFile.file({required this.id, required this.file, required this.type}) {
medium = Medium(
id: id,
mediumType:
type == MediaType.image ? MediumType.image : MediumType.video);
}
Future<Uint8List?> getThumbnail() async {

View File

@ -10,7 +10,7 @@ class MediaProvider extends StatelessWidget {
@override
Widget build(BuildContext context) {
return media.type == photo_gallery.MediumType.image
return media.isImage
? PhotoProvider(
media: media,
width: width,

View File

@ -23,7 +23,7 @@ class ThumbnailMedia extends StatelessWidget {
children: [
if (media.thumbnailFailed && onErrorBuilder == null)
Icon(
media.type == MediumType.image
media.isImage
? Icons.image_not_supported
: Icons.videocam_off_rounded,
color: Colors.grey,
@ -44,9 +44,7 @@ class ThumbnailMedia extends StatelessWidget {
bottom: 10,
left: 10,
child: Icon(
media.medium.mediumType == MediumType.video
? Icons.video_camera_back
: null,
media.isVideo ? Icons.video_camera_back : null,
color: Colors.white,
size: 20,
)),

View File

@ -52,7 +52,7 @@ class ThumbnailMediaFile extends StatelessWidget {
Container(
color: adjustFailedBgColor(),
child: Icon(
file.type == MediumType.image
file.isImage
? Icons.image_not_supported
: Icons.videocam_off_rounded,
size: 50,
@ -75,9 +75,7 @@ class ThumbnailMediaFile extends StatelessWidget {
bottom: 10,
left: 10,
child: Icon(
file.medium.mediumType == MediumType.video
? Icons.video_camera_back
: null,
file.isVideo ? Icons.video_camera_back : null,
color: Colors.white,
size: 20,
)),

View File

@ -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.1.0
version: 0.1.1
homepage: https://github.com/FlutterWay/gallery_picker
environment: