Skip to content

ContextPanel

A panel listing what is in the model’s context window — files, messages, tool output — with each item’s kind, priority, and token count under a one-line total. Turn on showTokenShare to append each item’s share of the panel’s tokens and make it obvious which items dominate the window.

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

ContextPanel(
showTokenShare: true,
usage: const TokenUsage(
input: 9200,
output: 3100,
contextUsed: 12300,
contextLimit: 200000,
),
items: const <ContextItem>[
ContextItem(
id: 'a',
label: 'lib/main.dart',
kind: ContextItemKind.file,
tokenCount: 410,
),
ContextItem(
id: 'b',
label: 'pubspec.yaml',
kind: ContextItemKind.file,
tokenCount: 120,
),
ContextItem(
id: 'c',
label: 'dart test',
kind: ContextItemKind.command,
tokenCount: 90,
),
],
)
ParameterTypeDefaultDescription
items:List<ContextItem>requiredContext items to display, select, activate, and copy.
usage:TokenUsage?—Optional overall token usage, shown in the summary line (such as 12k/200k 6%) and exposed through semantics. Without it, the summary shows the items’ combined tokens.
controller:ContextPanelController?—External selection and visible-range controller.
focusNode:FocusNode?—Focus node used for keyboard navigation.
autofocus:boolfalseWhether the panel should request focus when mounted.
label:String'Context'Semantic and visual label for the panel.
maxVisible:int6Maximum visible rows before the list scrolls.
showTokenShare:boolfalseAppend each item’s share of the items’ combined tokens to its count, such as 1k (12%). Off by default. Makes it obvious at a glance which items dominate the context window. Items with no tokens, or when the total is zero, get no share suffix.
copySelection:booltrueWhether Ctrl+C and semantic copy export the selected item.
copyOptions:ContextPanelCopyOptionsconst ContextPanelCopyOptions()Clipboard/export options for selected-item copy.
onSelect:void Function(ContextPanelSelectResult result)?—Called when a context item is activated.
onCopy:void Function(ContextPanelCopyResult result)?—Called after a copy attempt completes.

ContextPanel is defined in packages/fleury/lib/src/catalog/context_panel.dart.

Category: Agent surfaces · All widgets