aloisdeniel / media_gallery

A Flutter plugin that lists native gallery items.
MIT License
87 stars 33 forks source link

Some pictures are shown upside down on Android 10 #10

Open rignaneseleo opened 4 years ago

rignaneseleo commented 4 years ago

Hi, some pictures I'm loading on Android 10 are shown upside down. This is the piece of code I'm using:

Media m = Media.fromJson({
        "id": entity.id,
        "mediaType": type == AssetType.image ? "image" : "video",
        "height": entity.height,
        "width": entity.width,
        "creationDate": entity.createDtSecond ?? 0,
      });
var thumb =
          await m.getThumbnail(height: size, width: size, highQuality: false);

return Container(
          child: Stack(
        alignment: Alignment.topCenter,
        children: [
          Image.memory(
            thumb,
            fit: BoxFit.cover,
            width: double.infinity,
            height: double.infinity,
          ),
        ],
      ));

This is one of the picture as example: https://drive.google.com/file/d/1_Y7OOa9chJUSsECUHbJPIZOFg1tFaFzx/view?usp=sharing

EDIT: I think the error is the logic in rotatedBitmap method in MediaGalleryPlugin.kt

benwinding commented 3 years ago

To use this fix in your flutter project, add this to the pubspec.yaml

  media_gallery:
    git:
      url: git://github.com/rignaneseleo/media_gallery
      ref: f277e8c5955bc824feb700600d641df75329124e