imagePlaceholder method

dynamic imagePlaceholder(
  1. dynamic context,
  2. String roomId,
  3. dynamic ref
)

Implementation

Widget imagePlaceholder(BuildContext context, String roomId, WidgetRef ref) {
  return InkWell(
    onTap: () async {
      final notifier = ref.read(
        mediaChatStateProvider((
          messageId: message.remoteId ?? message.id,
          roomId: roomId,
        )).notifier,
      );
      await notifier.downloadMedia();
    },
    child: SizedBox(
      width: 200,
      height: 150,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          const Icon(Icons.download, size: 28),
          const SizedBox(height: 8),
          Container(
            decoration: BoxDecoration(
              color: Theme.of(context).colorScheme.surface,
              borderRadius: BorderRadius.circular(8),
            ),
            padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
            child: Row(
              mainAxisSize: MainAxisSize.min,
              children: [
                const Icon(Icons.image, size: 18),
                const SizedBox(width: 5),
                Text(
                  formatBytes(message.size.truncate()),
                  style: Theme.of(context).textTheme.bodySmall,
                ),
              ],
            ),
          ),
        ],
      ),
    ),
  );
}