builder method

PhotoViewGalleryPageOptions? builder(
  1. BuildContext context,
  2. int index
)

Implementation

PhotoViewGalleryPageOptions? builder (BuildContext context, int index)
{
  if (index < widget.files.length)
  {
    String file = widget.files[index];
    if (file.trim().startsWith("data:"))
    {
      UriData uri = UriData.parse(file);
      file = uri.contentText;
    }
    return PhotoViewGalleryPageOptions(imageProvider: MemoryImage(Base64Codec().decode(file)), initialScale: 1.5);
  }
  return null;
}