Skip to content

Commit 256c0ce

Browse files
authored
docs(repo): add migration guide for customAttachmentBuilder removal + restructuring (#1856)
* doc(repo): add migration guide for customAttachmentBuilder removal * doc(repo): restructure UI documentation
1 parent 7073571 commit 256c0ce

12 files changed

+91
-34
lines changed

docusaurus/docs/Flutter/02-stream_chat_flutter/03-custom_widgets/01-customize_message_widget.mdx

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,28 +137,46 @@ StreamMessageWidget(
137137

138138
### Building attachments
139139

140-
The `customAttachmentBuilders` property allows you to build any kind of attachment (inbuilt or custom)
140+
The `attachmentBuilders` property allows you to build any kind of attachment (inbuilt or custom)
141141
in your own way. While a separate guide is written for this, it is included here because of relevance.
142142

143143
```dart
144+
class LocationAttachmentBuilder extends StreamAttachmentWidgetBuilder {
145+
@override
146+
bool canHandle(
147+
Message message,
148+
Map<String, List<Attachment>> attachments,
149+
) {
150+
final imageAttachments = attachments['location'];
151+
return imageAttachments != null && imageAttachments.length == 1;
152+
}
153+
154+
@override
155+
Widget build(
156+
BuildContext context,
157+
Message message,
158+
Map<String, List<Attachment>> attachments,
159+
) {
160+
final attachmentWidget = Image.network(
161+
_buildMapAttachment(
162+
attachments[0].extraData['latitude'],
163+
attachments[0].extraData['longitude'],
164+
),
165+
);
166+
167+
return WrapAttachmentWidget(
168+
attachmentWidget: attachmentWidget,
169+
attachmentShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
170+
);
171+
}
172+
}
173+
144174
StreamMessageListView(
145175
messageBuilder: (context, details, messages, defaultMessage) {
146176
return defaultMessage.copyWith(
147-
customAttachmentBuilders: {
148-
'location': (context, message, attachments) {
149-
final attachmentWidget = Image.network(
150-
_buildMapAttachment(
151-
attachments[0].extraData['latitude'],
152-
attachments[0].extraData['longitude'],
153-
),
154-
);
155-
156-
return WrapAttachmentWidget(
157-
attachmentWidget: attachmentWidget,
158-
attachmentShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
159-
);
160-
}
161-
},
177+
attachmentBuilders: const [
178+
LocationAttachmentBuilder(),
179+
],
162180
);
163181
},
164182
),

docusaurus/docs/Flutter/04-stream_chat_flutter_core/lazy_load_scroll_view.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: lazy_load_scroll_view
3-
sidebar_position: 8
4-
title: LazyLoadScrollView
3+
sidebar_position: 11
4+
title: Paging
55
---
66

77
A Widget For Building A Paginated List

docusaurus/docs/Flutter/04-stream_chat_flutter_core/message_list_core.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: message_list_core
3-
sidebar_position: 5
4-
title: MessageListCore
3+
sidebar_position: 6
4+
title: Message List
55
---
66

77
A Widget For Building A List Of Messages

docusaurus/docs/Flutter/04-stream_chat_flutter_core/paged_value_listenable_builder.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: paged_value_listenable_builder
3-
sidebar_position: 9
4-
title: PagedValueListenableBuilder
3+
sidebar_position: 12
4+
title: Synchronize Paging Data
55
---
66

77
A Widget Whose Content Stays Synced With A `ValueNotifier` Of Type `PagedValue`.

docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_channel_list_controller.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: stream_channel_list_controller
33
sidebar_position: 4
4-
title: StreamChannelListController
4+
title: Channel List
55
---
66

77
A Widget For Controlling A List Of Channels

docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_channel_list_event_handler.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: stream_channel_list_event_handler
3-
sidebar_position: 10
4-
title: StreamChannelListEventHandler
3+
sidebar_position: 5
4+
title: Channel List Events
55
---
66

77
A Class To Customize The Event Handler For The StreamChannelListController.

docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_chat_core.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: stream_chat_core
33
sidebar_position: 3
4-
title: StreamChatCore
4+
title: Chat Client
55
---
66

77
`StreamChatCore` is a version of `StreamChat` found in `stream_chat_flutter` that is decoupled from

docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_member_list_controller.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: stream_member_list_controller
3-
sidebar_position: 5
4-
title: StreamMemberListController
3+
sidebar_position: 9
4+
title: Member List
55
---
66

77
A widget for controlling a list of members.

docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_message_input_controller.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: stream_message_input_controller
3-
sidebar_position: 4
4-
title: StreamMessageInputController
3+
sidebar_position: 7
4+
title: Message Composer
55
---
66

77
A Widget For Controlling A Message Input

docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_message_search_list_controller.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: stream_message_search_list_controller
3-
sidebar_position: 6
4-
title: StreamMessageSearchListController
3+
sidebar_position: 8
4+
title: Message Search
55
---
66

77
A Widget For Controlling A List Of Searched Messages

0 commit comments

Comments
 (0)