videoPlaceholder method
dynamic
videoPlaceholder( - dynamic context,
- dynamic attachment,
- dynamic mediaState,
- dynamic ref,
)
Implementation
Widget videoPlaceholder(
BuildContext context,
Attachment attachment,
AttachmentMediaState mediaState,
WidgetRef ref,
) {
final msgContent = attachment.msgContent();
return InkWell(
onTap: () async {
if (mediaState.mediaFile != null) {
showAdaptiveDialog(
context: context,
barrierDismissible: false,
useRootNavigator: false,
builder: (context) => VideoDialog(
title: msgContent.body(),
videoFile: mediaState.mediaFile!,
),
);
} else {
ref
.read(attachmentMediaStateProvider(attachment).notifier)
.downloadMedia();
}
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.download,
size: 24,
),
const SizedBox(height: 8),
Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(8),
),
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.video_file,
size: 14,
),
const SizedBox(width: 5),
Text(
formatBytes(msgContent.size()!.truncate()),
style: Theme.of(context).textTheme.labelSmall,
textScaler: const TextScaler.linear(0.7),
),
],
),
),
],
),
);
}