Merge branch 'develop' into chore/bump-lottie-to-v2

This commit is contained in:
Sahil Kumar
2022-12-06 14:26:25 +05:30
committed by GitHub
11 changed files with 67 additions and 44 deletions
@@ -58,7 +58,7 @@ void dispose() {
} }
``` ```
The `StreamChannelListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of channels has changed. The `StreamChannelListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of channels has changed.
You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest channels. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest channels.
```dart ```dart
@@ -46,7 +46,7 @@ void dispose() {
} }
``` ```
The `StreamMemberListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of members has changed. The `StreamMemberListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of members has changed.
You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest members. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest members.
```dart ```dart
@@ -46,7 +46,7 @@ void dispose() {
} }
``` ```
The `StreamMessageSearchListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of responses has changed. The `StreamMessageSearchListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of responses has changed.
You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest responses. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest responses.
```dart ```dart
@@ -46,7 +46,7 @@ void dispose() {
} }
``` ```
The `StreamUserListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of users has changed. The `StreamUserListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of users has changed.
You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest users. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest users.
```dart ```dart
@@ -12,9 +12,9 @@ This guide demonstrates three alternative ways for you to initialize Stream Chat
Before investigating potential solutions, lets first take a look at the relevant Stream Chat widgets and classes. Before investigating potential solutions, lets first take a look at the relevant Stream Chat widgets and classes.
Most of the Stream Chat Flutter UI widgets rely on having a [StreamChat](https://getstream.io/chat/docs/sdk/flutter/stream_chat_flutter/stream_chat_and_theming/) ancestor in the widget tree. Most of the Stream Chat Flutter UI widgets rely on having a [StreamChat](../../customization/stream_chat_and_theming/) ancestor in the widget tree.
The **StreamChat** widget is an [InheritedWidget](https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html) that exposes the **StreamChatClient** through **BuildContext**. The **StreamChat** widget is an [InheritedWidget](https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html) that exposes the **StreamChatClient** through **BuildContext**.
This widget also initializes the [StreamChatCore](../stream_chat_flutter_core/stream_chat_core.mdx) widget and the **StreamChatTheme**. This widget also initializes the [StreamChatCore](../../stream_chat_flutter_core/stream_chat_core.mdx) widget and the **StreamChatTheme**.
**StreamChatCore** is a **StatefulWidget** used to react to life cycle changes and system updates. **StreamChatCore** is a **StatefulWidget** used to react to life cycle changes and system updates.
When the app goes into the background, the WebSocket connection is closed. When the app goes into the background, the WebSocket connection is closed.
@@ -58,7 +58,7 @@ void dispose() {
} }
``` ```
The `StreamChannelListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of channels has changed. The `StreamChannelListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of channels has changed.
You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest channels. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest channels.
```dart ```dart
@@ -46,7 +46,7 @@ void dispose() {
} }
``` ```
The `StreamMessageSearchListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of responses has changed. The `StreamMessageSearchListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of responses has changed.
You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest responses. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest responses.
```dart ```dart
@@ -46,7 +46,7 @@ void dispose() {
} }
``` ```
The `StreamUserListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of users has changed. The `StreamUserListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of users has changed.
You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest users. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest users.
```dart ```dart
@@ -4,6 +4,10 @@
- Updated `lottie` dependency to `^2.0.0` - Updated `lottie` dependency to `^2.0.0`
🐞 Fixed
- [[#1379]](https://github.com/GetStream/stream-chat-flutter/issues/1379) Fixed "Issues with photo attachments on web", where the cached image attachment would not render while uploading.
- Fix render overflow issue with `MessageSearchListTileTitle`. It now uses `Text.rich` instead of `Row`. Better default behaviour and allows `TextOverflow`.
## 5.1.0 ## 5.1.0
🐞 Fixed 🐞 Fixed
@@ -56,22 +56,33 @@ class StreamImageAttachment extends StreamAttachmentWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return source.when( return source.when(
local: () { local: () {
if (attachment.localUri == null || attachment.file?.bytes == null) { if (attachment.file?.bytes != null) {
return AttachmentError(constraints: constraints); return _buildImageAttachment(
} context,
return _buildImageAttachment( Image.memory(
context, attachment.file!.bytes!,
Image.memory( height: constraints?.maxHeight,
attachment.file!.bytes!, width: constraints?.maxWidth,
height: constraints?.maxHeight, fit: BoxFit.cover,
width: constraints?.maxWidth, errorBuilder: _imageErrorBuilder,
fit: BoxFit.cover,
errorBuilder: (context, _, __) => Image.asset(
'images/placeholder.png',
package: 'stream_chat_flutter',
), ),
), );
); } else if (attachment.localUri != null) {
return _buildImageAttachment(
context,
Image.asset(
attachment.localUri!.path,
height: constraints?.maxHeight,
width: constraints?.maxWidth,
fit: BoxFit.cover,
errorBuilder: _imageErrorBuilder,
),
);
} else {
return AttachmentError(
constraints: constraints,
);
}
}, },
network: () { network: () {
var imageUrl = var imageUrl =
@@ -116,6 +127,12 @@ class StreamImageAttachment extends StreamAttachmentWidget {
); );
} }
Widget _imageErrorBuilder(BuildContext _, Object __, StackTrace? ___) =>
Image.asset(
'images/placeholder.png',
package: 'stream_chat_flutter',
);
Widget _buildImageAttachment(BuildContext context, Widget imageWidget) { Widget _buildImageAttachment(BuildContext context, Widget imageWidget) {
return Container( return Container(
constraints: constraints, constraints: constraints,
@@ -122,7 +122,8 @@ class StreamMessageSearchListTile extends StatelessWidget {
final title = this.title ?? final title = this.title ??
MessageSearchListTileTitle( MessageSearchListTileTitle(
messageResponse: messageResponse, messageResponse: messageResponse,
textStyle: channelPreviewTheme.titleStyle, textStyle: channelPreviewTheme.titleStyle
?.copyWith(overflow: TextOverflow.ellipsis),
); );
final subtitle = this.subtitle ?? final subtitle = this.subtitle ??
@@ -177,27 +178,28 @@ class MessageSearchListTileTitle extends StatelessWidget {
final channel = messageResponse.channel; final channel = messageResponse.channel;
final channelName = channel?.extraData['name']; final channelName = channel?.extraData['name'];
return Row( return Text.rich(
children: [ TextSpan(
Text( children: [
user.id == StreamChat.of(context).currentUser?.id TextSpan(
? context.translations.youText text: user.id == StreamChat.of(context).currentUser?.id
: user.name, ? context.translations.youText
style: textStyle, : user.name,
), ),
if (channelName != null) ...[ if (channelName != null) ...[
Text( TextSpan(
' ${context.translations.inText} ', text: ' ${context.translations.inText} ',
style: textStyle?.copyWith( style: textStyle?.copyWith(
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
),
), ),
), TextSpan(
Text( text: channelName as String,
channelName as String, ),
style: textStyle, ],
),
], ],
], ),
style: textStyle,
); );
} }
} }