Merge branch 'hotfix/video' of /Users/deven9852/Stream/stream-chat-flutter with conflicts.
This commit is contained in:
@@ -0,0 +1,299 @@
|
|||||||
|
PODS:
|
||||||
|
- DKImagePickerController/Core (4.3.2):
|
||||||
|
- DKImagePickerController/ImageDataManager
|
||||||
|
- DKImagePickerController/Resource
|
||||||
|
- DKImagePickerController/ImageDataManager (4.3.2)
|
||||||
|
- DKImagePickerController/PhotoGallery (4.3.2):
|
||||||
|
- DKImagePickerController/Core
|
||||||
|
- DKPhotoGallery
|
||||||
|
- DKImagePickerController/Resource (4.3.2)
|
||||||
|
- DKPhotoGallery (0.0.17):
|
||||||
|
- DKPhotoGallery/Core (= 0.0.17)
|
||||||
|
- DKPhotoGallery/Model (= 0.0.17)
|
||||||
|
- DKPhotoGallery/Preview (= 0.0.17)
|
||||||
|
- DKPhotoGallery/Resource (= 0.0.17)
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- DKPhotoGallery/Core (0.0.17):
|
||||||
|
- DKPhotoGallery/Model
|
||||||
|
- DKPhotoGallery/Preview
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- DKPhotoGallery/Model (0.0.17):
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- DKPhotoGallery/Preview (0.0.17):
|
||||||
|
- DKPhotoGallery/Model
|
||||||
|
- DKPhotoGallery/Resource
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- DKPhotoGallery/Resource (0.0.17):
|
||||||
|
- SDWebImage
|
||||||
|
- SwiftyGif
|
||||||
|
- esys_flutter_share (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- file_picker (0.0.1):
|
||||||
|
- DKImagePickerController/PhotoGallery
|
||||||
|
- Flutter
|
||||||
|
- Firebase/CoreOnly (6.33.0):
|
||||||
|
- FirebaseCore (= 6.10.3)
|
||||||
|
- Firebase/Messaging (6.33.0):
|
||||||
|
- Firebase/CoreOnly
|
||||||
|
- FirebaseMessaging (~> 4.7.0)
|
||||||
|
- firebase_core (0.5.3):
|
||||||
|
- Firebase/CoreOnly (~> 6.33.0)
|
||||||
|
- Flutter
|
||||||
|
- firebase_messaging (7.0.3):
|
||||||
|
- Firebase/CoreOnly (~> 6.33.0)
|
||||||
|
- Firebase/Messaging (~> 6.33.0)
|
||||||
|
- firebase_core
|
||||||
|
- Flutter
|
||||||
|
- FirebaseCore (6.10.3):
|
||||||
|
- FirebaseCoreDiagnostics (~> 1.6)
|
||||||
|
- GoogleUtilities/Environment (~> 6.7)
|
||||||
|
- GoogleUtilities/Logger (~> 6.7)
|
||||||
|
- FirebaseCoreDiagnostics (1.7.0):
|
||||||
|
- GoogleDataTransport (~> 7.4)
|
||||||
|
- GoogleUtilities/Environment (~> 6.7)
|
||||||
|
- GoogleUtilities/Logger (~> 6.7)
|
||||||
|
- nanopb (~> 1.30906.0)
|
||||||
|
- FirebaseInstallations (1.7.0):
|
||||||
|
- FirebaseCore (~> 6.10)
|
||||||
|
- GoogleUtilities/Environment (~> 6.7)
|
||||||
|
- GoogleUtilities/UserDefaults (~> 6.7)
|
||||||
|
- PromisesObjC (~> 1.2)
|
||||||
|
- FirebaseInstanceID (4.8.0):
|
||||||
|
- FirebaseCore (~> 6.10)
|
||||||
|
- FirebaseInstallations (~> 1.6)
|
||||||
|
- GoogleUtilities/Environment (~> 6.7)
|
||||||
|
- GoogleUtilities/UserDefaults (~> 6.7)
|
||||||
|
- FirebaseMessaging (4.7.1):
|
||||||
|
- FirebaseCore (~> 6.10)
|
||||||
|
- FirebaseInstanceID (~> 4.7)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 6.7)
|
||||||
|
- GoogleUtilities/Environment (~> 6.7)
|
||||||
|
- GoogleUtilities/Reachability (~> 6.7)
|
||||||
|
- GoogleUtilities/UserDefaults (~> 6.7)
|
||||||
|
- Protobuf (>= 3.9.2, ~> 3.9)
|
||||||
|
- Flutter (1.0.0)
|
||||||
|
- flutter_apns (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- flutter_app_badger (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- flutter_keyboard_visibility (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- flutter_local_notifications (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- flutter_secure_storage (3.3.1):
|
||||||
|
- Flutter
|
||||||
|
- FMDB (2.7.5):
|
||||||
|
- FMDB/standard (= 2.7.5)
|
||||||
|
- FMDB/standard (2.7.5)
|
||||||
|
- GoogleDataTransport (7.5.1):
|
||||||
|
- nanopb (~> 1.30906.0)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (6.7.2):
|
||||||
|
- GoogleUtilities/Environment
|
||||||
|
- GoogleUtilities/Logger
|
||||||
|
- GoogleUtilities/Network
|
||||||
|
- GoogleUtilities/Environment (6.7.2):
|
||||||
|
- PromisesObjC (~> 1.2)
|
||||||
|
- GoogleUtilities/Logger (6.7.2):
|
||||||
|
- GoogleUtilities/Environment
|
||||||
|
- GoogleUtilities/Network (6.7.2):
|
||||||
|
- GoogleUtilities/Logger
|
||||||
|
- "GoogleUtilities/NSData+zlib"
|
||||||
|
- GoogleUtilities/Reachability
|
||||||
|
- "GoogleUtilities/NSData+zlib (6.7.2)"
|
||||||
|
- GoogleUtilities/Reachability (6.7.2):
|
||||||
|
- GoogleUtilities/Logger
|
||||||
|
- GoogleUtilities/UserDefaults (6.7.2):
|
||||||
|
- GoogleUtilities/Logger
|
||||||
|
- image_gallery_saver (1.5.0):
|
||||||
|
- Flutter
|
||||||
|
- image_picker (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- nanopb (1.30906.0):
|
||||||
|
- nanopb/decode (= 1.30906.0)
|
||||||
|
- nanopb/encode (= 1.30906.0)
|
||||||
|
- nanopb/decode (1.30906.0)
|
||||||
|
- nanopb/encode (1.30906.0)
|
||||||
|
- path_provider (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- photo_manager (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- PromisesObjC (1.2.11)
|
||||||
|
- Protobuf (3.13.0)
|
||||||
|
- SDWebImage (5.10.0):
|
||||||
|
- SDWebImage/Core (= 5.10.0)
|
||||||
|
- SDWebImage/Core (5.10.0)
|
||||||
|
- shared_preferences (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- sqflite (0.0.2):
|
||||||
|
- Flutter
|
||||||
|
- FMDB (>= 2.7.5)
|
||||||
|
- sqlite3 (3.32.3):
|
||||||
|
- sqlite3/common (= 3.32.3)
|
||||||
|
- sqlite3/common (3.32.3)
|
||||||
|
- sqlite3/fts5 (3.32.3):
|
||||||
|
- sqlite3/common
|
||||||
|
- sqlite3/json1 (3.32.3):
|
||||||
|
- sqlite3/common
|
||||||
|
- sqlite3/perf-threadsafe (3.32.3):
|
||||||
|
- sqlite3/common
|
||||||
|
- sqlite3/rtree (3.32.3):
|
||||||
|
- sqlite3/common
|
||||||
|
- sqlite3_flutter_libs (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- sqlite3 (~> 3.32.3)
|
||||||
|
- sqlite3/fts5
|
||||||
|
- sqlite3/json1
|
||||||
|
- sqlite3/perf-threadsafe
|
||||||
|
- sqlite3/rtree
|
||||||
|
- Starscream (4.0.4)
|
||||||
|
- StreamChatClient (2.4.2):
|
||||||
|
- Starscream (~> 4.0)
|
||||||
|
- SwiftyGif (5.3.0)
|
||||||
|
- url_launcher (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- video_compress (0.3.0):
|
||||||
|
- Flutter
|
||||||
|
- video_player (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- wakelock (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
|
||||||
|
DEPENDENCIES:
|
||||||
|
- esys_flutter_share (from `.symlinks/plugins/esys_flutter_share/ios`)
|
||||||
|
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||||
|
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
||||||
|
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
||||||
|
- Flutter (from `Flutter`)
|
||||||
|
- flutter_apns (from `.symlinks/plugins/flutter_apns/ios`)
|
||||||
|
- flutter_app_badger (from `.symlinks/plugins/flutter_app_badger/ios`)
|
||||||
|
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
||||||
|
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
||||||
|
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||||
|
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
|
||||||
|
- image_picker (from `.symlinks/plugins/image_picker/ios`)
|
||||||
|
- path_provider (from `.symlinks/plugins/path_provider/ios`)
|
||||||
|
- photo_manager (from `.symlinks/plugins/photo_manager/ios`)
|
||||||
|
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
|
||||||
|
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||||
|
- sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/ios`)
|
||||||
|
- StreamChatClient
|
||||||
|
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
|
||||||
|
- video_compress (from `.symlinks/plugins/video_compress/ios`)
|
||||||
|
- video_player (from `.symlinks/plugins/video_player/ios`)
|
||||||
|
- wakelock (from `.symlinks/plugins/wakelock/ios`)
|
||||||
|
|
||||||
|
SPEC REPOS:
|
||||||
|
trunk:
|
||||||
|
- DKImagePickerController
|
||||||
|
- DKPhotoGallery
|
||||||
|
- Firebase
|
||||||
|
- FirebaseCore
|
||||||
|
- FirebaseCoreDiagnostics
|
||||||
|
- FirebaseInstallations
|
||||||
|
- FirebaseInstanceID
|
||||||
|
- FirebaseMessaging
|
||||||
|
- FMDB
|
||||||
|
- GoogleDataTransport
|
||||||
|
- GoogleUtilities
|
||||||
|
- nanopb
|
||||||
|
- PromisesObjC
|
||||||
|
- Protobuf
|
||||||
|
- SDWebImage
|
||||||
|
- sqlite3
|
||||||
|
- Starscream
|
||||||
|
- StreamChatClient
|
||||||
|
- SwiftyGif
|
||||||
|
|
||||||
|
EXTERNAL SOURCES:
|
||||||
|
esys_flutter_share:
|
||||||
|
:path: ".symlinks/plugins/esys_flutter_share/ios"
|
||||||
|
file_picker:
|
||||||
|
:path: ".symlinks/plugins/file_picker/ios"
|
||||||
|
firebase_core:
|
||||||
|
:path: ".symlinks/plugins/firebase_core/ios"
|
||||||
|
firebase_messaging:
|
||||||
|
:path: ".symlinks/plugins/firebase_messaging/ios"
|
||||||
|
Flutter:
|
||||||
|
:path: Flutter
|
||||||
|
flutter_apns:
|
||||||
|
:path: ".symlinks/plugins/flutter_apns/ios"
|
||||||
|
flutter_app_badger:
|
||||||
|
:path: ".symlinks/plugins/flutter_app_badger/ios"
|
||||||
|
flutter_keyboard_visibility:
|
||||||
|
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
|
||||||
|
flutter_local_notifications:
|
||||||
|
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
||||||
|
flutter_secure_storage:
|
||||||
|
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
||||||
|
image_gallery_saver:
|
||||||
|
:path: ".symlinks/plugins/image_gallery_saver/ios"
|
||||||
|
image_picker:
|
||||||
|
:path: ".symlinks/plugins/image_picker/ios"
|
||||||
|
path_provider:
|
||||||
|
:path: ".symlinks/plugins/path_provider/ios"
|
||||||
|
photo_manager:
|
||||||
|
:path: ".symlinks/plugins/photo_manager/ios"
|
||||||
|
shared_preferences:
|
||||||
|
:path: ".symlinks/plugins/shared_preferences/ios"
|
||||||
|
sqflite:
|
||||||
|
:path: ".symlinks/plugins/sqflite/ios"
|
||||||
|
sqlite3_flutter_libs:
|
||||||
|
:path: ".symlinks/plugins/sqlite3_flutter_libs/ios"
|
||||||
|
url_launcher:
|
||||||
|
:path: ".symlinks/plugins/url_launcher/ios"
|
||||||
|
video_compress:
|
||||||
|
:path: ".symlinks/plugins/video_compress/ios"
|
||||||
|
video_player:
|
||||||
|
:path: ".symlinks/plugins/video_player/ios"
|
||||||
|
wakelock:
|
||||||
|
:path: ".symlinks/plugins/wakelock/ios"
|
||||||
|
|
||||||
|
SPEC CHECKSUMS:
|
||||||
|
DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d
|
||||||
|
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
||||||
|
esys_flutter_share: 403498dab005b36ce1f8d7aff377e81f0621b0b4
|
||||||
|
file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1
|
||||||
|
Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5
|
||||||
|
firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659
|
||||||
|
firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75
|
||||||
|
FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd
|
||||||
|
FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1
|
||||||
|
FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2
|
||||||
|
FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1
|
||||||
|
FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a
|
||||||
|
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
||||||
|
flutter_apns: ddc629f26016140bf52165040b0a8e8869f9ce32
|
||||||
|
flutter_app_badger: 65de4d6f0c34a891df49e6cfb8a1c0496426fa68
|
||||||
|
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
||||||
|
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
|
||||||
|
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
|
||||||
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
|
GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833
|
||||||
|
GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3
|
||||||
|
image_gallery_saver: 259eab68fb271cfd57d599904f7acdc7832e7ef2
|
||||||
|
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
|
||||||
|
nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc
|
||||||
|
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
|
||||||
|
photo_manager: f7c619c2cc8c2adb8d85c63363babac477de9c67
|
||||||
|
PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f
|
||||||
|
Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748
|
||||||
|
SDWebImage: 9169792e9eec3e45bba2a0c02f74bf8bd922d1ee
|
||||||
|
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
|
||||||
|
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
|
||||||
|
sqlite3: 8f7d2078ae27778699a622a94b853285793422a2
|
||||||
|
sqlite3_flutter_libs: 5651f8ff48e3b44d910863c4ea5916085b1b245f
|
||||||
|
Starscream: 5178aed56b316f13fa3bc55694e583d35dd414d9
|
||||||
|
StreamChatClient: fc6419fa7ceda9c048188bb7c8e9f07755ced05f
|
||||||
|
SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40
|
||||||
|
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
|
||||||
|
video_compress: fce97e4fb1dfd88175aa07d2ffc8a2f297f87fbe
|
||||||
|
video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e
|
||||||
|
wakelock: bfc7955c418d0db797614075aabbc58a39ab5107
|
||||||
|
|
||||||
|
PODFILE CHECKSUM: eb001256612a59f8f9e4d083ad8b9671e69dd184
|
||||||
|
|
||||||
|
COCOAPODS: 1.10.1
|
||||||
@@ -61,9 +61,14 @@ class _FullScreenMediaState extends State<FullScreenMedia>
|
|||||||
.where((element) => element.type == 'video')
|
.where((element) => element.type == 'video')
|
||||||
.toList()
|
.toList()
|
||||||
.forEach((element) {
|
.forEach((element) {
|
||||||
videoPackages.add(VideoPackage(context, element, () {
|
videoPackages.add(VideoPackage(
|
||||||
setState(() {});
|
context,
|
||||||
}));
|
element,
|
||||||
|
() {
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
showControls: true,
|
||||||
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,15 +238,18 @@ class VideoPackage {
|
|||||||
bool initialised = false;
|
bool initialised = false;
|
||||||
VoidCallback onInit;
|
VoidCallback onInit;
|
||||||
BuildContext context;
|
BuildContext context;
|
||||||
|
bool showControls;
|
||||||
|
|
||||||
///
|
///
|
||||||
VideoPackage(this.context, Attachment attachment, this.onInit) {
|
VideoPackage(this.context, Attachment attachment, this.onInit,
|
||||||
|
{this.showControls = false}) {
|
||||||
_videoPlayerController = VideoPlayerController.network(attachment.assetUrl);
|
_videoPlayerController = VideoPlayerController.network(attachment.assetUrl);
|
||||||
_videoPlayerController.initialize().whenComplete(() {
|
_videoPlayerController.initialize().whenComplete(() {
|
||||||
initialised = true;
|
initialised = true;
|
||||||
_chewieController = ChewieController(
|
_chewieController = ChewieController(
|
||||||
videoPlayerController: _videoPlayerController,
|
videoPlayerController: _videoPlayerController,
|
||||||
autoInitialize: false,
|
autoInitialize: true,
|
||||||
|
showControls: showControls,
|
||||||
aspectRatio: _videoPlayerController.value.aspectRatio,
|
aspectRatio: _videoPlayerController.value.aspectRatio,
|
||||||
);
|
);
|
||||||
onInit();
|
onInit();
|
||||||
|
|||||||
@@ -239,6 +239,8 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
|
|
||||||
MessageListController _messageListController = MessageListController();
|
MessageListController _messageListController = MessageListController();
|
||||||
|
|
||||||
|
Map<String, VideoPackage> videoPackages = {};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MessageListCore(
|
return MessageListCore(
|
||||||
@@ -776,6 +778,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
videoPackages: videoPackages,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,6 +939,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
videoPackages: videoPackages,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!message.isDeleted && !message.isSystem && !message.isEphemeral) {
|
if (!message.isDeleted && !message.isSystem && !message.isEphemeral) {
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ class MessageWidget extends StatefulWidget {
|
|||||||
/// Function called when quotedMessage is tapped
|
/// Function called when quotedMessage is tapped
|
||||||
final OnQuotedMessageTap onQuotedMessageTap;
|
final OnQuotedMessageTap onQuotedMessageTap;
|
||||||
|
|
||||||
|
Map<String, VideoPackage> videoPackages = {};
|
||||||
|
|
||||||
///
|
///
|
||||||
MessageWidget({
|
MessageWidget({
|
||||||
Key key,
|
Key key,
|
||||||
@@ -190,6 +192,7 @@ class MessageWidget extends StatefulWidget {
|
|||||||
this.attachmentPadding = EdgeInsets.zero,
|
this.attachmentPadding = EdgeInsets.zero,
|
||||||
this.allRead = false,
|
this.allRead = false,
|
||||||
this.onQuotedMessageTap,
|
this.onQuotedMessageTap,
|
||||||
|
this.videoPackages,
|
||||||
}) : attachmentBuilders = {
|
}) : attachmentBuilders = {
|
||||||
'image': (context, message, attachment) {
|
'image': (context, message, attachment) {
|
||||||
return ImageAttachment(
|
return ImageAttachment(
|
||||||
@@ -832,6 +835,41 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
children: widget.message.attachments
|
children: widget.message.attachments
|
||||||
?.where((element) => element.ogScrapeUrl == null)
|
?.where((element) => element.ogScrapeUrl == null)
|
||||||
?.map((attachment) {
|
?.map((attachment) {
|
||||||
|
if (attachment.type == 'video') {
|
||||||
|
VideoPackage package;
|
||||||
|
|
||||||
|
if (widget.videoPackages == null) {
|
||||||
|
package = VideoPackage(context, attachment, () {});
|
||||||
|
} else {
|
||||||
|
package = widget?.videoPackages[
|
||||||
|
'${widget.message.id}${widget.message.attachments.indexOf(attachment)}'] ??
|
||||||
|
VideoPackage(context, attachment, () {});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (widget.videoPackages != null) {
|
||||||
|
widget.videoPackages[
|
||||||
|
'${widget.message.id}${widget.message.attachments.indexOf(attachment)}'] =
|
||||||
|
package;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Transform(
|
||||||
|
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: VideoAttachment(
|
||||||
|
attachment: attachment,
|
||||||
|
messageTheme: widget.messageTheme,
|
||||||
|
size: Size(
|
||||||
|
MediaQuery.of(context).size.width * 0.8,
|
||||||
|
MediaQuery.of(context).size.height * 0.3,
|
||||||
|
),
|
||||||
|
message: widget.message,
|
||||||
|
onShowMessage: widget.onShowMessage,
|
||||||
|
onReturnAction: widget.onReturnAction,
|
||||||
|
videoPackage: package,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
final attachmentBuilder =
|
final attachmentBuilder =
|
||||||
widget.attachmentBuilders[attachment.type];
|
widget.attachmentBuilders[attachment.type];
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,13 @@ class VideoAttachment extends StatefulWidget {
|
|||||||
final Message message;
|
final Message message;
|
||||||
final ShowMessageCallback onShowMessage;
|
final ShowMessageCallback onShowMessage;
|
||||||
final ValueChanged<ReturnActionType> onReturnAction;
|
final ValueChanged<ReturnActionType> onReturnAction;
|
||||||
|
final VideoPackage videoPackage;
|
||||||
|
|
||||||
VideoAttachment({
|
VideoAttachment({
|
||||||
Key key,
|
Key key,
|
||||||
@required this.attachment,
|
@required this.attachment,
|
||||||
@required this.messageTheme,
|
@required this.messageTheme,
|
||||||
|
this.videoPackage,
|
||||||
this.message,
|
this.message,
|
||||||
this.size,
|
this.size,
|
||||||
this.onShowMessage,
|
this.onShowMessage,
|
||||||
@@ -32,13 +34,21 @@ class VideoAttachment extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _VideoAttachmentState extends State<VideoAttachment> {
|
class _VideoAttachmentState extends State<VideoAttachment> {
|
||||||
ChewieController _chewieController;
|
|
||||||
VideoPlayerController _videoPlayerController;
|
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
widget.videoPackage.onInit = () {
|
||||||
|
setState(() {
|
||||||
|
initialized = true;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!initialized) {
|
if (!widget.videoPackage.initialised) {
|
||||||
return Container(
|
return Container(
|
||||||
height: widget.size?.height ?? 100,
|
height: widget.size?.height ?? 100,
|
||||||
width: widget.size?.width ?? 100,
|
width: widget.size?.width ?? 100,
|
||||||
@@ -47,43 +57,6 @@ class _VideoAttachmentState extends State<VideoAttachment> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_chewieController = ChewieController(
|
|
||||||
videoPlayerController: _videoPlayerController,
|
|
||||||
autoInitialize: true,
|
|
||||||
showControls: false,
|
|
||||||
aspectRatio: _videoPlayerController.value.aspectRatio,
|
|
||||||
errorBuilder: (_, e) {
|
|
||||||
if (widget.attachment.thumbUrl != null) {
|
|
||||||
return Stack(
|
|
||||||
children: <Widget>[
|
|
||||||
Container(
|
|
||||||
height: widget.size?.height,
|
|
||||||
width: widget.size?.width,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: CachedNetworkImageProvider(
|
|
||||||
widget.attachment.thumbUrl,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (widget.attachment.titleLink != null)
|
|
||||||
Material(
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () =>
|
|
||||||
launchURL(context, widget.attachment.titleLink),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return AttachmentError(
|
|
||||||
attachment: widget.attachment,
|
|
||||||
size: widget.size,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
@@ -123,7 +96,7 @@ class _VideoAttachmentState extends State<VideoAttachment> {
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Chewie(
|
Chewie(
|
||||||
controller: _chewieController,
|
controller: widget.videoPackage.chewieController,
|
||||||
),
|
),
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: Center(
|
child: Center(
|
||||||
@@ -153,23 +126,4 @@ class _VideoAttachmentState extends State<VideoAttachment> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_videoPlayerController =
|
|
||||||
VideoPlayerController.network(widget.attachment.assetUrl);
|
|
||||||
_videoPlayerController.initialize().whenComplete(() {
|
|
||||||
setState(() {
|
|
||||||
initialized = true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_videoPlayerController?.dispose();
|
|
||||||
_chewieController?.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user