imagePlaceholder method
dynamic
imagePlaceholder( - dynamic context,
- String roomId,
- dynamic mediaState,
- dynamic ref,
)
Implementation
Widget imagePlaceholder(
BuildContext context,
String roomId,
MediaChatState mediaState,
WidgetRef ref,
) {
return InkWell(
onTap: () async {
if (mediaState.mediaFile != null) {
showAdaptiveDialog(
context: context,
barrierDismissible: false,
useRootNavigator: false,
builder: (context) => ImageDialog(
title: message.name,
imageFile: mediaState.mediaFile!,
),
);
} else {
await ref
.read(
mediaChatStateProvider(
(messageId: message.remoteId ?? message.id, roomId: roomId),
).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,
),
],
),
),
],
),
),
);
}