diff_view 0.4.0
diff_view: ^0.4.0 copied to clipboard
A fast side-by-side and unified diff view for Flutter, like JetBrains IDEs' diff viewer, with ribbons, synced scrolling, word highlights, folding, text selection and line selection.
0.4.0 #
DiffThemeData.minTextContrastkeeps code readable on line and word tints. A run on a tint keeps the WCAG contrast its colour has on the plain background, up to this floor: if it reads less on its tint, only its lightness changes, hue and saturation kept, by the least change that gets there (away from the tint first, then the other way), and never to a colour that reads worse. The one case where the hue isn't kept: when no change of lightness gets there, white or black is used if it reads better. It works on sRGB colours. Text on the plain background, the gutter, the line-selection band, fold labels and the text selection are left alone. 0, the default, turns it off and draws everything as before. On, a recoloured line keeps one more paragraph per view, counted against the line cache, and takes about twice as long to lay out the first time it shows.DiffViewController.maxCachedLines(andParagraphCache.maxEntries) count paragraphs: one per line, plus the recoloured ones. With the contrast off that is the number of lines, as before.ParagraphCache.paragraphsgives the paragraphs held, the recoloured ones included.
0.3.0 #
- Text selection in the code: drag to select by character across lines, in one pane or across the unified rows as shown, with autoscroll past the edges. Double click selects a word, triple click a line, Shift-click extends the selection or selects from the last click, a click elsewhere or Escape clears. The pointer is a text cursor over code.
- Cmd/Ctrl+C copies the selected text as shown: lines joined by their own line ends, no markers or line numbers, folded lines left out. Lines a paging source hasn't loaded are loaded first.
DiffViewController.textSelection(aCodeSelectionController, aValueListenable<CodeSelection?>),clearTextSelectionandtextOf;CodeSelectionandCodePositiongive the side, start and end as line and column.selectionChangesfires for it.textSelectionEnabled(on by default) turns it off.- One selection at a time: a text selection clears the gutter selection and the other way round.
copySelectioncopies whichever there is, the unified one included. DiffThemeData.textSelection, set in both built-in themes; unset, the selection colour is used. The built-in colours are opaque, so a changed word's tint does not show inside a selection; a colour with transparency keeps it.LineLayout.offsetAthit tests a laid-out line.DiffPaneViewporttakestextSelection.- The example app shows the selection and has a Copy button.
0.2.0 #
UnifiedDiff: a single-column view driven by the sameDiffViewController, with old and new line numbers, deleted then inserted lines per change, folds, inlays, gutter selection with copy and syntax colours.UnifiedRowsmaps unified rows to old and new lines;RowSelectionandRowSelectionControllerhold the unified selection.jumpToLine,viewportYOfLineandensureLineVisibleact on the unified view when it is the one laid out. Switching views keeps the line in place.GutterMetrics.unifiedandDiffPaintResources.unifiedGutterlay out the two-number gutter;DiffPaneViewporttakesunified.DiffThemeData.unifiedDeletedLineandunifiedDeletedWordtint removed lines in the unified view; unset, they're the side-by-side colours.- The example app has a Split/Unified switch.
selectionChangesandgeometryChangesalso fire for the unified view.DiffPaneis aStatelessWidget.- Fix: an inlay added to a file shorter than the viewport no longer scrolls the view past its end and springs back.
0.1.0 #
- First release:
SideBySideDiff,DiffViewController,TextDiffand the pagingDiffLineSource.
