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
@override
Widget build(BuildContext context) {
super.build(context); // See AutomaticKeepAliveClientMixin.
assert(() {
return _controller._textSpan.visitChildren((InlineSpan span) => span.runtimeType == TextSpan);
}(), 'SelectableText only supports TextSpan; Other type of InlineSpan is not allowed');
// TODO(garyq): Assert to block WidgetSpans from being used here are removed,
// but we still do not yet have nice handling of things like carets, clipboard,
// 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(debugCheckHasDirectionality(context));
assert(
......
......@@ -319,7 +319,7 @@ void main() {
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(
const MediaQuery(
data: MediaQueryData(),
......@@ -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 {
......
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