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),)Details
Section titled “Details”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.
Constructors
Section titled “Constructors”PatchReview()
Section titled “PatchReview()”| Parameter | Type | Default | Description |
|---|---|---|---|
diff: | String | required | Unified 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: | PatchReviewStatus | PatchReviewStatus.pending | Aggregate 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: | bool | false | Whether the file list should request focus when mounted. |
diffAutofocus: | bool | false | Whether the embedded diff should request focus when mounted. |
label: | String | 'Patch review' | Semantic and visual label for the review surface. |
maxVisibleFiles: | int | 4 | Maximum number of file rows shown before the list scrolls. |
diffHeight: | int | 10 | Height, in terminal rows, reserved for the embedded diff. |
showDiff: | bool | true | Whether to render the embedded diff below the file list. |
copySelection: | bool | true | Whether Ctrl+C (and the semantic copy action) copies the selected file’s summary. |
copyOptions: | PatchReviewCopyOptions | const PatchReviewCopyOptions() | Clipboard/export options for the file list. |
diffCopyOptions: | DiffViewCopyOptions | const 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.document()
Section titled “PatchReview.document()”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.
| Parameter | Type | Default | Description |
|---|---|---|---|
document: | DiffDocument | required | Parsed unified diff displayed in the embedded DiffView. |
files: | List<PatchReviewFile> | required | File-level review rows shown above the diff. |
patchId: | Object? | — | Optional stable patch identity exposed through semantics. |
status: | PatchReviewStatus | PatchReviewStatus.pending | Aggregate 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: | bool | false | Whether the file list should request focus when mounted. |
diffAutofocus: | bool | false | Whether the embedded diff should request focus when mounted. |
label: | String | 'Patch review' | Semantic and visual label for the review surface. |
maxVisibleFiles: | int | 4 | Maximum number of file rows shown before the list scrolls. |
diffHeight: | int | 10 | Height, in terminal rows, reserved for the embedded diff. |
showDiff: | bool | true | Whether to render the embedded diff below the file list. |
copySelection: | bool | true | Whether Ctrl+C (and the semantic copy action) copies the selected file’s summary. |
copyOptions: | PatchReviewCopyOptions | const PatchReviewCopyOptions() | Clipboard/export options for the file list. |
diffCopyOptions: | DiffViewCopyOptions | const 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. |
Source
Section titled “Source”PatchReview is defined in packages/fleury/lib/src/catalog/patch_review.dart.
Category: Agent surfaces · All widgets