@@ -6,6 +6,7 @@ import 'package:image_picker/image_picker.dart';
66import 'package:piwigo_ng/constants/SettingsConstants.dart' ;
77import 'package:piwigo_ng/services/OrientationService.dart' ;
88import 'package:piwigo_ng/api/API.dart' ;
9+ import 'package:mime_type/mime_type.dart' ;
910
1011import 'package:flutter/material.dart' ;
1112
@@ -436,7 +437,7 @@ class _UploadGalleryViewPage extends State<UploadGalleryViewPage> {
436437 }
437438
438439 Widget _buildHorizontalListItem (XFile image) {
439- String expansion = image.path. split ( '.' ).last ;
440+ String mimeType = mime ( image.path) ;
440441 return Container (
441442 padding: EdgeInsets .symmetric (horizontal: 5 ),
442443 child: Stack (
@@ -456,7 +457,7 @@ class _UploadGalleryViewPage extends State<UploadGalleryViewPage> {
456457 ),
457458 child: ClipRRect (
458459 borderRadius: BorderRadius .circular (7 ),
459- child: expansion == 'mp4'
460+ child: mimeType. startsWith ( 'video' )
460461 ? VideoItem (path: image.path)
461462 : Image .file (File (image.path),
462463 fit: BoxFit .cover,
@@ -506,7 +507,7 @@ class _UploadGalleryViewPage extends State<UploadGalleryViewPage> {
506507 }
507508
508509 Widget _buildGridItem (XFile image) {
509- String expansion = image.path. split ( '.' ).last ;
510+ String mimeType = mime ( image.path) ;
510511 return Container (
511512 child: Stack (
512513 children: [
@@ -518,7 +519,7 @@ class _UploadGalleryViewPage extends State<UploadGalleryViewPage> {
518519 semanticContainer: true ,
519520 child: GridTile (
520521 child: Container (
521- child: expansion == 'mp4'
522+ child: mimeType. startsWith ( 'video' )
522523 ? VideoItem (path: image.path)
523524 : Image .file (File (image.path),
524525 fit: BoxFit .cover,
0 commit comments