Open ChatGPT or Gemini and tap the waveform icon: the chat UI disappears. No bubbles, no list — a full-screen surface with an orb that breathes while it waits, ripples while you talk, and morphs while the model speaks back. Voice mode is quietly becoming the default interface for AI apps, and users now expect it.

Yet almost everything published for Flutter is still a chat-bubble template. I wanted the other thing — the ambient, full-screen voice experience — built with nothing but the SDK. No packages, no native code, just dart:ui, gestures, and a state machine. This article breaks down how it works. The complete implementation is open as a showcase repo, and the finished kit is linked at the end.

What a full-screen voice UI actually needs

Strip the visuals away and six hard problems remain:

  1. A state machine. idle → listening → processing → speaking, plus error. Every animation, button behavior, and haptic derives from this. If your state is a pile of booleans, the UI will glitch under race conditions.
  2. An orb. One CustomPaint, one AnimationController, motion that changes per state.
  3. A waveform. Live amplitude bars driven by the mic stream while listening.
  4. A live transcript. Partial results dimmed, finals committed, auto-scroll pinned to the bottom — that politely yields when the user scrolls up.
  5. Gesture handling. Tap-to-toggle and hold-to-talk, with slide-off-to-cancel and accidental-tap rejection.
  6. A permission flow. A primer screen that explains why before the system prompt, and routes to a typing fallback on denial.

Let's go through the ones that carry the most weight.

1. A typed engine boundary

The UI should never know whether it's talking to a platform speech API, a websocket, or a test fake. Define a narrow interface with sealed events:

sealed class VoiceEvent { const VoiceEvent(); } class VoiceLevelEvent extends VoiceEvent { // mic amplitude, 0.0-1.0 const VoiceLevelEvent(this.level); final double level; } class UserPartialEvent extends VoiceEvent { // interim recognition result const UserPartialEvent(this.text); final String text; } class UserFinalEvent extends VoiceEvent { // end of speech const UserFinalEvent(this.text); final String text; } 
class AssistantReplyEvent extends VoiceEvent { // the model's answer const AssistantReplyEvent(this.text); final String text; } class SpeakingCompletedEvent extends VoiceEvent { const SpeakingCompletedEvent(); } class VoiceErrorEvent extends VoiceEvent { const VoiceErrorEvent(this.message); final String message; } abstract class VoiceEngine { Stream<VoiceEvent> get events; Future<void> startListening(); Future<void> stopListening(); Future<void> sendUserText(String text); // accessibility / typing fallback Future<bool> requestPermission(); void dispose(); } 

That's the whole contract — everything above this line is pure Flutter. A speech_to_text implementation, a Whisper websocket, or a scripted fake all plug in behind it, and no widget ever changes.

2. The state machine folds events, nothing else

The controller is a ChangeNotifier that subscribes to the engine's stream and maps each event to a state transition:

enum VoiceState { idle, listening, processing, speaking, error } void _onEvent(VoiceEvent event) { switch (event) { case VoiceLevelEvent(:final level): _onLevel(level); // smooth + push into waveform case UserPartialEvent(:final text): _upsertUserUtterance(text, isPartial: true); case UserFinalEvent(:final text): _upsertUserUtterance(text, isPartial: false); _setState(VoiceState.processing); case AssistantReplyEvent(:final text): _upsertAssistantUtterance(text, isPartial: false); _setState(VoiceState.speaking); haptics.impact(); case SpeakingCompletedEvent(): _setState(autoLoop ? VoiceState.listening : VoiceState.idle); case VoiceErrorEvent(:final message): _errorMessage = message; _setState(VoiceState.error); } } 

Two details that matter in production:

