build method
dynamic
build( - dynamic context,
- dynamic ref
)
Implementation
@override
Widget build(BuildContext context, WidgetRef ref) {
final ChatMessageInfo messageInfo =
(messageId: message.remoteId ?? message.id, roomId: roomId);
final mediaState = ref.watch(mediaChatStateProvider(messageInfo));
return InkWell(
onTap: () async {
final mediaFile =
ref.read(mediaChatStateProvider(messageInfo)).mediaFile;
if (mediaFile != null) {
await openFileShareDialog(
context: context,
file: mediaFile,
);
} else {
final notifier =
ref.read(mediaChatStateProvider(messageInfo).notifier);
await notifier.downloadMedia();
}
},
child: Container(
padding: const EdgeInsets.all(20.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
getFileIcon(context),
const SizedBox(width: 20),
fileInfoUI(context),
const SizedBox(width: 10),
if (mediaState.mediaChatLoadingState.isLoading ||
mediaState.isDownloading)
const CircularProgressIndicator()
else if (mediaState.mediaFile == null)
const Icon(Icons.download),
],
),
),
);
}