flutter_ai_elements 0.1.5 copy "flutter_ai_elements: ^0.1.5" to clipboard
flutter_ai_elements: ^0.1.5 copied to clipboard

Composable, themeable Flutter UI for AI chat — conversation, message bubbles, a streaming-aware composer, and a loader — styled entirely through a mobile-first AiThemeExtension. No shadcn/forui dependency.

flutter_ai_elements #

☕ Support this project #

Buy me a coffee on Ko-fi

If flutter_ai saves you time, buy me a coffee ☕ — it keeps the whole family maintained.


flutter_ai chat

Markdown response Parallel tool calls Sources

Reasoning Chain of thought Confirmation

Composable, themeable Flutter UI for AI chat — the UI layer of the flutter_ai family.

It adopts the Vercel AI Elements component vocabulary but renders through a mobile-first AiThemeExtension, built from base Flutter widgets. No shadcn_flutter / forui dependency, no hardcoded Material or Cupertino look — restyle everything via theme tokens.

Widgets #

Presentational (plain data + callbacks; reusable, testable):

  • AiMessageBubble — renders one message's parts (text, reasoning, tool calls, results, files, sources, data), role-aware, with streaming-safe semantics.
  • AiConversationView — a scrolling list of bubbles, optional thinking loader.
  • AiComposer — input with a leading attach (+) button and a main button that is Live while empty, Send once you type, and Stop while streaming; emits haptics.
  • AiLoader — a pulsing three-dot thinking indicator.

Controller-bound (wire to a UseChatController):

  • AiChat — live transcript with auto-scroll and a thinking loader.
  • AiPromptInput — composer wired to sendText / stop.

Quick start #

import 'package:flutter/material.dart';
import 'package:flutter_ai_elements/flutter_ai_elements.dart';

class ChatScreen extends StatelessWidget {
  const ChatScreen({super.key, required this.controller});
  final UseChatController controller; // from flutter_ai_client

  @override
  Widget build(BuildContext context) => Scaffold(
        body: Column(
          children: [
            Expanded(child: AiChat(controller: controller)),
            AiPromptInput(controller: controller),
          ],
        ),
      );
}

Theming #

Register an AiThemeExtension (or override the default) on your ThemeData:

MaterialApp(
  theme: ThemeData(
    extensions: [
      AiThemeExtension.fallback().copyWith(
        userBubbleColor: const Color(0xFF7C3AED),
        bubbleRadius: const BorderRadius.all(Radius.circular(28)),
        enableHaptics: true,
      ),
    ],
  ),
  home: const ChatScreen(...),
);

Widgets read tokens via AiThemeExtension.of(context), falling back to the mobile-first default when none is registered. All visual constants live behind this one extension, so a future flutter_ai_design_system can extract them without breaking the API.

Rich text #

Text renders through an injectable AiTextRenderer (TextRenderer<Widget>); the default is PlainTextRenderer. Provide your own for Markdown, code highlighting, or LaTeX:

AiChat(controller: controller, textRenderer: MyMarkdownRenderer());

Status #

0.1.0. Published on pub.dev; depends on the sibling flutter_ai packages. See example/ for a full app.

1
likes
0
points
722
downloads

Publisher

unverified uploader

Weekly Downloads

Composable, themeable Flutter UI for AI chat — conversation, message bubbles, a streaming-aware composer, and a loader — styled entirely through a mobile-first AiThemeExtension. No shadcn/forui dependency.

Homepage
Repository (GitHub)
View/report issues

Topics

#ai #llm #chat #streaming #widget

License

unknown (license)

Dependencies

flutter, flutter_ai_client, flutter_ai_core

More

Packages that depend on flutter_ai_elements