Repository navigation
feat!: val_highlight_flutter 1.0.0 — widgets-only core, stable widget API - #5
Merged
Merged
Conversation
… API Make the Flutter package safe to freeze at 1.0. Material is optional: - The main library needs only Flutter's widgets layer, so CodeView, HighlightTextController and CodeTheme work under package:flutter/material.dart, material_ui, Cupertino or anything else (0.1.2 threw in a flutter/material app). - CodeField, built on material_ui, moves to package:val_highlight_flutter/material.dart, which exports everything. - CodeTheme is an InheritedTheme holding CodeThemeData; brightness comes from CodeThemeData.brightness or the platform. CodeView no longer adds its own SelectionArea (selectable is gone). Stable API: - gutterBuilder/lineBuilder take a CodeLineDetails. - CodeView.textStyle -> style; CodeField.margin -> styleMargin; CodeField.lineNumbers falls back to CodeThemeData. - HighlightTextController.window is internal. - CodeEditingFormatter is immutable; its state lives on the controller, so one created in build keeps working. - Final classes: CodeToken, CodeEditing, CodeHighlighter, CodeEditingFormatter, CodeThemeData, the intents. Fixes: rows cut off at large text scales; code laid out right to left in RTL apps; shortcut edits skipping inputFormatters; screen readers reading line numbers; background highlight errors dropped; defaultShortcuts rebuilt on every build. Core: HighlightResult.lineAt replaces three copies of the same search. Docs: Flutter half of the upgrade guide; pages updated for the new API; troubleshooting entries for theming, selection and CodeField; the API completeness check counts a table row only when a cell is the symbol.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Step 2 of 2 for the 1.0.0 release: makes
val_highlight_fluttersafe to freeze. Builds on #4 (merged). Version bumped to 1.0.0; requiresval_highlight1.0.0.Please don't publish yet — publish
val_highlight1.0.0 first, then this package.Breaking changes (all in
docs/upgrading.mdxwith before/after code)CodeView,HighlightTextControllerandCodeThemework underpackage:flutter/material.dart,material_ui, Cupertino or anything else. 0.1.2 threw "No MaterialLocalizations found" / "No Material widget found" in aflutter/material.dartapp.CodeFieldmoved topackage:val_highlight_flutter/material.dart(which re-exports everything); it is still built onmaterial_ui.CodeThemeis anInheritedThemeholdingCodeThemeData(light, dark, brightness, textStyle, padding, lineNumbers), instead of aThemeExtension. The brightness isCodeThemeData.brightnessor the platform's; apps with their own light/dark toggle set it inMaterialApp.builderfromTheme.of(context).brightness.CodeViewno longer adds its ownSelectionArea(selectableis gone); wrap it in one, as with Flutter'sText.CodeView.textStyle→style;CodeField.margin→styleMargin;CodeField.lineNumbersfalls back toCodeThemeData.gutterBuilder/lineBuildertake aCodeLineDetails(line,lineNumber,highlighted) instead of positional args, so fields can be added later without breaking callers.HighlightTextController.windowis internal.CodeEditingFormatteris immutable; its state lives on the controller, so one created inbuildkeeps working.CodeToken,CodeEditing,CodeHighlighter,CodeEditingFormatter,CodeThemeData, the three intents.Fixes (each with a regression test)
CodeViewrows cut off at large text scales (line height ignored the text scaler).CodeFieldshortcuts (Tab, Ctrl+/, Enter) skippedinputFormatters.CodeView's line numbers.CodeEditingFormattercreated inbuildforgot its auto-closed pairs (f())).FlutterError.CodeField.defaultShortcutsreturned a new map every build.Also
HighlightResult.lineAt(offset)(additive) replaces three copies of the same binary search.test/flutter_material_test.dart: the widgets-layer library inside apackage:flutter/material.dartapp.CodeThemeinMaterialApp.builder, gallery and large file wrapped inSelectionArea.screenshots/code-view.pngregenerated: the committed one still showed the pre-material_uiimport in its sample code.Related issue
None found.
Checklist
just checkpasses (format, analyze, tests on the VM and JavaScript)CHANGELOG.md:## 1.0.0entry inval_highlight_flutter;lineAtadded toval_highlight's 1.0.0 entryVerification
just check(pinned Flutter 3.44.2): 485 VM and 373 JavaScript core tests, 106 Flutter tests, example test; analyzer clean.app_test,editor_test): pass.material_ui1.11): analyzer clean, all tests pass,flutter build webworks,pub publish --dry-run0 warnings for both packages.