Skip to content

PatchReview

A file-by-file review of a patch: a file list with per-file review status and +added/-removed counts above an embedded DiffView of the change.

See also: DiffView for one diff without the file list.

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

PatchReview(
diff: '''
diff --git a/bin/app.dart b/bin/app.dart
--- a/bin/app.dart
+++ b/bin/app.dart
@@ -1,3 +1,3 @@
void main() {
- print('hi');
+ print('hello');
}
''',
onSelectFile: (result) => openFile(result.file.path),
)

In the file list, Up and Down move the selected file; PageUp, PageDown, Home, and End jump. Enter or a click activates an enabled file: the diff jumps to it and onSelectFile is called. Ctrl+C copies the selected file’s summary. The diff below is a separate focus stop with DiffView’s keys. The default constructor builds everything, file rows included, from one unified-diff string.

ParameterTypeDefaultDescription
diff:StringrequiredUnified diff source parsed into document before rendering.
files:List<PatchReviewFile>?—File-level review rows shown above the diff.
patchId:Object?—Optional stable patch identity exposed through semantics.
status:PatchReviewStatusPatchReviewStatus.pendingAggregate review status for the patch.
controller:PatchReviewController?—External file-list selection controller.
diffController:DiffViewController?—External diff viewport and selection controller.
focusNode:FocusNode?—Focus node used by the file list.
diffFocusNode:FocusNode?—Focus node used by the embedded diff view.
autofocus:boolfalseWhether the file list should request focus when mounted.
diffAutofocus:boolfalseWhether the embedded diff should request focus when mounted.
label:String'Patch review'Semantic and visual label for the review surface.
maxVisibleFiles:int4Maximum number of file rows shown before the list scrolls.
diffHeight:int10Height, in terminal rows, reserved for the embedded diff.
showDiff:booltrueWhether to render the embedded diff below the file list.
copySelection:booltrueWhether Ctrl+C (and the semantic copy action) copies the selected file’s summary.
copyOptions:PatchReviewCopyOptionsconst PatchReviewCopyOptions()Clipboard/export options for the file list.
diffCopyOptions:DiffViewCopyOptionsconst DiffViewCopyOptions()Clipboard/export options for the embedded diff view.
onSelectFile:void Function(PatchReviewFileSelectResult result)?—Called when the user activates an enabled file with Enter or a click, after the diff jumps to it. Moving the selection doesn’t call it.
onCopyFile:void Function(PatchReviewCopyResult result)?—Called after copying a file summary.
onDiffCopy:void Function(DiffViewCopyResult result)?—Called after copying text from the embedded diff.

Creates a review from a parsed DiffDocument and explicit files.

Unlike the source-taking constructor, this constructor does not derive file rows from the document.

ParameterTypeDefaultDescription
document:DiffDocumentrequiredParsed unified diff displayed in the embedded DiffView.
files:List<PatchReviewFile>requiredFile-level review rows shown above the diff.
patchId:Object?—Optional stable patch identity exposed through semantics.
status:PatchReviewStatusPatchReviewStatus.pendingAggregate review status for the patch.
controller:PatchReviewController?—External file-list selection controller.
diffController:DiffViewController?—External diff viewport and selection controller.
focusNode:FocusNode?—Focus node used by the file list.
diffFocusNode:FocusNode?—Focus node used by the embedded diff view.
autofocus:boolfalseWhether the file list should request focus when mounted.
diffAutofocus:boolfalseWhether the embedded diff should request focus when mounted.
label:String'Patch review'Semantic and visual label for the review surface.
maxVisibleFiles:int4Maximum number of file rows shown before the list scrolls.
diffHeight:int10Height, in terminal rows, reserved for the embedded diff.
showDiff:booltrueWhether to render the embedded diff below the file list.
copySelection:booltrueWhether Ctrl+C (and the semantic copy action) copies the selected file’s summary.
copyOptions:PatchReviewCopyOptionsconst PatchReviewCopyOptions()Clipboard/export options for the file list.
diffCopyOptions:DiffViewCopyOptionsconst DiffViewCopyOptions()Clipboard/export options for the embedded diff view.
onSelectFile:void Function(PatchReviewFileSelectResult result)?—Called when the user activates an enabled file with Enter or a click, after the diff jumps to it. Moving the selection doesn’t call it.
onCopyFile:void Function(PatchReviewCopyResult result)?—Called after copying a file summary.
onDiffCopy:void Function(DiffViewCopyResult result)?—Called after copying text from the embedded diff.

PatchReview is defined in packages/fleury/lib/src/catalog/patch_review.dart.

Category: Agent surfaces · All widgets