Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hot-fix: video thumbnail is resize when open #1023

Merged
merged 1 commit into from
Nov 22, 2023
Merged
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
31 changes: 18 additions & 13 deletions lib/widgets/mxc_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ class _MxcImageState extends State<MxcImage>
child: _ImageWidget(
filePath: filePath,
data: data,
width: widget.width ?? 256,
height: widget.height ?? 256,
width: widget.width,
height: widget.height,
fit: widget.fit,
needResize: needResize,
imageErrorWidgetBuilder: (context, __, ___) {
Expand All @@ -292,17 +292,17 @@ class _MxcImageState extends State<MxcImage>
class _ImageWidget extends StatelessWidget {
final String? filePath;
final Uint8List? data;
final double width;
final double height;
final double? width;
final double? height;
final bool needResize;
final BoxFit? fit;
final ImageErrorWidgetBuilder imageErrorWidgetBuilder;

const _ImageWidget({
this.filePath,
this.data,
required this.width,
required this.height,
this.width,
this.height,
required this.needResize,
this.fit,
required this.imageErrorWidgetBuilder,
Expand All @@ -316,9 +316,12 @@ class _ImageWidget extends StatelessWidget {
File(filePath!),
width: width,
height: height,
cacheWidth: needResize ? (width * devicePixelRatio).toInt() : null,
cacheHeight:
needResize ? (height * devicePixelRatio).toInt() : null,
cacheWidth: (width != null && needResize)
? (width! * devicePixelRatio).toInt()
: null,
cacheHeight: (height != null && needResize)
? (height! * devicePixelRatio).toInt()
: null,
fit: fit,
filterQuality: FilterQuality.medium,
errorBuilder: imageErrorWidgetBuilder,
Expand All @@ -328,10 +331,12 @@ class _ImageWidget extends StatelessWidget {
data!,
width: width,
height: height,
cacheWidth:
needResize ? (width * devicePixelRatio).toInt() : null,
cacheHeight:
needResize ? (height * devicePixelRatio).toInt() : null,
cacheWidth: (width != null && needResize)
? (width! * devicePixelRatio).toInt()
: null,
cacheHeight: (height != null && needResize)
? (height! * devicePixelRatio).toInt()
: null,
fit: fit,
filterQuality: FilterQuality.medium,
errorBuilder: imageErrorWidgetBuilder,
Expand Down