The Display metadata view tells Flowty how to show an NFT. Display provides specifications for NFT cards, asset detail pages, and activity pages.
NFT cards make use of name and thumbnail from the Display view:
pub resource NFT: NonFungibleToken.INFT, MetadataViews.Resolver {
// ...
pub fun resolveView(_ view: Type): AnyStruct? {
switch view {
case Type<MetadataViews.Display>():
return MetadataViews.Display(
name: "Avataaars #".concat(self.id.toString()),
description: "This is a procedurally generated avatar! You can learn more about it here: https://avataaars.com/",
thumbnail: MetadataViews.HTTPFile(
url: Avataaars.imageBaseURL.concat(self.id.toString())
)
)
// truncated other metadata views...
}
return nil
}
// ...
}
/// Display is a basic view that includes the name, description and
/// thumbnail for an object. Most objects should implement this view.
///
pub struct Display {
/// The name of the object.
///
/// This field will be displayed in lists and therefore should
/// be short an concise.
///
pub let name: String
/// A written description of the object.
///
/// This field will be displayed in a detailed view of the object,
/// so can be more verbose (e.g. a paragraph instead of a single line).
///
pub let description: String
/// A small thumbnail representation of the object.
///
/// This field should be a web-friendly file (i.e JPEG, PNG)
/// that can be displayed in lists, link previews, etc.
///
pub let thumbnail: AnyStruct{File}
// init truncated
}