Skip to content

feat: variant-aware code pane in the code block's own style - #20

Merged
divyanshub024 merged 3 commits into
mainfrom
dv/playground-code-pane
Aug 23, 2026
Merged

feat: variant-aware code pane in the code block's own style#20
divyanshub024 merged 3 commits into
mainfrom
dv/playground-code-pane

Conversation

@divyanshub024

@divyanshub024 divyanshub024 commented Aug 23, 2026

Copy link
Copy Markdown
Member

Summary

Reworks the playground's code panel so it reads like the package instead of like VS Code, and keeps its snippet in step with the stage:

  • The snippet is typeset in the code block's own style: the package's built-in FlowSyntaxHighlighter over the theme's FlowSyntaxColors and Geist Mono code role, directly on the panel's ground with no card chrome. The syntax_highlight dependency, its bundled grammars, and the startup init are gone.
  • Snippets follow the variant pills. snippetFor takes the stage's active variant and every demo now ships per-variant code: composer streaming, message roles, each code block language, all four markdown variants, error card/minimal/failed turn, pill forms, attachments, thread default/streaming/short, and the on/off pairs for the streaming, shimmer, thinking, suggestions and greeting demos.
  • The panel resizes by dragging its left edge, clamped between the default 400px and 720px; double-tap snaps it back. The width tracks the pointer directly, with the slide easing reserved for open and close.
  • Copy and close sit together as matching header chips; copy is always visible and flips to a primary-tinted check while the confirmation lasts, resetting when the demo or variant changes.

The highlighter is not part of the public barrel, so the panel reaches into package:flow_ui/src/ for it with a commented, lint-acknowledged import. The playground absorbs that coupling instead of the package growing panel-only API.

Screenshots

Before After

How this was verified

flutter analyze clean in playground/ and the package root, dart format applied, and a full flutter build web compile. Exercised the panel in the running playground: variant pills swap the snippet, drag resize with clamping and double-tap reset, copy confirmation, and both themes.

Checklist

  • flutter analyze lib and flutter analyze in example/ and playground/ are clean
  • dart format . applied
  • Exercised in the playground — with a stage demo added or updated if this is a new component or variant
  • No new entries under dependencies: in pubspec.yaml (Flutter SDK and flutter.dev packages only)
  • Nothing model-facing — no prompts, schemas, or provider/network calls
  • New public API is exported from lib/flow_ui.dart and documented in docs/ and the README table
  • CHANGELOG.md updated for user-facing changes, with breaking changes called out
  • PR title follows conventional commits (feat:, fix:, refactor:, docs:, chore:)

Note

Low Risk
Playground-only UI and demo snippet changes; no package public API or runtime product paths.

Overview
Reworks the playground code panel so snippets look like FlowCodeBlock and stay in step with the stage.

Drops syntax_highlight (and its async grammar init) in favor of the package’s built-in FlowSyntaxHighlighter over theme syntax colors and the code typeface. The panel reaches into flow_ui/src for that highlighter rather than expanding public API.

snippetFor now takes the active variant; demos ship per-pill snippets (composer streaming, message roles, code languages, markdown/error/pill/thread forms, and on/off pairs). The pane is drag-resizable (400–720px, double-tap reset), with copy/close as matching header chips.

Reviewed by Cursor Bugbot for commit d856db3. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f5d3f0e. Configure here.

Comment thread playground/lib/src/demos/pill_demo.dart
Comment thread playground/lib/src/demos/streaming_message_demo.dart
@divyanshub024
divyanshub024 merged commit 6b8a483 into main Aug 23, 2026
5 checks passed
@divyanshub024
divyanshub024 deleted the dv/playground-code-pane branch August 23, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants