Merge pull request #634 from GetStream/hotfix/updateDocs
fix(doc): update `Adding custom attachment guide` with updated code
This commit is contained in:
@@ -146,21 +146,25 @@ Next, we build the Static Maps URL (Add your API key before using the code snipp
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
And then modify the MessageListView and tell it how to build a location attachment:
|
And then modify the `MessageListView` and tell it how to build a location attachment, using the `messageBuilder` property and copying the default message implementation overriding the `customAttachmentBuilders` property:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
MessageListView(
|
MessageListView(
|
||||||
customAttachmentBuilders: {
|
messageBuilder: (context, details, messages, defaultMessage) {
|
||||||
'location': (context, message, attachments) {
|
return defaultMessage.copyWith(
|
||||||
var attachmentWidget = Image.network(
|
customAttachmentBuilders: {
|
||||||
_buildMapAttachment(
|
'location': (context, message, attachments) {
|
||||||
attachments[0].extraData['latitude'],
|
final attachmentWidget = Image.network(
|
||||||
attachments[0].extraData['longitude'],
|
_buildMapAttachment(
|
||||||
),
|
attachments[0].extraData['latitude'],
|
||||||
);
|
attachments[0].extraData['longitude'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return wrapAttachmentWidget(context, attachmentWidget, null, true, BorderRadius.circular(8.0));
|
return wrapAttachmentWidget(context, attachmentWidget, null, true, BorderRadius.circular(8.0));
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user