sliver_text 1.0.0
sliver_text: ^1.0.0 copied to clipboard
Text as a sliver. A drop-in Text equivalent for CustomScrollView that needs no SliverToBoxAdapter - with rich text, selection, semantics and gradient fill.
1.0.0 #
SliverText is now a full Text equivalent for slivers, with tests - the
package previously shipped an empty test file.
Breaking #
- Long text wraps instead of being truncated.
overflowdefaulted toTextOverflow.ellipsis, which collapsed any text longer than one line into a single ellipsized line: the same string measured 800x14 in aSliverTextand 800x80 in aText. The default is nowTextOverflow.clip, as inText. directionrenamed totextDirection, and it now defaults to the ambientDirectionalityinstead of hard-coded left-to-right.styleis now nullable and merges with the ambientDefaultTextStyle. Previously the widget ignored the surrounding text style entirely.SliverTextAdapterrenamed toRenderSliverText; the old name remains as a deprecated alias.
Added #
- Full
Textparameter parity:strutStyle,locale,softWrap,textScaler,semanticsLabel,textWidthBasis,textHeightBehaviorandselectionColor. SliverText.richforInlineSpantrees, including per-span styles and gesture recognizers.WidgetSpanis rejected with an explanatory assert.gradient, painting the glyphs through a gradient via a shader mask. The shader spans the painted bounds of the text rather than its box: a sliver forces its child to the full cross axis extent, so a box-wide shader would spend most of its range on empty space.- Text selection inside a
SelectionArea. SliverRichText, the low-level sliver counterpart ofRichText.debugFillPropertieson the widgets and the render object, so the text shows up in the widget inspector.
Fixed #
- The user's text scale setting is honoured. The paragraph was built without a
textScaler, so the widget ignored the accessibility font size completely. maxPaintExtentreports the full extent of the text instead of the part currently painted. While scrolling it fell belowscrollExtent, which scrollbars and viewport calculations rely on.- The
RenderParagraphis created once and updated in place. Every property setter used to build a new one and drop the previous without disposing it. - The paragraph is disposed with the render object.
- The bold-text accessibility setting is applied.
Other #
- Requires Dart 3.8 / Flutter 3.32;
flutter_lints6. - 21 tests covering layout, inherited configuration, the render object lifecycle, rich text, semantics, gradient and selection.
0.0.2 #
- pubspec update.
- docs update.
0.0.1 #
- Initial release.