StreamChatThemeData.fromColorAndTextTheme constructor
StreamChatThemeData.fromColorAndTextTheme(
- StreamColorTheme colorTheme,
- StreamTextTheme textTheme
Creates a theme from a StreamColorTheme and a StreamTextTheme
Implementation
factory StreamChatThemeData.fromColorAndTextTheme(
StreamColorTheme colorTheme,
StreamTextTheme textTheme,
) {
final accentColor = colorTheme.accentPrimary;
final iconTheme = IconThemeData(color: colorTheme.textLowEmphasis);
final channelHeaderTheme = StreamChannelHeaderThemeData(
avatarTheme: StreamAvatarThemeData(
borderRadius: BorderRadius.circular(20),
constraints: const BoxConstraints.tightFor(
height: 40,
width: 40,
),
),
color: colorTheme.barsBg,
titleStyle: textTheme.headlineBold,
subtitleStyle: textTheme.footnote.copyWith(
color: const Color(0xff7A7A7A),
),
);
final channelPreviewTheme = StreamChannelPreviewThemeData(
unreadCounterColor: colorTheme.accentError,
avatarTheme: StreamAvatarThemeData(
borderRadius: BorderRadius.circular(20),
constraints: const BoxConstraints.tightFor(
height: 40,
width: 40,
),
),
titleStyle: textTheme.bodyBold,
subtitleStyle: textTheme.footnote.copyWith(
color: const Color(0xff7A7A7A),
),
lastMessageAtStyle: textTheme.footnote.copyWith(
// ignore: deprecated_member_use
color: colorTheme.textHighEmphasis.withOpacity(0.5),
),
indicatorIconSize: 16,
);
final audioWaveformTheme = StreamAudioWaveformThemeData(
color: colorTheme.textLowEmphasis,
progressColor: colorTheme.accentPrimary,
minBarHeight: 2,
spacingRatio: 0.3,
heightScale: 1,
);
final audioWaveformSliderTheme = StreamAudioWaveformSliderThemeData(
audioWaveformTheme: audioWaveformTheme,
thumbColor: Colors.white,
thumbBorderColor: colorTheme.borders,
);
return StreamChatThemeData.raw(
textTheme: textTheme,
colorTheme: colorTheme,
primaryIconTheme: iconTheme,
channelPreviewTheme: channelPreviewTheme,
channelListHeaderTheme: StreamChannelListHeaderThemeData(
avatarTheme: StreamAvatarThemeData(
borderRadius: BorderRadius.circular(20),
constraints: const BoxConstraints.tightFor(
height: 40,
width: 40,
),
),
color: colorTheme.barsBg,
titleStyle: textTheme.headlineBold,
),
channelHeaderTheme: channelHeaderTheme,
ownMessageTheme: StreamMessageThemeData(
messageAuthorStyle:
textTheme.footnote.copyWith(color: colorTheme.textLowEmphasis),
messageTextStyle: textTheme.body,
messageDeletedStyle: textTheme.body.copyWith(
color: colorTheme.textLowEmphasis,
fontStyle: FontStyle.italic,
),
createdAtStyle:
textTheme.footnote.copyWith(color: colorTheme.textLowEmphasis),
repliesStyle: textTheme.footnoteBold.copyWith(color: accentColor),
messageBackgroundColor: colorTheme.borders,
messageBorderColor: colorTheme.borders,
reactionsBackgroundColor: colorTheme.barsBg,
reactionsBorderColor: colorTheme.borders,
reactionsMaskColor: colorTheme.appBg,
avatarTheme: StreamAvatarThemeData(
borderRadius: BorderRadius.circular(20),
constraints: const BoxConstraints.tightFor(
height: 32,
width: 32,
),
),
messageLinksStyle: TextStyle(color: accentColor),
urlAttachmentBackgroundColor: colorTheme.linkBg,
urlAttachmentHostStyle: textTheme.bodyBold.copyWith(color: accentColor),
urlAttachmentTitleStyle: textTheme.footnoteBold,
urlAttachmentTextStyle: textTheme.footnote,
urlAttachmentTitleMaxLine: 1,
urlAttachmentTextMaxLine: 3,
),
otherMessageTheme: StreamMessageThemeData(
reactionsBackgroundColor: colorTheme.borders,
reactionsBorderColor: colorTheme.borders,
reactionsMaskColor: colorTheme.appBg,
messageTextStyle: textTheme.body,
messageDeletedStyle: textTheme.body.copyWith(
color: colorTheme.textLowEmphasis,
fontStyle: FontStyle.italic,
),
createdAtStyle:
textTheme.footnote.copyWith(color: colorTheme.textLowEmphasis),
messageAuthorStyle:
textTheme.footnote.copyWith(color: colorTheme.textLowEmphasis),
repliesStyle: textTheme.footnoteBold.copyWith(color: accentColor),
messageLinksStyle: TextStyle(color: accentColor),
messageBackgroundColor: colorTheme.barsBg,
messageBorderColor: colorTheme.borders,
avatarTheme: StreamAvatarThemeData(
borderRadius: BorderRadius.circular(20),
constraints: const BoxConstraints.tightFor(
height: 32,
width: 32,
),
),
urlAttachmentBackgroundColor: colorTheme.linkBg,
urlAttachmentHostStyle: textTheme.bodyBold.copyWith(color: accentColor),
urlAttachmentTitleStyle: textTheme.footnoteBold,
urlAttachmentTextStyle: textTheme.footnote,
urlAttachmentTitleMaxLine: 1,
urlAttachmentTextMaxLine: 3,
),
messageInputTheme: StreamMessageInputThemeData(
borderRadius: BorderRadius.circular(20),
sendAnimationDuration: const Duration(milliseconds: 300),
actionButtonColor: colorTheme.accentPrimary,
actionButtonIdleColor: colorTheme.textLowEmphasis,
expandButtonColor: colorTheme.accentPrimary,
sendButtonColor: colorTheme.accentPrimary,
sendButtonIdleColor: colorTheme.disabled,
inputBackgroundColor: colorTheme.barsBg,
inputTextStyle: textTheme.body,
linkHighlightColor: colorTheme.accentPrimary,
idleBorderGradient: LinearGradient(
colors: [
colorTheme.disabled,
colorTheme.disabled,
],
),
activeBorderGradient: LinearGradient(
colors: [
colorTheme.disabled,
colorTheme.disabled,
],
),
useSystemAttachmentPicker: false,
),
galleryHeaderTheme: StreamGalleryHeaderThemeData(
closeButtonColor: colorTheme.textHighEmphasis,
backgroundColor: channelHeaderTheme.color,
iconMenuPointColor: colorTheme.textHighEmphasis,
titleTextStyle: textTheme.headlineBold,
subtitleTextStyle: channelPreviewTheme.subtitleStyle,
bottomSheetBarrierColor: colorTheme.overlay,
),
galleryFooterTheme: StreamGalleryFooterThemeData(
backgroundColor: colorTheme.barsBg,
shareIconColor: colorTheme.textHighEmphasis,
titleTextStyle: textTheme.headlineBold,
gridIconButtonColor: colorTheme.textHighEmphasis,
bottomSheetBarrierColor: colorTheme.overlay,
bottomSheetBackgroundColor: colorTheme.barsBg,
bottomSheetPhotosTextStyle: textTheme.headlineBold,
bottomSheetCloseIconColor: colorTheme.textHighEmphasis,
),
messageListViewTheme: StreamMessageListViewThemeData(
backgroundColor: colorTheme.barsBg,
),
pollCreatorTheme: StreamPollCreatorThemeData(
backgroundColor: colorTheme.appBg,
appBarBackgroundColor: colorTheme.barsBg,
appBarElevation: 1,
appBarTitleStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
questionTextFieldFillColor: colorTheme.inputBg,
questionHeaderStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
questionTextFieldStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
questionTextFieldErrorStyle: textTheme.footnote.copyWith(
color: colorTheme.accentError,
),
questionTextFieldBorderRadius: BorderRadius.circular(12),
optionsTextFieldFillColor: colorTheme.inputBg,
optionsHeaderStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
optionsTextFieldStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
optionsTextFieldErrorStyle: textTheme.footnote.copyWith(
color: colorTheme.accentError,
),
optionsTextFieldBorderRadius: BorderRadius.circular(12),
switchListTileFillColor: colorTheme.inputBg,
switchListTileTitleStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
switchListTileErrorStyle: textTheme.footnote.copyWith(
color: colorTheme.accentError,
),
switchListTileBorderRadius: BorderRadius.circular(12),
),
pollInteractorTheme: StreamPollInteractorThemeData(
pollTitleStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollSubtitleStyle: textTheme.footnote.copyWith(
color: colorTheme.textLowEmphasis,
),
pollOptionTextStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
pollOptionVoteCountTextStyle: textTheme.footnote.copyWith(
color: colorTheme.textLowEmphasis,
),
pollOptionCheckboxShape: const CircleBorder(),
pollOptionCheckboxCheckColor: Colors.white,
pollOptionCheckboxActiveColor: colorTheme.accentPrimary,
pollOptionCheckboxBorderSide: BorderSide(
width: 2,
color: colorTheme.disabled,
),
pollOptionVotesProgressBarMinHeight: 4,
pollOptionVotesProgressBarTrackColor: colorTheme.disabled,
pollOptionVotesProgressBarValueColor: colorTheme.accentPrimary,
pollOptionVotesProgressBarWinnerColor: colorTheme.accentInfo,
pollOptionVotesProgressBarBorderRadius: BorderRadius.circular(4),
pollActionButtonStyle: TextButton.styleFrom(
textStyle: textTheme.headline,
foregroundColor: colorTheme.accentPrimary,
),
pollActionDialogTitleStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollActionDialogTextFieldStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
pollActionDialogTextFieldBorderRadius: BorderRadius.circular(12),
pollActionDialogTextFieldFillColor: colorTheme.inputBg,
),
pollResultsDialogTheme: StreamPollResultsDialogThemeData(
backgroundColor: colorTheme.appBg,
appBarElevation: 1,
appBarBackgroundColor: colorTheme.barsBg,
appBarTitleTextStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollTitleTextStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollTitleDecoration: BoxDecoration(
color: colorTheme.inputBg,
borderRadius: BorderRadius.circular(12),
),
pollOptionsDecoration: BoxDecoration(
color: colorTheme.inputBg,
borderRadius: BorderRadius.circular(12),
),
pollOptionsWinnerDecoration: BoxDecoration(
color: colorTheme.inputBg,
borderRadius: BorderRadius.circular(12),
),
pollOptionsTextStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollOptionsWinnerTextStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollOptionsVoteCountTextStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
pollOptionsWinnerVoteCountTextStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
pollOptionsShowAllVotesButtonStyle: TextButton.styleFrom(
textStyle: textTheme.headline,
foregroundColor: colorTheme.accentPrimary,
),
),
pollOptionsDialogTheme: StreamPollOptionsDialogThemeData(
backgroundColor: colorTheme.appBg,
appBarElevation: 1,
appBarBackgroundColor: colorTheme.barsBg,
appBarTitleTextStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollTitleTextStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollTitleDecoration: BoxDecoration(
color: colorTheme.inputBg,
borderRadius: BorderRadius.circular(12),
),
pollOptionsListViewDecoration: BoxDecoration(
color: colorTheme.inputBg,
borderRadius: BorderRadius.circular(12),
),
),
pollCommentsDialogTheme: StreamPollCommentsDialogThemeData(
backgroundColor: colorTheme.appBg,
appBarElevation: 1,
appBarBackgroundColor: colorTheme.barsBg,
appBarTitleTextStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollCommentItemBackgroundColor: colorTheme.inputBg,
pollCommentItemBorderRadius: BorderRadius.circular(12),
updateYourCommentButtonStyle: TextButton.styleFrom(
textStyle: textTheme.headlineBold,
foregroundColor: colorTheme.accentPrimary,
backgroundColor: colorTheme.inputBg,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.symmetric(
vertical: 18,
horizontal: 16,
),
),
),
pollOptionVotesDialogTheme: StreamPollOptionVotesDialogThemeData(
backgroundColor: colorTheme.appBg,
appBarElevation: 1,
appBarBackgroundColor: colorTheme.barsBg,
appBarTitleTextStyle: textTheme.headlineBold.copyWith(
color: colorTheme.textHighEmphasis,
),
pollOptionVoteCountTextStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
pollOptionWinnerVoteCountTextStyle: textTheme.headline.copyWith(
color: colorTheme.textHighEmphasis,
),
pollOptionVoteItemBackgroundColor: colorTheme.inputBg,
pollOptionVoteItemBorderRadius: BorderRadius.circular(12),
),
threadListTileTheme: StreamThreadListTileThemeData(
backgroundColor: colorTheme.barsBg,
padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 8),
threadUnreadMessageCountStyle: textTheme.footnoteBold.copyWith(
color: Colors.white,
),
threadUnreadMessageCountBackgroundColor:
channelPreviewTheme.unreadCounterColor,
threadChannelNameStyle: textTheme.bodyBold.copyWith(
color: colorTheme.textHighEmphasis,
),
threadReplyToMessageStyle: textTheme.footnote.copyWith(
color: colorTheme.textLowEmphasis,
),
threadLatestReplyTimestampStyle: textTheme.footnote.copyWith(
color: colorTheme.textLowEmphasis,
),
threadLatestReplyUsernameStyle: textTheme.bodyBold.copyWith(
color: colorTheme.textHighEmphasis,
),
threadLatestReplyMessageStyle: textTheme.body.copyWith(
color: colorTheme.textLowEmphasis,
),
),
audioWaveformTheme: audioWaveformTheme,
audioWaveformSliderTheme: audioWaveformSliderTheme,
voiceRecordingAttachmentTheme: StreamVoiceRecordingAttachmentThemeData(
backgroundColor: colorTheme.barsBg,
playIcon: const StreamSvgIcon(icon: StreamSvgIcons.play),
pauseIcon: const StreamSvgIcon(icon: StreamSvgIcons.pause),
loadingIndicator: SizedBox.fromSize(
size: const Size.square(24 - /* Padding */ 2),
child: Center(
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(colorTheme.accentPrimary),
),
),
),
audioControlButtonStyle: ElevatedButton.styleFrom(
elevation: 2,
iconColor: Colors.black,
padding: const EdgeInsets.symmetric(horizontal: 6),
backgroundColor: Colors.white,
shape: const CircleBorder(),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
minimumSize: const Size(36, 36),
),
titleTextStyle: textTheme.bodyBold.copyWith(
color: colorTheme.textHighEmphasis,
),
durationTextStyle: textTheme.footnote.copyWith(
color: colorTheme.textLowEmphasis,
),
speedControlButtonStyle: ElevatedButton.styleFrom(
elevation: 2,
textStyle: textTheme.footnote,
foregroundColor: Colors.black,
padding: const EdgeInsets.symmetric(horizontal: 8),
backgroundColor: Colors.white,
shape: const StadiumBorder(),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
minimumSize: const Size(40, 28),
),
audioWaveformSliderTheme: audioWaveformSliderTheme,
),
voiceRecordingTheme: colorTheme.brightness == Brightness.dark
? StreamVoiceRecordingThemeData.dark()
: StreamVoiceRecordingThemeData.light(),
);
}