1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00

Photo search: Add image, download button semantics (#989)

Adds the Unsplash photo description, if available, as the image
semantics label in the photo detail view.

Adds a 'download' tooltip to the download IconButton, which also sets
the semantics label for screen readers.
This commit is contained in:
Chris Bracken
2022-01-13 18:25:10 -08:00
committed by GitHub
parent 8da15e2059
commit 6f78a89a61

View File

@@ -78,6 +78,7 @@ class _PhotoDetailsState extends State<PhotoDetails> {
), ),
child: FadeInImage.memoryNetwork( child: FadeInImage.memoryNetwork(
placeholder: kTransparentImage, placeholder: kTransparentImage,
imageSemanticLabel: widget.photo.description,
image: widget.photo.urls!.small!, image: widget.photo.urls!.small!,
), ),
), ),
@@ -94,6 +95,7 @@ class _PhotoDetailsState extends State<PhotoDetails> {
_buildPhotoAttribution(context), _buildPhotoAttribution(context),
const SizedBox(width: 8), const SizedBox(width: 8),
IconButton( IconButton(
tooltip: 'Download',
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
icon: const Icon(Icons.cloud_download), icon: const Icon(Icons.cloud_download),
onPressed: () => widget.onPhotoSave(widget.photo), onPressed: () => widget.onPhotoSave(widget.photo),