Merge branch 'develop' into repo/dart-code-metrics
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
## Upcoming
|
||||
|
||||
- Updated Dart SDK constraints to `>=2.14.0 <3.0.0`
|
||||
|
||||
## 3.1.1
|
||||
|
||||
- Updated `stream_chat_flutter_core` dependency to [`3.1.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog).
|
||||
- Updated `file_picker`, `image_gallery_saver`, and `video_thumbnail` to the latest versions.
|
||||
|
||||
🐞 Fixed
|
||||
|
||||
-[[#687]](https://github.com/GetStream/stream-chat-flutter/issues/687): Fix Users losing their place in the conversation after replying in threads.
|
||||
- [[#687]](https://github.com/GetStream/stream-chat-flutter/issues/687): Fix Users losing their place in the conversation after replying in threads.
|
||||
- Fixed floating date stream subscription causing "Bad state: stream has already been listened.” error.
|
||||
- Fixed `String` capitalize extension not working on empty strings.
|
||||
|
||||
✅ Added
|
||||
|
||||
- Added `MessageInput.customOverlays` property to add custom overlays to the message input.
|
||||
- Added `MessageInput.mentionAllAppUsers` property to mention all app users in the message input.
|
||||
- The `MessageInput` now supports local search for channels with less than 100 members.
|
||||
- Added `MessageListView.paginationLoadingIndicatorBuilder` to override the default loading indicator shown while paginating the message list.
|
||||
- Added new `linkBackgroundColor` in `MessageTheme` for setting background colors of link attachments.
|
||||
|
||||
⚠️ Deprecated
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ Future<void> main() async {
|
||||
|
||||
await client.connectUser(
|
||||
User(id: 'super-band-9'),
|
||||
'''eyJ0eXAiO«iJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A''',
|
||||
'''eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A''',
|
||||
);
|
||||
|
||||
runApp(
|
||||
|
||||
+5
-1
@@ -10,6 +10,7 @@ class UrlAttachment extends StatelessWidget {
|
||||
Key? key,
|
||||
required this.urlAttachment,
|
||||
required this.hostDisplayName,
|
||||
required this.messageTheme,
|
||||
this.textPadding = const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
@@ -25,6 +26,9 @@ class UrlAttachment extends StatelessWidget {
|
||||
/// Padding for text
|
||||
final EdgeInsets textPadding;
|
||||
|
||||
/// [MessageThemeData] for showing image title
|
||||
final MessageThemeData messageTheme;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final chatThemeData = StreamChatTheme.of(context);
|
||||
@@ -58,7 +62,7 @@ class UrlAttachment extends StatelessWidget {
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(16),
|
||||
),
|
||||
color: chatThemeData.colorTheme.linkBg,
|
||||
color: messageTheme.linkBackgroundColor,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
@@ -12,7 +12,7 @@ final _emojiChars = Emoji.chars();
|
||||
extension StringExtension on String {
|
||||
/// Returns the capitalized string
|
||||
String capitalize() =>
|
||||
'${this[0].toUpperCase()}${substring(1).toLowerCase()}';
|
||||
isNotEmpty ? '${this[0].toUpperCase()}${substring(1).toLowerCase()}' : '';
|
||||
|
||||
/// Returns whether the string contains only emoji's or not.
|
||||
///
|
||||
|
||||
@@ -386,6 +386,9 @@ class MessageInputState extends State<MessageInput> {
|
||||
Timer? _slowModeTimer;
|
||||
|
||||
void _startSlowMode() {
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
final channel = StreamChannel.of(context).channel;
|
||||
final cooldownStartedAt = channel.cooldownStartedAt;
|
||||
if (cooldownStartedAt != null) {
|
||||
|
||||
@@ -170,6 +170,7 @@ class MessageListView extends StatefulWidget {
|
||||
this.messageListController,
|
||||
this.reverse = true,
|
||||
this.paginationLimit = 20,
|
||||
this.paginationLoadingIndicatorBuilder,
|
||||
}) : super(key: key);
|
||||
|
||||
/// Function used to build a custom message widget
|
||||
@@ -285,6 +286,9 @@ class MessageListView extends StatefulWidget {
|
||||
/// Use [ChannelListController.paginateData] pagination.
|
||||
final MessageListController? messageListController;
|
||||
|
||||
/// Builder used to build the loading indicator shown while paginating.
|
||||
final WidgetBuilder? paginationLoadingIndicatorBuilder;
|
||||
|
||||
@override
|
||||
_MessageListViewState createState() => _MessageListViewState();
|
||||
}
|
||||
@@ -294,7 +298,6 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
void Function(Message)? _onThreadTap;
|
||||
bool _showScrollToBottom = false;
|
||||
late final ItemPositionsListener _itemPositionListener;
|
||||
late final Stream<Iterable<ItemPosition>> _itemPositionStream;
|
||||
int? _messageListLength;
|
||||
StreamChannelState? streamChannel;
|
||||
late StreamChatThemeData _streamTheme;
|
||||
@@ -576,17 +579,22 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
}
|
||||
}
|
||||
|
||||
final indicatorBuilder =
|
||||
widget.paginationLoadingIndicatorBuilder;
|
||||
|
||||
if (i == itemCount - 3) {
|
||||
return _buildLoadingIndicator(
|
||||
return _loadingIndicator(
|
||||
streamChannel!,
|
||||
QueryDirection.top,
|
||||
indicatorBuilder: indicatorBuilder,
|
||||
);
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
return _buildLoadingIndicator(
|
||||
return _loadingIndicator(
|
||||
streamChannel!,
|
||||
QueryDirection.bottom,
|
||||
indicatorBuilder: indicatorBuilder,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -668,7 +676,8 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
right: 0,
|
||||
child: BetterStreamBuilder<Iterable<ItemPosition>>(
|
||||
initialData: _itemPositionListener.itemPositions.value,
|
||||
stream: _itemPositionStream,
|
||||
stream: _valueListenableToStreamAdapter(
|
||||
_itemPositionListener.itemPositions),
|
||||
comparator: (a, b) {
|
||||
if (a == null || b == null) {
|
||||
return false;
|
||||
@@ -819,15 +828,17 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
},
|
||||
);
|
||||
|
||||
Widget _buildLoadingIndicator(
|
||||
Widget _loadingIndicator(
|
||||
StreamChannelState streamChannel,
|
||||
QueryDirection direction,
|
||||
) =>
|
||||
QueryDirection direction, {
|
||||
WidgetBuilder? indicatorBuilder,
|
||||
}) =>
|
||||
_LoadingIndicator(
|
||||
direction: direction,
|
||||
streamTheme: _streamTheme,
|
||||
streamChannel: streamChannel,
|
||||
isThreadConversation: _isThreadConversation,
|
||||
indicatorBuilder: indicatorBuilder,
|
||||
);
|
||||
|
||||
Widget _buildBottomMessage(
|
||||
@@ -1197,8 +1208,6 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
_scrollController = widget.scrollController ?? ItemScrollController();
|
||||
_itemPositionListener =
|
||||
widget.itemPositionListener ?? ItemPositionsListener.create();
|
||||
_itemPositionStream =
|
||||
_valueListenableToStreamAdapter(_itemPositionListener.itemPositions);
|
||||
|
||||
_getOnThreadTap();
|
||||
super.initState();
|
||||
@@ -1297,12 +1306,14 @@ class _LoadingIndicator extends StatelessWidget {
|
||||
required this.isThreadConversation,
|
||||
required this.direction,
|
||||
required this.streamChannel,
|
||||
this.indicatorBuilder,
|
||||
}) : super(key: key);
|
||||
|
||||
final StreamChatThemeData streamTheme;
|
||||
final bool isThreadConversation;
|
||||
final QueryDirection direction;
|
||||
final StreamChannelState streamChannel;
|
||||
final WidgetBuilder? indicatorBuilder;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -1321,12 +1332,13 @@ class _LoadingIndicator extends StatelessWidget {
|
||||
),
|
||||
builder: (context, data) {
|
||||
if (!data) return const Offstage();
|
||||
return const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
return indicatorBuilder?.call(context) ??
|
||||
const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_portal/flutter_portal.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:stream_chat_flutter/src/attachment/url_attachment.dart';
|
||||
import 'package:stream_chat_flutter/src/extension.dart';
|
||||
import 'package:stream_chat_flutter/src/image_group.dart';
|
||||
import 'package:stream_chat_flutter/src/message_action.dart';
|
||||
@@ -15,7 +16,6 @@ import 'package:stream_chat_flutter/src/message_reactions_modal.dart';
|
||||
import 'package:stream_chat_flutter/src/quoted_message_widget.dart';
|
||||
import 'package:stream_chat_flutter/src/reaction_bubble.dart';
|
||||
import 'package:stream_chat_flutter/src/theme/themes.dart';
|
||||
import 'package:stream_chat_flutter/src/url_attachment.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
/// Widget builder for building attachments
|
||||
@@ -1010,6 +1010,7 @@ class _MessageWidgetState extends State<MessageWidget>
|
||||
urlAttachment: urlAttachment,
|
||||
hostDisplayName: hostDisplayName,
|
||||
textPadding: widget.textPadding,
|
||||
messageTheme: widget.messageTheme,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1348,7 +1349,7 @@ class _MessageWidgetState extends State<MessageWidget>
|
||||
}
|
||||
|
||||
if (hasUrlAttachments) {
|
||||
return _streamChatTheme.colorTheme.linkBg;
|
||||
return widget.messageTheme.linkBackgroundColor;
|
||||
}
|
||||
|
||||
if (isOnlyEmoji) {
|
||||
|
||||
@@ -285,7 +285,7 @@ class QuotedMessageWidget extends StatelessWidget {
|
||||
|
||||
Color? _getBackgroundColor(BuildContext context) {
|
||||
if (_containsLinkAttachment) {
|
||||
return StreamChatTheme.of(context).colorTheme.linkBg;
|
||||
return messageTheme.linkBackgroundColor;
|
||||
}
|
||||
return messageTheme.messageBackgroundColor;
|
||||
}
|
||||
|
||||
@@ -223,6 +223,7 @@ class StreamChatThemeData {
|
||||
messageLinksStyle: TextStyle(
|
||||
color: accentColor,
|
||||
),
|
||||
linkBackgroundColor: colorTheme.linkBg,
|
||||
),
|
||||
otherMessageTheme: MessageThemeData(
|
||||
reactionsBackgroundColor: colorTheme.disabled,
|
||||
@@ -246,6 +247,7 @@ class StreamChatThemeData {
|
||||
width: 32,
|
||||
),
|
||||
),
|
||||
linkBackgroundColor: colorTheme.linkBg,
|
||||
),
|
||||
messageInputTheme: MessageInputThemeData(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
|
||||
@@ -18,6 +18,7 @@ class MessageThemeData with Diagnosticable {
|
||||
this.reactionsMaskColor,
|
||||
this.avatarTheme,
|
||||
this.createdAtStyle,
|
||||
this.linkBackgroundColor,
|
||||
});
|
||||
|
||||
/// Text style for message text
|
||||
@@ -53,6 +54,9 @@ class MessageThemeData with Diagnosticable {
|
||||
/// Theme of the avatar
|
||||
final AvatarThemeData? avatarTheme;
|
||||
|
||||
/// Background color for messages with url attachments.
|
||||
final Color? linkBackgroundColor;
|
||||
|
||||
/// Copy with a theme
|
||||
MessageThemeData copyWith({
|
||||
TextStyle? messageTextStyle,
|
||||
@@ -66,6 +70,7 @@ class MessageThemeData with Diagnosticable {
|
||||
Color? reactionsBackgroundColor,
|
||||
Color? reactionsBorderColor,
|
||||
Color? reactionsMaskColor,
|
||||
Color? linkBackgroundColor,
|
||||
}) =>
|
||||
MessageThemeData(
|
||||
messageTextStyle: messageTextStyle ?? this.messageTextStyle,
|
||||
@@ -81,6 +86,7 @@ class MessageThemeData with Diagnosticable {
|
||||
reactionsBackgroundColor ?? this.reactionsBackgroundColor,
|
||||
reactionsBorderColor: reactionsBorderColor ?? this.reactionsBorderColor,
|
||||
reactionsMaskColor: reactionsMaskColor ?? this.reactionsMaskColor,
|
||||
linkBackgroundColor: linkBackgroundColor ?? this.linkBackgroundColor,
|
||||
);
|
||||
|
||||
/// Linearly interpolate from one [MessageThemeData] to another.
|
||||
@@ -109,6 +115,8 @@ class MessageThemeData with Diagnosticable {
|
||||
reactionsMaskColor:
|
||||
Color.lerp(a.reactionsMaskColor, b.reactionsMaskColor, t),
|
||||
repliesStyle: TextStyle.lerp(a.repliesStyle, b.repliesStyle, t),
|
||||
linkBackgroundColor:
|
||||
Color.lerp(a.linkBackgroundColor, b.linkBackgroundColor, t),
|
||||
);
|
||||
|
||||
/// Merge with a theme
|
||||
@@ -131,6 +139,7 @@ class MessageThemeData with Diagnosticable {
|
||||
reactionsBackgroundColor: other.reactionsBackgroundColor,
|
||||
reactionsBorderColor: other.reactionsBorderColor,
|
||||
reactionsMaskColor: other.reactionsMaskColor,
|
||||
linkBackgroundColor: other.linkBackgroundColor,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,7 +158,8 @@ class MessageThemeData with Diagnosticable {
|
||||
reactionsBackgroundColor == other.reactionsBackgroundColor &&
|
||||
reactionsBorderColor == other.reactionsBorderColor &&
|
||||
reactionsMaskColor == other.reactionsMaskColor &&
|
||||
avatarTheme == other.avatarTheme;
|
||||
avatarTheme == other.avatarTheme &&
|
||||
linkBackgroundColor == other.linkBackgroundColor;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
@@ -163,7 +173,8 @@ class MessageThemeData with Diagnosticable {
|
||||
reactionsBackgroundColor.hashCode ^
|
||||
reactionsBorderColor.hashCode ^
|
||||
reactionsMaskColor.hashCode ^
|
||||
avatarTheme.hashCode;
|
||||
avatarTheme.hashCode ^
|
||||
linkBackgroundColor.hashCode;
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
@@ -179,6 +190,7 @@ class MessageThemeData with Diagnosticable {
|
||||
..add(DiagnosticsProperty('avatarTheme', avatarTheme))
|
||||
..add(ColorProperty('reactionsBackgroundColor', reactionsBackgroundColor))
|
||||
..add(ColorProperty('reactionsBorderColor', reactionsBorderColor))
|
||||
..add(ColorProperty('reactionsMaskColor', reactionsMaskColor));
|
||||
..add(ColorProperty('reactionsMaskColor', reactionsMaskColor))
|
||||
..add(ColorProperty('linkBackgroundColor', linkBackgroundColor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
name: stream_chat_flutter
|
||||
homepage: https://github.com/GetStream/stream-chat-flutter
|
||||
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
|
||||
version: 3.0.0
|
||||
version: 3.1.1
|
||||
repository: https://github.com/GetStream/stream-chat-flutter
|
||||
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: '>=2.14.0 <3.0.0'
|
||||
flutter: ">=1.17.0"
|
||||
|
||||
dependencies:
|
||||
@@ -17,7 +17,7 @@ dependencies:
|
||||
diacritic: ^0.1.3
|
||||
dio: ^4.0.0
|
||||
ezanimation: ^0.5.0
|
||||
file_picker: ^3.0.1
|
||||
file_picker: ^4.1.3
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_markdown: ^0.6.1
|
||||
@@ -25,7 +25,7 @@ dependencies:
|
||||
flutter_slidable: ^0.6.0
|
||||
flutter_svg: ^0.22.0
|
||||
http_parser: ^4.0.0
|
||||
image_gallery_saver: ^1.6.9
|
||||
image_gallery_saver: ^1.7.0
|
||||
image_picker: ^0.8.2
|
||||
jiffy: ^4.1.0
|
||||
lottie: ^1.0.1
|
||||
@@ -37,13 +37,13 @@ dependencies:
|
||||
scrollable_positioned_list: ^0.2.0-nullsafety.0
|
||||
share_plus: ^2.0.3
|
||||
shimmer: ^2.0.0
|
||||
stream_chat_flutter_core: ^3.0.0
|
||||
stream_chat_flutter_core: ^3.1.1
|
||||
substring_highlight: ^1.0.26
|
||||
synchronized: ^3.0.0
|
||||
url_launcher: ^6.0.3
|
||||
video_compress: ^3.0.0
|
||||
video_player: ^2.1.0
|
||||
video_thumbnail: ^0.3.3
|
||||
video_thumbnail: ^0.4.3
|
||||
visibility_detector: ^0.2.0
|
||||
|
||||
flutter:
|
||||
@@ -58,6 +58,6 @@ dev_dependencies:
|
||||
dart_code_metrics: ^4.2.0-dev.5
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
golden_toolkit: ^0.9.0
|
||||
golden_toolkit: ^0.10.0
|
||||
mocktail: ^0.1.2
|
||||
path: ^1.8.0
|
||||
|
||||
@@ -59,6 +59,7 @@ final _messageThemeControl = MessageThemeData(
|
||||
messageLinksStyle: TextStyle(
|
||||
color: ColorTheme.light().accentPrimary,
|
||||
),
|
||||
linkBackgroundColor: ColorTheme.light().linkBg,
|
||||
);
|
||||
|
||||
final _messageThemeControlDark = MessageThemeData(
|
||||
@@ -87,4 +88,5 @@ final _messageThemeControlDark = MessageThemeData(
|
||||
messageLinksStyle: TextStyle(
|
||||
color: ColorTheme.dark().accentPrimary,
|
||||
),
|
||||
linkBackgroundColor: ColorTheme.dark().linkBg,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user