From 1849fa0f8982b687ca26110e40ed3fd979eebe5c Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 31 Jul 2022 09:36:20 +0200 Subject: [PATCH] neon: Round file previews in overview --- .../lib/src/apps/files/widgets/browser_view.dart | 1 + .../lib/src/apps/files/widgets/file_preview.dart | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/neon/lib/src/apps/files/widgets/browser_view.dart b/packages/neon/lib/src/apps/files/widgets/browser_view.dart index 3c98ab2d..fbc53852 100644 --- a/packages/neon/lib/src/apps/files/widgets/browser_view.dart +++ b/packages/neon/lib/src/apps/files/widgets/browser_view.dart @@ -303,6 +303,7 @@ class _FilesBrowserViewState extends State { : FilePreview( bloc: widget.filesBloc, details: details, + borderRadius: const BorderRadius.all(Radius.circular(8)), ), ), if (details.isFavorite ?? false) ...[ diff --git a/packages/neon/lib/src/apps/files/widgets/file_preview.dart b/packages/neon/lib/src/apps/files/widgets/file_preview.dart index 52f8750b..f9da8b49 100644 --- a/packages/neon/lib/src/apps/files/widgets/file_preview.dart +++ b/packages/neon/lib/src/apps/files/widgets/file_preview.dart @@ -7,6 +7,7 @@ class FilePreview extends StatelessWidget { this.width = 40, this.height = 40, this.color, + this.borderRadius, super.key, }); @@ -15,6 +16,7 @@ class FilePreview extends StatelessWidget { final int width; final int height; final Color? color; + final BorderRadius? borderRadius; @override Widget build(BuildContext context) { @@ -59,7 +61,19 @@ class FilePreview extends StatelessWidget { children: [ if (previewData != null) ...[ Center( - child: Image.memory(previewData), + child: SizedBox( + width: width.toDouble(), + height: height.toDouble(), + child: DecoratedBox( + decoration: BoxDecoration( + borderRadius: borderRadius, + image: DecorationImage( + image: MemoryImage(previewData), + fit: BoxFit.cover, + ), + ), + ), + ), ), ], if (previewError != null) ...[