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