🐛 Fix attachment loading

This commit is contained in:
2024-11-13 00:25:02 +08:00
parent 468d1377af
commit b9ad6d4fd0
4 changed files with 39 additions and 4 deletions

View File

@ -100,3 +100,37 @@ class UniversalImage extends StatelessWidget {
return NetworkImage(url);
}
}
class AutoResizeUniversalImage extends StatelessWidget {
final String url;
final double? width, height;
final BoxFit? fit;
final bool noProgressIndicator;
final bool noErrorWidget;
const AutoResizeUniversalImage(
this.url, {
super.key,
this.width,
this.height,
this.fit,
this.noProgressIndicator = false,
this.noErrorWidget = false,
});
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
return UniversalImage(
url,
fit: fit,
width: width,
height: height,
noProgressIndicator: noProgressIndicator,
noErrorWidget: noErrorWidget,
cacheHeight: constraints.maxHeight,
cacheWidth: constraints.maxWidth,
);
});
}
}