chatify_file_message 0.0.3
chatify_file_message: ^0.0.3 copied to clipboard
Chatify's file message implementation.
Chatify File Message #
File message provider for Chatify. Defines FileMessage
content and a FileMessageProvider
that renders files and provides a composer action to pick and upload arbitrary files.
Installation #
flutter pub add chatify_file_message
Usage #
Register the provider when initializing Chatify:
import 'package:chatify/chatify.dart';
import 'package:chatify_file_message/chatify_file_message.dart';
await Chatify.init(
currentUser: currentUser,
chatRepo: chatRepo,
messageRepoFactory: (chat) => messageRepoFor(chat),
uploaderFactory: (attachment) => uploaderFor(attachment),
messageProviders: [
FileMessageProvider(),
],
);
The provider adds a composer action labelled “File” that returns MediaComposerResult
with file metadata and bytes. Chatify uploads using your AttachmentUploader
, then calls MessageRepo.add(...)
with the final URL.
API #
FileMessage
extendsMessageContent
with:name
,extension
,size
FileMessageProvider
extendsMediaMessageProvider<FileMessage>
and exposes a composer actionFileMessageWidget
displays a file bubble; tapping downloads/opens the file where supported