Skip to content

Commit c37fa34

Browse files
committed
Merge remote-tracking branch 'origin/master' into v10.0.0
# Conflicts: # melos.yaml # packages/stream_chat/CHANGELOG.md # packages/stream_chat/example/pubspec.yaml # packages/stream_chat/lib/version.dart # packages/stream_chat/pubspec.yaml # packages/stream_chat_flutter/CHANGELOG.md # packages/stream_chat_flutter/example/pubspec.yaml # packages/stream_chat_flutter/pubspec.yaml # packages/stream_chat_flutter_core/example/pubspec.yaml # packages/stream_chat_flutter_core/pubspec.yaml # packages/stream_chat_localizations/CHANGELOG.md # packages/stream_chat_localizations/example/pubspec.yaml # packages/stream_chat_localizations/pubspec.yaml # packages/stream_chat_persistence/CHANGELOG.md # packages/stream_chat_persistence/example/pubspec.yaml # packages/stream_chat_persistence/pubspec.yaml # sample_app/pubspec.yaml
2 parents bf33673 + ab6554c commit c37fa34

File tree

14 files changed

+114
-17
lines changed

14 files changed

+114
-17
lines changed

packages/stream_chat/CHANGELOG.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@
99
✅ Added
1010

1111
- Added comprehensive location sharing support with static and live location features:
12-
- `Channel.sendStaticLocation()` - Send a static location message to the channel
13-
- `Channel.startLiveLocationSharing()` - Start sharing live location with automatic updates
14-
- `Channel.activeLiveLocations` - Track members active live location shares in the channel
15-
- `Client.activeLiveLocations` - Access current user active live location shares across channels
16-
- Location event listeners for `locationShared`, `locationUpdated`, and `locationExpired` events
12+
- `Channel.sendStaticLocation()` - Send a static location message to the channel
13+
- `Channel.startLiveLocationSharing()` - Start sharing live location with automatic updates
14+
- `Channel.activeLiveLocations` - Track members active live location shares in the channel
15+
- `Client.activeLiveLocations` - Access current user active live location shares across channels
16+
- Location event listeners for `locationShared`, `locationUpdated`, and `locationExpired` events
1717

18-
## Upcoming
18+
## 9.15.0
1919

2020
✅ Added
2121

2222
- Added `avgResponseTime` field to the `User` model to track average response time in seconds.
23+
- Added support for `skipPush` while updating a channel message, which allows you to update a
24+
message without sending a push notification.
2325

2426
🐞 Fixed
2527

packages/stream_chat/lib/src/client/channel.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ class Channel {
749749
/// before actually updating the message.
750750
Future<UpdateMessageResponse> updateMessage(
751751
Message message, {
752+
bool skipPush = false,
752753
bool skipEnrichUrl = false,
753754
}) async {
754755
_checkInitialized();
@@ -794,6 +795,7 @@ class Channel {
794795
final response = await _updateMessageLock.synchronized(
795796
() => _client.updateMessage(
796797
message,
798+
skipPush: skipPush,
797799
skipEnrichUrl: skipEnrichUrl,
798800
),
799801
);

packages/stream_chat/lib/src/client/client.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,10 +1648,12 @@ class StreamChatClient {
16481648
/// Update the given message
16491649
Future<UpdateMessageResponse> updateMessage(
16501650
Message message, {
1651+
bool skipPush = false,
16511652
bool skipEnrichUrl = false,
16521653
}) =>
16531654
_chatApi.message.updateMessage(
16541655
message,
1656+
skipPush: skipPush,
16551657
skipEnrichUrl: skipEnrichUrl,
16561658
);
16571659

packages/stream_chat/lib/src/core/api/message_api.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,14 @@ class MessageApi {
137137
/// Updates the given [message]
138138
Future<UpdateMessageResponse> updateMessage(
139139
Message message, {
140+
bool skipPush = false,
140141
bool skipEnrichUrl = false,
141142
}) async {
142143
final response = await _client.post(
143144
'/messages/${message.id}',
144145
data: {
145146
'message': message,
147+
'skip_push': skipPush,
146148
'skip_enrich_url': skipEnrichUrl,
147149
},
148150
);

packages/stream_chat/test/src/core/api/message_api_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ void main() {
143143
path,
144144
data: {
145145
'message': message,
146+
'skip_push': false,
146147
'skip_enrich_url': false,
147148
},
148149
)).thenAnswer(

packages/stream_chat_flutter/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
- Updated default reaction builders with standard emoji codes. (`❤️`, `👍`, `👎`, `😂`, `😮`)
77
- Added `StreamChatConfiguration.maybeOf()` method for safe context access in async operations.
88

9-
## Upcoming
9+
## 9.15.0
1010

1111
✅ Added
1212

13+
- Added `bottom` and `bottomOpacity` to the `StreamChannelHeader` widget.
1314
- Added `StreamChat.maybeOf()` method for safe context access in async operations.
1415

1516
🐞 Fixed
@@ -48,6 +49,7 @@ For more details, please refer to the [migration guide](../../migrations/v10-mig
4849
🐞 Fixed
4950

5051
- Fixed `StreamMessageInput` tries to expand to full height when used in a unconstrained environment.
52+
- Fixed `StreamCommandAutocompleteOptions` to style the command name with `textHighEmphasis` style.
5153

5254
## 10.0.0-beta.2
5355

packages/stream_chat_flutter/lib/src/autocomplete/stream_autocomplete.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ class StreamAutocompleteOptions<T extends Object> extends StatelessWidget {
623623
children: [
624624
if (headerBuilder != null) ...[
625625
headerBuilder!(context),
626-
const Divider(height: 0),
626+
Divider(height: 0, color: colorTheme.borders),
627627
],
628628
LimitedBox(
629629
maxHeight: maxHeight ?? height * 0.5,

packages/stream_chat_flutter/lib/src/autocomplete/stream_command_autocomplete_options.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ class StreamCommandAutocompleteOptions extends StatelessWidget {
5151
),
5252
title: Text(
5353
context.translations.instantCommandsLabel,
54-
style: TextStyle(
55-
// ignore: deprecated_member_use
56-
color: colorTheme.textHighEmphasis.withOpacity(0.5),
54+
style: textTheme.body.copyWith(
55+
color: colorTheme.textLowEmphasis,
5756
),
5857
),
5958
);
@@ -67,8 +66,8 @@ class StreamCommandAutocompleteOptions extends StatelessWidget {
6766
children: [
6867
Text(
6968
command.name.capitalize(),
70-
style: const TextStyle(
71-
fontWeight: FontWeight.bold,
69+
style: textTheme.bodyBold.copyWith(
70+
color: colorTheme.textHighEmphasis,
7271
),
7372
),
7473
const SizedBox(width: 8),

packages/stream_chat_flutter/lib/src/channel/channel_header.dart

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ class StreamChannelHeader extends StatelessWidget
6666
this.centerTitle,
6767
this.leading,
6868
this.actions,
69+
this.bottom,
6970
this.backgroundColor,
7071
this.elevation = 1,
71-
}) : preferredSize = const Size.fromHeight(kToolbarHeight);
72+
this.bottomOpacity = 1,
73+
});
7274

7375
/// Whether to show the leading back button
7476
///
@@ -106,6 +108,9 @@ class StreamChannelHeader extends StatelessWidget
106108
/// Leading widget
107109
final Widget? leading;
108110

111+
/// The bottom widget
112+
final PreferredSizeWidget? bottom;
113+
109114
/// {@macro flutter.material.appbar.actions}
110115
///
111116
/// The [StreamChannelAvatar] is shown by default
@@ -117,8 +122,14 @@ class StreamChannelHeader extends StatelessWidget
117122
/// The elevation for this [StreamChannelHeader].
118123
final double elevation;
119124

125+
/// The opacity of the bottom widget.
126+
final double bottomOpacity;
127+
120128
@override
121-
final Size preferredSize;
129+
Size get preferredSize {
130+
final bottomHeight = bottom?.preferredSize.height ?? 0;
131+
return Size.fromHeight(kToolbarHeight + bottomHeight);
132+
}
122133

123134
@override
124135
Widget build(BuildContext context) {
@@ -169,6 +180,8 @@ class StreamChannelHeader extends StatelessWidget
169180
: SystemUiOverlayStyle.dark,
170181
elevation: elevation,
171182
leading: leadingWidget,
183+
bottom: bottom,
184+
bottomOpacity: bottomOpacity,
172185
backgroundColor: backgroundColor ?? channelHeaderTheme.color,
173186
actions: actions ??
174187
<Widget>[

packages/stream_chat_flutter/test/src/channel/channel_header_test.dart

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:alchemist/alchemist.dart';
12
import 'package:flutter/material.dart';
23
import 'package:flutter_test/flutter_test.dart';
34
import 'package:mocktail/mocktail.dart';
@@ -476,4 +477,73 @@ void main() {
476477
expect(titleTapped, true);
477478
},
478479
);
480+
481+
goldenTest(
482+
'golden test for StreamChannelHeader with bottom widget',
483+
fileName: 'channel_header_bottom_widget',
484+
constraints: const BoxConstraints.tightFor(width: 300, height: 60),
485+
builder: () {
486+
final client = MockClient();
487+
final clientState = MockClientState();
488+
final channel = MockChannel();
489+
final channelState = MockChannelState();
490+
final user = OwnUser(id: 'user-id');
491+
final lastMessageAt = DateTime.parse('2020-06-22 12:00:00');
492+
493+
when(() => client.state).thenReturn(clientState);
494+
when(() => clientState.currentUser).thenReturn(user);
495+
when(() => clientState.currentUserStream)
496+
.thenAnswer((_) => Stream.value(user));
497+
when(() => channel.lastMessageAt).thenReturn(lastMessageAt);
498+
when(() => channel.state).thenReturn(channelState);
499+
when(() => channel.client).thenReturn(client);
500+
when(() => channel.isMuted).thenReturn(false);
501+
when(() => channel.isMutedStream).thenAnswer((i) => Stream.value(false));
502+
when(() => channel.nameStream).thenAnswer((_) => Stream.value('test'));
503+
when(() => channel.name).thenReturn('test');
504+
when(() => channel.imageStream)
505+
.thenAnswer((i) => Stream.value('https://bit.ly/321RmWb'));
506+
when(() => channel.image).thenReturn('https://bit.ly/321RmWb');
507+
when(() => channelState.unreadCount).thenReturn(1);
508+
when(() => client.wsConnectionStatusStream)
509+
.thenAnswer((_) => Stream.value(ConnectionStatus.connected));
510+
when(() => channelState.unreadCountStream)
511+
.thenAnswer((i) => Stream.value(1));
512+
when(() => clientState.totalUnreadCount).thenAnswer((i) => 1);
513+
when(() => clientState.totalUnreadCountStream)
514+
.thenAnswer((i) => Stream.value(1));
515+
when(() => channelState.membersStream).thenAnswer(
516+
(i) => Stream.value([
517+
Member(
518+
userId: 'user-id',
519+
user: User(id: 'user-id'),
520+
)
521+
]),
522+
);
523+
when(() => channelState.members).thenReturn([
524+
Member(
525+
userId: 'user-id',
526+
user: User(id: 'user-id'),
527+
),
528+
]);
529+
530+
return MaterialAppWrapper(
531+
home: StreamChat(
532+
client: client,
533+
connectivityStream: Stream.value([ConnectivityResult.wifi]),
534+
child: StreamChannel(
535+
channel: channel,
536+
child: const Scaffold(
537+
body: StreamChannelHeader(
538+
bottom: PreferredSize(
539+
preferredSize: Size.fromHeight(1),
540+
child: Divider(height: 1, color: Colors.red),
541+
),
542+
),
543+
),
544+
),
545+
),
546+
);
547+
},
548+
);
479549
}

0 commit comments

Comments
 (0)