feat: added new docs
This commit is contained in:
@@ -45,4 +45,52 @@ class ChannelPage extends StatelessWidget {
|
|||||||
### Building A Custom Attachment
|
### Building A Custom Attachment
|
||||||
|
|
||||||
When a custom attachment type (location, audio, etc.) is sent, the MessageWidget also needs to know
|
When a custom attachment type (location, audio, etc.) is sent, the MessageWidget also needs to know
|
||||||
how to build it.
|
how to build it. For this purpose, we can use the `customAttachmentBuilders` parameter.
|
||||||
|
|
||||||
|
As an example, if a message has a attachment type 'location', we do:
|
||||||
|
|
||||||
|
```dart
|
||||||
|
MessageWidget(
|
||||||
|
//...
|
||||||
|
customAttachmentBuilders: {
|
||||||
|
'location': (context, message, attachments) {
|
||||||
|
var attachmentWidget = Image.network(
|
||||||
|
_buildMapAttachment(
|
||||||
|
attachments[0].extraData['latitude'],
|
||||||
|
attachments[0].extraData['longitude'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return wrapAttachmentWidget(context, attachmentWidget, null, true, BorderRadius.circular(8.0));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also override the builder for existing attachment types like `image` and `video`.
|
||||||
|
|
||||||
|
### Show User Avatar For Messages
|
||||||
|
|
||||||
|
You can decide to show, hide, or remove user avatars of the sender of the message. To do this, set
|
||||||
|
the `showUserAvatar` property like this:
|
||||||
|
|
||||||
|
```dart
|
||||||
|
MessageWidget(
|
||||||
|
//...
|
||||||
|
showUserAvatar = DisplayWidget.show,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Reverse the message
|
||||||
|
|
||||||
|
In most cases, `MessageWidget` needs to be a different orientation depending upon if the sender is the
|
||||||
|
user or someone else.
|
||||||
|
|
||||||
|
For this, we use the `reverse` parameter to change the orientation of the message:
|
||||||
|
|
||||||
|
```dart
|
||||||
|
MessageWidget(
|
||||||
|
//...
|
||||||
|
reverse = true,
|
||||||
|
)
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user