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,29 +17,33 @@ class PhotoListImage extends StatelessWidget {
return FittedBox(
clipBehavior: Clip.hardEdge,
fit: BoxFit.cover,
child: CachedNetworkImage(
imageUrl: previewUrl,
httpHeaders: {
"Authorization": Api.getAuthorizationHeaderValue(account),
},
fadeInDuration: const Duration(),
filterQuality: FilterQuality.high,
errorWidget: (context, url, error) {
// where's the preview???
return Container(
color: AppTheme.getListItemBackgroundColor(context),
width: 128,
height: 128,
child: Center(
child: Icon(
Icons.image_not_supported,
size: 56,
color: Colors.white.withOpacity(.8),
child: Container(
// arbitrary size here
constraints: BoxConstraints.tight(const Size(128, 128)),
color: AppTheme.getListItemBackgroundColor(context),
child: CachedNetworkImage(
imageUrl: previewUrl,
httpHeaders: {
"Authorization": Api.getAuthorizationHeaderValue(account),
},
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(
child: Center(
child: Icon(
Icons.image_not_supported,
size: 64,
color: Colors.white.withOpacity(.8),
),
),
),
);
},
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
);
},
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
),
),
);
}
@ -60,30 +64,32 @@ class PhotoListVideo extends StatelessWidget {
return FittedBox(
clipBehavior: Clip.hardEdge,
fit: BoxFit.cover,
child: CachedNetworkImage(
imageUrl: previewUrl,
httpHeaders: {
"Authorization": Api.getAuthorizationHeaderValue(account),
},
fadeInDuration: const Duration(),
filterQuality: FilterQuality.high,
errorWidget: (context, url, error) {
// 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,
color: Colors.white.withOpacity(.8),
child: Container(
// arbitrary size here
constraints: BoxConstraints.tight(const Size(128, 128)),
color: AppTheme.getListItemBackgroundColor(context),
child: CachedNetworkImage(
imageUrl: previewUrl,
httpHeaders: {
"Authorization": Api.getAuthorizationHeaderValue(account),
},
fadeInDuration: const Duration(),
filterQuality: FilterQuality.high,
errorWidget: (context, url, error) {
// no preview for this video. Normal since video preview is disabled
// by default
return Container(
child: Center(
child: Icon(
Icons.videocam,
size: 64,
color: Colors.white.withOpacity(.8),
),
),
),
);
},
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
);
},
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
),
),
);
}