Indicate an item is a video

This commit is contained in:
Ming Ming 2021-06-22 13:23:28 +08:00
parent 2e9bc412f5
commit 4079ba39f2

View file

@ -64,32 +64,47 @@ 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: {
"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,
),
child: Stack(
children: [
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.image_not_supported,
size: 64,
color: Colors.white.withOpacity(.8),
),
),
);
},
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
),
),
Container(
// arbitrary size here
constraints: BoxConstraints.tight(const Size(128, 128)),
alignment: AlignmentDirectional.topEnd,
padding: const EdgeInsets.all(8),
child: const Icon(
Icons.play_circle_outlined,
size: 24,
color: Colors.white,
),
),
],
),
);
}