  • Partials collapse into one slot. The partial utterance replaces the previous partial instead of appending, so the transcript never flickers or duplicates while recognition streams in.
  • Amplitude is smoothed on the way in. Raw mic levels arrive at whatever rate the platform feels like. Exponential smoothing (value += (raw - value) * 0.35) lets you push noisy data in at any rate without visual stutter.

3. The breathing orb: one painter, five moods

One painter, one repeating controller, and the state decides how time maps to pixels: idle breathes on a slow sine, listening emits expanding ripples scaled by the live level, processing rotates an arc, speaking modulates an organic blob radius, error pulses. In the kit's _OrbPainter:

switch (state) { case VoiceState.idle: _paintBreathingCore(canvas, center, maxRadius * 0.62); case VoiceState.listening: _paintRipples(canvas, center, maxRadius); _paintBreathingCore(canvas, center, maxRadius * (0.42 + 0.10 * level)); case VoiceState.processing: _paintOrbit(canvas, center, maxRadius); case VoiceState.speaking: _paintSilhouette(canvas, center, maxRadius * 0.66); // the "voice blob" case VoiceState.error: _paintErrorPulse(canvas, center, maxRadius); } 

Three details do the heavy lifting in the widget that hosts this painter:

  • RepaintBoundary around the painter. The orb ticks continuously; without a boundary it drags the transcript's paint work along with it.
  • Reduced motion is free. Check it once and pin the phase:
final bool reducedMotion = MediaQuery.maybeDisableAnimationsOf(context) ?? false; // reduced: render the orb static, t pinned at 0.25 (mid-breath) 
  • Colors come from a ThemeExtension. Each state has a gradient/glow/accent palette for light and dark, so restyling never touches kit code.

4. The waveform: a history buffer and a painter

The engine emits amplitude samples while listening or speaking — real mic levels from speech_to_text's onSoundLevelChange, or synthetic ones from the mock. The controller keeps a fixed-length history (newest first) and the painter walks it with a per-bar attenuation so the shape reads as a wave instead of a comb:

if (_waveform.length >= waveformBars) { _waveform = <double>[..._waveform.sublist(1), _level]; } else { _waveform = <double>[..._waveform, _level]; } 
// in the painter final double recency = 1 - (i / n) * 0.45; // older bars decay final double h = (v * maxHalf * recency).clamp(3.0, maxHalf); 

The same buffer feeds two styles — bottom-anchored bars and center-mirrored bars — selected from the settings screen.

5. Hold-to-talk is a gesture-arena problem

A voice mic has two sane trigger modes, and both need to survive real fingers:

  • Tap-to-toggle: tap opens the mic, tap again closes it.
  • Hold-to-talk: long-press opens, release closes. A quick tap under 250 ms is rejected as accidental, and a pointer cancel (finger slides off the button, a system gesture steals the pointer) must stop capture — a mic that stays open after a cancelled gesture is a bug your users will find for you.
onLongPressStart: (_) { _pressStart = DateTime.now(); _capturing = true; onStart(); }, onLongPressEnd: (_) => _releaseHold(), onLongPressCancel: () => _releaseHold(cancelled: true), 

While a reply is being spoken, the same button becomes tap to interrupt — barge-in is just stopListening from a different state.

6. The scripted mock engine: the reason this is testable

You can't write widget tests against a real microphone, and you can't demo an app that shows an empty orb. The kit ships a MockVoiceEngine that plays a scripted conversation: amplitude ticks every 50 ms, partial results at human cadence, an end-of-speech detector that fires the final transcript, processing latency, then the reply with its own speaking envelope.

Because it's just another VoiceEngine, main.dart wires it end-to-end and flutter run works offline with zero setup — and the widget tests drive it deterministically with tester.pump:

await engine.startListening(); await tester.pump(const Duration(milliseconds: 400)); expect(find.text('Hey'), findsOneWidget); // first partial landed await tester.pump(const Duration(milliseconds: 2900)); expect(controller.state, VoiceState.speaking); // reply is being spoken 

When you're ready for real speech, implement VoiceEngine once — the UI, the tests' structure, and the settings all stay as they are.

The numbers

The kit ships 17 Dart files under lib/, 8 test files with 70 passing tests, and flutter analyze reports 0 issues — with zero third-party dependencies. It targets Flutter 3.35 → 3.50+.