ChatTheme.fromTheme constructor

ChatTheme.fromTheme(
  1. ThemeData theme
)

Creates a ChatTheme from a Flutter ThemeData This allows the chat widget to adopt the app's theme

Implementation

factory ChatTheme.fromTheme(ThemeData theme) {
  return ChatTheme(
    userBubbleColor: theme.colorScheme.primary,
    botBubbleColor: theme.colorScheme.surfaceContainerHighest,
    userTextStyle: TextStyle(color: theme.colorScheme.onPrimary),
    botTextStyle: TextStyle(color: theme.colorScheme.onSurfaceVariant),
    sendButtonColor: theme.colorScheme.primary,
    sendButtonDisabledColor: theme.disabledColor,
    loadingIndicatorColor: theme.colorScheme.primary,
    backgroundColor: theme.scaffoldBackgroundColor,
    userBubbleBorderRadius: BorderRadius.circular(16),
    botBubbleBorderRadius: BorderRadius.circular(16),
  );
}