Unverified Commit 1daae0b0 authored by Gary Qian's avatar Gary Qian Committed by GitHub

Remove assert that prevents WidgetSpans from being used in SelectableText (#92295)

parent 4d79bb02
...@@ -585,9 +585,11 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive ...@@ -585,9 +585,11 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); // See AutomaticKeepAliveClientMixin. super.build(context); // See AutomaticKeepAliveClientMixin.
assert(() { // TODO(garyq): Assert to block WidgetSpans from being used here are removed,
return _controller._textSpan.visitChildren((InlineSpan span) => span.runtimeType == TextSpan); // but we still do not yet have nice handling of things like carets, clipboard,
}(), 'SelectableText only supports TextSpan; Other type of InlineSpan is not allowed'); // and other features. We should add proper support. Currently, caret handling
// is blocked on SkParagraph switch and https://github.com/flutter/engine/pull/27010
// should be landed in SkParagraph after the switch is complete.
assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMediaQuery(context));
assert(debugCheckHasDirectionality(context)); assert(debugCheckHasDirectionality(context));
assert( assert(
......
...@@ -319,7 +319,7 @@ void main() { ...@@ -319,7 +319,7 @@ void main() {
expect(selectableText.enableInteractiveSelection, true); expect(selectableText.enableInteractiveSelection, true);
}); });
testWidgets('Rich selectable text only support TextSpan', (WidgetTester tester) async { testWidgets('Rich selectable text supports WidgetSpan', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const MediaQuery( const MediaQuery(
data: MediaQueryData(), data: MediaQueryData(),
...@@ -357,7 +357,7 @@ void main() { ...@@ -357,7 +357,7 @@ void main() {
), ),
), ),
); );
expect(tester.takeException(), isAssertionError); expect(tester.takeException(), isNull);
}); });
testWidgets('no text keyboard when widget is focused', (WidgetTester tester) async { testWidgets('no text keyboard when widget is focused', (WidgetTester tester) async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment