chore: address PR feedback

This commit is contained in:
groovinchip
2021-08-04 12:03:37 -04:00
parent f0cf4fd6db
commit 8a4632e6e2
9 changed files with 23 additions and 32 deletions
@@ -118,10 +118,7 @@ class ChannelListPage extends StatelessWidget {
channel: channel, channel: channel,
), ),
title: ChannelName( title: ChannelName(
textStyle: StreamChatTheme.of(context) textStyle: ChannelPreviewTheme.of(context).titleStyle!.copyWith(
.channelPreviewTheme
.titleStyle!
.copyWith(
color: StreamChatTheme.of(context) color: StreamChatTheme.of(context)
.colorTheme .colorTheme
.textHighEmphasis .textHighEmphasis
@@ -105,7 +105,7 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final channel = StreamChannel.of(context).channel; final channel = StreamChannel.of(context).channel;
final chatThemeData = StreamChatTheme.of(context); final channelHeaderTheme = ChannelHeaderTheme.of(context);
final leadingWidget = leading ?? final leadingWidget = leading ??
(showBackButton (showBackButton
@@ -141,17 +141,17 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget {
brightness: Theme.of(context).brightness, brightness: Theme.of(context).brightness,
elevation: 1, elevation: 1,
leading: leadingWidget, leading: leadingWidget,
backgroundColor: chatThemeData.channelHeaderTheme.color, backgroundColor: channelHeaderTheme.color,
actions: actions ?? actions: actions ??
<Widget>[ <Widget>[
Padding( Padding(
padding: const EdgeInsets.only(right: 10), padding: const EdgeInsets.only(right: 10),
child: Center( child: Center(
child: ChannelAvatar( child: ChannelAvatar(
borderRadius: chatThemeData borderRadius:
.channelHeaderTheme.avatarTheme?.borderRadius, channelHeaderTheme.avatarTheme?.borderRadius,
constraints: chatThemeData constraints:
.channelHeaderTheme.avatarTheme?.constraints, channelHeaderTheme.avatarTheme?.constraints,
onTap: onImageTap, onTap: onImageTap,
), ),
), ),
@@ -168,16 +168,14 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget {
children: <Widget>[ children: <Widget>[
title ?? title ??
ChannelName( ChannelName(
textStyle: textStyle: channelHeaderTheme.titleStyle,
chatThemeData.channelHeaderTheme.titleStyle,
), ),
const SizedBox(height: 2), const SizedBox(height: 2),
subtitle ?? subtitle ??
ChannelInfo( ChannelInfo(
showTypingIndicator: showTypingIndicator, showTypingIndicator: showTypingIndicator,
channel: channel, channel: channel,
textStyle: textStyle: channelHeaderTheme.subtitleStyle,
chatThemeData.channelHeaderTheme.subtitleStyle,
), ),
], ],
), ),
@@ -65,7 +65,7 @@ class ChannelInfo extends StatelessWidget {
} }
alternativeWidget = Text( alternativeWidget = Text(
text, text,
style: StreamChatTheme.of(context).channelHeaderTheme.subtitleStyle, style: ChannelHeaderTheme.of(context).subtitleStyle,
); );
} else { } else {
final userId = StreamChat.of(context).currentUser?.id; final userId = StreamChat.of(context).currentUser?.id;
@@ -241,12 +241,13 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
StreamChatClient client, StreamChatClient client,
) { ) {
final chatThemeData = StreamChatTheme.of(context); final chatThemeData = StreamChatTheme.of(context);
final channelListHeaderTheme = ChannelListHeaderTheme.of(context);
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Text(
context.translations.offlineLabel, context.translations.offlineLabel,
style: chatThemeData.channelListHeaderTheme.titleStyle?.copyWith( style: channelListHeaderTheme.titleStyle?.copyWith(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -257,7 +258,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
..openConnection(), ..openConnection(),
child: Text( child: Text(
context.translations.tryAgainLabel, context.translations.tryAgainLabel,
style: chatThemeData.channelListHeaderTheme.titleStyle?.copyWith( style: channelListHeaderTheme.titleStyle?.copyWith(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: chatThemeData.colorTheme.accentPrimary, color: chatThemeData.colorTheme.accentPrimary,
@@ -183,15 +183,13 @@ class ChannelPreview extends StatelessWidget {
return Text( return Text(
stringDate, stringDate,
style: StreamChatTheme.of(context) style: ChannelPreviewTheme.of(context).lastMessageAtStyle,
.channelPreviewTheme
.lastMessageAtStyle,
); );
}, },
); );
Widget _buildSubtitle(BuildContext context) { Widget _buildSubtitle(BuildContext context) {
final chatThemeData = StreamChatTheme.of(context); final channelPreviewTheme = ChannelPreviewTheme.of(context);
if (channel.isMuted) { if (channel.isMuted) {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
@@ -201,7 +199,7 @@ class ChannelPreview extends StatelessWidget {
), ),
Text( Text(
' ${context.translations.channelIsMutedText}', ' ${context.translations.channelIsMutedText}',
style: chatThemeData.channelPreviewTheme.subtitleStyle, style: channelPreviewTheme.subtitleStyle,
), ),
], ],
); );
@@ -209,7 +207,7 @@ class ChannelPreview extends StatelessWidget {
return TypingIndicator( return TypingIndicator(
channel: channel, channel: channel,
alternativeWidget: _buildLastMessage(context), alternativeWidget: _buildLastMessage(context),
style: chatThemeData.channelPreviewTheme.subtitleStyle, style: channelPreviewTheme.subtitleStyle,
); );
} }
@@ -124,9 +124,7 @@ class _FullScreenMediaState extends State<FullScreenMedia>
), ),
backgroundDecoration: BoxDecoration( backgroundDecoration: BoxDecoration(
color: ColorTween( color: ColorTween(
begin: StreamChatTheme.of(context) begin: ChannelHeaderTheme.of(context).color,
.channelHeaderTheme
.color,
end: Colors.black, end: Colors.black,
).lerp(_controller.value), ).lerp(_controller.value),
), ),
@@ -566,8 +566,7 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
elevation: 2, elevation: 2,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
isScrollControlled: true, isScrollControlled: true,
backgroundColor: backgroundColor: MessageInputTheme.of(context).inputBackgroundColor,
streamChatThemeData.messageInputTheme.inputBackgroundColor,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(16), topLeft: Radius.circular(16),
@@ -629,7 +629,7 @@ class _MessageListViewState extends State<MessageListView> {
child: Text( child: Text(
context.translations.threadSeparatorText(replyCount), context.translations.threadSeparatorText(replyCount),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: _streamTheme.channelHeaderTheme.subtitleStyle, style: ChannelHeaderTheme.of(context).subtitleStyle,
), ),
), ),
); );
@@ -122,18 +122,18 @@ class MessageSearchItem extends StatelessWidget {
text = parts.join(' '); text = parts.join(' ');
} }
final chatThemeData = StreamChatTheme.of(context); final channelPreviewTheme = ChannelPreviewTheme.of(context);
return Text.rich( return Text.rich(
_getDisplayText( _getDisplayText(
text!, text!,
message.mentionedUsers, message.mentionedUsers,
message.attachments, message.attachments,
chatThemeData.channelPreviewTheme.subtitleStyle?.copyWith( channelPreviewTheme.subtitleStyle?.copyWith(
fontStyle: (message.isSystem || message.isDeleted) fontStyle: (message.isSystem || message.isDeleted)
? FontStyle.italic ? FontStyle.italic
: FontStyle.normal, : FontStyle.normal,
), ),
chatThemeData.channelPreviewTheme.subtitleStyle?.copyWith( channelPreviewTheme.subtitleStyle?.copyWith(
fontStyle: (message.isSystem || message.isDeleted) fontStyle: (message.isSystem || message.isDeleted)
? FontStyle.italic ? FontStyle.italic
: FontStyle.normal, : FontStyle.normal,