flutter 3.44.0

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-16 22:51:33 +08:00
parent ad1583706a
commit 1fcc26464f
73 changed files with 1350 additions and 530 deletions

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: uri_does_not_exist_in_doc_import
// ignore_for_file: prefer_initializing_formals, uri_does_not_exist_in_doc_import
/// @docImport 'package:flutter/widgets.dart';
///
@@ -47,6 +47,7 @@ const String _kEllipsis = '\u2026';
class _UnspecifiedTextScaler extends TextScaler {
const _UnspecifiedTextScaler();
@override
Never get textScaleFactor => throw UnimplementedError();
@@ -130,6 +131,7 @@ class RenderParagraph extends RenderBox
// TODO(abarth): Make computing the min/max intrinsic width/height a
// non-destructive operation.
TextPainter? _textIntrinsicsCache;
TextPainter get _textIntrinsics {
return (_textIntrinsicsCache ??= TextPainter())
..text = _textPainter.text
@@ -150,6 +152,7 @@ class RenderParagraph extends RenderBox
/// The text to display.
InlineSpan get text => _textPainter.text!;
set text(({InlineSpan text, Color primary}) params) {
final value = params.text;
_primary = params.primary;
@@ -223,6 +226,7 @@ class RenderParagraph extends RenderBox
/// The [SelectionRegistrar] this paragraph will be, or is, registered to.
SelectionRegistrar? get registrar => _registrar;
SelectionRegistrar? _registrar;
set registrar(SelectionRegistrar? value) {
if (value == _registrar) {
return;
@@ -324,6 +328,7 @@ class RenderParagraph extends RenderBox
/// How the text should be aligned horizontally.
TextAlign get textAlign => _textPainter.textAlign;
set textAlign(TextAlign value) {
if (_textPainter.textAlign == value) {
return;
@@ -344,6 +349,7 @@ class RenderParagraph extends RenderBox
/// context, the English phrase will be on the right and the Hebrew phrase on
/// its left.
TextDirection get textDirection => _textPainter.textDirection!;
set textDirection(TextDirection value) {
if (_textPainter.textDirection == value) {
return;
@@ -361,6 +367,7 @@ class RenderParagraph extends RenderBox
/// effects.
bool get softWrap => _softWrap;
bool _softWrap;
set softWrap(bool value) {
if (_softWrap == value) {
return;
@@ -372,6 +379,7 @@ class RenderParagraph extends RenderBox
/// How visual overflow should be handled.
TextOverflow get overflow => _overflow;
TextOverflow _overflow;
set overflow(TextOverflow value) {
if (_overflow == value) {
return;
@@ -394,6 +402,7 @@ class RenderParagraph extends RenderBox
'This feature was deprecated after v3.12.0-2.0.pre.',
)
double get textScaleFactor => _textPainter.textScaleFactor;
@Deprecated(
'Use textScaler instead. '
'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. '
@@ -405,6 +414,7 @@ class RenderParagraph extends RenderBox
/// {@macro flutter.painting.textPainter.textScaler}
TextScaler get textScaler => _textPainter.textScaler;
set textScaler(TextScaler value) {
if (_textPainter.textScaler == value) {
return;
@@ -468,6 +478,7 @@ class RenderParagraph extends RenderBox
/// {@macro flutter.painting.textPainter.textWidthBasis}
TextWidthBasis get textWidthBasis => _textPainter.textWidthBasis;
set textWidthBasis(TextWidthBasis value) {
if (_textPainter.textWidthBasis == value) {
return;
@@ -480,6 +491,7 @@ class RenderParagraph extends RenderBox
/// {@macro dart.ui.textHeightBehavior}
ui.TextHeightBehavior? get textHeightBehavior =>
_textPainter.textHeightBehavior;
set textHeightBehavior(ui.TextHeightBehavior? value) {
if (_textPainter.textHeightBehavior == value) {
return;
@@ -494,6 +506,7 @@ class RenderParagraph extends RenderBox
/// Ignored if the text is not selectable (e.g. if [registrar] is null).
Color? get selectionColor => _selectionColor;
Color? _selectionColor;
set selectionColor(Color? value) {
if (_selectionColor == value) {
return;
@@ -1370,6 +1383,7 @@ class _SelectableFragment
@override
SelectionGeometry get value => _selectionGeometry;
late SelectionGeometry _selectionGeometry;
void _updateSelectionGeometry() {
final SelectionGeometry newValue = _getSelectionGeometry();
@@ -2328,6 +2342,7 @@ class _SelectableFragment
PlaceholderSpan.placeholderCodeUnit,
);
static final int _placeholderLength = _placeholderCharacter.length;
// This method handles updating the start edge by a text boundary that may
// not be contained within this selectable fragment. It is possible
// that a boundary spans multiple selectable fragments when the text contains
@@ -3702,12 +3717,13 @@ class _SelectableFragment
}
List<Rect>? _cachedBoundingBoxes;
@override
List<Rect> get boundingBoxes {
if (_cachedBoundingBoxes == null) {
final List<TextBox> boxes = paragraph.getBoxesForSelection(
TextSelection(baseOffset: range.start, extentOffset: range.end),
boxHeightStyle: ui.BoxHeightStyle.max,
boxHeightStyle: .max,
);
if (boxes.isNotEmpty) {
_cachedBoundingBoxes = <Rect>[];
@@ -3729,10 +3745,12 @@ class _SelectableFragment
}
Rect? _cachedRect;
Rect get _rect {
if (_cachedRect == null) {
final List<TextBox> boxes = paragraph.getBoxesForSelection(
TextSelection(baseOffset: range.start, extentOffset: range.end),
boxHeightStyle: .max,
);
if (boxes.isNotEmpty) {
Rect result = boxes.first.toRect();