From b9d06fffb2db263ab7021fc39adde7f2bf988a4a Mon Sep 17 00:00:00 2001 From: Ren You Date: Thu, 7 Jan 2021 18:36:48 -0800 Subject: [PATCH] Flutter 1.26 candidate.8 (#73522) * Cherrypick engine to 42a8d4c681baf87d2f2829ed3728eee4fe2bc3fe * Revert "Add BuildContext parameter to TextEditingController.buildTextSpan (#72344)" (#73503) This reverts commit 4901744e62f67ad10440725d2c97e84e66ce77f5, which was a minor breaking change that I missed. Will try to open the PR again following the breaking change process. Co-authored-by: Justin McCandless --- bin/internal/engine.version | 2 +- .../lib/src/material/selectable_text.dart | 2 +- .../lib/src/widgets/editable_text.dart | 3 +- .../test/widgets/editable_text_test.dart | 29 ------------------- 4 files changed, 3 insertions(+), 33 deletions(-) diff --git a/bin/internal/engine.version b/bin/internal/engine.version index 467183a5841..fe55d07284c 100644 --- a/bin/internal/engine.version +++ b/bin/internal/engine.version @@ -1 +1 @@ -e115066dcd65008513c66414f2f682c358d76c2a +42a8d4c681baf87d2f2829ed3728eee4fe2bc3fe diff --git a/packages/flutter/lib/src/material/selectable_text.dart b/packages/flutter/lib/src/material/selectable_text.dart index bd9fc6f8d05..7fc8433e333 100644 --- a/packages/flutter/lib/src/material/selectable_text.dart +++ b/packages/flutter/lib/src/material/selectable_text.dart @@ -31,7 +31,7 @@ class _TextSpanEditingController extends TextEditingController { final TextSpan _textSpan; @override - TextSpan buildTextSpan({TextStyle? style, required bool withComposing, required BuildContext context}) { + TextSpan buildTextSpan({TextStyle? style ,bool? withComposing}) { // This does not care about composing. return TextSpan( style: style, diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index 828e1fc17fa..7e374ebec5a 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -185,7 +185,7 @@ class TextEditingController extends ValueNotifier { /// /// By default makes text in composing range appear as underlined. Descendants /// can override this method to customize appearance of text. - TextSpan buildTextSpan({TextStyle? style , required bool withComposing, required BuildContext context}) { + TextSpan buildTextSpan({TextStyle? style , required bool withComposing}) { assert(!value.composing.isValid || !withComposing || value.isComposingRangeValid); // If the composing range is out of range for the current text, ignore it to // preserve the tree integrity, otherwise in release mode a RangeError will @@ -2669,7 +2669,6 @@ class EditableTextState extends State with AutomaticKeepAliveClien return widget.controller.buildTextSpan( style: widget.style, withComposing: !widget.readOnly, - context: context, ); } } diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart index 6442a4e3a6f..04f6943dd90 100644 --- a/packages/flutter/test/widgets/editable_text_test.dart +++ b/packages/flutter/test/widgets/editable_text_test.dart @@ -5674,25 +5674,6 @@ void main() { }), ); }); - - testWidgets('TextEditingController.buildTextSpan receives build context', (WidgetTester tester) async { - final _AccentColorTextEditingController controller = _AccentColorTextEditingController('a'); - const Color color = Color.fromARGB(255, 1, 2, 3); - await tester.pumpWidget(MaterialApp( - theme: ThemeData.light().copyWith(accentColor: color), - home: EditableText( - controller: controller, - focusNode: FocusNode(), - style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, - cursorColor: Colors.blue, - backgroundCursorColor: Colors.grey, - ), - )); - - final RenderEditable renderEditable = findRenderEditable(tester); - final TextSpan textSpan = renderEditable.text!; - expect(textSpan.style!.color, color); - }); }); testWidgets('autofocus:true on first frame does not throw', (WidgetTester tester) async { @@ -7128,13 +7109,3 @@ class SkipPaintingRenderObject extends RenderProxyBox { @override void paint(PaintingContext context, Offset offset) { } } - -class _AccentColorTextEditingController extends TextEditingController { - _AccentColorTextEditingController(String text) : super(text: text); - - @override - TextSpan buildTextSpan({TextStyle? style, required bool withComposing, required BuildContext context}) { - final Color color = Theme.of(context).accentColor; - return super.buildTextSpan(style: TextStyle(color: color), withComposing: withComposing, context: context); - } -}