imageFileView method
dynamic
imageFileView( - dynamic context,
- dynamic ref,
- File mediaFile
)
Implementation
Widget imageFileView(BuildContext context, WidgetRef ref, File mediaFile) {
return Image.file(
mediaFile,
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
if (wasSynchronouslyLoaded) {
return child;
}
return AnimatedOpacity(
opacity: frame == null ? 0 : 1,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
child: child,
);
},
errorBuilder:
(context, error, stack) => ActerInlineErrorButton.icon(
icon: Icon(PhosphorIcons.imageBroken()),
error: error,
stack: stack,
textBuilder:
(error, code) => L10n.of(context).couldNotLoadImage(error),
onRetryTap: () {
final ChatMessageInfo messageInfo = (
messageId: message.remoteId ?? message.id,
roomId: roomId,
);
ref.invalidate(mediaChatStateProvider(messageInfo));
},
),
fit: BoxFit.cover,
);
}