buildMediaItem method

Widget buildMediaItem(
  1. MediaItem item
)

Wraps the MediaItem and adds interaction functionality for tapping and long pressing.

Implementation

Widget buildMediaItem(MediaItem item) {
  return Material(
    color: Colors.transparent,
    child: InkWell(
      onTap: () async {
        MediaSource mediaSource = item.getMediaSource(appModel: appModel);

        await appModel.openMedia(
          context: context,
          ref: ref,
          mediaSource: mediaSource,
          item: item,
        );
      },
      onLongPress: () async {
        await showDialog(
          context: context,
          builder: (context) => MediaItemDialogPage(
            item: item,
            isHistory: isHistory,
            extraActions: extraActions,
          ),
        );
        if (isHistory) {
          setState(() {});
        }
      },
      child: buildMediaItemContent(item),
    ),
  );
}