Tweak layout of photo items

This commit is contained in:
Ming Ming 2021-06-22 12:52:50 +08:00
parent a809136474
commit 2e9bc412f5

View file

@ -17,6 +17,10 @@ class PhotoListImage extends StatelessWidget {
return FittedBox(
clipBehavior: Clip.hardEdge,
fit: BoxFit.cover,
child: Container(
// arbitrary size here
constraints: BoxConstraints.tight(const Size(128, 128)),
color: AppTheme.getListItemBackgroundColor(context),
child: CachedNetworkImage(
imageUrl: previewUrl,
httpHeaders: {
@ -25,15 +29,14 @@ class PhotoListImage extends StatelessWidget {
fadeInDuration: const Duration(),
filterQuality: FilterQuality.high,
errorWidget: (context, url, error) {
// won't work on web because the image is downloaded by the cache
// manager instead
// where's the preview???
return Container(
color: AppTheme.getListItemBackgroundColor(context),
width: 128,
height: 128,
child: Center(
child: Icon(
Icons.image_not_supported,
size: 56,
size: 64,
color: Colors.white.withOpacity(.8),
),
),
@ -41,6 +44,7 @@ class PhotoListImage extends StatelessWidget {
},
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
),
),
);
}
@ -60,6 +64,10 @@ class PhotoListVideo extends StatelessWidget {
return FittedBox(
clipBehavior: Clip.hardEdge,
fit: BoxFit.cover,
child: Container(
// arbitrary size here
constraints: BoxConstraints.tight(const Size(128, 128)),
color: AppTheme.getListItemBackgroundColor(context),
child: CachedNetworkImage(
imageUrl: previewUrl,
httpHeaders: {
@ -71,13 +79,10 @@ class PhotoListVideo extends StatelessWidget {
// no preview for this video. Normal since video preview is disabled
// by default
return Container(
color: AppTheme.getListItemBackgroundColor(context),
width: 128,
height: 128,
child: Center(
child: Icon(
Icons.videocam,
size: 56,
size: 64,
color: Colors.white.withOpacity(.8),
),
),
@ -85,6 +90,7 @@ class PhotoListVideo extends StatelessWidget {
},
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
),
),
);
}