fix heic pics
This commit is contained in:
@@ -38,7 +38,7 @@ PODS:
|
||||
- Firebase/Messaging (6.33.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseMessaging (~> 4.7.0)
|
||||
- firebase_core (0.5.2):
|
||||
- firebase_core (0.5.2-1):
|
||||
- Firebase/CoreOnly (~> 6.33.0)
|
||||
- Flutter
|
||||
- firebase_messaging (7.0.3):
|
||||
@@ -115,8 +115,6 @@ PODS:
|
||||
- nanopb/encode (1.30906.0)
|
||||
- path_provider (0.0.1):
|
||||
- Flutter
|
||||
- "permission_handler (5.0.1+1)":
|
||||
- Flutter
|
||||
- photo_manager (0.0.1):
|
||||
- Flutter
|
||||
- PromisesObjC (1.2.11)
|
||||
@@ -172,7 +170,6 @@ DEPENDENCIES:
|
||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||
- image_picker (from `.symlinks/plugins/image_picker/ios`)
|
||||
- path_provider (from `.symlinks/plugins/path_provider/ios`)
|
||||
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
|
||||
- photo_manager (from `.symlinks/plugins/photo_manager/ios`)
|
||||
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
|
||||
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||
@@ -228,8 +225,6 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/image_picker/ios"
|
||||
path_provider:
|
||||
:path: ".symlinks/plugins/path_provider/ios"
|
||||
permission_handler:
|
||||
:path: ".symlinks/plugins/permission_handler/ios"
|
||||
photo_manager:
|
||||
:path: ".symlinks/plugins/photo_manager/ios"
|
||||
shared_preferences:
|
||||
@@ -252,7 +247,7 @@ SPEC CHECKSUMS:
|
||||
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
||||
file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1
|
||||
Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5
|
||||
firebase_core: 350ba329d1641211bc6183a3236893cafdacfea7
|
||||
firebase_core: 7423d688a1c6f2f2d859d64ae26991be39989781
|
||||
firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75
|
||||
FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd
|
||||
FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1
|
||||
@@ -271,7 +266,6 @@ SPEC CHECKSUMS:
|
||||
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
|
||||
nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc
|
||||
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
|
||||
permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6
|
||||
photo_manager: f7c619c2cc8c2adb8d85c63363babac477de9c67
|
||||
PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f
|
||||
Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: example
|
||||
description: A new Flutter project.
|
||||
version: 1.0.80+82
|
||||
version: 1.0.82+84
|
||||
|
||||
environment:
|
||||
sdk: ">=2.2.2 <3.0.0"
|
||||
|
||||
@@ -37,7 +37,6 @@ class _MediaListViewState extends State<MediaListView> {
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
),
|
||||
cacheExtent: 1000,
|
||||
itemBuilder: (
|
||||
context,
|
||||
position,
|
||||
@@ -88,7 +87,7 @@ class _MediaListViewState extends State<MediaListView> {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (media.type == AssetType.video)
|
||||
if (media.type == AssetType.video) ...[
|
||||
Positioned(
|
||||
left: 8,
|
||||
bottom: 10,
|
||||
@@ -97,6 +96,17 @@ class _MediaListViewState extends State<MediaListView> {
|
||||
package: 'stream_chat_flutter',
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 4,
|
||||
bottom: 10,
|
||||
child: Text(
|
||||
'${media.videoDuration.inMinutes}:${media.videoDuration.inSeconds.toString().padLeft(2, '0')}',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
|
||||
+20
-37
@@ -11,7 +11,6 @@ import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:http_parser/http_parser.dart' as httpParser;
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:mime/mime.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:photo_manager/photo_manager.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:stream_chat_flutter/src/compress_video_service.dart';
|
||||
@@ -22,6 +21,7 @@ import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
|
||||
import 'package:stream_chat_flutter/src/user_avatar.dart';
|
||||
import 'package:substring_highlight/substring_highlight.dart';
|
||||
import 'package:video_compress/video_compress.dart';
|
||||
import 'package:photo_manager/photo_manager.dart';
|
||||
|
||||
import '../stream_chat_flutter.dart';
|
||||
import 'stream_channel.dart';
|
||||
@@ -772,10 +772,8 @@ class MessageInputState extends State<MessageInput> {
|
||||
Widget _buildPickerSection() {
|
||||
switch (_filePickerIndex) {
|
||||
case 0:
|
||||
return FutureBuilder<PermissionStatus>(
|
||||
future: Platform.isAndroid
|
||||
? Permission.storage.status
|
||||
: Permission.photos.status,
|
||||
return FutureBuilder<bool>(
|
||||
future: PhotoManager.requestPermission(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return Center(
|
||||
@@ -783,10 +781,10 @@ class MessageInputState extends State<MessageInput> {
|
||||
);
|
||||
}
|
||||
|
||||
if (snapshot.data.isGranted) {
|
||||
if (snapshot.data) {
|
||||
return MediaListView(
|
||||
selectedIds: _attachments.map((e) => e.id).toList(),
|
||||
onSelect: (media) {
|
||||
onSelect: (media) async {
|
||||
if (!_attachments
|
||||
.any((element) => element.id == media.id)) {
|
||||
_addAttachment(media);
|
||||
@@ -802,22 +800,7 @@ class MessageInputState extends State<MessageInput> {
|
||||
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var status = await (Platform.isAndroid
|
||||
? Permission.storage.status
|
||||
: Permission.photos.status);
|
||||
if (status.isPermanentlyDenied || status.isDenied) {
|
||||
if (await openAppSettings()) {
|
||||
setState(() {});
|
||||
}
|
||||
} else {
|
||||
status = await (Platform.isAndroid
|
||||
? Permission.storage
|
||||
: Permission.photos)
|
||||
.request();
|
||||
if (status.isGranted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
PhotoManager.openSetting();
|
||||
},
|
||||
child: Container(
|
||||
color: Color(0xFFF2F2F2),
|
||||
@@ -858,7 +841,7 @@ class MessageInputState extends State<MessageInput> {
|
||||
setState(() {
|
||||
_attachments.add(attachment);
|
||||
});
|
||||
final mediaFile = await medium.file;
|
||||
final mediaFile = await medium.originFile;
|
||||
|
||||
var file = PlatformFile(
|
||||
path: mediaFile.path,
|
||||
@@ -1326,7 +1309,10 @@ class MessageInputState extends State<MessageInput> {
|
||||
future: VideoCompress.getFileThumbnail(attachment.file.path),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return Offstage();
|
||||
return Image.asset(
|
||||
'images/placeholder.png',
|
||||
package: 'stream_chat_flutter',
|
||||
);
|
||||
}
|
||||
|
||||
return Image.file(
|
||||
@@ -1405,15 +1391,6 @@ class MessageInputState extends State<MessageInput> {
|
||||
_filePickerSize = _kMinMediaPickerSize;
|
||||
});
|
||||
} else {
|
||||
final status = await (Platform.isAndroid
|
||||
? Permission.storage.status
|
||||
: Permission.photos.status);
|
||||
if (status.isUndetermined) {
|
||||
await (Platform.isAndroid
|
||||
? Permission.storage
|
||||
: Permission.photos)
|
||||
.request();
|
||||
}
|
||||
showAttachmentModal();
|
||||
}
|
||||
},
|
||||
@@ -1646,14 +1623,20 @@ class MessageInputState extends State<MessageInput> {
|
||||
|
||||
Future<String> _uploadImage(PlatformFile file, Channel channel) async {
|
||||
final filename = file.name ?? file.path?.split('/')?.last;
|
||||
httpParser.MediaType mimeType;
|
||||
if (filename != null) {
|
||||
if (filename.toLowerCase().endsWith('heic')) {
|
||||
mimeType = httpParser.MediaType.parse('image/heic');
|
||||
} else {
|
||||
mimeType = httpParser.MediaType.parse(lookupMimeType(filename));
|
||||
}
|
||||
}
|
||||
final bytes = file.bytes;
|
||||
final res = await channel.sendImage(
|
||||
MultipartFile.fromBytes(
|
||||
bytes,
|
||||
filename: filename,
|
||||
contentType: filename != null
|
||||
? httpParser.MediaType.parse(lookupMimeType(filename))
|
||||
: null,
|
||||
contentType: mimeType,
|
||||
),
|
||||
);
|
||||
return res.file;
|
||||
|
||||
@@ -39,7 +39,6 @@ dependencies:
|
||||
carousel_slider: ^2.2.1
|
||||
clipboard: ^0.1.2+8
|
||||
photo_manager: ^0.5.8
|
||||
permission_handler: ^5.0.1+1
|
||||
transparent_image: ^1.0.0
|
||||
ezanimation: ^0.4.1
|
||||
synchronized: ^2.2.0+2
|
||||
|
||||
Reference in New Issue
Block a user