Repository navigation
Composer ApprovalBar
The bar above the composer that asks the user to approve or deny a tool call, with the sibling ApprovalKeyPane (the focus marker that decides which bar answers the keys).
import 'package:agent_kit/agent_kit.dart';
Expanded, 720 px: the request on the left, the Approve, For session and Deny buttons on the right, with key hints 1, 2 and 3.
Medium, 520 px: the bar is below the 600 px compact threshold, so the three buttons sit in equal widths under the request, with no key hints. The gallery frame is labelled "actions under the request"; the code uses the compact layout here.
Phone, 390 px: the compact layout. The three buttons are equal width and have no key hints.
Deny: after Deny is pressed, the bar shows the optional reason field in place of the three buttons.
| Parameter | Type | Notes |
|---|---|---|
approval |
Approval |
Required. The request: its tool, target, diff, arguments and requestedAt. |
onDecide |
ValueChanged<ApprovalDecision> |
Required. Called with approve, approve for session, or deny (with the optional reason). |
onReview |
VoidCallback? |
Review diff callback. The button shows only when the request has a diff and this is set. |
now |
DateTime? |
The clock for the "waiting" age. When null, WaitingLabel refreshes every 30 s. |
composerEmpty |
bool Function()? |
Lets the keys 1, 2 and 3 fire while the composer is empty. |
initiallyDenying |
bool |
Default false. Starts with the deny reason field open. |
captureKeys |
bool |
Default true. When false, the keys 1, 2 and 3 are ignored. |
enabled |
bool |
Default true. |
A focus marker. Its ApprovalKeyPane wraps a pane of the workspace; only the focused pane's bar answers the keys when several panes show approvals (test: "with two panes only the focused pane's bar answers").
BbTheme roles read in approval_bar.dart:
-
ink,muted,constructiveInk(the+addedcount),dangerInk(the−removedcount),radii.field,typeScale.body(touch),typeScale.ui -
colors.borderSubtle(the Details divider) - The pill is a
StatusMarkwithChatStatus.needsYou(status/status_mark.dart), which reads theneedsYoustatus style.
- Compact is
size.isCompact(below 600 px). Compact shows the three buttons equal width under the request, and drops the key hints (approval_bar.dart:256). - Not compact: key hints
1,2and3show on the buttons (keyHint: size.isCompact ? null : '1'). Key hints also hide on touch (KitButton). - The
_WrapActslayout puts the actions under the request when the request area is narrower than_minWhat(280 px) (approval_bar.dart:573). - In the compact layout the target is shortened with
shortenPath(approval_bar.dart:345).
- The keys 1, 2 and 3 fire Approve, For session and Deny when focus is outside a text field, inside the bar but outside the reason field, or when the composer is empty (
ApprovalBardoc comment). Esc in the reason field returns to the three buttons; Enter in the reason field denies. - The reason field's semantics and the buttons' labels come from
KitButton(semanticLabel). - Tests: "the keys 1, 2 and 3 fire the actions", "Esc in the reason field goes back to the three buttons", "with two panes only the focused pane's bar answers".
- Gallery scene: the Components scene (
apps/gallery/lib/src/components_scene.dart). Specimens: the ApprovalBar frames inapps/gallery/lib/components/composer.dart. - Golden shots:
apps/gallery/test/component_shots_test.dartwritesapproval_bar_expanded,_medium,_phoneand_denytoapps/gallery/test/goldens/shots/.scenes_golden_test.dartcovers the sheet ascomponents_1000_light.pngandcomponents_1000_dark.png. -
packages/agent_kit/test/composer/approval_bar_test.dart: the pill and age, Review diff, the keys, Deny with reason, the compact layout, narrow actions, two panes, and Details. -
packages/agent_kit/test/composer/composer_golden_test.dart: the composer goldens include the bar. -
packages/agent_kit/test/compositions/agent_chat_pane_test.dart: mentions the bar.
Generated from docs/components/composer/ApprovalBar.md. Edit the file there; changes made on the wiki are overwritten.
Guides
- Package layout and pinning
- agent_kit_core
- Backend mapping
- agent_kit and the gallery
- Icon and README assets
Component sheets
theme
status
transcript
- ActivityGroupView
- AssistantProse
- ChildQuestionRow
- CodeBlock
- DiffView
- ExecOutput
- FileEditRow
- PlanChecklist
- ReturnLine
- SystemLineView
- TranscriptList
- UserBubble
composer
chrome
context
history
outline
workspace
compositions
providers