Skip to content
Theming

Flutter SDK

Theme the Flutter messenger

Match messenger colors, typography, empty states, links, and sheet presentation to the host Flutter application.

Theme the packaged messenger

Pass BtxClientTheme through BtxMessengerOptions. The theme applies to the conversation history, composer, message links, empty state, controls, and foreground reply banners owned by the messenger.

Messenger theme
final messengerTheme = BtxClientTheme(
  backgroundColor: const Color(0xFF0B1020),
  primaryTextColor: const Color(0xFFF8FAFC),
  secondaryTextColor: const Color(0xFFCBD5E1),
  emptyStateLogo: const AssetImage('assets/acme-wordmark.png'),
  emptyStateAccentColor: const Color(0xFF8B5CF6),
  primaryCtaColor: const Color(0xFF8B5CF6),
  primaryCtaTextColor: Colors.white,
  linkColor: const Color(0xFF60A5FA),
);

await Btx.configure(
  BtxConfiguration(
    publishableClientKey: 'cfk_...',
    messengerOptions: BtxMessengerOptions(
      theme: messengerTheme,
      sheetConfiguration: const BtxMessengerSheetConfiguration(
        title: 'Messages',
        emptyPromptTitle: 'Talk to Acme',
        emptyPromptMessage: 'Send us a message and our team will reply.',
        createThreadLabel: 'Start a conversation',
      ),
    ),
  ),
);
01

Start with semantic colors

Set the background, primary and secondary text, CTA, CTA text, link, and empty state accent colors first. Add heroTextStyle, titleTextStyle, or bodyTextStyle only when host typography needs an explicit match.

  • Keep primary text legible over the configured background.
  • Keep CTA text legible over primaryCtaColor.
  • Choose a link color that remains distinct inside customer and operator message bubbles.
  • Use bounded artwork so the empty-state logo does not dominate the messenger.
02

Configure sheet presentation

BtxMessengerSheetConfiguration controls the customer-facing labels, sheet height, density, top radius, barrier, and whether hidden-messenger foreground reply banners appear.

Compact support sheet
const BtxMessengerSheetConfiguration(
  title: 'Support',
  heightFactor: 0.92,
  layoutDensity: BtxMessengerLayoutDensity.compact,
  borderRadius: BorderRadius.vertical(
    top: Radius.circular(24),
  ),
  showForegroundNotificationsWhenHidden: true,
)

Use BtxMessengerLayoutDensity.regular for the default spacing and .compact when the host needs a denser layout. Verify text scaling and small screens after changing height or density.

03

Know the theme boundary

BtxClientTheme configures the packaged messenger. The knowledge base viewer uses its own SDK defaults in the facade integration. Lower-level knowledge base implementation types are not the recommended host customization path.