Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions docs/docs_screenshots/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ dependencies:
record: ^6.2.0
stream_chat_flutter: ^10.2.0
stream_core_flutter:
git:
url: https://github.com/GetStream/stream-core-flutter.git
ref: ab4b1fb0a0be01b4270823c5c2c7b0c21ad886f8
path: packages/stream_core_flutter
path: /Users/renefloor/Documents/github/stream-core-flutter/packages/stream_core_flutter

dev_dependencies:
alchemist: ^0.14.0
Expand Down
5 changes: 1 addition & 4 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ command:
streaming_shared_preferences: ^2.0.0
svg_icon_widget: ^0.0.1
stream_core_flutter:
git:
url: https://github.com/GetStream/stream-core-flutter.git
ref: ab4b1fb0a0be01b4270823c5c2c7b0c21ad886f8
path: packages/stream_core_flutter
path: /Users/renefloor/Documents/github/stream-core-flutter/packages/stream_core_flutter
stream_thumbnail: ^0.1.0
synchronized: ^3.4.0
thumblr: ^0.0.4
Expand Down
1 change: 1 addition & 0 deletions packages/stream_chat_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Fixed the attachment picker throwing a `Tooltip` assertion error when a custom `TabbedAttachmentPickerOption` is added without a `title`; the tooltip is now only shown when a title is provided.
- Fixed the `StreamBackButton` unread badge including the currently open channel in its total count.
- Fixed modal dialogs (message actions, delete/flag confirmation) rendering over a white scrim in light theme; they now use the design system's scrim token.
- Fixed the message metadata in the long-press actions modal keeping its muted in-list colors against the dark scrim. The previewed message now renders its annotations ("Saved for later", "Pinned by", "Replied to a thread" + "View", "Reminder set"), username, sending status and read receipts, timestamp, "Edited" label, and thread-reply count in white. Added `StreamSendingIndicator.color` to override the indicator's icon color.

## 10.2.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class StreamSendingIndicator extends StatelessWidget {
this.isMessageRead = false,
this.isMessageDelivered = false,
this.size,
this.color,
});

