StreamChatThemeData.fromColorAndTextTheme constructor

StreamChatThemeData.fromColorAndTextTheme(
  1. StreamColorTheme colorTheme,
  2. 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(
      color: colorTheme.textHighEmphasis.withOpacity(0.5),
    ),
    indicatorIconSize: 16,
  );
  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,
      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,
      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,
        ],
      ),
    ),
    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,
    ),
  );
}