Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/stream_chat_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## Upcoming

🐞 Fixed

- Fixed StreamGallery not respecting the safe area for fullscreen
media. [[#2454]](https://github.com/GetStream/stream-chat-flutter/issues/2454)

## 9.20.0

✅ Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,56 +281,53 @@ class _FullScreenMediaState extends State<StreamFullScreenMedia> {
return ValueListenableBuilder(
valueListenable: _isDisplayingDetail,
builder: (context, isDisplayingDetail, child) {
final padding = MediaQuery.paddingOf(context);

return AnimatedContainer(
duration: kThemeChangeDuration,
color: isDisplayingDetail
? StreamChannelHeaderTheme.of(context).color
: Colors.black,
child: Builder(
builder: (context) {
if (attachment.type == AttachmentType.image ||
attachment.type == AttachmentType.giphy) {
return PhotoView.customChild(
maxScale: PhotoViewComputedScale.covered,
minScale: PhotoViewComputedScale.contained,
backgroundDecoration: const BoxDecoration(
color: Colors.transparent,
),
child: StreamMediaAttachmentThumbnail(
media: attachment,
width: double.infinity,
height: double.infinity,
),
);
} else if (attachment.type == AttachmentType.video) {
final controller = videoPackages[attachment.id]!;
if (!controller.initialized) {
return const Center(
child: CircularProgressIndicator.adaptive(),
);
}

final mediaQuery = MediaQuery.of(context);
final bottomPadding = mediaQuery.padding.bottom;

return AnimatedPadding(
duration: kThemeChangeDuration,
padding: EdgeInsets.symmetric(
vertical: isDisplayingDetail
? kToolbarHeight + bottomPadding
: 0,
),
child: Chewie(
controller: controller.chewieController!,
),
);
}

return const Empty();
},
color: switch (isDisplayingDetail) {
true => StreamChannelHeaderTheme.of(context).color,
false => Colors.black,
},
padding: EdgeInsetsDirectional.only(
top: padding.top + kToolbarHeight,
bottom: padding.bottom + kToolbarHeight,
),
child: child,
);
},
child: Builder(
builder: (context) {
if (attachment.type == AttachmentType.image ||
attachment.type == AttachmentType.giphy) {
return PhotoView.customChild(
maxScale: PhotoViewComputedScale.covered,
minScale: PhotoViewComputedScale.contained,
backgroundDecoration: const BoxDecoration(
color: Colors.transparent,
),
child: StreamMediaAttachmentThumbnail(
media: attachment,
width: double.infinity,
height: double.infinity,
),
);
} else if (attachment.type == AttachmentType.video) {
final controller = videoPackages[attachment.id]!;
if (!controller.initialized) {
return const Center(
child: CircularProgressIndicator.adaptive(),
);
}

return Chewie(
controller: controller.chewieController!,
);
}

return const Empty();
},
),
);
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,73 +317,70 @@ class _FullScreenMediaDesktopState extends State<FullScreenMediaDesktop> {
return ValueListenableBuilder(
valueListenable: _isDisplayingDetail,
builder: (context, isDisplayingDetail, child) {
final padding = MediaQuery.paddingOf(context);

return AnimatedContainer(
duration: kThemeChangeDuration,
color: isDisplayingDetail
? StreamChannelHeaderTheme.of(context).color
: Colors.black,
child: Builder(
builder: (context) {
if (attachment.type == AttachmentType.image ||
attachment.type == AttachmentType.giphy) {
return PhotoView.customChild(
maxScale: PhotoViewComputedScale.covered,
minScale: PhotoViewComputedScale.contained,
backgroundDecoration: const BoxDecoration(
color: Colors.transparent,
),
child: StreamMediaAttachmentThumbnail(
media: attachment,
width: double.infinity,
height: double.infinity,
),
);
} else if (attachment.type == AttachmentType.video) {
final package = videoPackages[attachment.id]!;
if (package.attachment.assetUrl != null) {
package.player.open(
Playlist(
[
Media(package.attachment.assetUrl!),
],
),
play: widget.autoplayVideos,
);
}

final mediaQuery = MediaQuery.of(context);
final bottomPadding = mediaQuery.padding.bottom;

return AnimatedPadding(
duration: kThemeChangeDuration,
padding: EdgeInsets.symmetric(
vertical: isDisplayingDetail
? kToolbarHeight + bottomPadding
: 0,
),
child: ContextMenuRegion(
contextMenuBuilder: (_, anchor) {
return ContextMenu(
anchor: anchor,
menuItems: [
DownloadMenuItem(
attachment: attachment,
),
],
);
},
child: Video(
controller: package.controller,
),
),
);
}

return const Empty();
},
color: switch (isDisplayingDetail) {
true => StreamChannelHeaderTheme.of(context).color,
false => Colors.black,
},
padding: EdgeInsetsDirectional.only(
top: padding.top + kToolbarHeight,
bottom: padding.bottom + kToolbarHeight,
),
child: child,
);
},
child: Builder(
builder: (context) {
if (attachment.type == AttachmentType.image ||
attachment.type == AttachmentType.giphy) {
return PhotoView.customChild(
maxScale: PhotoViewComputedScale.covered,
minScale: PhotoViewComputedScale.contained,
backgroundDecoration: const BoxDecoration(
color: Colors.transparent,
),
child: StreamMediaAttachmentThumbnail(
media: attachment,
width: double.infinity,
height: double.infinity,
),
);
} else if (attachment.type == AttachmentType.video) {
final package = videoPackages[attachment.id]!;
if (package.attachment.assetUrl != null) {
package.player.open(
Playlist(
[
Media(package.attachment.assetUrl!),
],
),
play: widget.autoplayVideos,
);
}

return ContextMenuRegion(
contextMenuBuilder: (_, anchor) {
return ContextMenu(
anchor: anchor,
menuItems: [
DownloadMenuItem(
attachment: attachment,
),
],
);
},
child: Video(
controller: package.controller,
),
);
}

return const Empty();
},
),
);
},
),
Expand Down
2 changes: 0 additions & 2 deletions sample_app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@
"${BUILT_PRODUCTS_DIR}/sqlite3_flutter_libs/sqlite3_flutter_libs.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher_ios/url_launcher_ios.framework",
"${BUILT_PRODUCTS_DIR}/video_player_avfoundation/video_player_avfoundation.framework",
"${BUILT_PRODUCTS_DIR}/volume_controller/volume_controller.framework",
"${BUILT_PRODUCTS_DIR}/wakelock_plus/wakelock_plus.framework",
);
name = "[CP] Embed Pods Frameworks";
Expand Down Expand Up @@ -348,7 +347,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqlite3_flutter_libs.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player_avfoundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/volume_controller.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/wakelock_plus.framework",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down