/// The message whose sending status is to be shown.
Expand All @@ -27,6 +28,12 @@ class StreamSendingIndicator extends StatelessWidget {
/// The size of the indicator icon.
final double? size;

/// The color of the indicator icon.
///
/// When null, read messages use `StreamColorScheme.accentPrimary` and every
/// other state uses `StreamColorScheme.textSecondary`.
final Color? color;

@override
Widget build(BuildContext context) {
final colorScheme = context.streamColorScheme;
Expand All @@ -36,7 +43,7 @@ class StreamSendingIndicator extends StatelessWidget {
return Icon(
context.streamIcons.checks,
size: size,
color: colorScheme.accentPrimary,
color: color ?? colorScheme.accentPrimary,
semanticLabel: a11y.messageReadStatusLabel,
);
}
Expand All @@ -45,7 +52,7 @@ class StreamSendingIndicator extends StatelessWidget {
return Icon(
context.streamIcons.checks,
size: size,
color: colorScheme.textSecondary,
color: color ?? colorScheme.textSecondary,
semanticLabel: a11y.messageDeliveredStatusLabel,
);
}
Expand All @@ -54,7 +61,7 @@ class StreamSendingIndicator extends StatelessWidget {
return Icon(
context.streamIcons.checkmark,
size: size,
color: colorScheme.textSecondary,
color: color ?? colorScheme.textSecondary,
semanticLabel: a11y.messageSentStatusLabel,
);
}
Expand All @@ -63,7 +70,7 @@ class StreamSendingIndicator extends StatelessWidget {
return Icon(
context.streamIcons.clock,
size: size,
color: colorScheme.textSecondary,
color: color ?? colorScheme.textSecondary,
semanticLabel: a11y.messageSendingStatusLabel,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,18 @@ class DefaultStreamMessageHeader extends core.NullableStatelessWidget {
final colorScheme = context.streamColorScheme;
final crossAxisAlignment = core.StreamMessageLayout.crossAxisAlignmentOf(context);

// Previews sit on the modal scrim, where accent-colored annotations don't
// have enough contrast, so they fall back to the on-scrim color.
final isPreview = core.StreamMessageLayout.presentationOf(context) == .preview;
final accentColor = isPreview ? colorScheme.textOnAccent : colorScheme.accentPrimary;
final linkColor = isPreview ? colorScheme.textOnAccent : colorScheme.textLink;

Widget? savedForLaterAnnotation;
if (message.reminder case final reminder? when reminder.remindAt == null) {
savedForLaterAnnotation = core.StreamMessageAnnotation(
leading: Icon(icons.save),
label: Text(translations.savedForLaterLabel),
style: .from(textColor: colorScheme.accentPrimary, iconColor: colorScheme.accentPrimary),
style: .from(textColor: accentColor, iconColor: accentColor),
);
}

Expand Down Expand Up @@ -137,7 +143,7 @@ class DefaultStreamMessageHeader extends core.NullableStatelessWidget {
leading: Icon(icons.arrowUpRight),
label: Text(annotationLabel),
trailing: Text(translations.viewLabel),
style: .from(trailingTextColor: colorScheme.textLink),
style: .from(trailingTextColor: linkColor),
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/indicators/sending_indicator.dart';
import 'package:stream_chat_flutter/src/utils/extensions.dart';
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:stream_core_flutter/chat.dart' as core;

/// Displays the sending status of a message, including attachment upload
/// progress and sent/delivered/read indicators.
Expand Down Expand Up @@ -51,6 +50,14 @@ class StreamMessageSendingStatus extends StatelessWidget {

final channel = StreamChannel.maybeOf(context)?.channel;

// Previews sit on the modal scrim, where neither the accent-colored read
// receipt nor the muted sent/delivered icon has enough contrast, so both
// fall back to the on-scrim color.
final iconColor = switch (core.StreamMessageLayout.presentationOf(context)) {
.preview => context.streamColorScheme.textOnAccent,
.standard => null,
};

return BetterStreamBuilder<List<Read>>(
stream: channel?.state?.readStream,
initialData: channel?.state?.read,
Expand All @@ -65,6 +72,7 @@ class StreamMessageSendingStatus extends StatelessWidget {
message: message,
isMessageRead: isMessageRead,
isMessageDelivered: isMessageDelivered,
color: iconColor,
);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,9 @@ class DefaultStreamMessageItem extends StatelessWidget {
builder: (_) => StreamChatConfiguration(
data: StreamChatConfiguration.of(context),
child: StreamMessageLayout(
data: layout,
// The message is re-rendered on top of the modal scrim, so its
// metadata and annotations switch to their on-scrim colors.
data: layout.copyWith(presentation: core.StreamMessagePresentation.preview),
child: StreamMessageActionsModal(
message: message,
messageActions: actions,
Expand Down
13 changes: 1 addition & 12 deletions packages/stream_chat_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,7 @@ dependencies:
shimmer: ^3.0.0
stream_chat_flutter_core: ^10.2.0
stream_core_flutter:
# The ignore below silences `invalid_dependency` because we occasionally
# pin stream_core_flutter to a git ref to iterate on it alongside this
# SDK between its releases.
#
# **Note:** Before publishing stream_chat_flutter, this MUST be swapped
# back to a pub version constraint — git deps are not allowed on pub.dev
# and will block the release.
# ignore: invalid_dependency
git:
url: https://github.com/GetStream/stream-core-flutter.git
ref: ab4b1fb0a0be01b4270823c5c2c7b0c21ad886f8
path: packages/stream_core_flutter
path: /Users/renefloor/Documents/github/stream-core-flutter/packages/stream_core_flutter
stream_thumbnail: ^0.1.0
svg_icon_widget: ^0.0.1
synchronized: ^3.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,98 @@ void main() {
);
},
);

// An explicit color is what lets the long-press preview draw the indicator in
// white against the modal scrim, where both accentPrimary and textSecondary
// lack contrast. See FLU-647.
group('StreamSendingIndicator color override', () {
const override = Color(0xFF4CAF50);

Future<Icon> pumpIndicator(
WidgetTester tester, {
required Message message,
bool isMessageRead = false,
bool isMessageDelivered = false,
Color? color,
}) async {
await tester.pumpWidget(
MaterialApp(
home: StreamChatTheme(
data: StreamChatThemeData(),
child: Scaffold(
body: Center(
child: StreamSendingIndicator(
message: message,
isMessageRead: isMessageRead,
isMessageDelivered: isMessageDelivered,
color: color,
),
),
),
),
),
);

return tester.widget<Icon>(find.byType(Icon));
}

testWidgets('applies to the read indicator', (tester) async {
final icon = await pumpIndicator(
tester,
message: Message(state: MessageState.sent),
isMessageRead: true,
color: override,
);

expect(icon.color, override);
});

testWidgets('applies to the delivered indicator', (tester) async {
final icon = await pumpIndicator(
tester,
message: Message(state: MessageState.sent),
isMessageDelivered: true,
color: override,
);

expect(icon.color, override);
});

testWidgets('applies to the sent indicator', (tester) async {
final icon = await pumpIndicator(
tester,
message: Message(state: MessageState.sent),
color: override,
);

expect(icon.color, override);
});

testWidgets('applies to the sending indicator', (tester) async {
final icon = await pumpIndicator(
tester,
message: Message(state: MessageState.sending),
color: override,
);

expect(icon.color, override);
});

testWidgets('falls back to the theme colors when null', (tester) async {
final colorScheme = StreamColorScheme.light();

final read = await pumpIndicator(
tester,
message: Message(state: MessageState.sent),
isMessageRead: true,
);
expect(read.color, colorScheme.accentPrimary);

final sent = await pumpIndicator(
tester,
message: Message(state: MessageState.sent),
);
expect(sent.color, colorScheme.textSecondary);
});
});
}
Loading
Loading