feat: more implementation.

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2023-07-28 21:07:02 +05:30
committed by xsahil03x
parent f246de55a1
commit e8de28854b
93 changed files with 883 additions and 843 deletions
@@ -7,7 +7,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
import 'package:stream_chat_flutter/platform_widget_builder/platform_widget_builder.dart';
import 'package:stream_chat_flutter/src/attachment/thumbnail/image_attachment_thumbnail.dart';
import 'package:stream_chat_flutter/src/attachment/thumbnail/media_attachment_thumbnail.dart';
import 'package:stream_chat_flutter/src/context_menu_items/download_menu_item.dart';
import 'package:stream_chat_flutter/src/fullscreen_media/full_screen_media_widget.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
@@ -272,7 +272,7 @@ class _FullScreenMediaState extends State<StreamFullScreenMedia> {
}
}
if (widget.autoplayVideos &&
currentAttachment.type == 'video') {
currentAttachment.type == AttachmentType.video) {
final controller = videoPackages[currentAttachment.id]!;
controller._chewieController?.play();
}
@@ -294,47 +294,19 @@ class _FullScreenMediaState extends State<StreamFullScreenMedia> {
child: ContextMenuArea(
verticalPadding: 0,
builder: (_) => [
DownloadMenuItem(
attachment: attachment,
),
DownloadMenuItem(attachment: attachment),
],
child: PhotoView.customChild(
heroAttributes: PhotoViewHeroAttributes(
tag: attachment.id,
),
// imageProvider: (imageUrl == null &&
// attachment.localUri != null &&
// attachment.file?.bytes != null)
// ? Image.memory(attachment.file!.bytes!).image
// : CachedNetworkImageProvider(imageUrl!),
// errorBuilder: (_, __, ___) => const AttachmentError(),
// loadingBuilder: (context, _) {
// final image = Image.asset(
// 'images/placeholder.png',
// fit: BoxFit.cover,
// package: 'stream_chat_flutter',
// );
// final colorTheme =
// StreamChatTheme.of(context).colorTheme;
// return Shimmer.fromColors(
// baseColor: colorTheme.disabled,
// highlightColor: colorTheme.inputBg,
// child: image,
// );
// },
child: StreamImageAttachmentThumbnail(
image: attachment,
width: double.infinity,
height: double.infinity,
),
maxScale: PhotoViewComputedScale.covered,
minScale: PhotoViewComputedScale.contained,
// heroAttributes: PhotoViewHeroAttributes(
// tag: widget.mediaAttachmentPackages,
// ),
backgroundDecoration: const BoxDecoration(
color: Colors.transparent,
),
child: StreamMediaAttachmentThumbnail(
media: attachment,
width: double.infinity,
height: double.infinity,
),
),
),
),
@@ -353,9 +325,7 @@ class _FullScreenMediaState extends State<StreamFullScreenMedia> {
child: ContextMenuArea(
verticalPadding: 0,
builder: (_) => [
DownloadMenuItem(
attachment: attachment,
),
DownloadMenuItem(attachment: attachment),
],
child: Chewie(
controller: controller.chewieController!,
@@ -94,7 +94,7 @@ class _FullScreenMediaDesktopState extends State<FullScreenMediaDesktop> {
_pageController = PageController(initialPage: widget.startIndex);
for (var i = 0; i < widget.mediaAttachmentPackages.length; i++) {
final attachment = widget.mediaAttachmentPackages[i].attachment;
if (attachment.type != 'video') continue;
if (attachment.type != AttachmentType.video) continue;
final package = DesktopVideoPackage(attachment);
videoPackages[attachment.id] = package;
}
@@ -298,7 +298,8 @@ class _FullScreenMediaDesktopState extends State<FullScreenMediaDesktop> {
p.player.pause();
}
}
if (widget.autoplayVideos && currentAttachment.type == 'video') {
if (widget.autoplayVideos &&
currentAttachment.type == AttachmentType.video) {
final package = videoPackages[currentAttachment.id]!;
package.player.play();
}
@@ -307,7 +308,8 @@ class _FullScreenMediaDesktopState extends State<FullScreenMediaDesktop> {
final currentAttachmentPackage =
widget.mediaAttachmentPackages[index];
final attachment = currentAttachmentPackage.attachment;
if (attachment.type == 'image' || attachment.type == 'giphy') {
if (attachment.type == AttachmentType.image ||
attachment.type == AttachmentType.giphy) {
final imageUrl = attachment.imageUrl ??
attachment.assetUrl ??
attachment.thumbUrl;
@@ -359,7 +361,7 @@ class _FullScreenMediaDesktopState extends State<FullScreenMediaDesktop> {
),
),
);
} else if (attachment.type == 'video') {
} else if (attachment.type == AttachmentType.video) {
final package = videoPackages[attachment.id]!;
package.player.open(
Playlist(