diff --git a/lib/shared/image_preview.dart b/lib/shared/image_preview.dart index ddffbd787..fed53580e 100644 --- a/lib/shared/image_preview.dart +++ b/lib/shared/image_preview.dart @@ -22,6 +22,7 @@ class ImagePreview extends StatefulWidget { final bool isGallery; final bool isExpandable; final bool showFullHeightImages; + final bool edgeToEdgeImages; final int? postId; final void Function()? navigateToPost; final bool? isComment; @@ -39,6 +40,7 @@ class ImagePreview extends StatefulWidget { this.isGallery = false, this.isExpandable = true, this.showFullHeightImages = false, + this.edgeToEdgeImages = false, this.postId, this.navigateToPost, this.isComment, @@ -93,7 +95,7 @@ class _ImagePreviewState extends State { return Container( clipBehavior: Clip.hardEdge, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12)), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(widget.edgeToEdgeImages ? 0 : 12)), child: Stack( children: [ // This is used for link posts where the preview comes from Lemmy @@ -108,7 +110,7 @@ class _ImagePreviewState extends State { maxWidth: MediaQuery.of(context).size.width * 0.60, ) : BoxConstraints( - maxWidth: widget.maxWidth ?? MediaQuery.of(context).size.width - 24, + maxWidth: widget.maxWidth ?? MediaQuery.of(context).size.width - (widget.edgeToEdgeImages ? 0 : 24), ), alignment: widget.isComment == true ? Alignment.topCenter : Alignment.center, widget.url!, diff --git a/lib/shared/link_information.dart b/lib/shared/link_information.dart index 805d530ed..422006a28 100644 --- a/lib/shared/link_information.dart +++ b/lib/shared/link_information.dart @@ -19,6 +19,8 @@ class LinkInformation extends StatefulWidget { /// Type of media (image, link, text, etc.) final MediaType? mediaType; + final bool showEdgeToEdgeImages; + /// Custom callback function for when the link is tapped final Function? onTap; @@ -30,6 +32,7 @@ class LinkInformation extends StatefulWidget { required this.viewMode, this.originURL, this.mediaType, + this.showEdgeToEdgeImages = false, this.onTap, this.onLongPress, }); @@ -75,7 +78,7 @@ class _LinkInformationState extends State { }, child: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), + borderRadius: BorderRadius.circular(widget.showEdgeToEdgeImages ? 0 : 12), color: ElevationOverlay.applySurfaceTint(theme.colorScheme.surface.withValues(alpha: 0.8), theme.colorScheme.surfaceTint, 10), ), padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 8.0), diff --git a/lib/shared/link_preview_card.dart b/lib/shared/link_preview_card.dart index e7c9e7b7b..d43cc58e2 100644 --- a/lib/shared/link_preview_card.dart +++ b/lib/shared/link_preview_card.dart @@ -78,6 +78,7 @@ class LinkPreviewCard extends StatelessWidget { url: mediaURL ?? originURL!, height: showFullHeightImages ? mediaHeight : ViewMode.comfortable.height, width: mediaWidth ?? MediaQuery.of(context).size.width - (edgeToEdgeImages ? 0 : 24), + edgeToEdgeImages: edgeToEdgeImages, isExpandable: false, ), ) @@ -86,6 +87,7 @@ class LinkPreviewCard extends StatelessWidget { url: mediaURL ?? originURL!, height: showFullHeightImages ? mediaHeight : ViewMode.comfortable.height, width: mediaWidth ?? MediaQuery.of(context).size.width - (edgeToEdgeImages ? 0 : 24), + edgeToEdgeImages: edgeToEdgeImages, isExpandable: false, ) ] else if (scrapeMissingPreviews) @@ -129,6 +131,7 @@ class LinkPreviewCard extends StatelessWidget { LinkInformation( viewMode: viewMode, originURL: originURL, + showEdgeToEdgeImages: edgeToEdgeImages, ), Positioned.fill( child: Material( diff --git a/lib/shared/media_view.dart b/lib/shared/media_view.dart index 17442c4b2..878fa9c97 100644 --- a/lib/shared/media_view.dart +++ b/lib/shared/media_view.dart @@ -354,6 +354,7 @@ class _MediaViewState extends State with TickerProviderStateMixin { viewMode: widget.viewMode, mediaType: widget.postViewMedia.media.first.mediaType, originURL: widget.postViewMedia.media.first.originalUrl ?? '', + showEdgeToEdgeImages: widget.edgeToEdgeImages, ), ), ), @@ -371,6 +372,7 @@ class _MediaViewState extends State with TickerProviderStateMixin { originURL: widget.postViewMedia.media.first.originalUrl, mediaType: widget.postViewMedia.media.first.mediaType, onTap: widget.postViewMedia.media.first.mediaType == MediaType.image ? showImage : null, + showEdgeToEdgeImages: widget.edgeToEdgeImages, ); } switch (widget.postViewMedia.media.firstOrNull?.mediaType) { @@ -382,6 +384,7 @@ class _MediaViewState extends State with TickerProviderStateMixin { viewMode: widget.viewMode, mediaType: widget.postViewMedia.media.first.mediaType, originURL: widget.postViewMedia.media.first.originalUrl ?? '', + showEdgeToEdgeImages: widget.edgeToEdgeImages, ); }