filePlaceholder method
dynamic
filePlaceholder( - dynamic context,
- dynamic attachment,
- dynamic mediaState,
- dynamic ref,
)
Implementation
Widget filePlaceholder(
BuildContext context,
Attachment attachment,
AttachmentMediaState mediaState,
WidgetRef ref,
) {
final msgContent = attachment.msgContent();
return InkWell(
onTap: () async {
if (mediaState.mediaFile != null) {
openFileShareDialog(context: context, file: 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.description,
size: 14,
),
const SizedBox(width: 5),
Text(
formatBytes(msgContent.size()!.truncate()),
style: Theme.of(context).textTheme.labelSmall!,
textScaler: const TextScaler.linear(0.7),
),
],
),
),
],
),
);
}