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

Composable, themeable Flutter UI for AI chat: conversation view, message bubbles, a streaming-aware composer, and a loader, styled through a mobile-first theme extension.

Changelog #

0.3.0 #

Accessibility, internationalization, and cross-fork compile fixes.

  • Fix: aiLightHaptic compiles against both upstream Flutter and the OHOS Flutter fork. The exhaustive TargetPlatform switch could not cover both enums at once (the fork adds TargetPlatform.ohos), so it is now an iOS/Android allowlist. Thanks to @HeZeBang. (#149)
  • Fix: strings that bypassed AiLocalizations are now localizable — tool-call section labels (toolArguments/toolResult/toolError), the context meter (contextLabel), source expand/collapse (moreSources/showLess), live voice statuses (liveConnecting/liveListening/liveThinking/ liveSpeaking), the empty-state headline (emptyStateTitle), the inline citation and model-selector semantics labels (citation/selectModel), and the attachment remove badge (removeAttachment). (#128)
  • Fix: touch targets below the 44px platform minimum — the attachment remove badge and AiBranch's navigation arrows now use InkResponse over a 44px box, which also gives them focus traversal and keyboard activation. AiModelSelector's trigger moves from GestureDetector to InkWell for the same reason. (#128)
  • Fix: the caution-tone confirm button painted white on amber (~2.2:1). The label color is now derived from the fill's brightness, and the buttons use a minHeight instead of a fixed 40px height so labels are not clipped at large text scales. (#128)
  • Fix: RTL gaps — the streaming loader alignment, the "New chat" label, and the Markdown blockquote's border/padding are now directional. (#128)
  • Potentially source-breaking: AiChainOfThought.title, AiContextMeter.label, AiEmptyState.title, and AiComposer.hintText are now String? and default to the matching AiLocalizations value. Passing a string still works; only reading one of these fields as a non-nullable String needs a change.

0.2.0 #

Extensibility release — driven by dogfooding a full Gemini-clone app on the packages. All changes are additive; requires flutter_ai_client ^0.3.0.

  • Add AiThemeExtension.chipColor (resolved via effectiveChipColor) so bubble-less themes (a transparent assistantBubbleColor) keep visible suggestion chips, the selected AiConversationList row, and the scroll-to-latest button instead of having them vanish. (#135)
  • AiModelSelector: add labelStyle, labelBuilder, showBorder, and padding so the trigger chip can be brand-styled (e.g. a larger two-tone title) while keeping the package's picker sheet. (#143)
  • AiConversationList: add header, footer, and a per-thread trailingBuilder so a real sidebar can have section headers, an account footer, and custom per-thread affordances (pin/overflow). (#144)
  • AiMessageActions: add order and trailing (with the new AiMessageActionKind enum) to reorder actions and push some — e.g. read-aloud — to the far side. (#145)
  • AiEmptyState: add titleStyle, subtitleStyle, and a background slot for a gradient/hero greeting. (#141)
  • AiPromptInput: add textController so voice dictation / quick-replies can populate the composer for review instead of dictate-and-send. (#138)
  • Add AiLiveController + AiVoiceEngine: a drop-in listen → send → speak → re-listen state machine that maps a UseChatController and a pluggable audio engine onto AiLiveSession, so live-voice plumbing no longer lives entirely in the app. (#139)
  • AiLiveSession: add a backgroundColor knob for apps that want a non-black live surface. (#146)
  • Docs: document the share_plus recipe on AiMessageActions.onShare (the package ships no share implementation to stay plugin-free). (#142)

0.1.16 #

  • Fix: AiChat auto-scroll no longer fights mouse-wheel, trackpad, or keyboard scrolling during streaming. The top-pin now releases on any upward user-initiated scroll (UserScrollNotification), not only touch drags, so scrolling up to re-read while the response streams works on desktop/web.
  • Fix: AiComposer's main button is now Send (not Live) whenever there are staged attachments, so tapping it with an attachment-only draft sends the attachment instead of launching full-screen voice mode.

0.1.15 #

  • Fix: raise the flutter_ai_core (^0.1.11) and flutter_ai_client (^0.2.0) lower bounds so dependency downgrades can't resolve sibling versions the widgets can't compile against.
  • Docs: shortened the pubspec description into pub.dev's 60–180 character window.

0.1.14 #

  • Widen the flutter_ai_client constraint to >=0.1.0 <0.3.0 so it resolves with client 0.2.0 (which adds the tool-call cancellation signal). No API changes here.

0.1.13 #

  • Docs: refreshed the README listing with a hero image, screenshot gallery, and badges (consistent across the package family). No code changes.

0.1.12 #

UX polish bundle:

  • Skeleton shimmer that crossfades into the first streamed token, and a streaming→Markdown crossfade when a turn finishes (both reduced-motion aware).
  • Reading-width column: new AiThemeExtension.maxContentWidth (default 720) centers long answers on wide screens; set to double.infinity to disable.
  • AiEmptyState gains a brand glyph and tappable suggestions.
  • Light haptics on turn completion, confirmation, and chip taps (opt-out via enableHaptics; no-op on web/desktop).
  • Markdown: strikethrough, horizontal rules, and GFM task-list checkboxes; link color is now themeable (AiThemeExtension.linkColor).
  • Source chips: numeric index badge, hover state, and an opt-in favicon (AiSources.showFavicons, default off — fetching discloses cited hosts to a third-party service).
  • AiConfirmation.tone (neutral/caution/danger) restyles the confirm button; danger uses the theme error color.
  • New AiOrb widget and a themeable live-session orb (AiThemeExtension.orbColor).

0.1.11 #

  • Reduce-motion: AiLoader and AiShimmer now hold a static state (and stop their controllers) when the platform "reduce motion" setting is on, completing the accessibility pass across the animated widgets.

0.1.10 #

  • AiAnimatedResponse shows a blinking caret at the streaming edge (the "being written" cue); it holds steady under reduce-motion.

0.1.9 #

  • Focus / hover / keyboard on the primary controls (desktop & web): the composer's attach/mic and send buttons and the confirmation Allow/Deny buttons use Material ink + focus traversal + Enter/Space instead of bare gesture detectors. The send/stop/live button now morphs (AnimatedSwitcher) and Stop reads as a distinct error-toned affordance.

0.1.8 #

  • Semantic theme tokens: AiThemeExtension gains errorColor, successColor, warningColor, codeBackgroundColor, and codeForegroundColor (light + dark defaults). Previously-hardcoded error/success/warning colors and the code block's dark palette now read from the theme, so the family is fully rebrandable.

0.1.7 #

  • AiChatView: a batteries-included drop-in (transcript + composer + layout + safe area) so a working chat is a single widget in your Scaffold body.

0.1.6 #

  • Declare supported platforms (Android/iOS/web/macOS/Windows/Linux) for the pub.dev listing; fix a stale library-doc reference (AiChat, not the removed AiConversation widget name).

0.1.5 #

  • Performance: AiConversationView memoizes bubbles by message identity, so only the changing message rebuilds while streaming.
  • AiAnimatedResponse honors reduce-motion (renders plain text) and isolates its reveal in a RepaintBoundary.
  • AiLocalizationsScope: override UI strings with one widget, no delegate wiring. Remaining hardcoded strings (reasoning, Allow/Deny, loader/shimmer/ avatar a11y labels) are now localized.

0.1.4 #

  • Internationalization: AiLocalizations (+ AiLocalizationsDelegate) holds the widgets' user-facing strings (defaults English). Every previously-hardcoded tooltip/label/action now reads from it, so apps can translate the UI by providing a delegate. AiConversationList.newChatLabel now defaults to the localized value.

0.1.3 #

  • AiConversationList: a ChatGPT-style conversation sidebar (New chat + a list of ChatThreads with select/delete) to pair with a ChatThreadStore.

0.1.2 #

  • Generative UI: AiWidgetRegistry (a dataType→widget allowlist) and AiDataView render DataParts the model emits as your own widgets — no reflection, unknown types fall back. The demo wires its chain-of-thought / task / confirmation cards through it.

0.1.1 #

  • AiChat now anchors the message you just sent to the top of the viewport (ChatGPT-style) and holds it there while the answer streams in below, reserving just enough trailing space and releasing it as the answer grows. A drag releases the pin; a floating "scroll to latest" button appears whenever the conversation is scrolled above the bottom.
  • New AiAnimatedResponse: a blur fade-in reveal (the Apple-Intelligence / Siri look) so streamed answers appear smoothly — each newly revealed word arrives blurred and faded, then sharpens into place over fadeDuration (blurSigma controls the starting blur). Text is paced at a readable charsPerSecond (default 120) and accelerates to drain a backlog within catchUpWindow so it never trails far behind a fast stream. Only the few words at the leading edge animate at once, so the cost stays bounded. The in-flight text renders as plain prose and settles into full Markdown once complete. MarkdownTextRenderer uses it automatically while streaming.
  • AiMessageActions is restyled with compact, evenly spaced icon buttons (ChatGPT-style) and gains optional onSpeak/onGood/onBad/onShare actions.
  • AiSources collapses past maxVisible chips (default 6) behind a "+N more" toggle, so grounded answers that return dozens of sources no longer flood the bubble.
  • Pluggable syntax highlighting: AiCodeBlock, AiResponse, and MarkdownTextRenderer accept an optional CodeHighlighter that turns code + language into styled spans. The package ships no grammar engine (stays dependency-free); supply one from the app. Defaults to plain monospace.
  • Fixed the Markdown block parser hanging (and exhausting memory) when handed a partial stream that ended mid-construct, e.g. a lone # before its heading text arrived — the parser now always makes forward progress.

0.1.0 #

Initial release.

  • AiThemeExtension — a ThemeExtension of design tokens (bubble colors, shapes, ambient shadow, spacing, typography, motion, haptics) with copyWith, lerp, of(context), and a mobile-first fallback().
  • Presentational widgets: AiMessageBubble (renders every AiPart type; streaming-safe semantics), AiConversationView, AiComposer (Send↔Stop swap, haptics), AiLoader.
  • Controller-bound widgets: AiChat (live transcript with auto-scroll and a thinking loader) and AiPromptInput.
  • AiResponse — a dependency-free Markdown renderer (headings, bold/italic, inline + fenced code, lists, blockquotes, links); MarkdownTextRenderer wraps it and is now the default AiTextRenderer. PlainTextRenderer remains.
  • AiChainOfThought (stepwise timeline), AiTask (agent checklist), AiInlineCitation (numbered badge), AiBranch (version navigation), AiImage (loading/error/tap-to-zoom).
  • Input upgrades: AiComposer gains an attach button, a model-selector slot, a voice button, and removable attachment previews; AiPromptInput stages attachments and switches models via the controller. AiModelSelector, AiConfirmation (approve/deny), AiContextMeter (token usage), and AiShimmer (loading skeleton).
  • AiLiveSession — a full-screen, engine-agnostic Live voice surface (animated orb reacting to amplitude + status, live transcript, mute/keyboard/end). UI only; drive it from a realtime audio engine.
  • Performance & a11y hardening: AiResponse parses Markdown and builds gesture recognizers once per text change (not every frame) — important on the streaming hot path; AiLiveSession animates only the orb (60fps no longer rebuilds the conversation); message bubbles no longer subscribe to window size in the common bounded case; list items carry stable keys; the composer measures with the ambient text scale + direction; disclosure widgets expose button/expanded semantics; modal sheets scroll; high-traffic layout uses directional insets/alignment for RTL.
  • Re-exports flutter_ai_client (and flutter_ai_core).
1
likes
160
points
170
downloads
screenshot

Documentation

API reference

Publisher

verified publishermouazanan.dev

Weekly Downloads

Composable, themeable Flutter UI for AI chat: conversation view, message bubbles, a streaming-aware composer, and a loader, styled through a mobile-first theme extension.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#ai #llm #chat #streaming #widget

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_ai_client, flutter_ai_core

More

Packages that depend on flutter_ai_elements